-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,59 @@ | ||
//! Traits | ||
use rlst::{RandomAccessByRef, RandomAccessMut, RlstScalar, Shape}; | ||
use std::fmt::Debug; | ||
use std::hash::Hash; | ||
|
||
mod element; | ||
pub trait FiniteElement { | ||
//! A finite element defined on a reference cell | ||
/// The scalar type | ||
type T: RlstScalar; | ||
/// Cell type | ||
type CellType: Debug + PartialEq + Eq + Clone + Copy + Hash; | ||
/// Map type | ||
type MapType: Debug + PartialEq + Eq + Clone + Copy + Hash; | ||
|
||
pub use element::{ElementFamily, FiniteElement}; | ||
/// The reference cell type | ||
fn cell_type(&self) -> Self::CellType; | ||
|
||
/// The highest degree polynomial in the element's polynomial set | ||
fn embedded_superdegree(&self) -> usize; | ||
|
||
/// The number of basis functions | ||
fn dim(&self) -> usize; | ||
|
||
/// The value shape | ||
fn value_shape(&self) -> &[usize]; | ||
|
||
/// The value size | ||
fn value_size(&self) -> usize; | ||
|
||
/// Tabulate the values of the basis functions and their derivatives at a set of points | ||
fn tabulate<Array2: RandomAccessByRef<2, Item = <Self::T as RlstScalar>::Real> + Shape<2>>( | ||
&self, | ||
points: &Array2, | ||
nderivs: usize, | ||
data: &mut impl RandomAccessMut<4, Item = Self::T>, | ||
); | ||
|
||
/// The DOFs that are associated with a subentity of the reference cell | ||
fn entity_dofs(&self, entity_dim: usize, entity_number: usize) -> Option<&[usize]>; | ||
|
||
/// The push forward / pull back map to use for this element | ||
fn map_type(&self) -> Self::MapType; | ||
|
||
/// Get the required shape for a tabulation array | ||
fn tabulate_array_shape(&self, nderivs: usize, npoints: usize) -> [usize; 4]; | ||
} | ||
|
||
pub trait ElementFamily { | ||
//! A family of finite elements | ||
/// The scalar type | ||
type T: RlstScalar; | ||
/// Cell type | ||
type CellType: Debug + PartialEq + Eq + Clone + Copy + Hash; | ||
/// The finite element type | ||
type FiniteElement: FiniteElement<T = Self::T, CellType = Self::CellType>; | ||
|
||
/// Get an elenent for a cell type | ||
fn element(&self, cell_type: Self::CellType) -> Self::FiniteElement; | ||
} |
This file was deleted.
Oops, something went wrong.