pub struct HypercuboidCheckerboard<const N: usize> { /* private fields */ }Expand description
2^N color checkerboard with axis-aligned hypercuboidal cells.
A HypercuboidCheckerboard is comprised of n x m x … axis aligned
spaces. Each space has the same shape, but each axis might have a different
edge length. Each axis may be periodic or not.
Along the non-periodic axes, the checkerboard overhangs the boundary so that
the entire domain is always covered (for any origin shift up to 1 cell length).
Along periodic axes, the checkerboard has exactly the same width as the domain.
HypercuboidCheckerboard wraps points “outside” the checkerboard into the correct
periodic space.
Obviously, HypercuboidCheckerboard is a suitable checkerboard for
Hypercuboid boundary geometries. It can also be a good choice for
other boundaries. For example: cylindrical boundaries (periodic in one
direction) and closed boundaries of any shape. There may be many overhanging
spaces (some completely outside the boundary) in these cases. However, the
checkerboard is still valid and rayon’s dynamic load balancing scheme should
be able to handle the empty cells efficiently.
Implementations§
Source§impl<const N: usize> HypercuboidCheckerboard<N>
impl<const N: usize> HypercuboidCheckerboard<N>
Sourcepub fn new<R: Rng + ?Sized>(
rng: &mut R,
interaction_range: PositiveReal,
edge_lengths: [PositiveReal; N],
periodic: [bool; N],
) -> Self
pub fn new<R: Rng + ?Sized>( rng: &mut R, interaction_range: PositiveReal, edge_lengths: [PositiveReal; N], periodic: [bool; N], ) -> Self
Construct a new HypercuboidCheckerboard.
Set interaction_range to the largest distance between any two
interacting bodies. new will construct a checkerboard that covers
the range [-edge_lengths[i]/2.0, edge_lengths[i]/2.0) (respecting
periodic[i]) for each dimension i.
Sourcepub fn update<R: Rng + ?Sized>(
&mut self,
rng: &mut R,
interaction_range: PositiveReal,
edge_lengths: [PositiveReal; N],
periodic: [bool; N],
)
pub fn update<R: Rng + ?Sized>( &mut self, rng: &mut R, interaction_range: PositiveReal, edge_lengths: [PositiveReal; N], periodic: [bool; N], )
Update an existing checkerboard.
update performs the same steps as new, but modifies self in place.
Prefer update when possible, as it can reuse the space index partitioning
when the shape doesn’t change.
Trait Implementations§
Source§impl<const N: usize> Checkerboard<Cartesian<N>> for HypercuboidCheckerboard<N>
impl<const N: usize> Checkerboard<Cartesian<N>> for HypercuboidCheckerboard<N>
Source§fn point_to_space_index(&self, point: &Cartesian<N>) -> Option<usize>
fn point_to_space_index(&self, point: &Cartesian<N>) -> Option<usize>
Source§fn space_indices_by_color(&self) -> &[Vec<usize>]
fn space_indices_by_color(&self) -> &[Vec<usize>]
Source§fn num_spaces(&self) -> usize
fn num_spaces(&self) -> usize
Source§impl<const N: usize> Clone for HypercuboidCheckerboard<N>
impl<const N: usize> Clone for HypercuboidCheckerboard<N>
Source§fn clone(&self) -> HypercuboidCheckerboard<N>
fn clone(&self) -> HypercuboidCheckerboard<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<const N: usize> Debug for HypercuboidCheckerboard<N>
impl<const N: usize> Debug for HypercuboidCheckerboard<N>
Source§impl<const N: usize> Default for HypercuboidCheckerboard<N>
impl<const N: usize> Default for HypercuboidCheckerboard<N>
Source§impl<'de, const N: usize> Deserialize<'de> for HypercuboidCheckerboard<N>
impl<'de, const N: usize> Deserialize<'de> for HypercuboidCheckerboard<N>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<const N: usize> PartialEq for HypercuboidCheckerboard<N>
impl<const N: usize> PartialEq for HypercuboidCheckerboard<N>
Source§impl<const N: usize> Serialize for HypercuboidCheckerboard<N>
impl<const N: usize> Serialize for HypercuboidCheckerboard<N>
impl<const N: usize> StructuralPartialEq for HypercuboidCheckerboard<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for HypercuboidCheckerboard<N>
impl<const N: usize> RefUnwindSafe for HypercuboidCheckerboard<N>
impl<const N: usize> Send for HypercuboidCheckerboard<N>
impl<const N: usize> Sync for HypercuboidCheckerboard<N>
impl<const N: usize> Unpin for HypercuboidCheckerboard<N>
impl<const N: usize> UnwindSafe for HypercuboidCheckerboard<N>
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