conspire/domain/fem/block/element/cohesive/linear/wedge/
mod.rs

1#[cfg(test)]
2pub mod test;
3
4use crate::{
5    fem::block::element::{
6        ElementNodalCoordinates, ElementNodalEitherCoordinates, ElementNodalReferenceCoordinates,
7        FiniteElement, ParametricCoordinate, ParametricCoordinates, ParametricReference,
8        ShapeFunctions, ShapeFunctionsGradients,
9        cohesive::{
10            CohesiveFiniteElement, M, Separations,
11            linear::{LinearCohesiveElement, LinearCohesiveFiniteElement},
12        },
13        surface::linear::Triangle,
14    },
15    math::ScalarList,
16    mechanics::NormalGradients,
17};
18
19// This should share integration_points() and parametric_weights() with Triangle<G=3> when get to it.
20
21const G: usize = 3;
22const N: usize = 6;
23const P: usize = 3;
24
25pub type Wedge = LinearCohesiveElement<G, N>;
26
27impl FiniteElement<G, M, N, P> for Wedge {
28    fn integration_points() -> ParametricCoordinates<G, M> {
29        [
30            [1.0 / 6.0, 1.0 / 6.0],
31            [2.0 / 3.0, 1.0 / 6.0],
32            [1.0 / 6.0, 2.0 / 3.0],
33        ]
34        .into()
35    }
36    fn integration_weights(&self) -> &ScalarList<G> {
37        &self.integration_weights
38    }
39    fn parametric_reference() -> ParametricReference<M, N> {
40        Triangle::parametric_reference()
41            .into_iter()
42            .chain(Triangle::parametric_reference())
43            .collect()
44    }
45    fn parametric_weights() -> ScalarList<G> {
46        [1.0 / 6.0; G].into()
47    }
48    fn shape_functions(parametric_coordinate: ParametricCoordinate<M>) -> ShapeFunctions<P> {
49        Triangle::shape_functions(parametric_coordinate)
50    }
51    fn shape_functions_gradients(
52        parametric_coordinate: ParametricCoordinate<M>,
53    ) -> ShapeFunctionsGradients<M, P> {
54        Triangle::shape_functions_gradients(parametric_coordinate)
55    }
56}
57
58impl From<ElementNodalReferenceCoordinates<N>> for Wedge {
59    fn from(reference_nodal_coordinates: ElementNodalReferenceCoordinates<N>) -> Self {
60        Self::from_linear(reference_nodal_coordinates)
61    }
62}
63
64impl CohesiveFiniteElement<G, N, P> for Wedge {
65    fn nodal_mid_surface<const I: usize>(
66        nodal_coordinates: &ElementNodalEitherCoordinates<I, N>,
67    ) -> ElementNodalEitherCoordinates<I, P> {
68        Self::nodal_mid_surface_linear(nodal_coordinates)
69    }
70    fn nodal_separations(nodal_coordinates: &ElementNodalCoordinates<N>) -> Separations<P> {
71        Self::nodal_separations_linear(nodal_coordinates)
72    }
73    fn normal_gradients_full(
74        nodal_mid_surface: &ElementNodalCoordinates<P>,
75    ) -> NormalGradients<N, G> {
76        Self::normal_gradients_full_linear(nodal_mid_surface)
77    }
78    fn signs() -> ScalarList<N> {
79        Self::signs_linear()
80    }
81}
82
83impl LinearCohesiveFiniteElement<G, N, P> for Wedge {}