BioCMAMC-ST
scalar_factory.hpp
1#ifndef __CORE_SCALAR_FACTORY_HPP__
2#define __CORE_SCALAR_FACTORY_HPP__
3
4#include <cstddef>
5#include <optional>
6#include <simulation/scalar_initializer.hpp>
7#include <span>
8#include <string_view>
9#include <variant>
10#include <vector>
11
21{
26 struct Uniform
27 {
31 std::vector<double> liquid_concentrations;
32
37 std::optional<std::vector<double>> gas_concentration = std::nullopt;
38 };
39
44 struct Local
45 {
49 std::vector<double> liquid_concentrations;
50
55 std::vector<size_t> liquid_indices;
56
61 std::optional<std::vector<double>> gas_concentration = std::nullopt;
62
67 std::optional<std::vector<size_t>> gas_indices = std::nullopt;
68 };
69
74 struct File
75 {
80
84 std::string_view path;
85 };
86
92 {
96 std::string_view path;
97 };
98
103 struct FullCase
104 {
108 std::size_t n_species;
109 std::vector<double> raw_liquid;
110 std::optional<std::vector<double>> raw_gas;
111 };
112
113 // /**
114 // * @struct CustomFunctor
115 // * @brief Represents scalar data initialized through a custom functor.
116 // */
117 // struct CustomFunctor
118 // {
119 // /**
120 // * @brief Path to the custom script used for initializing scalar data.
121 // */
122 // size_t n_compartment;
123 // size_t n_species;
124 // Simulation::init_scalar_f_t liquid;
125 // std::optional<Simulation::init_scalar_f_t> gas;
126 // };
127
133 std::variant<Uniform, Local, File, CustomScript, FullCase>;
134
140 struct Visitor
141 {
142
144
146
148
152 // Simulation::ScalarInitializer operator()(CustomFunctor func);
153 };
154
172 std::span<double> gas_volume,
173 std::span<double> liquid_volume,
174 ScalarVariant arg_liq);
175
177} // namespace Core::ScalarFactory
178
179#endif
Provides structures and functions to initialize scalar data for simulations, supporting multiple data...
Definition scalar_factory.hpp:21
bool sanitize(const Simulation::ScalarInitializer &res)
Definition scalar_factory.cpp:269
Simulation::ScalarInitializer scalar_factory(bool f_init_gas_flow, std::span< double > gas_volume, std::span< double > liquid_volume, ScalarVariant arg_liq)
Factory function to initialize scalar data based on the specified input source.
Definition scalar_factory.cpp:32
std::variant< Uniform, Local, File, CustomScript, FullCase > ScalarVariant
Path to the custom script used for initializing scalar data.
Definition scalar_factory.hpp:132
Represents scalar data initialized through a custom script.
Definition scalar_factory.hpp:92
std::string_view path
Path to the custom script used for initializing scalar data.
Definition scalar_factory.hpp:96
Represents scalar data sourced from an external file.
Definition scalar_factory.hpp:75
std::string_view path
Path to the file containing scalar data for compartments.
Definition scalar_factory.hpp:84
size_t n_compartment
Number of compartments represented in the file.
Definition scalar_factory.hpp:79
Represents scalar data everywhere.
Definition scalar_factory.hpp:104
std::vector< double > raw_liquid
Definition scalar_factory.hpp:109
std::optional< std::vector< double > > raw_gas
Definition scalar_factory.hpp:110
std::size_t n_species
Liquid concentration (size n*m)
Definition scalar_factory.hpp:108
Represents localized concentration data for specific compartments.
Definition scalar_factory.hpp:45
std::optional< std::vector< size_t > > gas_indices
Optional vector of indices corresponding to compartments with specified gas concentrations.
Definition scalar_factory.hpp:67
std::optional< std::vector< double > > gas_concentration
Optional vector of gas phase concentrations, applied to specific compartments if provided.
Definition scalar_factory.hpp:61
std::vector< size_t > liquid_indices
Vector of indices corresponding to compartments with specified liquid concentrations.
Definition scalar_factory.hpp:55
std::vector< double > liquid_concentrations
Vector of liquid phase concentrations for specified compartments.
Definition scalar_factory.hpp:49
Represents uniform concentration data for all compartments.
Definition scalar_factory.hpp:27
std::vector< double > liquid_concentrations
Vector of liquid phase concentrations for all compartments.
Definition scalar_factory.hpp:31
std::optional< std::vector< double > > gas_concentration
Optional vector of gas phase concentrations, applied uniformly if provided.
Definition scalar_factory.hpp:37
Functor struct to visit each type in ScalarVariant and initialize scalar data.
Definition scalar_factory.hpp:141
Simulation::ScalarInitializer operator()(Uniform args) const
Definition scalar_factory.cpp:62
bool init_gas
Definition scalar_factory.hpp:151
Definition scalar_initializer.hpp:28