ndgrid/traits/
geometry.rs

1//! Entity geometry
2use crate::types::Scalar;
3
4/// A point
5pub trait Point {
6    /// Scalar type
7    type T: Scalar;
8
9    /// The point's index
10    fn index(&self) -> usize;
11
12    /// Return the dimension of the point.
13    fn dim(&self) -> usize;
14
15    /// Get the coordinates of the point.
16    fn coords(&self, data: &mut [Self::T]);
17}
18
19/// The geometry of an entity
20///
21/// The geometry contains information about all points that make up the entity.
22pub trait Geometry {
23    /// Scalar type
24    type T: Scalar;
25
26    /// Point Type
27    type Point<'a>: Point<T = Self::T>
28    where
29        Self: 'a;
30
31    /// Point iterator
32    type PointIter<'a>: Iterator<Item = Self::Point<'a>>
33    where
34        Self: 'a;
35
36    /// Points
37    fn points(&self) -> Self::PointIter<'_>;
38
39    /// Point count
40    fn point_count(&self) -> usize;
41
42    /// Embedded superdegree
43    fn degree(&self) -> usize;
44}