BioCMAMC-ST
host_export_handler.hpp
1#ifndef __CORE_HOST_EXPORT_HANDLER_HPP__
2#define __CORE_HOST_EXPORT_HANDLER_HPP__
3
4#include <cma_utils/alias.hpp>
5#include <dataexporter/main_exporter.hpp>
6#include <dataexporter/partial_exporter.hpp>
7#include <optional>
8#include <progress_bar.hpp>
9#include <simulation/simulation.hpp>
10#include <span>
11class ExportHandler final
12{
13
14public:
15 ExportHandler() = default;
16
17 ExportHandler(std::shared_ptr<Core::MainExporter> _main_exporter,
18 ExecInfo _exec,
19 std::size_t _dump_interval,
20 std::size_t _n_iter_simulation);
21
39 bool operator()(double current_time,
40 size_t loop_counter,
42 Core::PartialExporter& partial_exporter,
43 const CmaUtils::TransitionnerPtrType& transitioner);
44
58 void pre_post_export(double current_time,
59 const Simulation::SimulationUnit& simulation,
60 const CmaUtils::TransitionnerPtrType& transitioner);
61
62private:
63 size_t dump_counter{};
64 size_t dump_interval{};
66 [[maybe_unused]] ExecInfo exec{};
67 std::shared_ptr<Core::MainExporter> main_exporter;
68
74 static std::optional<std::span<std::size_t>>
76
78};
79
80#endif
Exporter for each MPI worker (including host) that exports data relative to particle state.
Definition partial_exporter.hpp:28
IO::ProgressBar progressbar
Definition host_export_handler.hpp:77
size_t dump_interval
Definition host_export_handler.hpp:64
ExecInfo exec
Definition host_export_handler.hpp:66
void pre_post_export(double current_time, const Simulation::SimulationUnit &simulation, const CmaUtils::TransitionnerPtrType &transitioner)
Prepares and updates the exporter with the current simulation state before/after main loop.
Definition host_export_handler.cpp:21
std::shared_ptr< Core::MainExporter > main_exporter
Definition host_export_handler.hpp:67
size_t n_iter_simulation
Definition host_export_handler.hpp:65
size_t dump_counter
Definition host_export_handler.hpp:63
bool operator()(double current_time, size_t loop_counter, Simulation::SimulationUnit &simulation, Core::PartialExporter &partial_exporter, const CmaUtils::TransitionnerPtrType &transitioner)
Handles periodic export of simulation data.
Definition host_export_handler.cpp:139
static std::optional< std::span< std::size_t > > prepareEventSpan(Simulation::SimulationUnit &simulation)
Prepares the event span if the event counter is enabled.
Definition host_export_handler.cpp:208
ExportHandler()=default
ExportHandler(std::shared_ptr< Core::MainExporter > _main_exporter, ExecInfo _exec, std::size_t _dump_interval, std::size_t _n_iter_simulation)
Definition progress_bar.hpp:8
Definition simulation.hpp:56
rust::Box< TransitionerWrapper > TransitionnerPtrType
Opaque type for flowmap transitioner.
Definition alias.hpp:14
Definition execinfo.hpp:12