hops
H5Slice_traits.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c), 2017, Adrien Devresse <adrien.devresse@epfl.ch>
3  *
4  * Distributed under the Boost Software License, Version 1.0.
5  * (See accompanying file LICENSE_1_0.txt or copy at
6  * http://www.boost.org/LICENSE_1_0.txt)
7  *
8  */
9 #ifndef H5SLICE_TRAITS_HPP
10 #define H5SLICE_TRAITS_HPP
11 
12 #include <cstdlib>
13 #include <vector>
14 
15 #include "H5_definitions.hpp"
16 #include "H5Utils.hpp"
17 
18 namespace HighFive {
19 
20 class ElementSet {
21  public:
27  explicit ElementSet(std::initializer_list<std::size_t> list);
32  explicit ElementSet(std::initializer_list<std::vector<std::size_t>> list);
38  explicit ElementSet(const std::vector<std::size_t>& element_ids);
43  explicit ElementSet(const std::vector<std::vector<std::size_t>>& element_ids);
44 
45  private:
46  std::vector<std::size_t> _ids;
47 
48  template <typename Derivate>
49  friend class SliceTraits;
50 };
51 
52 
53 template <typename Derivate>
54 class SliceTraits {
55  public:
63  Selection select(const std::vector<size_t>& offset,
64  const std::vector<size_t>& count,
65  const std::vector<size_t>& stride = std::vector<size_t>())
66  const;
67 
73  Selection select(const std::vector<size_t>& columns) const;
74 
78  Selection select(const ElementSet& elements) const;
79 
89  template <typename T>
90  void read(T& array) const;
91 
100  template <typename T>
101  void read(T* array, const DataType& dtype = DataType()) const;
102 
110  template <typename T>
111  void write(const T& buffer);
112 
122  template <typename T>
123  void write_raw(const T* buffer, const DataType& dtype = DataType());
124 
125 };
126 
127 } // namespace HighFive
128 
129 #endif // H5SLICE_TRAITS_HPP
HighFive::Selection
Selection: represent a view on a slice/part of a dataset.
Definition: H5Selection.hpp:23
HighFive::ElementSet::ElementSet
ElementSet(std::initializer_list< std::size_t > list)
Create a list of points of N-dimension for selection.
Definition: H5Slice_traits_misc.hpp:59
HighFive::SliceTraits::write_raw
void write_raw(const T *buffer, const DataType &dtype=DataType())
Definition: H5Slice_traits_misc.hpp:218
HighFive::DataType
HDF5 Data Type.
Definition: H5DataType.hpp:42
HighFive::SliceTraits::read
void read(T &array) const
Definition: H5Slice_traits_misc.hpp:158
HighFive::SliceTraits
Definition: H5Slice_traits.hpp:54
HighFive::SliceTraits::select
Selection select(const std::vector< size_t > &offset, const std::vector< size_t > &count, const std::vector< size_t > &stride=std::vector< size_t >()) const
Select a region in the current Slice/Dataset of count points at offset separated by stride....
Definition: H5Slice_traits_misc.hpp:75
HighFive::SliceTraits::write
void write(const T &buffer)
Definition: H5Slice_traits_misc.hpp:200
HighFive::ElementSet
Definition: H5Slice_traits.hpp:20
H5Utils.hpp
HighFive
Definition: H5_definitions.hpp:15
H5_definitions.hpp