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>
25 constexpr std::array<int, 3>
28 return { _BIOMC_VERSION_MAJOR, _BIOMC_VERSION_MINOR, _BIOMC_VERSION_DEV };
78 static std::optional<std::unique_ptr<SimulationInstance> >
81 std::optional<std::size_t> run_id = std::nullopt)
noexcept;
162 Phase phase = Phase::Liquid);
165 double _concentration,
166 std::
size_t _species,
167 std::
size_t _position,
169 bool fed_batch = false);
172 double _concentration,
173 std::
size_t _species,
174 std::
size_t input_position,
175 std::
size_t output_position,
222 [[nodiscard]]
int get_id() const;
237 logger = std::move(_logger);
259 std::optional<std::size_t> run_id);
270 std::optional<Simulation::Feed::SimulationFeed>
feed
272 std::optional<Simulation::MassTransfer::Type::MtrTypeVariant>
mtr_type
Api This namespace contains classes and functions related to the simulation API.
Definition api.hpp:24
constexpr std::array< int, 3 > get_version()
Definition api.hpp:26
void finalise()
Definition api.cpp:66
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:14
ApiResult register_model_name(std::string_view path)
Register the model name for the simulation.
Definition api.cpp:398
SimulationInstance(SimulationInstance &&)=default
Defaulted move constructor for efficient resource transfer.
std::optional< Core::ScalarFactory::ScalarVariant > scalar_initializer_variant
Definition api.hpp:264
bool register_result_path(std::string_view path)
Register a result output path.
Definition api.cpp:344
bool registered
Flag indicating if resources are registered.
Definition api.hpp:269
const ExecInfo & get_exec_info() const
Definition api.cpp:405
ApiResult exec() noexcept
Execute the simulation.
Definition api.cpp:163
bool register_serde(std::string_view path)
Register a serialization/deserialization (serde) path.
Definition api.cpp:390
ApiResult set_feed(Simulation::Feed::FeedDescriptor feed_variant, Phase phase=Phase::Liquid)
Definition api.cpp:82
void set_logger(std::shared_ptr< IO::Logger > _logger)
Definition api.hpp:234
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:96
std::optional< Simulation::MassTransfer::Type::MtrTypeVariant > mtr_type
Definition api.hpp:273
void set_auto_mtr()
Definition api.cpp:236
SimulationInstance(const SimulationInstance &)=delete
Deleted copy constructor to prevent copying.
ApiResult register_initial_condition(Core::ScalarFactory::ScalarVariant &&type)
Definition api.cpp:382
auto & get_logger() const
Definition api.hpp:241
Core::CaseData _data
Case data for the simulation.
Definition api.hpp:265
bool auto_mtr
Definition api.hpp:275
SimulationInstance & operator=(SimulationInstance &&)=default
Defaulted move assignment operator for efficient resource transfer.
std::shared_ptr< IO::Logger > logger
Definition api.hpp:261
int get_id() const
Retrieve the simulation instance's unique identifier.
Definition api.cpp:76
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:148
ApiResult register_cma_path(std::string_view path)
Register a path for CMA data.
Definition api.cpp:360
ApiResult apply_load() noexcept
Load ad apply the simulation configuration and prepare for execution based on file.
Definition api.cpp:199
ApiResult set_mtr(Simulation::MassTransfer::Type::MtrTypeVariant &&variant)
Definition api.cpp:226
ApiResult register_parameters(Core::UserControlParameters &¶ms) noexcept
Register user control parameters for the simulation.
Definition api.cpp:335
bool applied
Flag indicating if the configuration is applied.
Definition api.hpp:268
~SimulationInstance()
Default destructor.
Definition api.cpp:141
std::optional< Simulation::Feed::SimulationFeed > feed
Optional feed configuration.
Definition api.hpp:271
SimulationInstance & operator=(const SimulationInstance &)=delete
Deleted copy assignment operator to prevent copying.
Core::UserControlParameters params
User-defined control parameters.
Definition api.hpp:266
ApiResult apply() noexcept
Apply the simulation configuration and prepare for execution.
Definition api.cpp:242
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:113
bool loaded
Flag indicating if the instance is loaded.
Definition api.hpp:267
ApiResult register_initialiser_file_path(std::string_view path)
Definition api.cpp:353
ApiResult register_scalar_initiazer(Core::ScalarFactory::ScalarVariant &&var)
Configure feed constants for the simulation.
Definition api.cpp:302
SimulationInstance()=delete
Default constructor.
Holds the data required to execute a simulation case.
Definition case_data.hpp:39
A structure to hold user-defined control parameters for simulation settings.
Definition simulation_parameters.hpp:24
Definition execinfo.hpp:12