Skip to main content

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