conspire/domain/fem/block/element/linear/pyramid/
mod.rs

1const G: usize = 5;
2const N: usize = 5;
3
4pub type Pyramid = Element<G, N>;
5
6crate::fem::block::element::linear::implement!(Pyramid);
7
8impl Pyramid {
9    const fn integration_points() -> [[Scalar; M]; G] {
10        [
11            [-0.5, 0.0, 1.0 / 6.0],
12            [0.5, 0.0, 1.0 / 6.0],
13            [0.0, -0.5, 1.0 / 6.0],
14            [0.0, 0.5, 1.0 / 6.0],
15            [0.0, 0.0, 0.25],
16        ]
17    }
18    const fn integration_weight() -> Scalars<G> {
19        Scalars::<G>::const_from([5.0 / 27.0, 5.0 / 27.0, 5.0 / 27.0, 5.0 / 27.0, 16.0 / 27.0])
20    }
21    const fn reference() -> ElementNodalReferenceCoordinates<N> {
22        ElementNodalReferenceCoordinates::<N>::const_from([
23            [-1.0, -1.0, 0.0],
24            [1.0, -1.0, 0.0],
25            [1.0, 1.0, 0.0],
26            [-1.0, 1.0, 0.0],
27            [0.0, 0.0, 1.0],
28        ])
29    }
30    #[cfg(test)]
31    const fn shape_functions([xi_1, xi_2, xi_3]: [Scalar; M]) -> [Scalar; N] {
32        [
33            (1.0 - xi_1) * (1.0 - xi_2) * (1.0 - xi_3) / 8.0,
34            (1.0 + xi_1) * (1.0 - xi_2) * (1.0 - xi_3) / 8.0,
35            (1.0 + xi_1) * (1.0 + xi_2) * (1.0 - xi_3) / 8.0,
36            (1.0 - xi_1) * (1.0 + xi_2) * (1.0 - xi_3) / 8.0,
37            (1.0 + xi_3) / 2.0,
38        ]
39    }
40    const fn shape_functions_gradients([xi_1, xi_2, xi_3]: [Scalar; M]) -> [[Scalar; M]; N] {
41        [
42            [
43                -(1.0 - xi_2) * (1.0 - xi_3) / 8.0,
44                -(1.0 - xi_1) * (1.0 - xi_3) / 8.0,
45                -(1.0 - xi_1) * (1.0 - xi_2) / 8.0,
46            ],
47            [
48                (1.0 - xi_2) * (1.0 - xi_3) / 8.0,
49                -(1.0 + xi_1) * (1.0 - xi_3) / 8.0,
50                -(1.0 + xi_1) * (1.0 - xi_2) / 8.0,
51            ],
52            [
53                (1.0 + xi_2) * (1.0 - xi_3) / 8.0,
54                (1.0 + xi_1) * (1.0 - xi_3) / 8.0,
55                -(1.0 + xi_1) * (1.0 + xi_2) / 8.0,
56            ],
57            [
58                -(1.0 + xi_2) * (1.0 - xi_3) / 8.0,
59                (1.0 - xi_1) * (1.0 - xi_3) / 8.0,
60                -(1.0 - xi_1) * (1.0 + xi_2) / 8.0,
61            ],
62            [0.0, 0.0, 0.5],
63        ]
64    }
65}