pub struct CartesianCuboid<F, const D: usize> {
pub rng_seed: u64,
/* private fields */
}
Expand description
A generic Domain with a cuboid layout.
This struct can be used to define custom domains on top of its behaviour.
Fields§
§rng_seed: u64
Seed from which all random numbers will be initially drawn
Implementations§
Source§impl<F, const D: usize> CartesianCuboid<F, D>where
F: Clone,
impl<F, const D: usize> CartesianCuboid<F, D>where
F: Clone,
Sourcepub fn get_min(&self) -> SVector<F, D>
pub fn get_min(&self) -> SVector<F, D>
Get the minimum point which defines the simulation domain
Sourcepub fn get_max(&self) -> SVector<F, D>
pub fn get_max(&self) -> SVector<F, D>
Get the maximum point which defines the simulation domain
Sourcepub fn get_n_voxels(&self) -> SVector<usize, D>
pub fn get_n_voxels(&self) -> SVector<usize, D>
Get the number of voxels in each dimension of the domain
Source§impl<F, const D: usize> CartesianCuboid<F, D>
impl<F, const D: usize> CartesianCuboid<F, D>
Sourcepub fn from_boundaries_and_interaction_range(
min: impl Into<[F; D]>,
max: impl Into<[F; D]>,
interaction_range: F,
) -> Result<Self, BoundaryError>
pub fn from_boundaries_and_interaction_range( min: impl Into<[F; D]>, max: impl Into<[F; D]>, interaction_range: F, ) -> Result<Self, BoundaryError>
Builds a new CartesianCuboid from given boundaries and maximum interaction ranges of the containing cells.
let min = [2.0, 3.0, 1.0];
let max = [10.0, 10.0, 20.0];
let interaction_range = 2.0;
let domain = CartesianCuboid::from_boundaries_and_interaction_range(
min,
max,
interaction_range
)?;
assert_eq!(domain.get_n_voxels()[0], 4);
assert_eq!(domain.get_n_voxels()[1], 3);
assert_eq!(domain.get_n_voxels()[2], 9);
Source§impl<F, const D: usize> CartesianCuboid<F, D>where
F: 'static + Float + Copy + Debug + FromPrimitive + ToPrimitive + SubAssign + Div<Output = F> + DivAssign,
impl<F, const D: usize> CartesianCuboid<F, D>where
F: 'static + Float + Copy + Debug + FromPrimitive + ToPrimitive + SubAssign + Div<Output = F> + DivAssign,
Trait Implementations§
Source§impl<F: Clone, const D: usize> Clone for CartesianCuboid<F, D>
impl<F: Clone, const D: usize> Clone for CartesianCuboid<F, D>
Source§fn clone(&self) -> CartesianCuboid<F, D>
fn clone(&self) -> CartesianCuboid<F, D>
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<C, Ci, F, const D: usize> Domain<C, CartesianSubDomain<F, D>, Ci> for CartesianCuboid<F, D>where
C: Position<SVector<F, D>>,
F: 'static + Float + Copy + Debug + FromPrimitive + ToPrimitive + SubAssign + Div<Output = F> + DivAssign,
Ci: IntoIterator<Item = C>,
impl<C, Ci, F, const D: usize> Domain<C, CartesianSubDomain<F, D>, Ci> for CartesianCuboid<F, D>where
C: Position<SVector<F, D>>,
F: 'static + Float + Copy + Debug + FromPrimitive + ToPrimitive + SubAssign + Div<Output = F> + DivAssign,
Ci: IntoIterator<Item = C>,
Source§type SubDomainIndex = usize
type SubDomainIndex = usize
Subdomains can be identified by their unique SubDomainIndex.
The backend uses this property to construct a mapping (graph) between subdomains.
Source§type VoxelIndex = [usize; D]
type VoxelIndex = [usize; D]
Similarly to the SubDomainIndex, voxels can be accessed by
their unique index. The backend will use this information to construct a mapping
(graph) between voxels inside their respective subdomains.
Source§fn decompose(
self,
n_subdomains: NonZeroUsize,
cells: Ci,
) -> Result<DecomposedDomain<Self::SubDomainIndex, CartesianSubDomain<F, D>, C>, DecomposeError>
fn decompose( self, n_subdomains: NonZeroUsize, cells: Ci, ) -> Result<DecomposedDomain<Self::SubDomainIndex, CartesianSubDomain<F, D>, C>, DecomposeError>
Deconstructs the [Domain] into its respective subdomains. Read more
Source§impl<F, const D: usize> DomainCreateSubDomains<CartesianSubDomain<F, D>> for CartesianCuboid<F, D>
impl<F, const D: usize> DomainCreateSubDomains<CartesianSubDomain<F, D>> for CartesianCuboid<F, D>
Source§type SubDomainIndex = usize
type SubDomainIndex = usize
This should always be identical to [Domain::SubDomainIndex].
Source§type VoxelIndex = [usize; D]
type VoxelIndex = [usize; D]
This should always be identical to [Domain::VoxelIndex].
Source§fn create_subdomains(
&self,
n_subdomains: NonZeroUsize,
) -> Result<impl IntoIterator<Item = (Self::SubDomainIndex, CartesianSubDomain<F, D>, Vec<Self::VoxelIndex>)>, DecomposeError>
fn create_subdomains( &self, n_subdomains: NonZeroUsize, ) -> Result<impl IntoIterator<Item = (Self::SubDomainIndex, CartesianSubDomain<F, D>, Vec<Self::VoxelIndex>)>, DecomposeError>
Generates at most
n_subdomains
. This function can also return a lower amount of
subdomains but never less than 1.Source§impl<F, const D: usize> DomainRngSeed for CartesianCuboid<F, D>
impl<F, const D: usize> DomainRngSeed for CartesianCuboid<F, D>
Source§fn get_rng_seed(&self) -> u64
fn get_rng_seed(&self) -> u64
Obtains the current rng seed
Source§impl<C, F, const D: usize> SortCells<C> for CartesianCuboid<F, D>where
F: 'static + Float + Copy + Debug + FromPrimitive + ToPrimitive + SubAssign + Div<Output = F> + DivAssign,
C: Position<SVector<F, D>>,
impl<C, F, const D: usize> SortCells<C> for CartesianCuboid<F, D>where
F: 'static + Float + Copy + Debug + FromPrimitive + ToPrimitive + SubAssign + Div<Output = F> + DivAssign,
C: Position<SVector<F, D>>,
Source§type VoxelIndex = [usize; D]
type VoxelIndex = [usize; D]
An index which determines to which next smaller unit the cell should be assigned.
Source§fn get_voxel_index_of(
&self,
cell: &C,
) -> Result<Self::VoxelIndex, BoundaryError>
fn get_voxel_index_of( &self, cell: &C, ) -> Result<Self::VoxelIndex, BoundaryError>
If given a cell, we can sort this cell into the corresponding sub unit.
Auto Trait Implementations§
impl<F, const D: usize> Freeze for CartesianCuboid<F, D>where
F: Freeze,
impl<F, const D: usize> RefUnwindSafe for CartesianCuboid<F, D>where
F: RefUnwindSafe,
impl<F, const D: usize> Send for CartesianCuboid<F, D>where
F: Send,
impl<F, const D: usize> Sync for CartesianCuboid<F, D>where
F: Sync,
impl<F, const D: usize> Unpin for CartesianCuboid<F, D>where
F: Unpin,
impl<F, const D: usize> UnwindSafe for CartesianCuboid<F, D>where
F: UnwindSafe,
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
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>
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 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>
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<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.