IOSS 2.0
Loading...
Searching...
No Matches
AdiosWrapper.h
Go to the documentation of this file.
1// Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions
2// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3// NTESS, the U.S. Government retains certain rights in this software.
4//
5// See packages/seacas/LICENSE for details
6
7#pragma once
8
9#include "ioad_export.h"
10
11#include "Ioss_CodeTypes.h"
13#include <adios2.h>
14#include <string>
15
16namespace Ioad {
17
18 class IOAD_EXPORT AdiosWrapper : private adios2::ADIOS, private adios2::IO, private adios2::Engine
19 {
20 public:
21 AdiosWrapper(Ioss_MPI_Comm communicator, const std::string &filename, bool is_input,
22 unsigned long rank, const Ioss::PropertyManager &properties);
25 adios2::StepStatus BeginStep();
26 void EndStep();
27 template <typename T>
28 void DefineMetaVariable(const std::string &meta_name, const std::string &variable_name = "");
29
30 template <typename T>
31 void DefineVariable(const std::string &name, const adios2::Dims &shape = adios2::Dims(),
32 const adios2::Dims &start = adios2::Dims(),
33 const adios2::Dims &count = adios2::Dims(),
34 const bool constantDims = false);
35 template <typename T> void Put(const std::string &name, const T *value);
36
37 template <typename T> void DefineAttribute(const std::string &name, const T &value);
38
39 template <typename T> void InquireAndPut(const std::string &name, const T *value);
40 template <typename T>
41 T GetAttribute(const std::string &attribute_name, bool ignore_missing = false,
42 T default_value = T());
43
44 template <typename T> void GetSync(adios2::Variable<T> var, T *data);
45
46 template <typename T> void GetSync(std::string var_name, T *data);
47
48 template <typename T> void GetSync(adios2::Variable<T> var, T &data);
49 template <typename T> void GetSync(std::string var_name, T &data);
50
51 template <typename T>
52 void PutMetaVariable(const std::string &meta_name, T value,
53 const std::string &variable_name = "");
54 template <typename T>
55 T GetMetaVariable(const std::string &meta_name, const std::string &variable_name = "");
56 std::pair<std::string, std::string> DecodeMetaName(std::string name) const;
57 std::string EncodeMetaVariable(const std::string &meta_name,
58 const std::string &variable_name = "") const;
59
60 bool IsStreaming() const { return m_IsStreaming; };
61
62 using adios2::Engine::AllStepsBlocksInfo;
63 using adios2::IO::AvailableVariables;
64 using adios2::IO::InquireAttribute;
65 using adios2::IO::InquireVariable;
66
67 private:
68 adios2::IO IOInit(const Ioss::PropertyManager &properties, bool is_input);
69 adios2::Engine EngineInit(const std::string &filename, bool is_input);
70
71 const std::string m_MetaSeparator{"::"};
72
73 const int m_Rank;
75
78 int count_real_begin = 0;
79 };
80
81} // end of namespace Ioad
82
83#include "adios/AdiosWrapper.hpp"
int Ioss_MPI_Comm
Definition Ioss_CodeTypes.h:64
Definition AdiosWrapper.h:19
bool m_IsStreaming
Definition AdiosWrapper.h:77
T GetAttribute(const std::string &attribute_name, bool ignore_missing=false, T default_value=T())
bool IsStreaming() const
Definition AdiosWrapper.h:60
AdiosWrapper(AdiosWrapper &&wrapper)
void DefineAttribute(const std::string &name, const T &value)
T GetMetaVariable(const std::string &meta_name, const std::string &variable_name="")
void DefineVariable(const std::string &name, const adios2::Dims &shape=adios2::Dims(), const adios2::Dims &start=adios2::Dims(), const adios2::Dims &count=adios2::Dims(), const bool constantDims=false)
bool m_OpenStep
Definition AdiosWrapper.h:76
void PutMetaVariable(const std::string &meta_name, T value, const std::string &variable_name="")
void GetSync(std::string var_name, T &data)
const int m_Rank
Definition AdiosWrapper.h:73
void GetSync(adios2::Variable< T > var, T *data)
void InquireAndPut(const std::string &name, const T *value)
const Ioss_MPI_Comm m_Communicator
Definition AdiosWrapper.h:74
void GetSync(std::string var_name, T *data)
void GetSync(adios2::Variable< T > var, T &data)
void DefineMetaVariable(const std::string &meta_name, const std::string &variable_name="")
void Put(const std::string &name, const T *value)
A collection of Ioss::Property objects.
Definition Ioss_PropertyManager.h:36
A namespace for the adios database format.
Definition AdiosWrapper.C:11