ndelement/lib.rs
1//! A library for the definition and tabulation of finite elements in Rust.
2//!
3//! `ndelement` provides definition of many frequently used low and high order finite elements
4//! and provides routines for the tabulation of their values.
5//!
6//! The following presents a simple example of how to use `ndelement`.
7//!
8//! ```
9//! use ndelement::ciarlet::LagrangeElementFamily;
10//! use ndelement::traits::{ElementFamily, FiniteElement};
11//! use ndelement::types::{Continuity, ReferenceCellType};
12//! use rlst::DynArray;
13//!
14//! // Create the degree 2 Lagrange element family. A family is a set of finite elements with the
15//! // same family type, degree, and continuity across a set of cells
16//! let family = LagrangeElementFamily::<f64>::new(2, Continuity::Standard);
17//!
18//! // Get the element in the family on a triangle
19//! let element = family.element(ReferenceCellType::Triangle);
20//! println!("Cell: {:?}", element.cell_type());
21//!
22//! // Get the element in the family on a quadrilateral
23//! let element = family.element(ReferenceCellType::Quadrilateral);
24//! println!("Cell: {:?}", element.cell_type());
25//!
26//! // Create an array to store the basis function values
27//! let mut basis_values = DynArray::<f64, 4>::from_shape(element.tabulate_array_shape(0, 1));
28//! // Create array containing the point [1/2, 1/2]
29//! let mut points = DynArray::<f64, 2>::from_shape([2, 1]);
30//! points[[0, 0]] = 1.0 / 2.0;
31//! points[[1, 0]] = 1.0 / 2.0;
32//! // Tabulate the element's basis functions at the point
33//! element.tabulate(&points, 0, &mut basis_values);
34//! println!(
35//! "The values of the basis functions at the point (1/2, 1/2) are: {:?}",
36//! basis_values.data()
37//! );
38//! ```
39#![cfg_attr(feature = "strict", deny(warnings), deny(unused_crate_dependencies))]
40#![warn(missing_docs)]
41
42pub mod bindings;
43pub mod ciarlet;
44pub mod map;
45pub mod math;
46pub mod orientation;
47pub mod polynomials;
48pub mod quadrature;
49pub mod reference_cell;
50pub mod traits;
51pub mod types;