pub struct SimplexView<'a, SimplexDim, const MESH_DIM: usize> { /* private fields */ }Expand description
A view into a single simplex’s data.
This type can also be used as an index into a primal Cochain
of the corresponding dimension, providing a shorter syntax
and a type check to ensure the dimensions match:
let c_primal: Cochain<1, Primal> = mesh_3d.new_zero_cochain();
let c_dual: Cochain<2, Dual> = mesh_3d.new_zero_cochain();
for edge in mesh_3d.simplices::<1>() {
let primal_val = c_primal[edge];
let dual_val = c_dual[edge.dual()];
// ..is a typechecked equivalent to
let primal_val = c_primal.values[edge.index()];
let dual_val = c_dual.values[edge.index()];
}Something like this wouldn’t compile, for instance:
ⓘ
let c: Cochain<1, Dual> = mesh_3d.new_zero_cochain();
for edge in mesh_3d.simplices::<1>() {
let val = c[edge];
// ..but the index method would still work (almost certainly incorrectly):
let val = c.values[edge.index()];
}Implementations§
Source§impl<'a, SimplexDim, const MESH_DIM: usize> SimplexView<'a, SimplexDim, MESH_DIM>
impl<'a, SimplexDim, const MESH_DIM: usize> SimplexView<'a, SimplexDim, MESH_DIM>
Sourcepub fn vertices(&self) -> impl '_ + Iterator<Item = SVector<f64, MESH_DIM>>
pub fn vertices(&self) -> impl '_ + Iterator<Item = SVector<f64, MESH_DIM>>
Iterate over the vertices of this simplex.
Sourcepub fn vertex_indices(&self) -> impl '_ + Iterator<Item = usize>
pub fn vertex_indices(&self) -> impl '_ + Iterator<Item = usize>
Iterate over the vertex indices of this simplex.
Sourcepub fn dual_volume(&self) -> f64
pub fn dual_volume(&self) -> f64
Get the unsigned volume of the dual cell corresponding to this simplex.
Sourcepub fn circumcenter(&self) -> SVector<f64, MESH_DIM>
pub fn circumcenter(&self) -> SVector<f64, MESH_DIM>
Get the circumcenter of this simplex.
Sourcepub fn barycenter(&self) -> SVector<f64, MESH_DIM>
pub fn barycenter(&self) -> SVector<f64, MESH_DIM>
Get the barycenter of this simplex.
Sourcepub fn dual(
self,
) -> DualCellView<'a, DimNameDiff<Const<MESH_DIM>, SimplexDim>, MESH_DIM>
pub fn dual( self, ) -> DualCellView<'a, DimNameDiff<Const<MESH_DIM>, SimplexDim>, MESH_DIM>
Get the dual cell corresponding to this simplex.
Source§impl<'a, SimplexDim, const MESH_DIM: usize> SimplexView<'a, SimplexDim, MESH_DIM>
impl<'a, SimplexDim, const MESH_DIM: usize> SimplexView<'a, SimplexDim, MESH_DIM>
Sourcepub fn coboundary(
self,
) -> BoundaryIter<'a, DimNameSum<SimplexDim, U1>, MESH_DIM>
pub fn coboundary( self, ) -> BoundaryIter<'a, DimNameSum<SimplexDim, U1>, MESH_DIM>
Iterate over the k+1-dimensional simplices on whose boundary this simplex lies.
Source§impl<'a, SimplexDim, const MESH_DIM: usize> SimplexView<'a, SimplexDim, MESH_DIM>where
SimplexDim: DimNameSub<U1>,
impl<'a, SimplexDim, const MESH_DIM: usize> SimplexView<'a, SimplexDim, MESH_DIM>where
SimplexDim: DimNameSub<U1>,
Sourcepub fn boundary(self) -> BoundaryIter<'a, DimNameDiff<SimplexDim, U1>, MESH_DIM>
pub fn boundary(self) -> BoundaryIter<'a, DimNameDiff<SimplexDim, U1>, MESH_DIM>
Iterate over the k-1-dimensional simplices on the boundary of this simplex.
Trait Implementations§
Source§impl<'a, SimplexDim: Clone, const MESH_DIM: usize> Clone for SimplexView<'a, SimplexDim, MESH_DIM>
impl<'a, SimplexDim: Clone, const MESH_DIM: usize> Clone for SimplexView<'a, SimplexDim, MESH_DIM>
Source§fn clone(&self) -> SimplexView<'a, SimplexDim, MESH_DIM>
fn clone(&self) -> SimplexView<'a, SimplexDim, MESH_DIM>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a, SimplexDim: Debug, const MESH_DIM: usize> Debug for SimplexView<'a, SimplexDim, MESH_DIM>
impl<'a, SimplexDim: Debug, const MESH_DIM: usize> Debug for SimplexView<'a, SimplexDim, MESH_DIM>
Source§impl<'a, D, const MESH_DIM: usize> Index<SimplexView<'a, D, MESH_DIM>> for CochainImpl<D, Primal>
impl<'a, D, const MESH_DIM: usize> Index<SimplexView<'a, D, MESH_DIM>> for CochainImpl<D, Primal>
Source§impl<'a, D, const MESH_DIM: usize> IndexMut<SimplexView<'a, D, MESH_DIM>> for CochainImpl<D, Primal>
impl<'a, D, const MESH_DIM: usize> IndexMut<SimplexView<'a, D, MESH_DIM>> for CochainImpl<D, Primal>
Source§impl<'a, SimplexDim, const MESH_DIM: usize> PartialEq for SimplexView<'a, SimplexDim, MESH_DIM>
impl<'a, SimplexDim, const MESH_DIM: usize> PartialEq for SimplexView<'a, SimplexDim, MESH_DIM>
impl<'a, SimplexDim: Copy, const MESH_DIM: usize> Copy for SimplexView<'a, SimplexDim, MESH_DIM>
impl<'a, SimplexDim, const MESH_DIM: usize> Eq for SimplexView<'a, SimplexDim, MESH_DIM>
Auto Trait Implementations§
impl<'a, SimplexDim, const MESH_DIM: usize> Freeze for SimplexView<'a, SimplexDim, MESH_DIM>
impl<'a, SimplexDim, const MESH_DIM: usize> !RefUnwindSafe for SimplexView<'a, SimplexDim, MESH_DIM>
impl<'a, SimplexDim, const MESH_DIM: usize> !Send for SimplexView<'a, SimplexDim, MESH_DIM>
impl<'a, SimplexDim, const MESH_DIM: usize> !Sync for SimplexView<'a, SimplexDim, MESH_DIM>
impl<'a, SimplexDim, const MESH_DIM: usize> Unpin for SimplexView<'a, SimplexDim, MESH_DIM>where
SimplexDim: Unpin,
impl<'a, SimplexDim, const MESH_DIM: usize> !UnwindSafe for SimplexView<'a, SimplexDim, MESH_DIM>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.