Skip to main content

PointUpdate

Trait PointUpdate 

Source
pub trait PointUpdate<P, K> {
    // Required methods
    fn insert(&mut self, key: K, position: P);
    fn remove(&mut self, key: &K);
    fn len(&self) -> usize;
    fn is_empty(&self) -> bool;
    fn contains_key(&self, key: &K) -> bool;
    fn clear(&mut self);
}
Expand description

Allow incremental updates to points in the spatial data.

Required Methods§

Source

fn insert(&mut self, key: K, position: P)

Insert or update a point identified by a key.

§Example
use hoomd_spatial::{PointUpdate, VecCell};

let mut vec_cell = VecCell::default();

vec_cell.insert(0, [1.25, 2.5].into());
Source

fn remove(&mut self, key: &K)

Remove the point with the given key.

§Example
use hoomd_spatial::{PointUpdate, VecCell};

let mut vec_cell = VecCell::default();
vec_cell.insert(0, [1.25, 2.5].into());

vec_cell.remove(&0)
Source

fn len(&self) -> usize

Get the number of points in the spatial data structure.

§Example
use hoomd_spatial::{PointUpdate, VecCell};

let mut vec_cell = VecCell::default();
vec_cell.insert(0, [1.25, 2.5].into());

assert_eq!(vec_cell.len(), 1)
Source

fn is_empty(&self) -> bool

Test if the spatial data structure is empty.

§Example
use hoomd_spatial::{PointUpdate, VecCell};

let mut vec_cell = VecCell::<usize, 2>::default();

assert!(vec_cell.is_empty());
Source

fn contains_key(&self, key: &K) -> bool

Test if the spatial data structure contains a key.

use hoomd_spatial::{PointUpdate, VecCell};

let mut vec_cell = VecCell::default();
vec_cell.insert(0, [1.25, 2.5].into());

assert!(vec_cell.contains_key(&0));
Source

fn clear(&mut self)

Remove all points.

§Example
use hoomd_spatial::{PointUpdate, VecCell};

let mut vec_cell = VecCell::default();
vec_cell.insert(0, [1.25, 2.5].into());

vec_cell.clear();

Implementors§

Source§

impl<K, const D: usize> PointUpdate<Cartesian<D>, K> for HashCell<K, D>
where K: Copy + Eq + Hash,

Source§

impl<K, const D: usize> PointUpdate<Cartesian<D>, K> for VecCell<K, D>
where K: Copy + Eq + Hash,

Source§

impl<P, K> PointUpdate<P, K> for AllPairs<K>
where K: Copy + Eq + Hash,