WARPXM v1.10.0
Loading...
Searching...
No Matches
wxhdf5iotmpl.h
Go to the documentation of this file.
1#ifndef wxhdf5iotmpl_h
2#define wxhdf5iotmpl_h
3
4// WarpX lib includes
5#include "wxiotmpl.h"
6
7// HDF5 includes
8#include <hdf5.h>
9
10// std includes
11#include <vector>
12
13// forward declarations
14class WxRange;
15
24{
25
34 {
35 if (parent)
36 parent->children.push_back(this);
37 }
38
41
47 void setNodeType(unsigned type)
48 {
49 nodeType = type;
50 }
51
59 {
60 return node == static_cast<const WxHdf5NodeTypev&>(v).node;
61 }
62
64 hid_t node;
68 std::vector<WxHdf5NodeTypev*> children;
71};
72
77class WxHdf5IoTmpl : public WxIoTmpl
78{
79
80public:
85
89 virtual ~WxHdf5IoTmpl();
90
107 virtual WxIoNodeType
109 const std::string& dataName,
110 const std::vector<std::pair<int, int>>& fileSpaceCorners,
111 const std::vector<std::pair<int, int>>& memorySpaceCorners,
112 const std::vector<std::pair<int, int>>& writeSelectionCorners,
113 const WmConstOpaquePtr& data) const;
114
127 virtual void writeToDataSet(WxIoNodeType node,
128 const WxRange& memoryRange,
129 const WxRange& memorySubRange,
130 const WxRange& fileRange,
131 const WxRange& fileSubRange,
132 const WmConstOpaquePtr& data) const;
133
148 virtual WxIoNodeType
150 const std::string& dataName,
151 const std::vector<std::pair<int, int>>& memorySpaceCorners,
152 const std::vector<std::pair<int, int>>& readSelectionCorners,
153 WmOpaquePtr& data) const;
154
167 virtual void readFromDataSet(WxIoNodeType node,
168 const WxRange& memoryRange,
169 const WxRange& memorySubRange,
170 const WxRange& fileRange,
171 const WxRange& fileSubRange,
172 WmOpaquePtr& data) const;
173
187 const std::string& dataSetName,
188 WxRange& dataShape) const;
189
198 virtual void writeAttribute(WxIoNodeType node,
199 const std::string& attribName,
200 const WmConstOpaquePtr& attrib) const;
201
212 const std::string& attribName,
213 const WmConstOpaquePtr& attrib,
214 int count) const;
215
225 virtual void readAttribute(WxIoNodeType node,
226 const std::string& attribName,
227 WmOpaquePtr& attrib) const;
228
242 const std::string& attribName,
243 WmOpaquePtr& attribStorage,
244 int count) const;
245
249 static const int max_dims = 8;
250
251private:
254
256 WxHdf5IoTmpl& operator=(const WxHdf5IoTmpl&);
257};
258
260#endif // wxhdf5iotmpl_h
Opaque Pointer object that carries the referenced data type, but does not expose this payload type as...
Definition: wmopaqueptr.h:81
Opaque Pointer object that carries the referenced data type, but does not expose this payload type as...
Definition: wmopaqueptr.h:24
WxHdf5IoTmpl does the reading and writing to HDF5 files for a given data type.
Definition: wxhdf5iotmpl.h:78
virtual WxIoNodeType readDataSet(WxIoNodeType node, const std::string &dataName, const std::vector< std::pair< int, int > > &memorySpaceCorners, const std::vector< std::pair< int, int > > &readSelectionCorners, WmOpaquePtr &data) const
Read a data set under a node.
virtual WxIoNodeType writeDataSet(WxIoNodeType node, const std::string &dataName, const std::vector< std::pair< int, int > > &fileSpaceCorners, const std::vector< std::pair< int, int > > &memorySpaceCorners, const std::vector< std::pair< int, int > > &writeSelectionCorners, const WmConstOpaquePtr &data) const
Write a new data set under a node.
WxHdf5IoTmpl()
Constructor.
virtual void writeToDataSet(WxIoNodeType node, const WxRange &memoryRange, const WxRange &memorySubRange, const WxRange &fileRange, const WxRange &fileSubRange, const WmConstOpaquePtr &data) const
Write to an open dataset (independent)
virtual int readVecAttribute(WxIoNodeType node, const std::string &attribName, WmOpaquePtr &attribStorage, int count) const
Read a vector attribute.
virtual WxIoNodeType getDataShape(WxIoNodeType node, const std::string &dataSetName, WxRange &dataShape) const
Obtain simple data shape for a data set under a node.
virtual void readAttribute(WxIoNodeType node, const std::string &attribName, WmOpaquePtr &attrib) const
Read an attribute.
static const int max_dims
Max rank dataset that needs to be represented.
Definition: wxhdf5iotmpl.h:249
virtual ~WxHdf5IoTmpl()
Virtual destructor.
virtual void readFromDataSet(WxIoNodeType node, const WxRange &memoryRange, const WxRange &memorySubRange, const WxRange &fileRange, const WxRange &fileSubRange, WmOpaquePtr &data) const
Read from an open dataset (independent)
virtual void writeVecAttribute(WxIoNodeType node, const std::string &attribName, const WmConstOpaquePtr &attrib, int count) const
Write a vector attribute.
virtual void writeAttribute(WxIoNodeType node, const std::string &attribName, const WmConstOpaquePtr &attrib) const
Write an attribute.
WxIoTmpl is the base class for access to a hierarchical file system with groups, data sets,...
Definition: wxiotmpl.h:57
WxRange represents a hyper-rectangular domain of an n-dimensional space of integers.
Definition: wxrange.h:23
HDF5 specific i/o node wrapper.
Definition: wxhdf5iotmpl.h:24
std::vector< WxHdf5NodeTypev * > children
This node's list of children.
Definition: wxhdf5iotmpl.h:68
int nodeType
This node's type.
Definition: wxhdf5iotmpl.h:70
WxHdf5NodeTypev * parent
This node's parent node.
Definition: wxhdf5iotmpl.h:66
bool operator==(const WxIoNodeTypev &v)
Comparison operator.
Definition: wxhdf5iotmpl.h:58
void setNodeType(unsigned type)
Sets the type of this node.
Definition: wxhdf5iotmpl.h:47
virtual ~WxHdf5NodeTypev()
Destructor.
WxHdf5NodeTypev(hid_t node=0, WxHdf5NodeTypev *parent=0)
The constructor.
Definition: wxhdf5iotmpl.h:32
hid_t node
This node's node number.
Definition: wxhdf5iotmpl.h:64
Provides a means for derived messengers to return implimentation specific message status flags and da...
Definition: wxiotmpl.h:23