BioCMAMC-ST
transitionner.hpp
1// #ifndef __CLI_FLOWMAP_TRANSITIONNER_HPP__
2// #define __CLI_FLOWMAP_TRANSITIONNER_HPP__
3
4// #include <cma_read/flow_iterator.hpp>
5// #include <cma_read/reactorstate.hpp>
6// #include <cstddef>
7// #include <memory>
8
9// namespace CmaUtils
10// {
11// class PreCalculatedHydroState;
12
13// } // namespace CmaUtils
14
15// // Foward declaration
16// namespace Simulation
17// {
18// class SimulationUnit;
19// struct TransitionState;
20
21// } // namespace Simulation
22
23// namespace Simulation
24// {
25
26// class FlowMapTransitioner
27// {
28// public:
29// enum FlowmapTransitionMethod
30// {
31// Discontinuous,
32// InterpolationFO,
33// };
34
35// FlowMapTransitioner(size_t n_flowmap,
36// size_t _n_per_flowmap,
37// FlowmapTransitionMethod method,
38// size_t number_time_step,
39// std::unique_ptr<CmaRead::FlowIterator>&& iterator = nullptr,
40// bool is_two_phase_flow = false);
41
42// FlowMapTransitioner(const FlowMapTransitioner&) = delete;
43// FlowMapTransitioner(FlowMapTransitioner&&) = delete;
44// FlowMapTransitioner& operator=(const FlowMapTransitioner&) = delete;
45// FlowMapTransitioner& operator=(FlowMapTransitioner&&) = delete;
46
47// ~FlowMapTransitioner();
48
49// void update_flow(Simulation::SimulationUnit& unit);
50// void advance(Simulation::SimulationUnit& unit);
51
52// void update_flow(std::span<double> flows,
53// size_t n_compartment,
54// const CmaRead::Neighbors::Neighbors_const_view_t& neighbors);
55
56// [[nodiscard]] size_t get_n_timestep() const;
57
58// [[nodiscard]] size_t getFlowIndex() const;
59
60// // TODO REMOVE THOSE
61// [[nodiscard]] size_t size() const;
62
63// CmaRead::ReactorState& get_current_unchecked_mut();
64
65// [[nodiscard]] const CmaRead::ReactorState& get_current_unchecked() const;
66
67// CmaRead::ReactorState& get_unchecked_mut(size_t index);
68// [[nodiscard]] const CmaRead::ReactorState& get_unchecked(size_t index) const;
69
70// [[nodiscard]] const CmaRead::ReactorState* getState() const;
71
72// private:
73// void discontinuous_transition();
74// void linear_interpolation_transition();
75
76// void calculate_full_state(const CmaRead::ReactorState& reactor_state,
77// const Simulation::SimulationUnit& unit,
78// CmaUtils::PreCalculatedHydroState* liq_hydro_state,
79// CmaUtils::PreCalculatedHydroState* gas_hydro_state);
80
81// void calculate_liquid_state(const CmaRead::FlowMap::FlowMap_const_view_t& mat_f_liq_view,
82// const CmaRead::Neighbors::Neighbors_const_view_t& neighbors,
83// CmaUtils::PreCalculatedHydroState* liq_hydro_state);
84
85// void (FlowMapTransitioner::*f_update)(Simulation::SimulationUnit& unit);
86
87// void update_flow_interpolation(Simulation::SimulationUnit& unit);
88
89// void update_flow_discontinous(Simulation::SimulationUnit& unit);
90
91// bool two_phase_flow;
92// std::unique_ptr<CmaRead::FlowIterator> iterator = nullptr;
93// size_t n_per_flowmap;
94// size_t n_flowmap;
95// size_t n_timestep;
96// CmaRead::ReactorState interpolated_reactor_state;
97
98// size_t current_flowmap_count;
99// size_t repetition_count;
100
101// std::vector<CmaUtils::PreCalculatedHydroState> liquid_pc;
102// std::vector<CmaUtils::PreCalculatedHydroState> gas_pc;
103
104// CmaUtils::PreCalculatedHydroState* current_liq_hydro_state = nullptr;
105// CmaUtils::PreCalculatedHydroState* current_gas_hydro_state = nullptr;
106// TransitionState* interpolated_state;
107
108// const CmaRead::ReactorState* current_state = nullptr;
109// size_t current_index;
110// };
111
112// inline const CmaRead::ReactorState* FlowMapTransitioner::getState() const
113// {
114// return current_state;
115// }
116
117// inline CmaRead::ReactorState& FlowMapTransitioner::get_unchecked_mut(size_t index)
118// {
119// return iterator->get_unchcked_mut(index);
120// }
121// [[nodiscard]] inline const CmaRead::ReactorState&
122// FlowMapTransitioner::get_unchecked(size_t index) const
123// {
124// return iterator->get_unchecked(index);
125// };
126
127// [[nodiscard]] inline const CmaRead::ReactorState&
128// FlowMapTransitioner::get_current_unchecked() const
129// {
130// return iterator->get_unchecked(getFlowIndex());
131// };
132
133// inline CmaRead::ReactorState& FlowMapTransitioner::get_current_unchecked_mut()
134// {
135// return iterator->get_unchcked_mut(getFlowIndex());
136// }
137
138// [[nodiscard]] inline size_t FlowMapTransitioner::get_n_timestep() const
139// {
140// return this->n_timestep;
141// };
142
143// [[nodiscard]] inline size_t FlowMapTransitioner::getFlowIndex() const
144// {
145// return this->repetition_count % this->n_flowmap;
146// }
147
148// [[nodiscard]] inline size_t FlowMapTransitioner::size() const
149// {
150// return iterator->size();
151// }
152
153// } // namespace Simulation
154
155// #endif //__CLI_FLOWMAP_TRANSITIONNER_HPP__