Loading include/dca/io/hdf5/hdf5_reader.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,8 @@ public: std::string get_path(); std::size_t getStepCount(); template <typename arbitrary_struct_t> static void from_file(arbitrary_struct_t& arbitrary_struct, std::string file_name); Loading include/dca/io/hdf5/hdf5_writer.hpp +1 −9 Original line number Diff line number Diff line Loading @@ -123,15 +123,7 @@ public: verbose_ = verbose; } std::string makeFullName(const std::string& name) { std::string full_name = get_path() + '/'; if (in_step_) full_name += "step_" + std::to_string(step_) + "_" + name; else full_name += name; return full_name; } std::string makeFullName(const std::string& name); private: bool exists(const std::string& name) const; Loading include/dca/io/json/json_reader.hpp +6 −2 Original line number Diff line number Diff line Loading @@ -42,8 +42,12 @@ public: // the root group. bool close_group() noexcept; void begin_step(){}; void end_step(){}; std::size_t getStepCount() { return 0; } std::string get_path() { return {}; } void begin_step(){} void end_step(){} constexpr static bool is_reader = true; constexpr static bool is_writer = false; Loading include/dca/io/reader.hpp +8 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,10 @@ public: std::visit([&](auto& var) { var.close_group(); }, reader_); } std::size_t getStepCount() { return std::visit([&](auto& var) ->std::size_t { return var.getStepCount(); }, reader_); } void begin_step() { std::visit([&](auto& var) { var.begin_step(); }, reader_); } Loading @@ -114,6 +118,10 @@ public: std::visit([&](auto& var) { var.end_step(); }, reader_); } std::string get_path() { return std::visit([&](auto& var) -> std::string { return var.get_path(); }, reader_); } template <class... Args> bool execute(Args&&... args) noexcept { return std::visit([&](auto& var) -> bool { return var.execute(std::forward<Args>(args)...); }, Loading include/dca/io/writer.hpp +14 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ #include "dca/io/adios2/adios2_writer.hpp" #endif #define RETURN_IF_NOT_PARALLEL(x) if(concurrency_.id() != concurrency_.first() && !isADIOS2()) \ return x namespace dca::io { template <class Concurrency> Loading Loading @@ -89,19 +92,23 @@ public: bool isOpen() { return is_open_; } void begin_step() { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.begin_step(); }, writer_); } void end_step() { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.end_step(); }, writer_); } void open_file(const std::string& file_name, bool overwrite = true) { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.open_file(file_name, overwrite); }, writer_); is_open_ = true; } void close_file() { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.close_file(); }, writer_); is_open_ = false; } Loading @@ -109,24 +116,29 @@ public: /** For writing open_group is expected to always return true */ bool open_group(const std::string& new_path) { RETURN_IF_NOT_PARALLEL(true); return std::visit([&](auto& var) -> bool { return var.open_group(new_path); }, writer_); } void close_group() { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.close_group(); }, writer_); } void flush() { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.flush(); }, writer_); } template <class... Args> bool execute(const Args&... args) { RETURN_IF_NOT_PARALLEL(true); return std::visit([&](auto& var) ->bool { return var.execute(args...); }, writer_); } template <class... Args> void executePartial(const Args&... args) { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.executePartial(args...); }, writer_); } Loading @@ -147,10 +159,12 @@ public: } void lock() { RETURN_IF_NOT_PARALLEL(); mutex_.lock(); } void unlock() { RETURN_IF_NOT_PARALLEL(); mutex_.unlock(); } Loading Loading
include/dca/io/hdf5/hdf5_reader.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,8 @@ public: std::string get_path(); std::size_t getStepCount(); template <typename arbitrary_struct_t> static void from_file(arbitrary_struct_t& arbitrary_struct, std::string file_name); Loading
include/dca/io/hdf5/hdf5_writer.hpp +1 −9 Original line number Diff line number Diff line Loading @@ -123,15 +123,7 @@ public: verbose_ = verbose; } std::string makeFullName(const std::string& name) { std::string full_name = get_path() + '/'; if (in_step_) full_name += "step_" + std::to_string(step_) + "_" + name; else full_name += name; return full_name; } std::string makeFullName(const std::string& name); private: bool exists(const std::string& name) const; Loading
include/dca/io/json/json_reader.hpp +6 −2 Original line number Diff line number Diff line Loading @@ -42,8 +42,12 @@ public: // the root group. bool close_group() noexcept; void begin_step(){}; void end_step(){}; std::size_t getStepCount() { return 0; } std::string get_path() { return {}; } void begin_step(){} void end_step(){} constexpr static bool is_reader = true; constexpr static bool is_writer = false; Loading
include/dca/io/reader.hpp +8 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,10 @@ public: std::visit([&](auto& var) { var.close_group(); }, reader_); } std::size_t getStepCount() { return std::visit([&](auto& var) ->std::size_t { return var.getStepCount(); }, reader_); } void begin_step() { std::visit([&](auto& var) { var.begin_step(); }, reader_); } Loading @@ -114,6 +118,10 @@ public: std::visit([&](auto& var) { var.end_step(); }, reader_); } std::string get_path() { return std::visit([&](auto& var) -> std::string { return var.get_path(); }, reader_); } template <class... Args> bool execute(Args&&... args) noexcept { return std::visit([&](auto& var) -> bool { return var.execute(std::forward<Args>(args)...); }, Loading
include/dca/io/writer.hpp +14 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ #include "dca/io/adios2/adios2_writer.hpp" #endif #define RETURN_IF_NOT_PARALLEL(x) if(concurrency_.id() != concurrency_.first() && !isADIOS2()) \ return x namespace dca::io { template <class Concurrency> Loading Loading @@ -89,19 +92,23 @@ public: bool isOpen() { return is_open_; } void begin_step() { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.begin_step(); }, writer_); } void end_step() { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.end_step(); }, writer_); } void open_file(const std::string& file_name, bool overwrite = true) { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.open_file(file_name, overwrite); }, writer_); is_open_ = true; } void close_file() { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.close_file(); }, writer_); is_open_ = false; } Loading @@ -109,24 +116,29 @@ public: /** For writing open_group is expected to always return true */ bool open_group(const std::string& new_path) { RETURN_IF_NOT_PARALLEL(true); return std::visit([&](auto& var) -> bool { return var.open_group(new_path); }, writer_); } void close_group() { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.close_group(); }, writer_); } void flush() { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.flush(); }, writer_); } template <class... Args> bool execute(const Args&... args) { RETURN_IF_NOT_PARALLEL(true); return std::visit([&](auto& var) ->bool { return var.execute(args...); }, writer_); } template <class... Args> void executePartial(const Args&... args) { RETURN_IF_NOT_PARALLEL(); std::visit([&](auto& var) { var.executePartial(args...); }, writer_); } Loading @@ -147,10 +159,12 @@ public: } void lock() { RETURN_IF_NOT_PARALLEL(); mutex_.lock(); } void unlock() { RETURN_IF_NOT_PARALLEL(); mutex_.unlock(); } Loading