#[cfg(feature = "mpi")]
use mpi::traits::Communicator;
use ndelement::{traits::FiniteElement, types::ReferenceCellType};
#[cfg(feature = "mpi")]
use ndgrid::traits::ParallelGrid;
use ndgrid::{traits::Grid, types::Ownership};
use rlst::RlstScalar;
use std::collections::HashMap;
pub trait FunctionSpace {
type T: RlstScalar;
type Grid: Grid<T = <Self::T as RlstScalar>::Real, EntityDescriptor = ReferenceCellType>;
type FiniteElement: FiniteElement<T = Self::T> + Sync;
fn grid(&self) -> &Self::Grid;
fn element(&self, cell_type: ReferenceCellType) -> &Self::FiniteElement;
fn is_serial(&self) -> bool {
true
}
fn get_local_dof_numbers(&self, entity_dim: usize, entity_number: usize) -> &[usize];
fn local_size(&self) -> usize;
fn global_size(&self) -> usize;
fn cell_dofs(&self, cell: usize) -> Option<&[usize]>;
unsafe fn cell_dofs_unchecked(&self, cell: usize) -> &[usize];
fn cell_colouring(&self) -> HashMap<ReferenceCellType, Vec<Vec<usize>>>;
fn global_dof_index(&self, local_dof_index: usize) -> usize;
fn ownership(&self, local_dof_index: usize) -> Ownership;
}
#[cfg(feature = "mpi")]
pub trait ParallelFunctionSpace<C: Communicator>: FunctionSpace {
type ParallelGrid: ParallelGrid<C>
+ Grid<T = <Self::T as RlstScalar>::Real, EntityDescriptor = ReferenceCellType>;
type LocalSpace<'a>: FunctionSpace<T = Self::T> + Sync
where
Self: 'a;
fn comm(&self) -> &C;
fn grid(&self) -> &Self::ParallelGrid;
fn local_space(&self) -> &Self::LocalSpace<'_>;
}