conspire/domain/fem/block/element/cohesive/linear/hexahedron/
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::Quadrilateral,
14    },
15    math::ScalarList,
16    mechanics::NormalGradients,
17};
18
19const G: usize = 4;
20const N: usize = 8;
21const P: usize = 4;
22
23pub type Hexahedron = LinearCohesiveElement<G, N>;
24
25impl FiniteElement<G, M, N, P> for Hexahedron {
26    fn integration_points() -> ParametricCoordinates<G, M> {
27        Quadrilateral::integration_points()
28    }
29    fn integration_weights(&self) -> &ScalarList<G> {
30        &self.integration_weights
31    }
32    fn parametric_reference() -> ParametricReference<M, N> {
33        Quadrilateral::parametric_reference()
34            .into_iter()
35            .chain(Quadrilateral::parametric_reference())
36            .collect()
37    }
38    fn parametric_weights() -> ScalarList<G> {
39        Quadrilateral::parametric_weights()
40    }
41    fn shape_functions(parametric_coordinate: ParametricCoordinate<M>) -> ShapeFunctions<P> {
42        Quadrilateral::shape_functions(parametric_coordinate)
43    }
44    fn shape_functions_gradients(
45        parametric_coordinate: ParametricCoordinate<M>,
46    ) -> ShapeFunctionsGradients<M, P> {
47        Quadrilateral::shape_functions_gradients(parametric_coordinate)
48    }
49}
50
51impl From<ElementNodalReferenceCoordinates<N>> for Hexahedron {
52    fn from(reference_nodal_coordinates: ElementNodalReferenceCoordinates<N>) -> Self {
53        Self::from_linear(reference_nodal_coordinates)
54    }
55}
56
57impl CohesiveFiniteElement<G, N, P> for Hexahedron {
58    fn nodal_mid_surface<const I: usize>(
59        nodal_coordinates: &ElementNodalEitherCoordinates<I, N>,
60    ) -> ElementNodalEitherCoordinates<I, P> {
61        Self::nodal_mid_surface_linear(nodal_coordinates)
62    }
63    fn nodal_separations(nodal_coordinates: &ElementNodalCoordinates<N>) -> Separations<P> {
64        Self::nodal_separations_linear(nodal_coordinates)
65    }
66    fn normal_gradients_full(
67        nodal_mid_surface: &ElementNodalCoordinates<P>,
68    ) -> NormalGradients<N, G> {
69        Self::normal_gradients_full_linear(nodal_mid_surface)
70    }
71    fn signs() -> ScalarList<N> {
72        Self::signs_linear()
73    }
74}
75
76impl LinearCohesiveFiniteElement<G, N, P> for Hexahedron {}