1#ifndef __BIOMC_API_HPP__
2#define __BIOMC_API_HPP__
4#include "common/logger.hpp"
5#include <api/results.hpp>
6#include <common/execinfo.hpp>
7#include <core/case_data.hpp>
8#include <core/scalar_factory.hpp>
9#include <core/simulation_parameters.hpp>
13#include <simulation/feed_descriptor.hpp>
14#include <simulation/mass_transfer.hpp>
74 static std::optional<std::unique_ptr<SimulationInstance>>
77 std::optional<std::size_t> run_id = std::nullopt)
noexcept;
158 Phase phase = Phase::Liquid);
161 double _concentration,
162 std::
size_t _species,
163 std::
size_t _position,
165 bool fed_batch = false);
168 double _concentration,
169 std::
size_t _species,
170 std::
size_t input_position,
171 std::
size_t output_position,
214 [[nodiscard]]
int get_id() const;
228 logger = std::move(_logger);
249 std::optional<std::size_t> run_id);
253 std::optional<Core::ScalarFactory::ScalarVariant>
260 std::optional<Simulation::Feed::SimulationFeed>
feed =
262 std::optional<Simulation::MassTransfer::Type::MtrTypeVariant>
mtr_type =
Api This namespace contains classes and functions related to the simulation API.
Definition api.hpp:24
void finalise()
Definition api.cpp:66
std::array< int, 3 > get_version()
Definition api.cpp:61
Core component to perform simulation.
Definition data_exporter.hpp:19
Definition impl_post_process.hpp:11
Namespace that contains classes and structures related to simulation handling.
Definition host_specific.hpp:13
ApiResult register_model_name(std::string_view path)
Register the model name for the simulation.
Definition api.cpp:339
SimulationInstance(SimulationInstance &&)=default
Defaulted move constructor for efficient resource transfer.
std::optional< Core::ScalarFactory::ScalarVariant > scalar_initializer_variant
Definition api.hpp:254
bool register_result_path(std::string_view path)
Register a result output path.
Definition api.cpp:287
bool registered
Flag indicating if resources are registered.
Definition api.hpp:259
const ExecInfo & get_exec_info() const
Definition api.cpp:345
ApiResult exec() noexcept
Execute the simulation.
Definition api.cpp:157
bool register_serde(std::string_view path)
Register a serialization/deserialization (serde) path.
Definition api.cpp:332
ApiResult set_feed(Simulation::Feed::FeedDescriptor feed_variant, Phase phase=Phase::Liquid)
Definition api.cpp:85
void set_logger(std::shared_ptr< IO::Logger > _logger)
Definition api.hpp:225
ApiResult set_feed_constant(double _flow, double _concentration, std::size_t _species, std::size_t _position, bool gas=false, bool fed_batch=false)
Definition api.cpp:98
bool register_cma_path(std::string_view path, bool recursive=false)
Register a path for CMA data.
Definition api.cpp:302
std::optional< Simulation::MassTransfer::Type::MtrTypeVariant > mtr_type
Definition api.hpp:262
SimulationInstance(const SimulationInstance &)=delete
Deleted copy constructor to prevent copying.
ApiResult register_initial_condition(Core::ScalarFactory::ScalarVariant &&type)
Definition api.cpp:325
auto & get_logger() const
Definition api.hpp:231
Core::CaseData _data
Case data for the simulation.
Definition api.hpp:255
SimulationInstance & operator=(SimulationInstance &&)=default
Defaulted move assignment operator for efficient resource transfer.
std::shared_ptr< IO::Logger > logger
Definition api.hpp:251
int get_id() const
Retrieve the simulation instance's unique identifier.
Definition api.cpp:74
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.
Definition api.cpp:144
ApiResult apply_load() noexcept
Load ad apply the simulation configuration and prepare for execution based on file.
Definition api.cpp:186
ApiResult register_parameters(Core::UserControlParameters &¶ms) noexcept
Register user control parameters for the simulation.
Definition api.cpp:279
bool applied
Flag indicating if the configuration is applied.
Definition api.hpp:258
~SimulationInstance()
Default destructor.
Definition api.cpp:138
std::optional< Simulation::Feed::SimulationFeed > feed
Optional feed configuration.
Definition api.hpp:260
SimulationInstance & operator=(const SimulationInstance &)=delete
Deleted copy assignment operator to prevent copying.
Core::UserControlParameters params
User-defined control parameters.
Definition api.hpp:256
ApiResult apply() noexcept
Apply the simulation configuration and prepare for execution.
Definition api.cpp:209
ApiResult set_feed_constant_different_output(double _flow, double _concentration, std::size_t _species, std::size_t input_position, std::size_t output_position, bool gas=false)
Definition api.cpp:114
bool loaded
Flag indicating if the instance is loaded.
Definition api.hpp:257
ApiResult register_initialiser_file_path(std::string_view path)
Definition api.cpp:296
ApiResult register_scalar_initiazer(Core::ScalarFactory::ScalarVariant &&var)
Configure feed constants for the simulation.
Definition api.cpp:262
SimulationInstance()=delete
Default constructor.
Holds the data required to execute a simulation case.
Definition case_data.hpp:38
A structure to hold user-defined control parameters for simulation settings.
Definition simulation_parameters.hpp:24
Definition execinfo.hpp:12