BioCMAMC-ST
CmaUtils::FlowMapTransitionner Class Referenceabstract

Manages the reading, caching, and transitioning of flowmaps for simulation timesteps. More...

#include <transitionner.hpp>

Inheritance diagram for CmaUtils::FlowMapTransitionner:
[legend]

Public Member Functions

 FlowMapTransitionner ()=default
 
FlowMapTransitionneroperator= (FlowMapTransitionner &&)=default
 
 FlowMapTransitionner (FlowMapTransitionner &&)=default
 
FlowMapTransitionneroperator= (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::ProxyPreCalculatedHydroStatecurrent_liq_hydro_state ()=0
 Get current liquid state read from CmaRead.
 
virtual CmaUtils::ProxyPreCalculatedHydroStatecurrent_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::ProxyPreCalculatedHydroStateliquid_pc
 Buffer for liquid state.
 
std::vector< CmaUtils::ProxyPreCalculatedHydroStategas_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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FlowMapTransitionner() [1/4]

CmaUtils::FlowMapTransitionner::FlowMapTransitionner ( )
default

◆ FlowMapTransitionner() [2/4]

CmaUtils::FlowMapTransitionner::FlowMapTransitionner ( FlowMapTransitionner && )
default

◆ FlowMapTransitionner() [3/4]

CmaUtils::FlowMapTransitionner::FlowMapTransitionner ( const FlowMapTransitionner & )
delete

◆ FlowMapTransitionner() [4/4]

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 )

◆ ~FlowMapTransitionner()

virtual CmaUtils::FlowMapTransitionner::~FlowMapTransitionner ( )
virtualdefault

Member Function Documentation

◆ advance()

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.

Returns
IterationState representing the current iteration's state.
Here is the call graph for this function:

◆ advance_worker()

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.

Todo
Use template to have conditional build This method updates the current flowmap state, transitions to the next flowmap if needed, and handles periodic looping.
Returns
IterationState representing the current iteration's state.
Here is the call graph for this function:

◆ calculate_full_state()

void CmaUtils::FlowMapTransitionner::calculate_full_state ( const CmaRead::ReactorState & reactor_state,
CmaUtils::ProxyPreCalculatedHydroState & liq_hydro_state,
CmaUtils::ProxyPreCalculatedHydroState & gas_hydro_state ) const
protected

Calculate the whole state (liquid+gas+neighbor) for the current time step.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ common_advance()

IterationState CmaUtils::FlowMapTransitionner::common_advance ( NeighborsView< HostSpace > host_view,
std::unordered_map< std::string, std::span< const double > > && info )
protected

Operation required by all methods in order to perform advance function .

Here is the call graph for this function:
Here is the caller graph for this function:

◆ current_gas_hydro_state()

virtual CmaUtils::ProxyPreCalculatedHydroState & CmaUtils::FlowMapTransitionner::current_gas_hydro_state ( )
protectedpure virtual

Get current gas state read from CmaRead.

Implemented in CmaUtils::DiscontinuousFMT, and CmaUtils::LinterFMT.

Here is the caller graph for this function:

◆ current_liq_hydro_state()

virtual CmaUtils::ProxyPreCalculatedHydroState & CmaUtils::FlowMapTransitionner::current_liq_hydro_state ( )
protectedpure virtual

Get current liquid state read from CmaRead.

Implemented in CmaUtils::DiscontinuousFMT, and CmaUtils::LinterFMT.

Here is the caller graph for this function:

◆ get_current_reactor_state()

virtual const CmaRead::ReactorState & CmaUtils::FlowMapTransitionner::get_current_reactor_state ( ) const
nodiscardpure virtualnoexcept

Provides a const reference to the current reactor state.

This method returns the reactor state currently read from the flowmap.

Todo
: Consider making this method protected or moving it to MPI_WRAP.

Implemented in CmaUtils::DiscontinuousFMT, and CmaUtils::LinterFMT.

Here is the caller graph for this function:

◆ get_n_timestep()

std::size_t CmaUtils::FlowMapTransitionner::get_n_timestep ( ) const
nodiscardnoexcept

Returns the total number of expected simulation timesteps.

◆ get_neighbors_view()

NeighborsView< HostSpace > CmaUtils::FlowMapTransitionner::get_neighbors_view ( const CmaRead::Neighbors::Neighbors_const_view_t & liquid_neighbors)
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.

Parameters
liquid_neighborsConstant view of the liquid neighbors.
Returns
Kokkos view of the neighbors.
Here is the caller graph for this function:

◆ get_unchecked()

const CmaRead::ReactorState & CmaUtils::FlowMapTransitionner::get_unchecked ( size_t index) const
inlinenodiscardprotectednoexcept

Direct read state from iterator.

Here is the caller graph for this function:

◆ getFlowIndex()

size_t CmaUtils::FlowMapTransitionner::getFlowIndex ( ) const
inlinenodiscardprotectednoexcept

Return the index of the current ProxyPreCalculatedHydroState.

Here is the caller graph for this function:

◆ is_two_phase_flow()

bool CmaUtils::FlowMapTransitionner::is_two_phase_flow ( ) const
inlinenodiscardnoexcept

Checks whether a gas flowmap is provided.

This method returns true if a gas flowmap is available, indicating a two-phase flow simulation.

Here is the caller graph for this function:

◆ need_liquid_state_calculation()

bool CmaUtils::FlowMapTransitionner::need_liquid_state_calculation ( ) const
inlinenodiscardprotectednoexcept

Check if liquid state has to calculated or can be use via caching.

Here is the caller graph for this function:

◆ operator=() [1/2]

FlowMapTransitionner & CmaUtils::FlowMapTransitionner::operator= ( const FlowMapTransitionner & )
delete

◆ operator=() [2/2]

FlowMapTransitionner & CmaUtils::FlowMapTransitionner::operator= ( FlowMapTransitionner && )
default

◆ size()

size_t CmaUtils::FlowMapTransitionner::size ( ) const
inlinenodiscardprotectednoexcept

Get the number of load flowmap.

◆ update_counters()

void CmaUtils::FlowMapTransitionner::update_counters ( )
private

Update flow and iteration counters.

Here is the caller graph for this function:

◆ update_flow()

virtual void CmaUtils::FlowMapTransitionner::update_flow ( )
protectedpure virtual

Calculate the current state based on the selected method, may be caching or direct calculation.

Implemented in CmaUtils::DiscontinuousFMT, and CmaUtils::LinterFMT.

Here is the caller graph for this function:

◆ update_flow_worker()

void CmaUtils::FlowMapTransitionner::update_flow_worker ( std::span< double > flows,
std::span< double > volumeLiq,
std::span< double > volumeGas,
const CmaRead::Neighbors::Neighbors_const_view_t & neighbors )
protected

ONLY for MPI_WORKER Calculate the current state based on the selected method, may be caching or direct calculation.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ current_flowmap_count

std::size_t CmaUtils::FlowMapTransitionner::current_flowmap_count {}
private

How many iteration have been performed since last flowmap change (<n_per_flowmap)

◆ gas_pc

std::vector<CmaUtils::ProxyPreCalculatedHydroState> CmaUtils::FlowMapTransitionner::gas_pc
protected

Buffer for gas state.

◆ iterator

std::unique_ptr<CmaRead::FlowIterator> CmaUtils::FlowMapTransitionner::iterator
private

Iterator that reads flowmap.

◆ liquid_pc

std::vector<CmaUtils::ProxyPreCalculatedHydroState> CmaUtils::FlowMapTransitionner::liquid_pc
protected

Buffer for liquid state.

◆ n_flowmap

std::size_t CmaUtils::FlowMapTransitionner::n_flowmap {}
private

Number of flowmap.

◆ n_per_flowmap

std::size_t CmaUtils::FlowMapTransitionner::n_per_flowmap {}
private

Number of iteration per flowmap.

◆ n_timestep

std::size_t CmaUtils::FlowMapTransitionner::n_timestep {}
private

Total number of timestep.

◆ repetition_count

std::size_t CmaUtils::FlowMapTransitionner::repetition_count {}
private

How many flowmaps (different or not) have been used.

◆ two_phase_flow

bool CmaUtils::FlowMapTransitionner::two_phase_flow {}
private

Is two_phase_flow.


The documentation for this class was generated from the following files: