SimplexView

Struct SimplexView 

Source
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>
where SimplexDim: DimName, Const<MESH_DIM>: DimNameSub<SimplexDim>,

Source

pub fn vertices(&self) -> impl '_ + Iterator<Item = SVector<f64, MESH_DIM>>

Iterate over the vertices of this simplex.

Source

pub fn vertex_indices(&self) -> impl '_ + Iterator<Item = usize>

Iterate over the vertex indices of this simplex.

Source

pub fn index(&self) -> usize

Get the index of this simplex in the ordering of DIM-simplices.

Source

pub fn volume(&self) -> f64

Get the unsigned volume of this simplex.

Source

pub fn dual_volume(&self) -> f64

Get the unsigned volume of the dual cell corresponding to this simplex.

Source

pub fn circumcenter(&self) -> SVector<f64, MESH_DIM>

Get the circumcenter of this simplex.

Source

pub fn barycenter(&self) -> SVector<f64, MESH_DIM>

Get the barycenter of this simplex.

Source

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>
where SimplexDim: DimNameAdd<U1>, Const<MESH_DIM>: DimNameSub<DimNameSum<SimplexDim, U1>>,

Source

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>,

Source

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>

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<'a, SimplexDim: Debug, const MESH_DIM: usize> Debug for SimplexView<'a, SimplexDim, MESH_DIM>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, D, const MESH_DIM: usize> Index<SimplexView<'a, D, MESH_DIM>> for CochainImpl<D, Primal>
where D: DimName, Const<MESH_DIM>: DimNameSub<D>,

Source§

type Output = f64

The returned type after indexing.
Source§

fn index(&self, simplex: SimplexView<'a, D, MESH_DIM>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, D, const MESH_DIM: usize> IndexMut<SimplexView<'a, D, MESH_DIM>> for CochainImpl<D, Primal>
where D: DimName, Const<MESH_DIM>: DimNameSub<D>,

Source§

fn index_mut( &mut self, simplex: SimplexView<'a, D, MESH_DIM>, ) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a, SimplexDim, const MESH_DIM: usize> PartialEq for SimplexView<'a, SimplexDim, MESH_DIM>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, SimplexDim: Copy, const MESH_DIM: usize> Copy for SimplexView<'a, SimplexDim, MESH_DIM>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,