conspire/constitutive/hybrid/
mod.rsmod elastic;
mod hyperelastic;
use crate::{
constitutive::{Constitutive, ConstitutiveError},
mechanics::DeformationGradient,
};
pub trait Hybrid<'a, C1: Constitutive<'a>, C2: Constitutive<'a>> {
fn construct(constitutive_model_1: C1, constitutive_model_2: C2) -> Self;
fn constitutive_model_1(&self) -> &C1;
fn constitutive_model_2(&self) -> &C2;
}
#[derive(Debug)]
pub struct Additive<C1, C2> {
constitutive_model_1: C1,
constitutive_model_2: C2,
}
#[derive(Debug)]
pub struct Multiplicative<C1, C2> {
constitutive_model_1: C1,
constitutive_model_2: C2,
}
pub trait MultiplicativeTrait {
fn deformation_gradients(
&self,
deformation_gradient: &DeformationGradient,
) -> Result<(DeformationGradient, DeformationGradient), ConstitutiveError>;
}
impl<'a, C1: Constitutive<'a>, C2: Constitutive<'a>> Hybrid<'a, C1, C2> for Additive<C1, C2> {
fn construct(constitutive_model_1: C1, constitutive_model_2: C2) -> Self {
Self {
constitutive_model_1,
constitutive_model_2,
}
}
fn constitutive_model_1(&self) -> &C1 {
&self.constitutive_model_1
}
fn constitutive_model_2(&self) -> &C2 {
&self.constitutive_model_2
}
}
impl<'a, C1: Constitutive<'a>, C2: Constitutive<'a>> Hybrid<'a, C1, C2> for Multiplicative<C1, C2> {
fn construct(constitutive_model_1: C1, constitutive_model_2: C2) -> Self {
Self {
constitutive_model_1,
constitutive_model_2,
}
}
fn constitutive_model_1(&self) -> &C1 {
&self.constitutive_model_1
}
fn constitutive_model_2(&self) -> &C2 {
&self.constitutive_model_2
}
}