pub fn create<T: RlstScalar + Getrf + Getri, TGeo: RlstScalar>(
cell_type: ReferenceCellType,
degree: usize,
continuity: Continuity,
) -> CiarletElement<T, IdentityMap, TGeo>Expand description
Create a Lagrange element.
Examples found in repository?
ndelement/examples/lagrange_element.rs (line 11)
8fn main() {
9 // Create a P2 element on a triangle
10 let element =
11 lagrange::create::<f64, f64>(ReferenceCellType::Triangle, 2, Continuity::Standard);
12
13 println!("This element has {} basis functions.", element.dim());
14
15 // Create an array to store the basis function values
16 let mut basis_values = DynArray::<f64, 4>::from_shape(element.tabulate_array_shape(0, 1));
17 // Create array containing the point [1/3, 1/3]
18 let mut points = rlst_dynamic_array!(f64, [2, 1]);
19 points[[0, 0]] = 1.0 / 3.0;
20 points[[1, 0]] = 1.0 / 3.0;
21 // Tabulate the element's basis functions at the point
22 element.tabulate(&points, 0, &mut basis_values);
23 println!(
24 "The values of the basis functions at the point (1/3, 1/3) are: {:?}",
25 basis_values.data()
26 );
27
28 // Set point to [1, 0]
29 points[[0, 0]] = 1.0;
30 points[[1, 0]] = 0.0;
31 // Tabulate the element's basis functions at the point
32 element.tabulate(&points, 0, &mut basis_values);
33 println!(
34 "The values of the basis functions at the point (1, 0) are: {:?}",
35 basis_values.data()
36 );
37}