Struct SubDomainBox

pub struct SubDomainBox<I, S, C, A, Com, Sy = BarrierSync>
where S: SubDomain,
{ /* private fields */ }
Available on crate feature chili only.
Expand description

Encapsulates a subdomain with cells and other simulation aspects.

Implementations§

§

impl<I, S, C, A, Com, Sy> SubDomainBox<I, S, C, A, Com, Sy>
where S: SubDomain,

pub fn sync(&mut self) -> Result<(), SimulationError>
where Sy: SyncSubDomains,

Available on crate feature cpu_os_threads only.

Allows to sync between threads. In the most simplest case of BarrierSync syncing is done by a global barrier.

pub fn store_error( &mut self, maybe_error: Result<(), SimulationError>, ) -> Result<bool, SimulationError>
where Sy: SyncSubDomains,

Available on crate feature cpu_os_threads only.

Stores an error which has occurred and notifies other running threads to wind down.

pub fn insert_cells( &mut self, new_cells: &mut Vec<(C, Option<A>)>, init_aux_storage: impl Fn(&C) -> A, ) -> Result<(), BoundaryError>
where <S as SubDomain>::VoxelIndex: Eq + Hash + Ord, S: SortCells<C, VoxelIndex = <S as SubDomain>::VoxelIndex>,

Available on crate feature cpu_os_threads only.

Allows insertion of cells into the subdomain.

pub fn run_local_cell_funcs<Func, F>( &mut self, func: Func, next_time_point: &NextTimePoint<F>, ) -> Result<(), SimulationError>
where Func: Fn(&mut C, &mut A, F, &mut ChaCha8Rng) -> Result<(), SimulationError>, F: Copy,

Available on crate feature cpu_os_threads only.

Update all purely local functions

Used to iterate over all cells in the current subdomain and running local functions which need no communication with other subdomains

pub fn run_local_subdomain_funcs<Func, F>( &mut self, func: Func, next_time_point: &NextTimePoint<F>, ) -> Result<(), SimulationError>
where Func: Fn(&mut S, F) -> Result<(), SimulationError>, F: Copy,

Available on crate feature cpu_os_threads only.

TODO

pub fn save_subdomains<F>( &self, storage_manager: &mut StorageManager<SubDomainPlainIndex, S>, next_time_point: &NextTimePoint<F>, ) -> Result<(), StorageError>
where F: Debug, S: Clone + Serialize,

Available on crate feature cpu_os_threads only.

Save all subdomains with the given storage manager.

pub fn save_cells<F>( &self, storage_manager: &mut StorageManager<CellIdentifier, (CellBox<C>, A)>, next_time_point: &NextTimePoint<F>, ) -> Result<(), StorageError>
where F: Debug, A: Clone + Serialize, C: Clone + Serialize, CellBox<C>: Id<Identifier = CellIdentifier>,

Available on crate feature cpu_os_threads only.

Stores all cells of the subdomain via the given storage_manager

§

impl<I, S, C, A, Com, Sy> SubDomainBox<I, S, C, A, Com, Sy>
where S: SubDomain,

pub fn update_cell_cycle_4<F, Func>( &mut self, default_from: &Func, ) -> Result<(), SimulationError>
where F: Debug, C: Cycle<C, F>, A: UpdateCycle, Func: Fn(&C) -> A,

Available on crate feature cpu_os_threads only.

Separate function to update the cell cycle

Instead of running one big update function for all local rules, we have to treat this cell cycle differently since new cells could be generated and thus have consequences for other update steps as well.

§

impl<I, S, C, A, Com, Sy> SubDomainBox<I, S, C, A, Com, Sy>
where S: SubDomain,

pub fn update_mechanics_interaction_step_1<Pos, Vel, For, Float, Inf, const N: usize>( &mut self, ) -> Result<(), SimulationError>
where Pos: Clone, Vel: Clone, Inf: Clone, C: Position<Pos> + Velocity<Vel> + Mechanics<Pos, Vel, For, Float> + Interaction<Pos, Vel, For, Inf>, A: UpdateMechanics<Pos, Vel, For, N> + UpdateInteraction, For: Xapy<Float> + AddAssign, Float: Float + AddAssign, <S as SubDomain>::VoxelIndex: Ord, S: SubDomainMechanics<Pos, Vel>, Com: Communicator<SubDomainPlainIndex, PosInformation<Pos, Vel, Inf>>,

Available on crate feature cpu_os_threads only.

Update cells position and velocity

We assume that cells implement the Mechanics and Interaction traits. Then, threads will exchange information in the PosInformation format to calculate the forces acting on the cells.

pub fn calculate_custom_domain_force<Pos, Vel, For, const N: usize>( &mut self, ) -> Result<(), SimulationError>
where Pos: Clone, Vel: Clone, C: Position<Pos> + Velocity<Vel>, A: UpdateMechanics<Pos, Vel, For, N>, S: SubDomainForce<Pos, Vel, For>,

Available on crate feature cpu_os_threads only.

Calculates the custom force of the domain on the cells.

pub fn update_mechanics_interaction_step_2<Pos, Vel, For, Float, Inf, const N: usize>( &mut self, determinism: bool, ) -> Result<(), SimulationError>
where For: Xapy<Float> + Clone + AddAssign, A: UpdateMechanics<Pos, Vel, For, N> + UpdateInteraction, Float: Float, Pos: Clone, Vel: Clone, C: Position<Pos> + Velocity<Vel> + Mechanics<Pos, Vel, For, Float> + Interaction<Pos, Vel, For, Inf>, Com: Communicator<SubDomainPlainIndex, PosInformation<Pos, Vel, Inf>> + Communicator<SubDomainPlainIndex, ForceInformation<For>>,

Available on crate feature cpu_os_threads only.

Update cells position and velocity

We assume that cells implement the Mechanics and Interaction traits. Then, threads will use the previously exchanged PosInformation to calculate forces and send back information about the acting force in the ForceInformation format. In addition, this method also applies the inverse force to local cells.

pub fn update_mechanics_interaction_step_3<Pos, Vel, For, const N: usize>( &mut self, determinism: bool, ) -> Result<(), SimulationError>
where A: UpdateMechanics<Pos, Vel, For, N>, Com: Communicator<SubDomainPlainIndex, ForceInformation<For>>,

Available on crate feature cpu_os_threads only.

Receive all calculated forces and include them for later update steps.

pub fn apply_boundary<Pos, Vel>(&mut self) -> Result<(), BoundaryError>
where C: Position<Pos> + Velocity<Vel>, S: SubDomainMechanics<Pos, Vel>,

Available on crate feature cpu_os_threads only.

Applies boundary conditions to cells. For the future, we hope to be using previous and current position of cells rather than the cell itself.

pub fn sort_cells_in_voxels_step_1(&mut self) -> Result<(), SimulationError>
where Com: Communicator<SubDomainPlainIndex, SendCell<CellBox<C>, A>>, S: SortCells<C, VoxelIndex = <S as SubDomain>::VoxelIndex>, <S as SubDomain>::VoxelIndex: Eq + Hash + Ord,

Available on crate feature cpu_os_threads only.

Sort new cells into respective voxels

This step determines if a cell is still in its correct location after its position has changed. This can be due to the SubDomainBox::update_mechanics_interaction_step_3 method or due to other effects such as cell-division by the cellular_raza_concepts::Cycle trait.

If the cell is not in the correct voxel, we either directly insert this cell into the voxel or send it to the other SubDomainBox to take care of this.

pub fn sort_cells_in_voxels_step_2( &mut self, determinism: bool, ) -> Result<(), SimulationError>
where Com: Communicator<SubDomainPlainIndex, SendCell<CellBox<C>, A>>, <S as SubDomain>::VoxelIndex: Eq + Hash + Ord, S: SortCells<C, VoxelIndex = <S as SubDomain>::VoxelIndex>,

Available on crate feature cpu_os_threads only.

Sort new cells into respective voxels

After having sent cells to the new SubDomainBox in the SubDomainBox::sort_cells_in_voxels_step_1 method, we receive these new cells and insert them into their respective voxels.

§

impl<I, S, C, A, Com, Sy> SubDomainBox<I, S, C, A, Com, Sy>
where S: SubDomain,

pub fn update_reactions_extra_step_1<Pos, Ri, Re, Float>( &mut self, ) -> Result<(), SimulationError>
where C: ReactionsExtra<Ri, Re>, S: SubDomainReactions<Pos, Re, Float>, Com: Communicator<SubDomainPlainIndex, ReactionsExtraBorderInfo<<S as SubDomainReactions<Pos, Re, Float>>::BorderInfo>>,

Available on crate feature cpu_os_threads only.

Send ReactionsExtraBorderInfo to neighboring subdomains

pub fn update_reactions_extra_step_2<Pos, Ri, Re, Float>( &mut self, determinism: bool, ) -> Result<(), SimulationError>

Available on crate feature cpu_os_threads only.

Receive ReactionsExtraBorderInfo of neighboring subdomains and return ReactionsExtraBorderReturn

pub fn update_reactions_extra_step_3<Pos, Ri, Re, Float>( &mut self, determinism: bool, ) -> Result<(), SimulationError>

Available on crate feature cpu_os_threads only.

Receive ReactionsExtraBorderReturn and update values.

§

impl<I, S, C, A, Com, Sy> SubDomainBox<I, S, C, A, Com, Sy>
where S: SubDomain,

pub fn update_contact_reactions_step_1<Ri, Pos, RInf, Float, const N: usize>( &mut self, ) -> Result<(), SimulationError>
where Pos: Clone, C: ReactionsContact<Ri, Pos, Float, RInf> + Intracellular<Ri> + Position<Pos>, A: UpdateReactions<Ri> + UpdateReactionsContact<Ri, N>, Ri: Xapy<Float> + Clone, RInf: Clone, Float: Float, Com: Communicator<SubDomainPlainIndex, ReactionsContactInformation<Pos, Ri, RInf>>,

Available on crate feature cpu_os_threads only.

Send ReactionsContactInformation to neighboring subdomains.

pub fn update_contact_reactions_step_2<Ri, Pos, RInf, Float, const N: usize>( &mut self, determinism: bool, ) -> Result<(), SimulationError>

Available on crate feature cpu_os_threads only.

Receive ReactionsContactInformation, perform calculations of increments of ReactionsContact and return ReactionsContactReturn

pub fn update_contact_reactions_step_3<Ri>( &mut self, determinism: bool, ) -> Result<(), SimulationError>

Available on crate feature cpu_os_threads only.

Receive all calculated increments and include them for later update steps.

Auto Trait Implementations§

§

impl<I, S, C, A, Com, Sy> Freeze for SubDomainBox<I, S, C, A, Com, Sy>
where I: Freeze, S: Freeze, Com: Freeze, Sy: Freeze,

§

impl<I, S, C, A, Com, Sy> RefUnwindSafe for SubDomainBox<I, S, C, A, Com, Sy>

§

impl<I, S, C, A, Com, Sy> Send for SubDomainBox<I, S, C, A, Com, Sy>
where I: Send, S: Send, Com: Send, Sy: Send, <S as SubDomain>::VoxelIndex: Send, A: Send, C: Send,

§

impl<I, S, C, A, Com, Sy> Sync for SubDomainBox<I, S, C, A, Com, Sy>
where I: Sync, S: Sync, Com: Sync, Sy: Sync, <S as SubDomain>::VoxelIndex: Sync, A: Sync, C: Sync,

§

impl<I, S, C, A, Com, Sy> Unpin for SubDomainBox<I, S, C, A, Com, Sy>
where I: Unpin, S: Unpin, Com: Unpin, Sy: Unpin,

§

impl<I, S, C, A, Com, Sy> UnwindSafe for SubDomainBox<I, S, C, A, Com, Sy>

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
§

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