Struct SubDomainBox
pub struct SubDomainBox<I, S, C, A, Com, Sy = BarrierSync>where
S: SubDomain,{ /* private fields */ }
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,
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.
pub fn sync(&mut self) -> Result<(), SimulationError>where
Sy: SyncSubDomains,
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.
pub fn store_error(
&mut self,
maybe_error: Result<(), SimulationError>,
) -> Result<bool, SimulationError>where
Sy: SyncSubDomains,
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.
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>,
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>
Available on crate feature cpu_os_threads
only.
pub fn run_local_cell_funcs<Func, F>( &mut self, func: Func, next_time_point: &NextTimePoint<F>, ) -> Result<(), SimulationError>
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>
Available on crate feature cpu_os_threads
only.
pub fn run_local_subdomain_funcs<Func, F>( &mut self, func: Func, next_time_point: &NextTimePoint<F>, ) -> Result<(), SimulationError>
cpu_os_threads
only.TODO
pub fn save_subdomains<F>(
&self,
storage_manager: &mut StorageManager<SubDomainPlainIndex, S>,
next_time_point: &NextTimePoint<F>,
) -> Result<(), StorageError>
Available on crate feature cpu_os_threads
only.
pub fn save_subdomains<F>( &self, storage_manager: &mut StorageManager<SubDomainPlainIndex, S>, next_time_point: &NextTimePoint<F>, ) -> Result<(), StorageError>
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>
Available on crate feature cpu_os_threads
only.
pub fn save_cells<F>( &self, storage_manager: &mut StorageManager<CellIdentifier, (CellBox<C>, A)>, next_time_point: &NextTimePoint<F>, ) -> Result<(), StorageError>
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,
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>
Available on crate feature cpu_os_threads
only.
pub fn update_cell_cycle_4<F, Func>( &mut self, default_from: &Func, ) -> Result<(), SimulationError>
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,
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.
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>>,
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.
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>,
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.
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>>,
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.
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>>,
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>
Available on crate feature cpu_os_threads
only.
pub fn apply_boundary<Pos, Vel>(&mut self) -> Result<(), BoundaryError>
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.
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,
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.
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>,
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,
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.
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>>,
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>where
C: ReactionsExtra<Ri, Re>,
S: SubDomainReactions<Pos, Re, Float>,
Com: Communicator<SubDomainPlainIndex, ReactionsExtraBorderReturn<<S as SubDomainReactions<Pos, Re, Float>>::NeighborValue>> + Communicator<SubDomainPlainIndex, ReactionsExtraBorderInfo<<S as SubDomainReactions<Pos, Re, Float>>::BorderInfo>>,
Available on crate feature cpu_os_threads
only.
pub fn update_reactions_extra_step_2<Pos, Ri, Re, Float>(
&mut self,
determinism: bool,
) -> Result<(), SimulationError>where
C: ReactionsExtra<Ri, Re>,
S: SubDomainReactions<Pos, Re, Float>,
Com: Communicator<SubDomainPlainIndex, ReactionsExtraBorderReturn<<S as SubDomainReactions<Pos, Re, Float>>::NeighborValue>> + Communicator<SubDomainPlainIndex, ReactionsExtraBorderInfo<<S as SubDomainReactions<Pos, Re, Float>>::BorderInfo>>,
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>where
C: ReactionsExtra<Ri, Re> + Intracellular<Ri> + Position<Pos>,
A: UpdateReactions<Ri>,
S: SubDomainReactions<Pos, Re, Float>,
Com: Communicator<SubDomainPlainIndex, ReactionsExtraBorderReturn<<S as SubDomainReactions<Pos, Re, Float>>::NeighborValue>>,
Available on crate feature cpu_os_threads
only.
pub fn update_reactions_extra_step_3<Pos, Ri, Re, Float>(
&mut self,
determinism: bool,
) -> Result<(), SimulationError>where
C: ReactionsExtra<Ri, Re> + Intracellular<Ri> + Position<Pos>,
A: UpdateReactions<Ri>,
S: SubDomainReactions<Pos, Re, Float>,
Com: Communicator<SubDomainPlainIndex, ReactionsExtraBorderReturn<<S as SubDomainReactions<Pos, Re, Float>>::NeighborValue>>,
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,
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.
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>>,
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>where
C: ReactionsContact<Ri, Pos, Float, RInf> + Position<Pos> + Intracellular<Ri>,
A: UpdateReactions<Ri> + UpdateReactionsContact<Ri, N>,
Ri: Xapy<Float>,
Float: Float,
Pos: Clone,
Com: Communicator<SubDomainPlainIndex, ReactionsContactInformation<Pos, Ri, RInf>> + Communicator<SubDomainPlainIndex, ReactionsContactReturn<Ri>>,
Available on crate feature cpu_os_threads
only.
pub fn update_contact_reactions_step_2<Ri, Pos, RInf, Float, const N: usize>(
&mut self,
determinism: bool,
) -> Result<(), SimulationError>where
C: ReactionsContact<Ri, Pos, Float, RInf> + Position<Pos> + Intracellular<Ri>,
A: UpdateReactions<Ri> + UpdateReactionsContact<Ri, N>,
Ri: Xapy<Float>,
Float: Float,
Pos: Clone,
Com: Communicator<SubDomainPlainIndex, ReactionsContactInformation<Pos, Ri, RInf>> + Communicator<SubDomainPlainIndex, ReactionsContactReturn<Ri>>,
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.
pub fn update_contact_reactions_step_3<Ri>( &mut self, determinism: bool, ) -> Result<(), SimulationError>
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>
impl<I, S, C, A, Com, Sy> RefUnwindSafe for SubDomainBox<I, S, C, A, Com, Sy>where
I: RefUnwindSafe,
S: RefUnwindSafe,
Com: RefUnwindSafe,
Sy: RefUnwindSafe,
<S as SubDomain>::VoxelIndex: RefUnwindSafe,
A: RefUnwindSafe,
C: RefUnwindSafe,
impl<I, S, C, A, Com, Sy> Send for SubDomainBox<I, S, C, A, Com, Sy>
impl<I, S, C, A, Com, Sy> Sync for SubDomainBox<I, S, C, A, Com, Sy>
impl<I, S, C, A, Com, Sy> Unpin for SubDomainBox<I, S, C, A, Com, Sy>
impl<I, S, C, A, Com, Sy> UnwindSafe for SubDomainBox<I, S, C, A, Com, Sy>where
I: UnwindSafe,
S: UnwindSafe,
Com: UnwindSafe,
Sy: UnwindSafe,
<S as SubDomain>::VoxelIndex: RefUnwindSafe,
A: RefUnwindSafe,
C: RefUnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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
impl<T> Pointable for T
§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>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.