Grid

Trait Grid 

Source
pub trait Grid {
    type T: Scalar;
    type Entity<'a>: Entity<EntityDescriptor = Self::EntityDescriptor, T = Self::T>
       where Self: 'a;
    type GeometryMap<'a>: GeometryMap<T = Self::T>
       where Self: 'a;
    type EntityDescriptor: Debug + PartialEq + Eq + Clone + Copy + Hash;
    type EntityIter<'a>: Iterator<Item = Self::Entity<'a>>
       where Self: 'a;

    // Required methods
    fn geometry_dim(&self) -> usize;
    fn topology_dim(&self) -> usize;
    fn entity(
        &self,
        entity_type: Self::EntityDescriptor,
        local_index: usize,
    ) -> Option<Self::Entity<'_>>;
    fn entity_types(&self, tdim: usize) -> &[Self::EntityDescriptor];
    fn entity_count(&self, entity_type: Self::EntityDescriptor) -> usize;
    fn entity_iter(
        &self,
        entity_type: Self::EntityDescriptor,
    ) -> Self::EntityIter<'_>;
    fn entity_from_id(
        &self,
        entity_type: Self::EntityDescriptor,
        id: usize,
    ) -> Option<Self::Entity<'_>>;
    fn geometry_map(
        &self,
        entity_type: Self::EntityDescriptor,
        geometry_degree: usize,
        points: &[Self::T],
    ) -> Self::GeometryMap<'_>;

    // Provided methods
    fn cell_count(&self) -> usize { ... }
    fn cell_types(&self) -> &[Self::EntityDescriptor] { ... }
    fn owned_cell_count(&self) -> usize { ... }
}
Expand description

A grid provides access to entities, their geometrical and their topological properties.

Required Associated Types§

Source

type T: Scalar

Scalar type

Source

type Entity<'a>: Entity<EntityDescriptor = Self::EntityDescriptor, T = Self::T> where Self: 'a

Type used as identifier of different entity types

Source

type GeometryMap<'a>: GeometryMap<T = Self::T> where Self: 'a

Geometry map type

Source

type EntityDescriptor: Debug + PartialEq + Eq + Clone + Copy + Hash

Type used as identifier of different entity types

Source

type EntityIter<'a>: Iterator<Item = Self::Entity<'a>> where Self: 'a

Iterator over sub-entities

Required Methods§

Source

fn geometry_dim(&self) -> usize

Dimension of the geometry of this grid

Source

fn topology_dim(&self) -> usize

Dimension of the topology of this grid

Source

fn entity( &self, entity_type: Self::EntityDescriptor, local_index: usize, ) -> Option<Self::Entity<'_>>

An entity in this grid

Source

fn entity_types(&self, tdim: usize) -> &[Self::EntityDescriptor]

The entity types of topological dimension dim contained in this grid

Source

fn entity_count(&self, entity_type: Self::EntityDescriptor) -> usize

Number of entities of type entity_type

Source

fn entity_iter( &self, entity_type: Self::EntityDescriptor, ) -> Self::EntityIter<'_>

Iterator over entities

Source

fn entity_from_id( &self, entity_type: Self::EntityDescriptor, id: usize, ) -> Option<Self::Entity<'_>>

An entity in this grid from an insertion id

Source

fn geometry_map( &self, entity_type: Self::EntityDescriptor, geometry_degree: usize, points: &[Self::T], ) -> Self::GeometryMap<'_>

Geometry map from reference entity to physical entities at the given points

points should have space [entity_topology_dim, npts] and use column-major ordering

Provided Methods§

Source

fn cell_count(&self) -> usize

Number of cells in the grid

Source

fn cell_types(&self) -> &[Self::EntityDescriptor]

Return the cell types in the grid

Source

fn owned_cell_count(&self) -> usize

Owned cell count

Note. The default implementation iterates through all grid to count the number of owned elements. Override this method if a more efficient implementation is available.

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.

Implementors§

Source§

impl<G: Grid + Sync> Grid for LocalGrid<G>

Source§

type T = <G as Grid>::T

Source§

type Entity<'a> = GridEntity<<G as Grid>::Entity<'a>> where Self: 'a

Source§

type GeometryMap<'a> = <G as Grid>::GeometryMap<'a> where Self: 'a

Source§

type EntityDescriptor = <G as Grid>::EntityDescriptor

Source§

type EntityIter<'a> = GridEntityIter<'a, <G as Grid>::Entity<'a>, <G as Grid>::EntityIter<'a>> where Self: 'a

Source§

impl<T: Scalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>> Grid for MixedGrid<T, E>

Source§

type T = T

Source§

type Entity<'a> = MixedGridEntity<'a, T, E> where Self: 'a

Source§

type GeometryMap<'a> = GeometryMap<'a, T, BaseArray<VectorContainer<T>, 2>, BaseArray<VectorContainer<usize>, 2>> where Self: 'a

Source§

type EntityDescriptor = ReferenceCellType

Source§

type EntityIter<'a> = MixedGridEntityIter<'a, T, E> where Self: 'a

Source§

impl<T: Scalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>> Grid for SingleElementGrid<T, E>

Source§

type T = T

Source§

type Entity<'a> = SingleElementGridEntity<'a, T, E> where Self: 'a

Source§

type GeometryMap<'a> = GeometryMap<'a, T, BaseArray<VectorContainer<T>, 2>, BaseArray<VectorContainer<usize>, 2>> where Self: 'a

Source§

type EntityDescriptor = ReferenceCellType

Source§

type EntityIter<'a> = SingleElementGridEntityIter<'a, T, E> where Self: 'a