HypercuboidCheckerboard

Struct HypercuboidCheckerboard 

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

Source

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.

Source

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>

Source§

fn point_to_space_index(&self, point: &Cartesian<N>) -> Option<usize>

Determine the space index of a given point. Read more
Source§

fn space_indices_by_color(&self) -> &[Vec<usize>]

The indices of all spaces, grouped by color. Read more
Source§

fn num_spaces(&self) -> usize

The total number of spaces in the checkerboard.
Source§

impl<const N: usize> Clone for HypercuboidCheckerboard<N>

Source§

fn clone(&self) -> HypercuboidCheckerboard<N>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<const N: usize> Debug for HypercuboidCheckerboard<N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> Default for HypercuboidCheckerboard<N>

Source§

fn default() -> Self

Construct a default HypercuboidCheckerboard.

The default is a 2x2x… non-periodic checkerboard with 1.0 x 1.0 x … spaces.

Source§

impl<'de, const N: usize> Deserialize<'de> for HypercuboidCheckerboard<N>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<const N: usize> PartialEq for HypercuboidCheckerboard<N>

Source§

fn eq(&self, other: &HypercuboidCheckerboard<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> Serialize for HypercuboidCheckerboard<N>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<const N: usize> StructuralPartialEq for HypercuboidCheckerboard<N>

Auto Trait Implementations§

Blanket Implementations§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,