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
38 bool operator()(double current_time,
39 size_t loop_counter,
41 Core::PartialExporter& partial_exporter,
42 const CmaUtils::TransitionnerPtrType& transitioner);
43
57 void pre_post_export(double current_time,
58 const Simulation::SimulationUnit& simulation,
59 const CmaUtils::TransitionnerPtrType& transitioner);
60
61private:
62 size_t dump_counter{};
63 size_t dump_interval{};
65 [[maybe_unused]] ExecInfo exec{};
66 std::shared_ptr<Core::MainExporter> main_exporter;
67
73 static std::optional<std::span<std::size_t>>
75
77};
78
79#endif
Exporter for each MPI worker (including host) that exports data relative to particle state.
Definition partial_exporter.hpp:27
IO::ProgressBar progressbar
Definition host_export_handler.hpp:76
size_t dump_interval
Definition host_export_handler.hpp:63
ExecInfo exec
Definition host_export_handler.hpp:65
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:20
std::shared_ptr< Core::MainExporter > main_exporter
Definition host_export_handler.hpp:66
size_t n_iter_simulation
Definition host_export_handler.hpp:64
size_t dump_counter
Definition host_export_handler.hpp:62
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:134
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:204
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:55
rust::Box< TransitionerWrapper > TransitionnerPtrType
Opaque type for flowmap transitioner.
Definition alias.hpp:14
Definition execinfo.hpp:12