Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PETRA III Debian Packages
h5cpp-bp
Commits
e978ae5a
Unverified
Commit
e978ae5a
authored
Sep 02, 2019
by
Jan Kotanski
Browse files
add fix for writing from std vector
parent
7a70e2da
Changes
2
Hide whitespace changes
Inline
Side-by-side
debian/patches/0002-add-fix-for-writing-from-std-vector.patch
0 → 100644
View file @
e978ae5a
From: Jan Kotanski <jankotan@gmail.com>
Date: Mon, 2 Sep 2019 16:19:03 +0200
Subject: add fix for writing from std::vector
---
src/h5cpp/node/dataset.hpp | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/src/h5cpp/node/dataset.hpp b/src/h5cpp/node/dataset.hpp
index 1021440..2be11db 100644
--- a/src/h5cpp/node/dataset.hpp
+++ b/src/h5cpp/node/dataset.hpp
@@ -635,6 +635,16 @@
void Dataset::write(const T &data,const property::DatasetTransferList &dtpl) con
auto file_space = dataspace();
file_space.selection.all();
+ if (file_space.size() == memory_space.size() &&
+ memory_space.type() == dataspace::Type::SIMPLE &&
+ file_space.type() == dataspace::Type::SIMPLE){
+ const dataspace::Simple & mem_space = dataspace::Simple(memory_space);
+ const dataspace::Simple & fl_space = dataspace::Simple(file_space);
+ if(fl_space.rank() > 1 && mem_space.rank() == 1){
+ write(data,memory_type,file_space,file_space,dtpl);
+ return;
+ }
+ }
write(data,memory_type,memory_space,file_space,dtpl);
}
@@ -728,9 +738,33 @@
void Dataset::write(const T &data,const dataspace::Selection &selection,
dataspace::Dataspace file_space = dataspace();
file_space.selection(dataspace::SelectionOperation::SET,selection);
- write(data,memory_type,memory_space,file_space,dtpl);
-}
+ if (memory_space.type() != dataspace::Type::SIMPLE) {
+ write(data,memory_type,memory_space,file_space,dtpl);
+ }
+ else{
+ try{
+
+ const dataspace::Hyperslab & hyper = dynamic_cast<const dataspace::Hyperslab &>(selection);
+ const dataspace::Simple & mem_space = dataspace::Simple(memory_space);
+
+ auto dims = hyper.block();
+ auto count = hyper.count();
+ for(Dimensions::size_type i = 0; i != dims.size(); i++)
+ dims[i] *= count[i];
+ dataspace::Simple selected_space(dims);
+ if(selected_space.rank() > 1 &&
+ mem_space.rank() == 1 &&
+ selected_space.size() == memory_space.size())
+ write(data,memory_type,selected_space,file_space,dtpl);
+ else
+ write(data,memory_type,memory_space,file_space,dtpl);
+ }
+ catch(const std::bad_cast&){
+ write(data,memory_type,memory_space,file_space,dtpl);
+ }
+ }
+}
template<typename T>
debian/patches/series
View file @
e978ae5a
0001-fix-version.patch
0002-add-fix-for-writing-from-std-vector.patch
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment