Struct gchemol_neighbors::Neighborhood
source · pub struct Neighborhood { /* private fields */ }
Expand description
Neighborhood is a neighboring nodes detector, for given cutoff distance.
Implementations§
source§impl Neighborhood
impl Neighborhood
sourcepub fn update<I>(&mut self, iter: I)where
I: IntoIterator<Item = (usize, Point)>,
pub fn update<I>(&mut self, iter: I)where I: IntoIterator<Item = (usize, Point)>,
Automatically build and update Neighborhood with contents of an iterator.
The position of a point is associated with a permanent key in type
of usize
.
sourcepub fn nodes(&self) -> impl Iterator<Item = usize> + '_
pub fn nodes(&self) -> impl Iterator<Item = usize> + '_
Return an iterator over the serial numbers associated with internal points/particles.
sourcepub fn neighbors(
&self,
n: usize,
radius: f64
) -> impl Iterator<Item = Neighbor> + '_
pub fn neighbors( &self, n: usize, radius: f64 ) -> impl Iterator<Item = Neighbor> + '_
Return an iterator of the nodes connected to the node n
.
Parameters
- n: the key of host node for searching neighbors
- radius: cutoff radius distance
sourcepub fn get_position(&self, n: usize) -> Option<&Point>
pub fn get_position(&self, n: usize) -> Option<&Point>
Return the position of node n
. Return None if there is no
associated point with node n
.
sourcepub fn search(
&self,
pt: Point,
radius: f64
) -> impl Iterator<Item = Neighbor> + '_
pub fn search( &self, pt: Point, radius: f64 ) -> impl Iterator<Item = Neighbor> + '_
Return neighbors of a particle pt
within distance cutoff radius
.
sourcepub fn set_lattice(&mut self, mat: [[f64; 3]; 3])
pub fn set_lattice(&mut self, mat: [[f64; 3]; 3])
Set lattice for applying periodic boundary conditions
Trait Implementations§
source§impl Clone for Neighborhood
impl Clone for Neighborhood
source§fn clone(&self) -> Neighborhood
fn clone(&self) -> Neighborhood
Returns a copy 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 Debug for Neighborhood
impl Debug for Neighborhood
source§impl Default for Neighborhood
impl Default for Neighborhood
source§fn default() -> Neighborhood
fn default() -> Neighborhood
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for Neighborhood
impl Send for Neighborhood
impl Sync for Neighborhood
impl Unpin for Neighborhood
impl UnwindSafe for Neighborhood
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
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§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 more§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).§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.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.