conspire/domain/fem/block/element/surface/linear/triangle/
mod.rs1#[cfg(test)]
2pub mod test;
3
4use crate::{
5 fem::block::element::{
6 FiniteElement, ParametricCoordinate, ParametricCoordinates, ParametricReference,
7 ShapeFunctions, ShapeFunctionsGradients,
8 surface::{M, linear::LinearSurfaceElement},
9 },
10 math::ScalarList,
11};
12
13const G: usize = 1;
16const N: usize = 3;
17const P: usize = N;
18
19pub type Triangle = LinearSurfaceElement<G, N>;
20
21impl FiniteElement<G, M, N, P> for Triangle {
22 fn integration_points() -> ParametricCoordinates<G, M> {
23 [[1.0 / 3.0; M]].into()
24 }
25 fn integration_weights(&self) -> &ScalarList<G> {
26 &self.integration_weights
27 }
28 fn parametric_reference() -> ParametricReference<M, N> {
29 [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]].into()
30 }
31 fn parametric_weights() -> ScalarList<G> {
32 [1.0 / 2.0; G].into()
33 }
34 fn shape_functions(parametric_coordinate: ParametricCoordinate<M>) -> ShapeFunctions<N> {
35 let [xi_1, xi_2] = parametric_coordinate.into();
36 [1.0 - xi_1 - xi_2, xi_1, xi_2].into()
37 }
38 fn shape_functions_gradients(
39 _parametric_coordinate: ParametricCoordinate<M>,
40 ) -> ShapeFunctionsGradients<M, N> {
41 [[-1.0, -1.0], [1.0, 0.0], [0.0, 1.0]].into()
42 }
43}