Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/cpp/h5cpp/dataspace/selections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@

namespace {

hdf5::Dimensions get_dimensions(const hdf5::dataspace::Hyperslab &self)
{
return self.dimensions();
}

hdf5::Dimensions get_offset(const hdf5::dataspace::Hyperslab &self)
{
return self.offset();
Expand Down Expand Up @@ -102,6 +107,9 @@ void create_selections()
((arg("offset"),arg("count"),arg("stride")))
)
.add_property("rank",&Hyperslab::rank)
.add_property("size",&Hyperslab::size)
.add_property("type",&Hyperslab::type)
.def("dimensions",get_dimensions)
.def("offset",get_offset)
.def("offset",set_entire_offset)
.def("offset",set_individual_offset)
Expand Down
14 changes: 13 additions & 1 deletion test/h5cpp_tests/node_tests/dataset_partial_io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from pninexus.h5cpp.node import Dataset
from pninexus.h5cpp.dataspace import Simple
# from pninexus.h5cpp.dataspace import Scalar
from pninexus.h5cpp.dataspace import Hyperslab
from pninexus.h5cpp.dataspace import Hyperslab, SelectionType
from pninexus.h5cpp.datatype import kInt32
from pninexus.h5cpp.datatype import String
from pninexus.h5cpp.property import LinkCreationList
Expand Down Expand Up @@ -113,6 +113,12 @@ def testWriteReadStrips(self):
# write data
#
selection = Hyperslab(offset=(0, 0), block=(1, 5))

self.assertEqual(selection.rank, 2)
self.assertEqual(selection.size, 5)
self.assertEqual(selection.dimensions(), (1, 5))
self.assertEqual(selection.type, SelectionType.HYPERSLAB)

dataset.write(data_base, selection=selection)
selection.offset(0, 1)
dataset.write(2 * data_base, selection=selection)
Expand Down Expand Up @@ -140,6 +146,12 @@ def testWriteReadPoints(self):

value = 0
selection = Hyperslab(offset=(0, 0), block=(1, 1))

self.assertEqual(selection.rank, 2)
self.assertEqual(selection.size, 1)
self.assertEqual(selection.dimensions(), (1, 1))
self.assertEqual(selection.type, SelectionType.HYPERSLAB)

for i in range(3):
selection.offset(0, i)
for j in range(5):
Expand Down