BioCMAMC-ST
|
Manages the reading, caching, and transitioning of flowmaps for simulation timesteps. More...
#include <transitionner.hpp>
Public Member Functions | |
FlowMapTransitionner ()=default | |
FlowMapTransitionner & | operator= (FlowMapTransitionner &&)=default |
FlowMapTransitionner (FlowMapTransitionner &&)=default | |
FlowMapTransitionner & | operator= (const FlowMapTransitionner &)=delete |
FlowMapTransitionner (const FlowMapTransitionner &)=delete | |
FlowMapTransitionner (std::size_t _n_flowmap, std::size_t _n_per_flowmap, std::size_t number_time_step, std::unique_ptr< CmaRead::FlowIterator > &&_iterator, bool is_two_phase_flow) | |
virtual | ~FlowMapTransitionner ()=default |
IterationState | advance () |
Advances the simulation by one timestep. | |
IterationState | advance_worker (std::span< double > flows, std::span< double > volumeLiq, std::span< double > volumeGas, const CmaRead::Neighbors::Neighbors_const_view_t &neighbors) |
Advances the simulation by one timestep from a MPI Wroker. | |
bool | is_two_phase_flow () const noexcept |
Checks whether a gas flowmap is provided. | |
std::size_t | get_n_timestep () const noexcept |
Returns the total number of expected simulation timesteps. | |
virtual const CmaRead::ReactorState & | get_current_reactor_state () const noexcept=0 |
Provides a const reference to the current reactor state. | |
Static Public Member Functions | |
static NeighborsView< HostSpace > | get_neighbors_view (const CmaRead::Neighbors::Neighbors_const_view_t &liquid_neighbors) |
Converts the provided neighbors' data into a Kokkos view. | |
Protected Member Functions | |
bool | need_liquid_state_calculation () const noexcept |
Check if liquid state has to calculated or can be use via caching. | |
IterationState | common_advance (NeighborsView< HostSpace > host_view, std::unordered_map< std::string, std::span< const double > > &&info) |
Operation required by all methods in order to perform advance function . | |
virtual void | update_flow ()=0 |
Calculate the current state based on the selected method, may be caching or direct calculation. | |
void | update_flow_worker (std::span< double > flows, std::span< double > volumeLiq, std::span< double > volumeGas, const CmaRead::Neighbors::Neighbors_const_view_t &neighbors) |
ONLY for MPI_WORKER Calculate the current state based on the selected method, may be caching or direct calculation. | |
virtual CmaUtils::ProxyPreCalculatedHydroState & | current_liq_hydro_state ()=0 |
Get current liquid state read from CmaRead. | |
virtual CmaUtils::ProxyPreCalculatedHydroState & | current_gas_hydro_state ()=0 |
Get current gas state read from CmaRead. | |
void | calculate_full_state (const CmaRead::ReactorState &reactor_state, CmaUtils::ProxyPreCalculatedHydroState &liq_hydro_state, CmaUtils::ProxyPreCalculatedHydroState &gas_hydro_state) const |
Calculate the whole state (liquid+gas+neighbor) for the current time step. | |
size_t | getFlowIndex () const noexcept |
Return the index of the current ProxyPreCalculatedHydroState. | |
size_t | size () const noexcept |
Get the number of load flowmap. | |
const CmaRead::ReactorState & | get_unchecked (size_t index) const noexcept |
Direct read state from iterator. | |
Protected Attributes | |
std::vector< CmaUtils::ProxyPreCalculatedHydroState > | liquid_pc |
Buffer for liquid state. | |
std::vector< CmaUtils::ProxyPreCalculatedHydroState > | gas_pc |
Buffer for gas state. | |
Private Member Functions | |
void | update_counters () |
Update flow and iteration counters. | |
Private Attributes | |
bool | two_phase_flow {} |
Is two_phase_flow. | |
std::size_t | n_per_flowmap {} |
Number of iteration per flowmap. | |
std::size_t | n_flowmap {} |
Number of flowmap. | |
std::size_t | n_timestep {} |
Total number of timestep. | |
std::size_t | repetition_count {} |
How many flowmaps (different or not) have been used. | |
std::size_t | current_flowmap_count {} |
std::unique_ptr< CmaRead::FlowIterator > | iterator |
Iterator that reads flowmap. | |
Manages the reading, caching, and transitioning of flowmaps for simulation timesteps.
This class reads flowmaps from a file and converts them into simulation states used at each timestep. It handles transitions between consecutive flowmaps (from instant t to t + dt) and supports periodic looping over the same flowmaps. To optimize performance, caching ensures that flowmap-to-state conversions are not repeated.
|
default |
|
default |
|
delete |
CmaUtils::FlowMapTransitionner::FlowMapTransitionner | ( | std::size_t | _n_flowmap, |
std::size_t | _n_per_flowmap, | ||
std::size_t | number_time_step, | ||
std::unique_ptr< CmaRead::FlowIterator > && | _iterator, | ||
bool | is_two_phase_flow ) |
|
virtualdefault |
IterationState CmaUtils::FlowMapTransitionner::advance | ( | ) |
Advances the simulation by one timestep.
This method updates the current flowmap state, transitions to the next flowmap if needed, and handles periodic looping.
IterationState CmaUtils::FlowMapTransitionner::advance_worker | ( | std::span< double > | flows, |
std::span< double > | volumeLiq, | ||
std::span< double > | volumeGas, | ||
const CmaRead::Neighbors::Neighbors_const_view_t & | neighbors ) |
Advances the simulation by one timestep from a MPI Wroker.
|
protected |
Calculate the whole state (liquid+gas+neighbor) for the current time step.
|
protected |
Operation required by all methods in order to perform advance function .
|
protectedpure virtual |
Get current gas state read from CmaRead.
Implemented in CmaUtils::DiscontinuousFMT, and CmaUtils::LinterFMT.
|
protectedpure virtual |
Get current liquid state read from CmaRead.
Implemented in CmaUtils::DiscontinuousFMT, and CmaUtils::LinterFMT.
|
nodiscardpure virtualnoexcept |
Provides a const reference to the current reactor state.
This method returns the reactor state currently read from the flowmap.
Implemented in CmaUtils::DiscontinuousFMT, and CmaUtils::LinterFMT.
|
nodiscardnoexcept |
Returns the total number of expected simulation timesteps.
|
static |
Converts the provided neighbors' data into a Kokkos view.
This static method transforms neighbor information into a Kokkos view, enabling efficient access and usage during the simulation.
liquid_neighbors | Constant view of the liquid neighbors. |
|
inlinenodiscardprotectednoexcept |
Direct read state from iterator.
|
inlinenodiscardprotectednoexcept |
Return the index of the current ProxyPreCalculatedHydroState.
|
inlinenodiscardnoexcept |
Checks whether a gas flowmap is provided.
This method returns true if a gas flowmap is available, indicating a two-phase flow simulation.
|
inlinenodiscardprotectednoexcept |
Check if liquid state has to calculated or can be use via caching.
|
delete |
|
default |
|
inlinenodiscardprotectednoexcept |
Get the number of load flowmap.
|
private |
Update flow and iteration counters.
|
protectedpure virtual |
Calculate the current state based on the selected method, may be caching or direct calculation.
Implemented in CmaUtils::DiscontinuousFMT, and CmaUtils::LinterFMT.
|
protected |
ONLY for MPI_WORKER Calculate the current state based on the selected method, may be caching or direct calculation.
|
private |
How many iteration have been performed since last flowmap change (<n_per_flowmap)
|
protected |
Buffer for gas state.
|
private |
Iterator that reads flowmap.
|
protected |
Buffer for liquid state.
|
private |
Number of flowmap.
|
private |
Number of iteration per flowmap.
|
private |
Total number of timestep.
|
private |
How many flowmaps (different or not) have been used.
|
private |
Is two_phase_flow.