Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove traits folder #5

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading