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 scaled_jacobians<const I: usize>(
49        nodal_coordinates: ElementNodalEitherCoordinates<I, N>,
50    ) -> ScalarList<P> {
51        Triangle::scaled_jacobians(Self::nodal_mid_surface(&nodal_coordinates))
52    }
53    fn shape_functions(parametric_coordinate: ParametricCoordinate<M>) -> ShapeFunctions<P> {
54        Triangle::shape_functions(parametric_coordinate)
55    }
56    fn shape_functions_gradients(
57        parametric_coordinate: ParametricCoordinate<M>,
58    ) -> ShapeFunctionsGradients<M, P> {
59        Triangle::shape_functions_gradients(parametric_coordinate)
60    }
61}
62
63impl From<ElementNodalReferenceCoordinates<N>> for Wedge {
64    fn from(reference_nodal_coordinates: ElementNodalReferenceCoordinates<N>) -> Self {
65        Self::from_linear(reference_nodal_coordinates)
66    }
67}
68
69impl CohesiveFiniteElement<G, N, P> for Wedge {
70    fn nodal_mid_surface<const I: usize>(
71        nodal_coordinates: &ElementNodalEitherCoordinates<I, N>,
72    ) -> ElementNodalEitherCoordinates<I, P> {
73        Self::nodal_mid_surface_linear(nodal_coordinates)
74    }
75    fn nodal_separations(nodal_coordinates: &ElementNodalCoordinates<N>) -> Separations<P> {
76        Self::nodal_separations_linear(nodal_coordinates)
77    }
78    fn normal_gradients_full(
79        nodal_mid_surface: &ElementNodalCoordinates<P>,
80    ) -> NormalGradients<N, G> {
81        Self::normal_gradients_full_linear(nodal_mid_surface)
82    }
83    fn signs() -> ScalarList<N> {
84        Self::signs_linear()
85    }
86}
87
88impl LinearCohesiveFiniteElement<G, N, P> for Wedge {}