1#ifndef __CMA_UTILS_TRANSITIONNER_HPP__
2#define __CMA_UTILS_TRANSITIONNER_HPP__
4#include <cma_read/flow_iterator.hpp>
5#include <cma_read/neighbors.hpp>
6#include <cma_read/reactorstate.hpp>
7#include <cma_utils/cache_hydro_state.hpp>
8#include <cma_utils/iteration_state.hpp>
11#include <transitionner/proxy_cache.hpp>
27 class ProxyPreCalculatedHydroState;
51 std::size_t _n_per_flowmap,
52 std::size_t number_time_step,
53 std::unique_ptr<CmaRead::FlowIterator>&& _iterator,
78 std::span<double> volumeLiq,
79 std::span<double> volumeGas,
80 const CmaRead::Neighbors::Neighbors_const_view_t& neighbors);
101 [[nodiscard]] virtual const CmaRead::ReactorState&
114 const CmaRead::Neighbors::Neighbors_const_view_t& liquid_neighbors);
128 std::unordered_map<std::
string, std::span<const
double>>&& info);
141 std::span<
double> flows,
142 std::span<
double> volumeLiq,
143 std::span<
double> volumeGas,
144 const CmaRead::Neighbors::Neighbors_const_view_t& neighbors);
162 const CmaRead::ReactorState& reactor_state,
174 [[nodiscard]]
size_t size() const noexcept;
179 [[nodiscard]] const CmaRead::ReactorState&
204 std::unique_ptr<CmaRead::FlowIterator>
208 [[nodiscard]]
inline size_t
222 [[nodiscard]]
inline bool
228 [[nodiscard]]
inline bool
237 [[nodiscard]]
inline const CmaRead::ReactorState&
240 return iterator->get_unchecked(index);
bool two_phase_flow
Is two_phase_flow.
Definition transitionner.hpp:195
std::unique_ptr< CmaRead::FlowIterator > iterator
Iterator that reads flowmap.
Definition transitionner.hpp:205
std::size_t n_flowmap
Number of flowmap.
Definition transitionner.hpp:197
virtual ~FlowMapTransitionner()=default
virtual void update_flow()=0
Calculate the current state based on the selected method, may be caching or direct calculation.
bool need_liquid_state_calculation() const noexcept
Check if liquid state has to calculated or can be use via caching.
Definition transitionner.hpp:229
FlowMapTransitionner & operator=(FlowMapTransitionner &&)=default
FlowMapTransitionner()=default
virtual CmaUtils::ProxyPreCalculatedHydroState & current_liq_hydro_state()=0
Get current liquid state read from CmaRead.
std::size_t repetition_count
Definition transitionner.hpp:199
virtual CmaUtils::ProxyPreCalculatedHydroState & current_gas_hydro_state()=0
Get current gas state read from CmaRead.
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 .
Definition transitionner.cpp:162
static NeighborsView< HostSpace > get_neighbors_view(const CmaRead::Neighbors::Neighbors_const_view_t &liquid_neighbors)
Converts the provided neighbors' data into a Kokkos view.
Definition transitionner.cpp:55
FlowMapTransitionner(FlowMapTransitionner &&)=default
FlowMapTransitionner(const FlowMapTransitionner &)=delete
virtual const CmaRead::ReactorState & get_current_reactor_state() const noexcept=0
Provides a const reference to the current reactor state.
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 & operator=(const FlowMapTransitionner &)=delete
size_t getFlowIndex() const noexcept
Return the index of the current ProxyPreCalculatedHydroState.
Definition transitionner.hpp:209
std::size_t n_timestep
Total number of timestep.
Definition transitionner.hpp:198
IterationState advance()
Advances the simulation by one timestep.
Definition transitionner.cpp:132
std::vector< CmaUtils::ProxyPreCalculatedHydroState > liquid_pc
Buffer for liquid state.
Definition transitionner.hpp:185
std::size_t current_flowmap_count
Definition transitionner.hpp:202
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 direc...
Definition transitionner.cpp:78
std::vector< CmaUtils::ProxyPreCalculatedHydroState > gas_pc
Buffer for gas state.
Definition transitionner.hpp:187
bool is_two_phase_flow() const noexcept
Checks whether a gas flowmap is provided.
Definition transitionner.hpp:223
size_t size() const noexcept
Get the number of load flowmap.
Definition transitionner.hpp:217
std::size_t n_per_flowmap
Number of iteration per flowmap.
Definition transitionner.hpp:196
void update_counters()
Update flow and iteration counters.
Definition transitionner.cpp:176
const CmaRead::ReactorState & get_unchecked(size_t index) const noexcept
Direct read state from iterator.
Definition transitionner.hpp:238
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.
Definition transitionner.cpp:147
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.
Definition transitionner.cpp:105
std::size_t get_n_timestep() const noexcept
Returns the total number of expected simulation timesteps.
Definition transitionner.cpp:192
Proxy class for PreCalculatedHydroState used to fill this struct with data from an external library.
Definition proxy_cache.hpp:28
Namespace to handle algorithms and structures related to reading compartment mesh.
Definition host_specific.hpp:18
FlowmapTransitionMethod
Defines the transition methods used between flowmaps.
Definition transitionner.hpp:20
@ Discontinuous
Represents a sharp, abrupt transition.
Definition transitionner.hpp:21
@ InterpolationFO
Definition transitionner.hpp:22
Kokkos::View< std::size_t **, Kokkos::LayoutRight, Space, Kokkos::MemoryTraits< Kokkos::RandomAccess > > NeighborsView
Definition iteration_state.hpp:11
Structure to store information about the reactor state during simulation.
Definition iteration_state.hpp:25