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§
Source§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,
Sourcepub fn sync(&mut self) -> Result<(), SimulationError>where
Sy: SyncSubDomains,
pub fn sync(&mut self) -> Result<(), SimulationError>where
Sy: SyncSubDomains,
Allows to sync between threads. In the most simplest case of BarrierSync syncing is done by a global barrier.
Sourcepub fn store_error(
&mut self,
maybe_error: Result<(), SimulationError>,
) -> Result<bool, SimulationError>where
Sy: SyncSubDomains,
pub fn store_error(
&mut self,
maybe_error: Result<(), SimulationError>,
) -> Result<bool, SimulationError>where
Sy: SyncSubDomains,
Stores an error which has occurred and notifies other running threads to wind down.
Sourcepub 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>,
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>,
Allows insertion of cells into the subdomain.
Sourcepub fn run_local_cell_funcs<Func, F>(
&mut self,
func: Func,
next_time_point: &NextTimePoint<F>,
) -> Result<(), SimulationError>
pub fn run_local_cell_funcs<Func, F>( &mut self, func: Func, next_time_point: &NextTimePoint<F>, ) -> Result<(), SimulationError>
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
Sourcepub fn run_local_subdomain_funcs<Func, F>(
&mut self,
func: Func,
next_time_point: &NextTimePoint<F>,
) -> Result<(), SimulationError>
pub fn run_local_subdomain_funcs<Func, F>( &mut self, func: Func, next_time_point: &NextTimePoint<F>, ) -> Result<(), SimulationError>
TODO
Sourcepub fn save_subdomains<F: Debug>(
&self,
storage_manager: &mut StorageManager<SubDomainPlainIndex, S>,
next_time_point: &NextTimePoint<F>,
) -> Result<(), StorageError>
pub fn save_subdomains<F: Debug>( &self, storage_manager: &mut StorageManager<SubDomainPlainIndex, S>, next_time_point: &NextTimePoint<F>, ) -> Result<(), StorageError>
Save all subdomains with the given storage manager.
Sourcepub fn save_cells<F: Debug>(
&self,
storage_manager: &mut StorageManager<CellIdentifier, (CellBox<C>, A)>,
next_time_point: &NextTimePoint<F>,
) -> Result<(), StorageError>
pub fn save_cells<F: Debug>( &self, storage_manager: &mut StorageManager<CellIdentifier, (CellBox<C>, A)>, next_time_point: &NextTimePoint<F>, ) -> Result<(), StorageError>
Stores all cells of the subdomain via the given storage_manager
Source§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,
Sourcepub fn update_cell_cycle_4<F: Debug, Func>(
&mut self,
default_from: &Func,
) -> Result<(), SimulationError>
pub fn update_cell_cycle_4<F: Debug, Func>( &mut self, default_from: &Func, ) -> Result<(), SimulationError>
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.
Source§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,
Sourcepub 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>>,
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>>,
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.
Sourcepub 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>,
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>,
Calculates the custom force of the domain on the cells.
Sourcepub 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>>,
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>>,
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.
Sourcepub 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>>,
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>>,
Receive all calculated forces and include them for later update steps.
Sourcepub fn apply_boundary<Pos, Vel>(&mut self) -> Result<(), BoundaryError>
pub fn apply_boundary<Pos, Vel>(&mut self) -> Result<(), BoundaryError>
Applies boundary conditions to cells. For the future, we hope to be using previous and current position of cells rather than the cell itself.
Sourcepub 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,
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,
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.
Sourcepub 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>,
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>,
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.
Source§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,
Sourcepub 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>>,
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>>,
Send ReactionsExtraBorderInfo to neighboring subdomains
Sourcepub 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>>,
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>>,
Receive ReactionsExtraBorderInfo of neighboring subdomains and return ReactionsExtraBorderReturn
Sourcepub 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>>,
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>>,
Receive ReactionsExtraBorderReturn and update values.
Source§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,
Sourcepub 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>>,
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>>,
Send ReactionsContactInformation to neighboring subdomains.
Sourcepub 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>>,
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>>,
Receive ReactionsContactInformation, perform calculations of increments of ReactionsContact and return ReactionsContactReturn
Sourcepub fn update_contact_reactions_step_3<Ri>(
&mut self,
determinism: bool,
) -> Result<(), SimulationError>
pub fn update_contact_reactions_step_3<Ri>( &mut self, determinism: bool, ) -> Result<(), SimulationError>
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