Commit a09c9971 authored by Doak, Peter W.'s avatar Doak, Peter W. Committed by Doak, Peter W.
Browse files

hdf5 supporting stepped reading and writing

parent 85f48664
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);

+1 −9
Original line number Diff line number Diff line
@@ -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;

+6 −2
Original line number Diff line number Diff line
@@ -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;
+8 −0
Original line number Diff line number Diff line
@@ -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_);
  }
@@ -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)...); },
+3 −7
Original line number Diff line number Diff line
@@ -609,14 +609,10 @@ void DcaData<Parameters, DT>::initializeSigma(adios2::ADIOS& adios [[maybe_unuse
    io::IOType sigma_file_io = io::extensionToIOType(filename);
    io::Reader reader(concurrency_, sigma_file_io);
    reader.open_file(filename);
    // ADIOS2 output files can contain multiple iterations of sigma data, use the last one.
    if (sigma_file_io == io::IOType::ADIOS2) {
      auto& adios2_reader = std::get<io::ADIOS2Reader<Concurrency>>(reader.getUnderlying());
      std::size_t step_count = adios2_reader.getStepCount();
    std::size_t step_count = reader.getStepCount();
      for (std::size_t i = 0; i < step_count; ++i) {
        adios2_reader.begin_step();
        adios2_reader.end_step();
      }
        reader.begin_step();
        reader.end_step();
      }
    readSigmaFile(reader);
  }
Loading