69 m_Id = H5I_INVALID_HID;
175 H5_CALL(H5Pset_chunk, (
m_Id, dims.size(), &dims[0]));
184 H5_CALL(H5Pset_dxpl_mpio, (
m_Id, H5FD_MPIO_COLLECTIVE));
188 H5_CALL(H5Pset_dxpl_mpio, (
m_Id, H5FD_MPIO_INDEPENDENT));
193 ASSERTL0(mpi_comm,
"Can't convert communicator to MPI communicator.")
195 MPI_Info info = MPI_INFO_NULL;
196 H5_CALL(H5Pset_fapl_mpio, (
m_Id, mpi_comm->GetComm(), info));
201 ASSERTL0(
false,
"Trying to use parallel HDF5 without MPI!");
205 ASSERTL0(
false,
"Trying to use parallel HDF5 without MPI!");
209 ASSERTL0(
false,
"Trying to use parallel HDF5 without MPI!");
219 (
m_Id,
name.c_str(), H5P_DEFAULT, createPL->GetId(),
233 (
m_Id,
name.c_str(), type->GetId(), space->GetId(),
234 H5P_DEFAULT, createPL->GetId(), accessPL->GetId()));
264 for (
auto it = begin(); it != end(); ++it)
266 if (it.GetName() == nm)
278 std::dynamic_pointer_cast<CanHaveGroupsDataSets>(shared_from_this());
286 std::dynamic_pointer_cast<CanHaveGroupsDataSets>(shared_from_this());
292 : m_grp(grp), m_idx(-1), m_next(idx), m_size(grp->GetNumElements())
299 return m_currentName;
307 H5_CALL(H5Literate, (m_grp->GetId(), H5_INDEX_NAME, H5_ITER_NATIVE,
315 return (m_grp == other.
m_grp && m_idx == other.
m_idx);
318 [[maybe_unused]] hid_t g_id,
const char *
name,
319 [[maybe_unused]]
const H5L_info_t *info,
void *op_data)
343 return info.num_attrs;
350 std::dynamic_pointer_cast<CanHaveAttributes>(shared_from_this());
357 std::dynamic_pointer_cast<CanHaveAttributes>(shared_from_this());
363 : m_obj(obj), m_idx(-1), m_next(idx), m_size(obj->GetNumAttr())
370 return m_currentName;
377 H5_CALL(H5Aiterate2, (m_obj->GetId(), H5_INDEX_CRT_ORDER, H5_ITER_INC,
385 return m_obj == other.
m_obj && m_idx == other.
m_idx;
389 [[maybe_unused]] hid_t g_id,
const char *
name,
390 [[maybe_unused]]
const H5A_info_t *info,
void *op_data)
414 H5_CONSTRUCT(ans->m_Id, H5Screate_simple, (1, &size,
nullptr));
428 int rank = dims.size();
434 const hsize_t *max_p =
nullptr;
435 if (max != (H5S_UNLIMITED - 1))
443 const std::vector<hsize_t> &max_dims)
446 int rank = dims.size();
458 m_Id = H5I_INVALID_HID;
463 (
m_Id, H5S_SELECT_SET, &start,
nullptr, &count,
nullptr));
468 (
m_Id, H5S_SELECT_OR, &start,
nullptr, &count,
nullptr));
471 const std::vector<hsize_t> count)
474 (
m_Id, H5S_SELECT_SET, &start[0],
nullptr, &count[0],
nullptr));
477 const std::vector<hsize_t> count)
480 (
m_Id, H5S_SELECT_OR, &start[0],
nullptr, &count[0],
nullptr));
483 const std::vector<hsize_t> &coords)
492 (
m_Id, H5S_SELECT_SET, num_elmt, &coords[0]));
503 return H5Sget_simple_extent_npoints(
m_Id);
508 int ndims = H5Sget_simple_extent_ndims(
m_Id);
509 std::vector<hsize_t> ret(ndims, 0);
510 H5Sget_simple_extent_dims(
m_Id, &ret[0],
nullptr);
525 H5_CALL(H5Tset_size, (ans->GetId(), len));
532 m_Id = H5I_INVALID_HID;
538 m_Id = H5I_INVALID_HID;
543 hid_t ans_id = H5I_INVALID_HID;
556 return std::shared_ptr<CompoundDataType>(
571 m_Id = H5I_INVALID_HID;
597 (parent,
name.c_str(), type->GetId(), space->GetId(),
598 H5P_DEFAULT, H5P_DEFAULT));
616 m_Id = H5I_INVALID_HID;
633 (filename.c_str(), mode, createPL->GetId(), accessPL->GetId()));
640 H5_CONSTRUCT(
id, H5Fopen, (filename.c_str(), mode, accessPL->GetId()));
646 if (
m_Id != H5I_INVALID_HID)
655 m_Id = H5I_INVALID_HID;
660 return root->GetNumElements();
668 if (
m_Id != H5I_INVALID_HID)
677 m_Id = H5I_INVALID_HID;
689 std::vector<std::string> ret;
693 H5Gget_objname_by_idx(
m_Id, (
size_t)i,
name, 50);
694 ret.push_back(std::string(
name));
711 m_Id = H5I_INVALID_HID;
#define ASSERTL0(condition, msg)
#define H5_CALL(func, args)
#define H5_CONSTRUCT(ans, func, args)
static AttributeSharedPtr Open(hid_t parent, const std::string &name)
DataSpaceSharedPtr GetSpace() const
static AttributeSharedPtr Create(hid_t parent, const std::string &name, DataTypeSharedPtr type, DataSpaceSharedPtr space)
bool operator==(const AttrIterator &other) const
static herr_t helper(hid_t g_id, const char *name, const H5A_info_t *info, void *op_data)
const std::string & operator*()
AttrIterator(CanHaveAttributesSharedPtr obj, hsize_t idx=0)
CanHaveAttributesSharedPtr m_obj
AttrIterator & operator++()
std::string m_currentName
AttributeSharedPtr OpenAttribute(const std::string &name)
AttrIterator attr_begin()
AttributeSharedPtr CreateAttribute(const std::string &name, DataTypeSharedPtr type, DataSpaceSharedPtr space)
LinkIterator & operator++()
static herr_t helper(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data)
std::string m_currentName
LinkIterator(CanHaveGroupsDataSetsSharedPtr grp, hsize_t idx=0)
bool operator==(const LinkIterator &other) const
CanHaveGroupsDataSetsSharedPtr m_grp
const std::string & operator*()
GroupSharedPtr OpenGroup(const std::string &name, PListSharedPtr accessPL=PList::Default()) const
DataSetSharedPtr OpenDataSet(const std::string &name, PListSharedPtr accessPL=PList::Default()) const
GroupSharedPtr CreateGroup(const std::string &name, PListSharedPtr createPL=PList::Default(), PListSharedPtr accessPL=PList::Default())
DataSetSharedPtr CreateDataSet(const std::string &name, DataTypeSharedPtr type, DataSpaceSharedPtr space, PListSharedPtr createPL=PList::Default(), PListSharedPtr accessPL=PList::Default())
bool ContainsDataSet(std::string nm)
static CompoundDataTypeSharedPtr Create(size_t sz)
DataSpaceSharedPtr GetSpace() const
void SelectRange(const hsize_t start, const hsize_t count)
void AppendRange(const hsize_t start, const hsize_t count)
static DataSpaceSharedPtr Null()
static DataSpaceSharedPtr Scalar()
std::vector< hsize_t > GetDims()
static DataSpaceSharedPtr OneD(hsize_t size)
void SetSelection(const hsize_t num_elmt, const std::vector< hsize_t > &coords)
Wrap and HDF5 data type object. Technically this can have attributes, but not really bothered.
DataTypeSharedPtr Copy() const
static DataTypeSharedPtr String(size_t len=0)
static FileSharedPtr Open(const std::string &filename, unsigned mode, PListSharedPtr accessPL=PList::Default())
static FileSharedPtr Create(const std::string &filename, unsigned mode, PListSharedPtr createPL=PList::Default(), PListSharedPtr accessPL=PList::Default())
hsize_t v_GetNumElements() override
std::vector< std::string > GetElementNames()
hsize_t v_GetNumElements() override
static PListSharedPtr ObjectCreate()
Properties for object creation.
static PListSharedPtr DatasetXfer()
Properties for raw data transfer.
static PListSharedPtr StringCreate()
Properties for character encoding when encoding strings or object names.
static PListSharedPtr FileAccess()
Properties for file access.
void SetDxMpioIndependent()
void SetMpio(CommSharedPtr comm)
void SetDxMpioCollective()
void SetDeflate(const unsigned level=1)
static PListSharedPtr FileCreate()
Properties for file creation.
static PListSharedPtr GroupAccess()
Properties for group access.
static PListSharedPtr DatasetAccess()
Properties for dataset access.
static PListSharedPtr Default()
Default options.
static PListSharedPtr FileMount()
Properties for file mounting.
static PListSharedPtr ObjectCopy()
Properties governing the object copying process.
static PListSharedPtr DatasetCreate()
Properties for dataset creation.
static PListSharedPtr GroupCreate()
Properties for group creation.
void SetChunk(const std::vector< hsize_t > &dims)
static PListSharedPtr AttributeCreate()
Properties for attribute creation.
static PListSharedPtr LinkAccess()
Properties governing link traversal when accessing objects.
static PListSharedPtr LinkCreate()
Properties governing link creation.
static PListSharedPtr DatatypeCreate()
Properties for datatype creation.
static PListSharedPtr DatatypeAccess()
Properties for datatype access.
PredefinedDataType(hid_t)
static DataTypeSharedPtr CS1()
std::shared_ptr< DataSpace > DataSpaceSharedPtr
std::shared_ptr< PList > PListSharedPtr
std::shared_ptr< File > FileSharedPtr
std::shared_ptr< DataType > DataTypeSharedPtr
std::shared_ptr< CanHaveGroupsDataSets > CanHaveGroupsDataSetsSharedPtr
std::shared_ptr< Attribute > AttributeSharedPtr
std::shared_ptr< CompoundDataType > CompoundDataTypeSharedPtr
std::shared_ptr< CanHaveAttributes > CanHaveAttributesSharedPtr
std::shared_ptr< Group > GroupSharedPtr
std::shared_ptr< DataSet > DataSetSharedPtr
std::shared_ptr< CommMpi > CommMpiSharedPtr
Pointer to a Communicator object.
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Traits class for HDF5 data types.