37 #include <boost/make_shared.hpp>
45 namespace LibUtilities
74 m_Id = H5I_INVALID_HID;
180 H5_CALL(H5Pset_chunk, (
m_Id, dims.size(), &dims[0]));
186 #ifdef NEKTAR_USE_MPI
189 H5_CALL(H5Pset_dxpl_mpio, (
m_Id, H5FD_MPIO_COLLECTIVE));
193 H5_CALL(H5Pset_dxpl_mpio, (
m_Id, H5FD_MPIO_INDEPENDENT));
198 ASSERTL0(mpi_comm,
"Can't convert communicator to MPI communicator.")
200 MPI_Info info = MPI_INFO_NULL;
201 H5_CALL(H5Pset_fapl_mpio, (
m_Id, mpi_comm->GetComm(), info));
206 ASSERTL0(
false,
"Trying to use parallel HDF5 without MPI!");
210 ASSERTL0(
false,
"Trying to use parallel HDF5 without MPI!");
214 ASSERTL0(
false,
"Trying to use parallel HDF5 without MPI!");
223 H5_CONSTRUCT(grp, H5Gcreate2, (m_Id, name.c_str(), H5P_DEFAULT,
224 createPL->GetId(), accessPL->GetId()));
237 (m_Id, name.c_str(), type->GetId(), space->GetId(),
238 H5P_DEFAULT, createPL->GetId(), accessPL->GetId()));
250 H5_CONSTRUCT(grp, H5Gopen2, (m_Id, name.c_str(), accessPL->GetId()));
261 H5_CONSTRUCT(ds, H5Dopen2, (m_Id, name.c_str(), accessPL->GetId()));
284 : m_grp(grp), m_idx(-1), m_next(idx), m_size(grp->GetNumElements())
291 return m_currentName;
299 H5_CALL(H5Literate, (m_grp->GetId(), H5_INDEX_NAME, H5_ITER_NATIVE,
307 return (m_grp == other.
m_grp && m_idx == other.
m_idx);
310 const H5L_info_t *info,
334 H5_CALL(H5Oget_info, (m_Id, &info));
335 return info.num_attrs;
355 : m_obj(obj), m_idx(-1), m_next(idx), m_size(obj->GetNumAttr())
362 return m_currentName;
369 H5_CALL(H5Aiterate2, (m_obj->GetId(), H5_INDEX_CRT_ORDER, H5_ITER_INC,
377 return m_obj == other.
m_obj && m_idx == other.
m_idx;
381 const H5A_info_t *info,
406 H5_CONSTRUCT(ans->m_Id, H5Screate_simple, (1, &size, NULL));
420 int rank = dims.size();
421 H5_CONSTRUCT(m_Id, H5Screate_simple, (rank, &dims[0], NULL));
426 const hsize_t *max_p = NULL;
427 if (max != (H5S_UNLIMITED - 1))
429 H5_CONSTRUCT(m_Id, H5Screate_simple, (1, &size, max_p));
433 const std::vector<hsize_t> &max_dims)
436 int rank = dims.size();
437 H5_CONSTRUCT(m_Id, H5Screate_simple, (rank, &dims[0], &max_dims[0]));
448 m_Id = H5I_INVALID_HID;
453 (m_Id, H5S_SELECT_SET, &start, NULL, &count, NULL));
458 return H5Sget_simple_extent_npoints(m_Id);
472 H5_CALL(H5Tset_size, (ans->GetId(), len));
479 m_Id = H5I_INVALID_HID;
484 hid_t ans_id = H5I_INVALID_HID;
502 m_Id = H5I_INVALID_HID;
525 H5_CONSTRUCT(
id, H5Acreate2, (parent, name.c_str(), type->GetId(),
526 space->GetId(), H5P_DEFAULT, H5P_DEFAULT));
533 H5_CONSTRUCT(
id, H5Aopen, (parent, name.c_str(), H5P_DEFAULT));
544 m_Id = H5I_INVALID_HID;
559 H5_CONSTRUCT(
id, H5Fcreate, (filename.c_str(), mode, createPL->GetId(),
567 H5_CONSTRUCT(
id, H5Fopen, (filename.c_str(), mode, accessPL->GetId()));
579 m_Id = H5I_INVALID_HID;
584 return root->GetNumElements();
598 m_Id = H5I_INVALID_HID;
604 H5_CALL(H5Gget_info, (m_Id, &info));
620 m_Id = H5I_INVALID_HID;
#define H5_CALL(func, args)
static PListSharedPtr DatatypeCreate()
Properties for datatype creation.
#define ASSERTL0(condition, msg)
boost::shared_ptr< Group > GroupSharedPtr
CanHaveAttributesSharedPtr m_obj
const std::string & operator*()
static DataTypeSharedPtr CS1()
static FileSharedPtr Create(const std::string &filename, unsigned mode, PListSharedPtr createPL=PList::Default(), PListSharedPtr accessPL=PList::Default())
void SelectRange(const hsize_t start, const hsize_t count)
static AttributeSharedPtr Create(hid_t parent, const std::string &name, DataTypeSharedPtr type, DataSpaceSharedPtr space)
LinkIterator(CanHaveGroupsDataSetsSharedPtr grp, hsize_t idx=0)
PredefinedDataType(hid_t)
static herr_t helper(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data)
boost::shared_ptr< DataSet > DataSetSharedPtr
#define H5_CONSTRUCT(ans, func, args)
AttrIterator(CanHaveAttributesSharedPtr obj, hsize_t idx=0)
DataSetSharedPtr CreateDataSet(const std::string &name, DataTypeSharedPtr type, DataSpaceSharedPtr space, PListSharedPtr createPL=PList::Default(), PListSharedPtr accessPL=PList::Default())
static DataTypeSharedPtr String(size_t len=0)
static PListSharedPtr GroupAccess()
Properties for group access.
boost::shared_ptr< File > FileSharedPtr
DataSetSharedPtr OpenDataSet(const std::string &name, PListSharedPtr accessPL=PList::Default()) const
Mixin for objects that can have attributes (Group, DataSet, DataType)
boost::shared_ptr< DataType > DataTypeSharedPtr
AttrIterator & operator++()
boost::shared_ptr< PList > PListSharedPtr
static PListSharedPtr DatasetCreate()
Properties for dataset creation.
void SetDxMpioIndependent()
static PListSharedPtr GroupCreate()
Properties for group creation.
AttrIterator attr_begin()
const std::string & operator*()
Wrap and HDF5 data type object. Technically this can have attributes, but not really bothered...
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
boost::shared_ptr< DataSpace > DataSpaceSharedPtr
static DataSpaceSharedPtr OneD(hsize_t size)
static FileSharedPtr Open(const std::string &filename, unsigned mode, PListSharedPtr accessPL=PList::Default())
boost::shared_ptr< Attribute > AttributeSharedPtr
boost::shared_ptr< CommMpi > CommMpiSharedPtr
Pointer to a Communicator object.
void SetChunk(const std::vector< hsize_t > &dims)
static PListSharedPtr ObjectCreate()
Properties for object creation.
DataSpaceSharedPtr GetSpace() const
Traits class for HDF5 data types.
static DataSpaceSharedPtr Null()
static PListSharedPtr DatasetXfer()
Properties for raw data transfer.
static PListSharedPtr FileCreate()
Properties for file creation.
void SetDxMpioCollective()
GroupSharedPtr CreateGroup(const std::string &name, PListSharedPtr createPL=PList::Default(), PListSharedPtr accessPL=PList::Default())
static PListSharedPtr DatatypeAccess()
Properties for datatype access.
static DataSpaceSharedPtr Scalar()
LinkIterator & operator++()
Mixin for objects that contain groups and datasets (Group and File)
static herr_t helper(hid_t g_id, const char *name, const H5A_info_t *info, void *op_data)
void SetMpio(CommSharedPtr comm)
AttributeSharedPtr CreateAttribute(const std::string &name, DataTypeSharedPtr type, DataSpaceSharedPtr space)
virtual hsize_t GetNumElements()
DataSpaceSharedPtr GetSpace() const
virtual hsize_t GetNumElements()
CanHaveGroupsDataSetsSharedPtr m_grp
static PListSharedPtr StringCreate()
Properties for character encoding when encoding strings or object names.
DataTypeSharedPtr Copy() const
bool operator==(const LinkIterator &other) const
static PListSharedPtr LinkCreate()
Properties governing link creation.
boost::shared_ptr< CanHaveAttributes > CanHaveAttributesSharedPtr
static PListSharedPtr DatasetAccess()
Properties for dataset access.
static PListSharedPtr FileAccess()
Properties for file access.
std::string m_currentName
std::string m_currentName
bool operator==(const AttrIterator &other) const
static PListSharedPtr AttributeCreate()
Properties for attribute creation.
static PListSharedPtr LinkAccess()
Properties governing link traversal when accessing objects.
AttributeSharedPtr OpenAttribute(const std::string &name)
void SetDeflate(const unsigned level=1)
static PListSharedPtr ObjectCopy()
Properties governing the object copying process.
static PListSharedPtr Default()
Default options.
static PListSharedPtr FileMount()
Properties for file mounting.
GroupSharedPtr OpenGroup(const std::string &name, PListSharedPtr accessPL=PList::Default()) const
boost::shared_ptr< CanHaveGroupsDataSets > CanHaveGroupsDataSetsSharedPtr
static AttributeSharedPtr Open(hid_t parent, const std::string &name)