pub struct ParticleNeighborList { /* private fields */ }Expand description
Cutoff-filtered neighbor helper for canonical massive-particle objects.
Implementations§
Source§impl ParticleNeighborList
impl ParticleNeighborList
Sourcepub fn from_bounds(
min: &[f64],
max: &[f64],
cutoff: f64,
) -> Result<Self, ParticleNeighborListError>
pub fn from_bounds( min: &[f64], max: &[f64], cutoff: f64, ) -> Result<Self, ParticleNeighborListError>
Builds a particle neighbor list over explicit rectangular bounds.
Sourcepub fn from_box(
dimensions: &[f64],
cutoff: f64,
) -> Result<Self, ParticleNeighborListError>
pub fn from_box( dimensions: &[f64], cutoff: f64, ) -> Result<Self, ParticleNeighborListError>
Builds a particle neighbor list over [0, dimensions[k]] on each axis.
Sourcepub fn rebuild(
&mut self,
objects: &PhysObj,
) -> Result<(), ParticleNeighborListError>
pub fn rebuild( &mut self, objects: &PhysObj, ) -> Result<(), ParticleNeighborListError>
Rebuilds nearby-cell candidates from objects.core[ATTR_R].
Sourcepub fn collect_pairs(
&self,
objects: &PhysObj,
selection: ParticleSelection,
) -> Result<Vec<(usize, usize)>, ParticleNeighborListError>
pub fn collect_pairs( &self, objects: &PhysObj, selection: ParticleSelection, ) -> Result<Vec<(usize, usize)>, ParticleNeighborListError>
Collects physical neighbor pairs within cutoff.
Requires unchanged positions since rebuild; prefer rebuild_and_collect.
The result contains unique unordered pairs (i, j) with i < j.
With ParticleSelection::AliveOnly, pairs touching dead particles are
skipped. Use ParticleSelection::All only when intentionally debugging or
inspecting all allocated slots.
Sourcepub fn rebuild_and_collect(
&mut self,
objects: &PhysObj,
selection: ParticleSelection,
) -> Result<Vec<(usize, usize)>, ParticleNeighborListError>
pub fn rebuild_and_collect( &mut self, objects: &PhysObj, selection: ParticleSelection, ) -> Result<Vec<(usize, usize)>, ParticleNeighborListError>
Rebuilds and queries current positions, preventing stale candidate use. Distance is strictly between zero and cutoff, with no periodic minimum image. Positions may be clipped into cells, but distance uses raw values.
Sourcepub fn rebuild_and_collect_into(
&mut self,
objects: &PhysObj,
selection: ParticleSelection,
output: &mut Vec<(usize, usize)>,
) -> Result<(), ParticleNeighborListError>
pub fn rebuild_and_collect_into( &mut self, objects: &PhysObj, selection: ParticleSelection, output: &mut Vec<(usize, usize)>, ) -> Result<(), ParticleNeighborListError>
Rebuilds current positions and replaces a caller-owned pair buffer. Retains buffer capacity. Geometry/state errors leave output unchanged.
Sourcepub fn collect_pairs_into(
&self,
objects: &PhysObj,
selection: ParticleSelection,
output: &mut Vec<(usize, usize)>,
) -> Result<(), ParticleNeighborListError>
pub fn collect_pairs_into( &self, objects: &PhysObj, selection: ParticleSelection, output: &mut Vec<(usize, usize)>, ) -> Result<(), ParticleNeighborListError>
Queries a previously rebuilt list into a reusable output buffer. Positions and particle count must remain unchanged since rebuild; alive flags are read at query time. Rebuild-and-query is the normal safe path. Shape and mask errors are validated before replacing the output.
Sourcepub fn for_each_pair(
&self,
objects: &PhysObj,
selection: ParticleSelection,
visitor: impl FnMut(usize, usize),
) -> Result<(), ParticleNeighborListError>
pub fn for_each_pair( &self, objects: &PhysObj, selection: ParticleSelection, visitor: impl FnMut(usize, usize), ) -> Result<(), ParticleNeighborListError>
Visits unique cutoff-filtered pairs without allocating a pair vector. Requires unchanged positions since the last rebuild. Queries before the first rebuild or after count changes fail; arbitrary position edits cannot be detected because particle attributes remain publicly mutable.
Trait Implementations§
Source§impl Clone for ParticleNeighborList
impl Clone for ParticleNeighborList
Source§fn clone(&self) -> ParticleNeighborList
fn clone(&self) -> ParticleNeighborList
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ParticleNeighborList
impl RefUnwindSafe for ParticleNeighborList
impl Send for ParticleNeighborList
impl Sync for ParticleNeighborList
impl Unpin for ParticleNeighborList
impl UnsafeUnpin for ParticleNeighborList
impl UnwindSafe for ParticleNeighborList
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
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> ⓘ
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> ⓘ
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