dev #2

Merged
chizeta merged 32 commits from dev into main 2024-02-02 20:36:53 +01:00
3 changed files with 28 additions and 2 deletions
Showing only changes of commit e2e233b931 - Show all commits

View file

@ -0,0 +1,18 @@
#ifndef __cxz_h5_dataset_cc_h__
#define __cxz_h5_dataset_cc_h__
namespace CNORXZ
{
namespace hdf5
{
template <typename T>
Dataset& Dataset::init(const ArrayBase<T>& data)
{
// !!!!
}
}
}
#endif

View file

@ -27,6 +27,9 @@ namespace CNORXZ
Dataset& init(const RangePtr& dataRange, hid_t type); Dataset& init(const RangePtr& dataRange, hid_t type);
template <typename T>
Dataset& init(const ArrayBase<T>& data);
const RangePtr& dataRange() const; const RangePtr& dataRange() const;
protected: protected:

View file

@ -81,11 +81,16 @@ namespace CNORXZ
Dataset& Dataset::init(const RangePtr& dataRange, hid_t type) Dataset& Dataset::init(const RangePtr& dataRange, hid_t type)
{ {
// check if type is valid type!!! CXZ_ASSERT(not open(), "tried to initialize dataset that is already extisting");
const H5T_class_t tc = H5Tget_class(type);
CXZ_ASSERT(tc != H5T_NO_CLASS, "id does not correspond to a data type"); // (did not found anythng better to check if type id is valid)...
const hid_t dcpl_id = H5Pcreate(H5P_DATASET_CREATE); const hid_t dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
// TODO: all sub-ranges explicity!!!: // TODO: all sub-ranges explicity!!!:
const SizeT ndim = dataRange->dim(); const SizeT ndim = dataRange->dim();
Vector<hsize_t> exts(ndim); Vector<hsize_t> exts(ndim);
for(SizeT i = 0; i != ndim; ++i){
exts[i] = static_cast<hsize_t>( dataRange->sub(i)->size() );
}
mFilespace = H5Screate_simple(ndim, exts.data(), NULL); mFilespace = H5Screate_simple(ndim, exts.data(), NULL);
mType = type; mType = type;
mId = H5Dcreate(mParent->id(), mName.c_str(), mType, mFilespace, mId = H5Dcreate(mParent->id(), mName.c_str(), mType, mFilespace,