Skip to content

Commit

Permalink
simplify structure (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
mscroggs authored Jul 22, 2024
1 parent 6b3d683 commit 135ec86
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 61 deletions.
58 changes: 56 additions & 2 deletions src/traits.rs
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;
}
59 changes: 0 additions & 59 deletions src/traits/element.rs

This file was deleted.

0 comments on commit 135ec86

Please sign in to comment.