diff --git a/doc/source/users_guide/dataspace.rst b/doc/source/users_guide/dataspace.rst index 75bd5e505d..609b2f6dfa 100644 --- a/doc/source/users_guide/dataspace.rst +++ b/doc/source/users_guide/dataspace.rst @@ -188,8 +188,63 @@ STL container to obtain all simple dataspaces in a collection sdfsdfsf { return space.type() == Type::SIMPLE; }); + +Dataspace type trait +==================== + +When working with user defined types a new type trait to create a dataspace +must be provided if something else than a scalar dataspace should be +returned for this type. + +As an example we consider here a trait for a 3x3 matrix type. The C++ class +template for such a class could look like this + +.. code-block:: cpp + template class Matrix + { + private: + std::array data_; + public: + + T *data(); + const T *data() const; + }; +Now as a dataspace for such a type we would like to have a simple dataspace +of shape 3x3 and fixed size. The type trait which must be provided could +look like this + +.. code-block:: cpp + + #include + + namespace hdf5 { + namespace dataspace { + + + template<> class TypeTrait + { + public: + using DataspaceType = Simple; + static DataspaceType create(const Matrix &) + { + return Simple({3,3}); + } + + static void *ptr(Matrix &value) + { + return reinterpret_cast(value.data()); + } + + static const void*cptr(const Matrix &value) + { + return reinterpret_cast(value.data()); + } + }; + } + } + Selections ========== @@ -228,8 +283,17 @@ To apply a selection you need to .. figure:: ../images/hdf5_selection_manager.svg :align: center :width: 75% + +.. todo:: finish this section + +Hyperslab selections +-------------------- + +.. todo:: write this section + +Point selections +---------------- -Hyperslabs ----------- +.. todo:: write this section diff --git a/doc/source/users_guide/overview.rst b/doc/source/users_guide/overview.rst index 295c49f045..f2348325fe 100644 --- a/doc/source/users_guide/overview.rst +++ b/doc/source/users_guide/overview.rst @@ -221,6 +221,10 @@ is used. As a matter of fact it is the job of the dataspace to map the multidimensional index of a particular element onto a linear address in the storage area. +.. todo:: + + add a figure here! + When data is written to disk, the content of the :cpp:class:`MemoryStorage` is transfered to the :cpp:class:`DiskStorage`. It is important to note that the dataspace of the latter one must not be equal to that of the memory storage. @@ -229,6 +233,10 @@ data elements in memory must be convertable to those associated with the file storage. The same is true for the other direction when reading data from the disk. +.. todo:: + + add a figure here! + Selections and partial IO ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -249,7 +257,7 @@ With a point selection we could for instance read the elements size 3 (which would be 72Bytes in total) or in a more sophisticated setup we could map them on points (0),(5) and (11) in a 1D array in memory. - +.. todo:: add a figure here