QMCPACK
h5data_proxy< boost::multi::array_ref< T, 2, Ptr > > Struct Template Reference
+ Inheritance diagram for h5data_proxy< boost::multi::array_ref< T, 2, Ptr > >:
+ Collaboration diagram for h5data_proxy< boost::multi::array_ref< T, 2, Ptr > >:

Public Types

using FileSpace = h5_space_type< T, 2 >
 
using data_type = boost::multi::array_ref< T, 2, Ptr >
 

Public Member Functions

 h5data_proxy (const data_type &a)
 
bool read (data_type &ref, hid_t grp, const std::string &aname, hid_t xfer_plist=H5P_DEFAULT)
 
bool write (const data_type &ref, hid_t grp, const std::string &aname, hid_t xfer_plist=H5P_DEFAULT) const
 

Additional Inherited Members

- Static Public Member Functions inherited from h5_space_type< T, 2 >
static constexpr int added_rank ()
 new rank added due to T More...
 
static auto get_address (T *a)
 return the address More...
 
static auto get_address (const T *a)
 
- Public Attributes inherited from h5_space_type< T, 2 >
hsize_t dims [RANK > 0 ? RANK :1]
 shape of the dataspace, protected for zero size array, hdf5 support scalar as rank = 0 More...
 
- Static Public Attributes inherited from h5_space_type< T, 2 >
static constexpr hsize_t rank
 rank of the multidimensional dataspace More...
 

Detailed Description

template<typename T, class Ptr>
struct qmcplusplus::h5data_proxy< boost::multi::array_ref< T, 2, Ptr > >

Definition at line 114 of file hdf_multi.h.

Member Typedef Documentation

◆ data_type

using data_type = boost::multi::array_ref<T, 2, Ptr>

Definition at line 119 of file hdf_multi.h.

◆ FileSpace

using FileSpace = h5_space_type<T, 2>

Definition at line 116 of file hdf_multi.h.

Constructor & Destructor Documentation

◆ h5data_proxy()

h5data_proxy ( const data_type a)
inline

Definition at line 121 of file hdf_multi.h.

References h5_space_type< T, 0 >::dims.

122  {
123  dims[0] = std::get<0>(a.sizes());
124  dims[1] = std::get<1>(a.sizes());
125  }
hsize_t dims[RANK > 0 ? RANK :1]
shape of the dataspace, protected for zero size array, hdf5 support scalar as rank = 0 ...
Definition: hdf_dataspace.h:47

Member Function Documentation

◆ read()

bool read ( data_type ref,
hid_t  grp,
const std::string &  aname,
hid_t  xfer_plist = H5P_DEFAULT 
)
inline

Definition at line 127 of file hdf_multi.h.

References h5_space_type< T, 0 >::dims, h5_space_type< T, 0 >::get_address(), qmcplusplus::h5d_read(), and h5_space_type< T, 0 >::rank.

128  {
129  if (!checkShapeConsistency<T>(grp, aname, FileSpace::rank, dims))
130  {
131  if (dims[0] * dims[1] > 0)
132  {
133  std::cerr << " Error: multi::array_ref can't be resized in h5data_proxy<>::read." << std::endl;
134  std::cerr << dims[0] << " " << dims[1] << " " << std::get<0>(ref.sizes()) << " " << std::get<1>(ref.sizes()) << std::endl;
135  }
136  return false;
137  }
138  return h5d_read(grp, aname, get_address(std::addressof(*ref.origin())), xfer_plist);
139  }
hsize_t dims[RANK > 0 ? RANK :1]
shape of the dataspace, protected for zero size array, hdf5 support scalar as rank = 0 ...
Definition: hdf_dataspace.h:47
static auto get_address(T *a)
return the address
Definition: hdf_dataspace.h:53
static constexpr hsize_t rank
rank of the multidimensional dataspace
Definition: hdf_dataspace.h:49
bool h5d_read(hid_t grp, const std::string &aname, T *first, hid_t xfer_plist)
return true, if successful

◆ write()

bool write ( const data_type ref,
hid_t  grp,
const std::string &  aname,
hid_t  xfer_plist = H5P_DEFAULT 
) const
inline

Definition at line 141 of file hdf_multi.h.

References h5_space_type< T, 0 >::dims, h5_space_type< T, 0 >::get_address(), qmcplusplus::h5d_write(), and h5_space_type< T, 0 >::rank.

142  {
143  return h5d_write(grp, aname.c_str(), FileSpace::rank, dims, get_address(std::addressof(*ref.origin())), xfer_plist);
144  }
hsize_t dims[RANK > 0 ? RANK :1]
shape of the dataspace, protected for zero size array, hdf5 support scalar as rank = 0 ...
Definition: hdf_dataspace.h:47
static auto get_address(T *a)
return the address
Definition: hdf_dataspace.h:53
static constexpr hsize_t rank
rank of the multidimensional dataspace
Definition: hdf_dataspace.h:49
bool h5d_write(hid_t grp, const std::string &aname, hsize_t ndims, const hsize_t *dims, const T *first, hid_t xfer_plist)

The documentation for this struct was generated from the following file: