pub trait FiniteElement {
type T: RlstScalar;
type CellType: Debug + PartialEq + Eq + Clone + Copy + Hash;
// Required methods
fn cell_type(&self) -> Self::CellType;
fn dim(&self) -> usize;
fn value_shape(&self) -> &[usize];
fn value_size(&self) -> usize;
fn tabulate<TGeo: RlstScalar, Array2Impl: ValueArrayImpl<TGeo, 2>, Array4MutImpl: MutableArrayImpl<Self::T, 4>>(
&self,
points: &Array<Array2Impl, 2>,
nderivs: usize,
data: &mut Array<Array4MutImpl, 4>,
);
fn tabulate_array_shape(&self, nderivs: usize, npoints: usize) -> [usize; 4];
fn entity_dofs(
&self,
entity_dim: usize,
entity_number: usize,
) -> Option<&[usize]>;
fn entity_closure_dofs(
&self,
entity_dim: usize,
entity_number: usize,
) -> Option<&[usize]>;
}Expand description
A finite element.
Required Associated Types§
Required Methods§
Sourcefn cell_type(&self) -> Self::CellType
fn cell_type(&self) -> Self::CellType
The reference cell type, eg one of Point, Interval, Triangle, etc.
Sourcefn value_shape(&self) -> &[usize]
fn value_shape(&self) -> &[usize]
The shape of the values returned by functions in $\mathcal{V}$.
If the values are scalar an empty slice is returned.
Sourcefn value_size(&self) -> usize
fn value_size(&self) -> usize
The number of values returned.
If (for example) value_shape is [3, 4] then value_size is $3\times4 = 12$.
If value_shape returns an empty array (ie the shape functions are scalar) the
Sourcefn tabulate<TGeo: RlstScalar, Array2Impl: ValueArrayImpl<TGeo, 2>, Array4MutImpl: MutableArrayImpl<Self::T, 4>>(
&self,
points: &Array<Array2Impl, 2>,
nderivs: usize,
data: &mut Array<Array4MutImpl, 4>,
)
fn tabulate<TGeo: RlstScalar, Array2Impl: ValueArrayImpl<TGeo, 2>, Array4MutImpl: MutableArrayImpl<Self::T, 4>>( &self, points: &Array<Array2Impl, 2>, nderivs: usize, data: &mut Array<Array4MutImpl, 4>, )
Tabulate the values of the basis functions and their derivatives at a set of points
pointsis a two-dimensional array where each column contains the coordinates of one point.nderivsis the desired number of derivatives (0 for no derivatives, 1 for all first order derivatives, etc.).datais the 4-dimensional output array. The first dimension is the total number of partial derivatives, the second dimension is the number of evaluation points, the third dimension is the number of basis functions of the element, and the fourth dimension is the value size of the basis function output. For example,data[3, 2, 1, 0]returns the 0th value of the third partial derivative on the point with index 2 for the basis function with index 1.
§Remark
Let $d^{i + k} = dx^{i}dy^{j}$ be a derivative with respect to $x$, $y$ in two dimensions and
$d^{i + k + j} = dx^{i}dy^{j}dz^{k}$ be a derivative with respect to $x$, $y$, and $z$ in three dimensions.
Then the corresponding index $\ell$ in the first dimension of the data array is computed as follows.
- Triangle: $l = (i + j + 1) * (i + j) / 2 + j$
- Quadrilateral: $l = i * (n + 1) + j$
- Tetrahedron: $l = (i + j + k) * (i + j + k + 1) * (i + j + k + 2) / 6 + (j + k) * (j + k + 1) / 2 + k$
- Hexahedron $l = i * (n + 1) * (n + 1) + j * (n + 1) + k$.
For the quadrilaterals and hexahedra, the parameter $n$ denotes the Lagrange superdegree.
Sourcefn tabulate_array_shape(&self, nderivs: usize, npoints: usize) -> [usize; 4]
fn tabulate_array_shape(&self, nderivs: usize, npoints: usize) -> [usize; 4]
Get the required shape for a tabulation array.
Sourcefn entity_dofs(
&self,
entity_dim: usize,
entity_number: usize,
) -> Option<&[usize]>
fn entity_dofs( &self, entity_dim: usize, entity_number: usize, ) -> Option<&[usize]>
Return the dof indices that are associated with the subentity with index entity_number and dimension entity_dim.
- For
entity_dim = 0this returns the degrees of freedom (dofs) associated with the corresponding point. - For
entity_dim = 1this returns the dofs associated with the corresponding edge. - For
entity_dim = 2this returns the dofs associated with the corresponding face.
Note that this does not return dofs on the boundary of an entity, that means that (for example) for an edge the dofs associated with the two vertices at the boundary of the edge are not returned. To return also the boundary dofs use FiniteElement::entity_closure_dofs.
Sourcefn entity_closure_dofs(
&self,
entity_dim: usize,
entity_number: usize,
) -> Option<&[usize]>
fn entity_closure_dofs( &self, entity_dim: usize, entity_number: usize, ) -> Option<&[usize]>
The DOFs that are associated with a closure of a subentity of the reference cell.
This method is similar to FiniteElement::entity_dofs, but it includes the dofs associated with the boundary of an entity. For an edge (for example) it returns the dofs associated with the vertices at the boundary of the edge (as well as the dofs associated with the edge itself).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.