Skip to content

Commit 7769929

Browse files
committed
++
1 parent ce5e46c commit 7769929

File tree

4 files changed

+14
-58
lines changed

4 files changed

+14
-58
lines changed

src/core/data/particles/particle_array.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,16 @@ namespace core
341341
};
342342

343343

344+
template<typename T>
345+
using tuple_element = std::tuple<std::string, container_t<T>&, std::size_t>;
344346

345347
auto static _as_named_tuple(auto&& self)
346348
{
347-
return std::make_tuple( //
348-
std::forward_as_tuple("weight", self.weight, 1), //
349-
std::forward_as_tuple("charge", self.charge, 1), //
350-
std::forward_as_tuple("iCell", self.iCell, dim), //
351-
std::forward_as_tuple("delta", self.delta, dim), //
352-
std::forward_as_tuple("v", self.v, 3));
349+
return std::make_tuple(tuple_element<double>("weight", self.weight, 1),
350+
tuple_element<double>("charge", self.charge, 1),
351+
tuple_element<int>("iCell", self.iCell, dim),
352+
tuple_element<double>("delta", self.delta, dim),
353+
tuple_element<double>("v", self.v, 3));
353354
}
354355

355356
auto operator()() { return _as_named_tuple(*this); }

src/core/utilities/types.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ namespace core
104104

105105

106106
template<typename TupleOfTuples, typename Func>
107-
void double_apply(TupleOfTuples&& tuples, Func const func)
107+
void double_apply(TupleOfTuples&& tuples, Func&& func)
108108
{
109109
auto on_tuple
110-
= [&](auto& tuple) { std::apply([&](auto&... args) { func(args...); }, tuple); };
110+
= [&](auto& tuple) { std::apply([&](auto&&... args) { func(args...); }, tuple); };
111111

112-
std::apply([&](auto&... args) { (on_tuple(args), ...); }, tuples);
112+
std::apply([&](auto&&... args) { (on_tuple(args), ...); }, tuples);
113113
}
114114

115115
template<typename Type, std::size_t Size> // std::array::fill is only constexpr in C++20 ffs

src/hdf5/writer/particle_writer.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,14 @@ class ParticleWriter
2121
auto constexpr dim = Particles::dimension;
2222
using Packer = core::ParticlePacker<dim>;
2323

24-
PHARE_LOG_LINE_SS(particles.size());
2524
Packer{particles}.pack_ranges_into([&](auto&&... args) {
2625
auto&& [arr, from] = std::forward_as_tuple(args...);
2726

28-
PHARE_LOG_LINE_SS(arr.size() << " " << from);
2927
core::double_apply(arr(), [&](auto const& key, auto const& arg, auto size) {
30-
PHARE_LOG_LINE_SS(arg.size() << " " << key);
31-
32-
PHARE_LOG_LINE_SS(h5file.file().getDataSet(path + key).getStorageSize());
33-
h5file.file().getDataSet(path + key).select({from * size}, {arg.size()}).write(arg);
28+
h5file.file()
29+
.getDataSet(path + key)
30+
.select({from, 0ul}, {arr.size(), size})
31+
.write_raw(arg.data());
3432
});
3533
});
3634
}

tests/diagnostic/highfive_selection.cpp

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)