Skip to content

Commit

Permalink
Added toto marks on the missing sections of the documentation
Browse files Browse the repository at this point in the history
Update #110
  • Loading branch information
eugenwintersberger committed Nov 3, 2017
1 parent 81b8dee commit 1dacc20
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 3 deletions.
68 changes: 66 additions & 2 deletions doc/source/users_guide/dataspace.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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<typename T> class Matrix
{
private:
std::array<T,9> 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 <h5cpp/hdf5.cpp>
namespace hdf5 {
namespace dataspace {
template<> class TypeTrait<Matrix>
{
public:
using DataspaceType = Simple;
static DataspaceType create(const Matrix &)
{
return Simple({3,3});
}
static void *ptr(Matrix &value)
{
return reinterpret_cast<void*>(value.data());
}
static const void*cptr(const Matrix &value)
{
return reinterpret_cast<const void*>(value.data());
}
};
}
}
Selections
==========

Expand Down Expand Up @@ -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


10 changes: 9 additions & 1 deletion doc/source/users_guide/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -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



Expand Down

0 comments on commit 1dacc20

Please sign in to comment.