Struct CartesianCuboid

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

Source

pub fn get_min(&self) -> SVector<F, D>

Get the minimum point which defines the simulation domain

Source

pub fn get_max(&self) -> SVector<F, D>

Get the maximum point which defines the simulation domain

Source

pub fn get_dx(&self) -> SVector<F, D>

Get the discretization used to generate voxels

Source

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>
where F: 'static + Float + Copy + Debug + FromPrimitive + ToPrimitive,

Source

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

pub fn from_boundaries_and_n_voxels( min: impl Into<[F; D]>, max: impl Into<[F; D]>, n_voxels: impl Into<[usize; D]>, ) -> Result<Self, BoundaryError>

Builds a new CartesianCuboid from given boundaries and the number of voxels per dimension specified.

Source§

impl<F, const D: usize> CartesianCuboid<F, D>
where F: 'static + Float + Copy + Debug + FromPrimitive + ToPrimitive + SubAssign + Div<Output = F> + DivAssign,

Source

pub fn get_voxel_index_of_raw( &self, pos: &SVector<F, D>, ) -> Result<[usize; D], BoundaryError>

Obtains the voxel index given a regular vector

This function can be used in derivatives of this type.

Trait Implementations§

Source§

impl<F: Clone, const D: usize> Clone for CartesianCuboid<F, D>

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<F: Debug, const D: usize> Debug for CartesianCuboid<F, D>

Source§

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

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

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

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]

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>

Deconstructs the [Domain] into its respective subdomains. Read more
Source§

impl<F, const D: usize> DomainCreateSubDomains<CartesianSubDomain<F, D>> for CartesianCuboid<F, D>
where F: 'static + Float + Debug + FromPrimitive,

Source§

type SubDomainIndex = usize

This should always be identical to [Domain::SubDomainIndex].
Source§

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>

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>

Source§

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

Source§

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>

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> 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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

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

Checks if self is actually part of its subset T (and can be converted to it).
§

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

The inclusion map: converts self to the equivalent element of its superset.
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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Ungil for T
where T: Send,