#[cfg(test)]
mod test;
use crate::{
fem::block::element::{
FiniteElement, ParametricCoordinate, ParametricCoordinates, ParametricReference,
ShapeFunctions, ShapeFunctionsGradients,
linear::{LinearElement, LinearFiniteElement, M},
},
math::ScalarList,
};
const G: usize = 1;
const N: usize = 4;
const P: usize = N;
pub type Tetrahedron = LinearElement<G, N>;
impl FiniteElement<G, M, N, P> for Tetrahedron {
fn integration_points() -> ParametricCoordinates<G, M> {
[[0.25; M]].into()
}
fn integration_weights(&self) -> &ScalarList<G> {
&self.integration_weights
}
fn parametric_reference() -> ParametricReference<M, N> {
[
[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0],
]
.into()
}
fn parametric_weights() -> ScalarList<G> {
[1.0 / 6.0; G].into()
}
fn shape_functions(parametric_coordinate: ParametricCoordinate<M>) -> ShapeFunctions<N> {
let [xi_1, xi_2, xi_3] = parametric_coordinate.into();
[1.0 - xi_1 - xi_2 - xi_3, xi_1, xi_2, xi_3].into()
}
fn shape_functions_gradients(
_parametric_coordinate: ParametricCoordinate<M>,
) -> ShapeFunctionsGradients<M, N> {
[
[-1.0, -1.0, -1.0],
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0],
]
.into()
}
}
impl LinearFiniteElement<G, N> for Tetrahedron {}