lagrange_element/
lagrange_element.rs1use ndelement::ciarlet::lagrange;
2use ndelement::{
3 traits::FiniteElement,
4 types::{Continuity, ReferenceCellType},
5};
6use rlst::{DynArray, rlst_dynamic_array};
7
8fn main() {
9 let element =
11 lagrange::create::<f64, f64>(ReferenceCellType::Triangle, 2, Continuity::Standard);
12
13 println!("This element has {} basis functions.", element.dim());
14
15 let mut basis_values = DynArray::<f64, 4>::from_shape(element.tabulate_array_shape(0, 1));
17 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 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 points[[0, 0]] = 1.0;
30 points[[1, 0]] = 0.0;
31 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}