Struct CartesianCuboid

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§

§

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

pub fn get_min(&self) -> Matrix<F, Const<D>, Const<1>, ArrayStorage<F, D, 1>>

Available on crate feature cpu_os_threads only.

Get the minimum point which defines the simulation domain

pub fn get_max(&self) -> Matrix<F, Const<D>, Const<1>, ArrayStorage<F, D, 1>>

Available on crate feature cpu_os_threads only.

Get the maximum point which defines the simulation domain

pub fn get_dx(&self) -> Matrix<F, Const<D>, Const<1>, ArrayStorage<F, D, 1>>

Available on crate feature cpu_os_threads only.

Get the discretization used to generate voxels

pub fn get_n_voxels( &self, ) -> Matrix<usize, Const<D>, Const<1>, ArrayStorage<usize, D, 1>>

Available on crate feature cpu_os_threads only.

Get the number of voxels in each dimension of the domain

§

impl<F, const D: usize> CartesianCuboid<F, D>
where F: 'static + Float + Copy + Debug + FromPrimitive + ToPrimitive,

pub fn from_boundaries_and_interaction_range( min: impl Into<[F; D]>, max: impl Into<[F; D]>, interaction_range: F, ) -> Result<CartesianCuboid<F, D>, BoundaryError>

Available on crate feature cpu_os_threads only.

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);

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

Available on crate feature cpu_os_threads only.

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

§

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

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

Available on crate feature cpu_os_threads only.

Obtains the voxel index given a regular vector

This function can be used in derivatives of this type.

Trait Implementations§

§

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

§

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
§

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

§

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

Formats the value using the given formatter. Read more
§

impl<C, Ci, F, const D: usize> Domain<C, CartesianSubDomain<F, D>, Ci> for CartesianCuboid<F, D>
where C: Position<Matrix<F, Const<D>, Const<1>, ArrayStorage<F, D, 1>>>, F: 'static + Float<Output = F> + Copy + Debug + FromPrimitive + ToPrimitive + SubAssign + Div + DivAssign, Ci: IntoIterator<Item = C>,

§

type SubDomainIndex = usize

Subdomains can be identified by their unique SubDomainIndex. The backend uses this property to construct a mapping (graph) between subdomains.
§

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

fn decompose( self, n_subdomains: NonZero<usize>, cells: Ci, ) -> Result<DecomposedDomain<<CartesianCuboid<F, D> as Domain<C, CartesianSubDomain<F, D>, Ci>>::SubDomainIndex, CartesianSubDomain<F, D>, C>, DecomposeError>

Deconstructs the Domain into its respective subdomains. Read more
§

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

§

type SubDomainIndex = usize

This should always be identical to Domain::SubDomainIndex.
§

type VoxelIndex = [usize; D]

This should always be identical to Domain::VoxelIndex.
§

fn create_subdomains( &self, n_subdomains: NonZero<usize>, ) -> Result<impl IntoIterator<Item = (<CartesianCuboid<F, D> as DomainCreateSubDomains<CartesianSubDomain<F, D>>>::SubDomainIndex, CartesianSubDomain<F, D>, Vec<<CartesianCuboid<F, D> as DomainCreateSubDomains<CartesianSubDomain<F, D>>>::VoxelIndex>)>, DecomposeError>

Generates at most n_subdomains. This function can also return a lower amount of subdomains but never less than 1.
§

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

§

fn get_rng_seed(&self) -> u64

Obtains the current rng seed
§

impl<C, F, const D: usize> SortCells<C> for CartesianCuboid<F, D>
where F: 'static + Float<Output = F> + Copy + Debug + FromPrimitive + ToPrimitive + SubAssign + Div + DivAssign, C: Position<Matrix<F, Const<D>, Const<1>, ArrayStorage<F, D, 1>>>,

§

type VoxelIndex = [usize; D]

An index which determines to which next smaller unit the cell should be assigned.
§

fn get_voxel_index_of( &self, cell: &C, ) -> Result<<CartesianCuboid<F, D> as SortCells<C>>::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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> InteractionInformation for T
where T: Send + Sync + Clone + Debug,

§

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

§

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

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,