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§
Sourcetype Entity<'a>: Entity<EntityDescriptor = Self::EntityDescriptor, T = Self::T>
where
Self: 'a
type Entity<'a>: Entity<EntityDescriptor = Self::EntityDescriptor, T = Self::T> where Self: 'a
Type used as identifier of different entity types
Sourcetype GeometryMap<'a>: GeometryMap<T = Self::T>
where
Self: 'a
type GeometryMap<'a>: GeometryMap<T = Self::T> where Self: 'a
Geometry map type
Sourcetype EntityDescriptor: Debug + PartialEq + Eq + Clone + Copy + Hash
type EntityDescriptor: Debug + PartialEq + Eq + Clone + Copy + Hash
Type used as identifier of different entity types
Sourcetype EntityIter<'a>: Iterator<Item = Self::Entity<'a>>
where
Self: 'a
type EntityIter<'a>: Iterator<Item = Self::Entity<'a>> where Self: 'a
Iterator over sub-entities
Required Methods§
Sourcefn geometry_dim(&self) -> usize
fn geometry_dim(&self) -> usize
Dimension of the geometry of this grid
Sourcefn topology_dim(&self) -> usize
fn topology_dim(&self) -> usize
Dimension of the topology of this grid
Sourcefn entity(
&self,
entity_type: Self::EntityDescriptor,
local_index: usize,
) -> Option<Self::Entity<'_>>
fn entity( &self, entity_type: Self::EntityDescriptor, local_index: usize, ) -> Option<Self::Entity<'_>>
An entity in this grid
Sourcefn entity_types(&self, tdim: usize) -> &[Self::EntityDescriptor]
fn entity_types(&self, tdim: usize) -> &[Self::EntityDescriptor]
The entity types of topological dimension dim contained in this grid
Sourcefn entity_count(&self, entity_type: Self::EntityDescriptor) -> usize
fn entity_count(&self, entity_type: Self::EntityDescriptor) -> usize
Number of entities of type entity_type
Sourcefn entity_iter(
&self,
entity_type: Self::EntityDescriptor,
) -> Self::EntityIter<'_>
fn entity_iter( &self, entity_type: Self::EntityDescriptor, ) -> Self::EntityIter<'_>
Iterator over entities
Sourcefn entity_from_id(
&self,
entity_type: Self::EntityDescriptor,
id: usize,
) -> Option<Self::Entity<'_>>
fn entity_from_id( &self, entity_type: Self::EntityDescriptor, id: usize, ) -> Option<Self::Entity<'_>>
An entity in this grid from an insertion id
Sourcefn geometry_map(
&self,
entity_type: Self::EntityDescriptor,
geometry_degree: usize,
points: &[Self::T],
) -> Self::GeometryMap<'_>
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§
Sourcefn cell_count(&self) -> usize
fn cell_count(&self) -> usize
Number of cells in the grid
Sourcefn cell_types(&self) -> &[Self::EntityDescriptor]
fn cell_types(&self) -> &[Self::EntityDescriptor]
Return the cell types in the grid
Sourcefn owned_cell_count(&self) -> usize
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.