Skip to main content

SievedArray

Struct SievedArray 

Source
pub struct SievedArray<P, V> { /* private fields */ }
Expand description

A generic array of values indexed by mesh points, supporting refinement and assembly.

§Type Parameters

  • P: Point identifier type (must convert to PointId).
  • V: Value type stored for each point.

Implementations§

Source§

impl<P, V> SievedArray<P, V>
where P: Into<PointId> + Copy + Eq,

Source

pub fn atlas(&self) -> &Atlas

Access the underlying atlas for point-to-slice mapping.

Source

pub fn try_get(&self, p: PointId) -> Result<&[V], MeshSieveError>

Get a read-only slice for the given point, or an error if not present.

Source

pub fn try_get_mut(&mut self, p: PointId) -> Result<&mut [V], MeshSieveError>

Get a mutable slice for the given point, or an error if not present.

Source

pub fn try_iter_in_order( &self, ) -> impl Iterator<Item = Result<(PointId, &[V]), MeshSieveError>> + '_

Fallible iterator over (PointId, &[V]) in atlas insertion order.

§Complexity

O(n) to traverse, O(1) per element.

§Determinism

Iteration strictly follows atlas insertion order.

Source

pub fn iter_in_order(&self) -> impl Iterator<Item = (PointId, &[V])> + '_

Non-fallible iterator over (PointId, &[V]) in atlas insertion order.

§Complexity

O(n) to traverse, O(1) per element.

§Determinism

Iteration strictly follows atlas insertion order.

Source§

impl<P, V: Clone> SievedArray<P, V>
where P: Into<PointId> + Copy + Eq,

Source

pub fn try_set(&mut self, p: PointId, val: &[V]) -> Result<(), MeshSieveError>

Set the values for the given point from a slice, or return an error if lengths mismatch or point not found.

Source§

impl<P, V: Clone + Default> SievedArray<P, V>
where P: Into<PointId> + Copy + Eq,

Source

pub fn new(atlas: Atlas) -> Self

Create a new SievedArray with the given atlas.

Source

pub fn try_refine_with_sifter( &mut self, coarse: &SievedArray<P, V>, refinement: &[(P, Vec<(P, Polarity)>)], ) -> Result<(), MeshSieveError>

Refine this array from a coarse array using a sifter (with orientations).

The refinement mapping must be a partial function from fine points to coarse points; any fine point appearing more than once results in [MeshSieveError::DuplicateRefinementTarget].

§Complexity

O(m · k), where m is the number of fine targets and k is slice length.

§Determinism

Serial: deterministic. Parallel: deterministic final state if refinement has no duplicate fine targets (duplicates are rejected). Writes occur after a read-only computation phase.

Source

pub fn try_refine( &mut self, coarse: &SievedArray<P, V>, refinement: &[(P, Vec<P>)], ) -> Result<(), MeshSieveError>

Refine this array from a coarse array using a simple mapping (all forward), propagating errors.

§Complexity

O(m · k), where m is the number of fine targets and k is slice length.

§Determinism

Serial: deterministic. Parallel: deterministic final state if refinement has no duplicate fine targets (duplicates are rejected). Writes occur after a read-only computation phase.

Source§

impl<P, V> SievedArray<P, V>
where P: Into<PointId> + Copy + Eq, V: FromPrimitive + AddAssign + Div<Output = V> + Clone + Default,

Source

pub fn try_assemble( &self, coarse: &mut SievedArray<P, V>, refinement: &[(P, Vec<P>)], ) -> Result<(), MeshSieveError>

Assemble fine data into coarse by averaging over refinement, propagating errors.

§Complexity

O(m · k); performs element-wise reduction per coarse point.

§Determinism

Determined by the reduction order, which is fixed by the refinement input order.

Trait Implementations§

Source§

impl<P: Clone, V: Clone> Clone for SievedArray<P, V>

Source§

fn clone(&self) -> SievedArray<P, V>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P: Debug, V: Debug> Debug for SievedArray<P, V>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<P, V> Freeze for SievedArray<P, V>

§

impl<P, V> RefUnwindSafe for SievedArray<P, V>

§

impl<P, V> Send for SievedArray<P, V>
where P: Send, V: Send,

§

impl<P, V> Sync for SievedArray<P, V>
where P: Sync, V: Sync,

§

impl<P, V> Unpin for SievedArray<P, V>
where P: Unpin, V: Unpin,

§

impl<P, V> UnsafeUnpin for SievedArray<P, V>

§

impl<P, V> UnwindSafe for SievedArray<P, V>
where P: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> AccumulatePathExt for T

Source§

fn accumulate_path<O, I>(path: I) -> O
where O: Orientation, I: IntoIterator<Item = O>,

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