BioCMAMC-ST
|
Represents an instance of a simulation with customizable parameters and behaviors. More...
#include <api.hpp>
Public Member Functions | |
SimulationInstance (const SimulationInstance &)=delete | |
Deleted copy constructor to prevent copying. | |
SimulationInstance (SimulationInstance &&)=default | |
Defaulted move constructor for efficient resource transfer. | |
SimulationInstance & | operator= (const SimulationInstance &)=delete |
Deleted copy assignment operator to prevent copying. | |
SimulationInstance & | operator= (SimulationInstance &&)=default |
Defaulted move assignment operator for efficient resource transfer. | |
SimulationInstance ()=delete | |
Default constructor. | |
~SimulationInstance () | |
Default destructor. | |
ApiResult | apply (bool to_load) noexcept |
Apply the simulation configuration and prepare for execution. | |
ApiResult | apply () noexcept |
Apply the simulation configuration and prepare for execution. | |
ApiResult | apply_load () noexcept |
Load ad apply the simulation configuration and prepare for execution based on file. | |
ApiResult | register_parameters (Core::UserControlParameters &¶ms) noexcept |
Register user control parameters for the simulation. | |
bool | register_result_path (std::string_view path) |
Register a result output path. | |
ApiResult | register_initial_condition (Core::ScalarFactory::ScalarVariant &&type) |
ApiResult | register_initialiser_file_path (std::string_view path) |
bool | register_cma_path (std::string_view path, bool recursive=false) |
Register a path for CMA data. | |
bool | register_serde (std::string_view path) |
Register a serialization/deserialization (serde) path. | |
ApiResult | register_model_name (std::string_view path) |
Register the model name for the simulation. | |
bool | set_feed_constant (double _flow, std::span< double > _concentration, std::span< std::size_t > _position, std::span< std::size_t > _species, bool gas=false, bool fed_batch=false) |
Configure feed constants for the simulation. | |
bool | set_feed_constant_from_rvalue (double _f, std::vector< double > &&_target, std::vector< std::size_t > &&_position, std::vector< std::size_t > &&_species, bool gas=false, bool fed_batch=false) |
ApiResult | register_scalar_initiazer (Core::ScalarFactory::ScalarVariant &&var) |
int | get_id () const |
Retrieve the simulation instance's unique identifier. | |
const ExecInfo & | get_exec_info () const |
ApiResult | exec () noexcept |
Execute the simulation. | |
Static Public Member Functions | |
static std::optional< std::unique_ptr< SimulationInstance > > | init (int argc, char **argv, std::optional< std::size_t > run_id=std::nullopt) noexcept |
Initialize a simulation instance. | |
Private Member Functions | |
SimulationInstance (int argc, char **argv, std::optional< std::size_t > run_id) | |
simulation instance constructor | |
Private Attributes | |
int | id {} |
The unique identifier to connect with c api. | |
std::optional< Core::ScalarFactory::ScalarVariant > | scalar_initializer_variant = std::nullopt |
Core::CaseData | _data |
Case data for the simulation. | |
Core::UserControlParameters | params |
User-defined control parameters. | |
bool | loaded = false |
Flag indicating if the instance is loaded. | |
bool | applied = false |
Flag indicating if the configuration is applied. | |
bool | registered = false |
Flag indicating if resources are registered. | |
std::optional< Simulation::Feed::SimulationFeed > | feed |
Optional feed configuration. | |
Represents an instance of a simulation with customizable parameters and behaviors.
The SimulationInstance class is designed to encapsulate the configuration, execution, and management of a simulation process. It supports initialization for single-threaded or multi-threaded (optionally MPI-enabled) scenarios, parameter registration, and execution control.
The class is non-copyable but movable to ensure unique ownership and efficient resource management. Note: Define this struct as struct and not class to be coherent with the C opaque type defined as typedef struct This change absolutely nothing to the code behaviour it's just a name
|
delete |
Deleted copy constructor to prevent copying.
|
default |
Defaulted move constructor for efficient resource transfer.
|
delete |
Default constructor.
Api::SimulationInstance::~SimulationInstance | ( | ) |
Default destructor.
|
private |
simulation instance constructor
argc | Number of runtime argument. |
argv | Tuntime arguments. |
id | A unique identifier for the simulation instance (optional). |
|
noexcept |
Apply the simulation configuration and prepare for execution.
|
noexcept |
Apply the simulation configuration and prepare for execution.
to_load | Flag indicating whether the configuration should be loaded. |
|
noexcept |
Load ad apply the simulation configuration and prepare for execution based on file.
|
noexcept |
Execute the simulation.
|
inlinenodiscard |
|
nodiscard |
Retrieve the simulation instance's unique identifier.
|
staticnoexcept |
Initialize a simulation instance.
argc | Number of runtime argument. |
argv | Tuntime arguments. |
id | A unique identifier for the simulation instance (optional). |
|
delete |
Deleted copy assignment operator to prevent copying.
|
default |
Defaulted move assignment operator for efficient resource transfer.
bool Api::SimulationInstance::register_cma_path | ( | std::string_view | path, |
bool | recursive = false ) |
Register a path for CMA data.
path | The file system path for CMA data. |
recursive | Flag indicating if recursive registration is required. |
ApiResult Api::SimulationInstance::register_initial_condition | ( | Core::ScalarFactory::ScalarVariant && | type | ) |
ApiResult Api::SimulationInstance::register_initialiser_file_path | ( | std::string_view | path | ) |
ApiResult Api::SimulationInstance::register_model_name | ( | std::string_view | path | ) |
Register the model name for the simulation.
path | The model name or path. |
|
noexcept |
Register user control parameters for the simulation.
params | A rvalue reference to a UserControlParameters object. |
bool Api::SimulationInstance::register_result_path | ( | std::string_view | path | ) |
Register a result output path.
path | The file system path to store simulation results. |
ApiResult Api::SimulationInstance::register_scalar_initiazer | ( | Core::ScalarFactory::ScalarVariant && | var | ) |
bool Api::SimulationInstance::register_serde | ( | std::string_view | path | ) |
Register a serialization/deserialization (serde) path.
path | The file system path for serde operations. |
bool Api::SimulationInstance::set_feed_constant | ( | double | _flow, |
std::span< double > | _concentration, | ||
std::span< std::size_t > | _position, | ||
std::span< std::size_t > | _species, | ||
bool | gas = false, | ||
bool | fed_batch = false ) |
Configure feed constants for the simulation.
_flow | A constant flow value. |
concentrations | A span of concentrations values. |
_position | A span of position indices. |
_species | A span of species indices. |
gas | Flag indicating whether the feed is gas-phase. |
bool Api::SimulationInstance::set_feed_constant_from_rvalue | ( | double | _f, |
std::vector< double > && | _target, | ||
std::vector< std::size_t > && | _position, | ||
std::vector< std::size_t > && | _species, | ||
bool | gas = false, | ||
bool | fed_batch = false ) |
|
private |
Case data for the simulation.
|
private |
Flag indicating if the configuration is applied.
|
private |
Optional feed configuration.
|
private |
The unique identifier to connect with c api.
|
private |
Flag indicating if the instance is loaded.
|
private |
User-defined control parameters.
|
private |
Flag indicating if resources are registered.
|
private |