1#ifndef __CORE_DATA_EXPORTER_HPP__
2#define __CORE_DATA_EXPORTER_HPP__
4#include "common/logger.hpp"
5#include <common/common.hpp>
6#include <common/execinfo.hpp>
7#include <core/simulation_parameters.hpp>
15#include <unordered_map>
21 template <
typename MapType>
23 get_descriptor_impl(MapType& descriptors, std::string_view name)
27 return descriptors.at(std::string(name));
29 catch (
const std::out_of_range&)
31 throw std::runtime_error(
32 IO::format(
"DataExporter: unknown matrix: ", name));
85 void do_link(std::string_view filename,
86 std::string_view link_name,
87 std::string_view groupname);
92 logger = std::move(_logger);
113 std::optional<std::vector<unsigned long long>>
121 = std::variant<uint64_t, int, std::string>;
124 = std::unordered_map<std::string,
128 = Kokkos::View<
double**,
134 std::vector<std::string>,
140 = std::unordered_map<std::string,
145 = std::variant<std::span<const double>,
146 std::span<const std::size_t>,
152 std::string_view _filename,
153 std::optional<export_metadata_t> user_description
158 std::span<const double> values,
159 bool compress =
false);
162 std::span<const double> values,
165 bool compress =
false);
172 std::span<const double> data,
173 uint64_t last_size = 0);
198 std::span<const std::size_t>
199 get_dim(std::string_view name)
const
206 std::unordered_map<std::string, MultiMatrixDescription>
m_descriptors;
208 std::unique_ptr<impl>
pimpl;
void append_matrix(std::string_view name, matrix_variant_t data)
Definition impl_default_dataexporter.cpp:41
void append_array(std::string_view name, std::span< const double > data, uint64_t last_size=0)
Definition impl_default_dataexporter.cpp:46
void do_link(std::string_view filename, std::string_view link_name, std::string_view groupname)
Creates a link to a specified file.
Definition impl_default_dataexporter.cpp:11
std::variant< uint64_t, int, std::string > export_metadata_t
Definition data_exporter.hpp:120
std::variant< std::span< const double >, std::span< const std::size_t >, double > matrix_variant_t
Variant for matrix data types.
Definition data_exporter.hpp:140
void write_simple(const export_initial_kv &values, std::string_view root)
Definition impl_default_dataexporter.cpp:68
std::shared_ptr< IO::Logger > logger
Definition data_exporter.hpp:96
auto & get_descriptor_mut(std::string_view name)
Definition data_exporter.hpp:188
void write_matrix(std::string_view name, std::span< const double > values, bool compress=false)
Definition impl_default_dataexporter.cpp:29
uint64_t export_counter
Definition data_exporter.hpp:179
std::unordered_map< std::string, MultiMatrixDescription > m_descriptors
Definition data_exporter.hpp:201
void write_properties(std::optional< std::string > specific_dataspace, const export_metadata_kv &values)
Definition impl_default_dataexporter.cpp:53
std::unordered_map< std::string, export_metadata_t > export_metadata_kv
Definition data_exporter.hpp:122
void prepare_matrix(MultiMatrixDescription description)
Definition impl_default_dataexporter.cpp:36
DataExporter(const DataExporter &)=delete
DataExporter & operator=(DataExporter &&)=delete
Kokkos::View< double **, Kokkos::LayoutRight, HostSpace > ViewParticleProperties
View for particle properties.
Definition data_exporter.hpp:125
export_metadata_kv metadata
Definition data_exporter.hpp:178
std::variant< size_t, std::string, std::vector< size_t >, std::vector< std::string >, std::vector< double >, double, uint32_t > simple_export_t
Definition data_exporter.hpp:128
std::unique_ptr< impl > pimpl
Definition data_exporter.hpp:203
std::unordered_map< std::string, simple_export_t > export_initial_kv
Definition data_exporter.hpp:136
void set_logger(std::shared_ptr< IO::Logger > _logger)
Definition data_exporter.hpp:90
DataExporter(DataExporter &&)=delete
std::span< const std::size_t > get_dim(std::string_view name) const
Definition data_exporter.hpp:194
const auto & get_descriptor(std::string_view name) const
Definition data_exporter.hpp:182
DataExporter & operator=(const DataExporter &)=delete
Core component to perform simulation.
Definition data_exporter.hpp:38
bool fill_and_check_result_file_path(const std::shared_ptr< IO::Logger > &logger, Core::UserControlParameters ¶ms)
Definition main_exporter.cpp:237
std::string format(MsgType &&... msgs)
Definition logger.hpp:160
Definition species_name_extractor.hpp:7
Describes the properties of a multi-dimensional matrix for export operations.
Definition data_exporter.hpp:109
std::vector< size_t > dims
Dataset dimensions.
Definition data_exporter.hpp:111
std::optional< std::vector< unsigned long long > > chunk_dims
Data chunk along each dimension.
Definition data_exporter.hpp:114
bool is_integer
Matrix data is integer type or floating point.
Definition data_exporter.hpp:116
std::vector< size_t > max_dims
Expected dataset max dimensions.
Definition data_exporter.hpp:112
bool compression
Matrix data has to be compressed or not.
Definition data_exporter.hpp:115
std::string name
Dataset name.
Definition data_exporter.hpp:110
A structure to hold user-defined control parameters for simulation settings.
Definition simulation_parameters.hpp:24
Definition execinfo.hpp:21