Skip to content

Commit

Permalink
More stl
Browse files Browse the repository at this point in the history
  • Loading branch information
Davknapp committed Oct 1, 2024
1 parent ffc6a49 commit 291c0f5
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/t8_data/t8_data_handler.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ along with t8code; if not, write to the Free Software Foundation, Inc.,
#include <t8_data/t8_data_handler_base.hxx>
#include <algorithm>
#include <memory>
#include <type_traits>
#include <numeric>

class t8_abstract_data_handler {
public:
Expand Down Expand Up @@ -157,9 +157,8 @@ class t8_data_handler: public t8_abstract_data_handler {
const int mpiret = sc_MPI_Pack_size (1, sc_MPI_INT, comm, &total_size);
SC_CHECK_MPI (mpiret);
if (m_data) {
for (const auto &item : *m_data) {
total_size += single_handler.size (item, comm);
}
total_size += std::accumulate (m_data->begin (), m_data->end (), 0,
[&] (int sum, const T &item) { return sum + single_handler.size (item, comm); });
}
return total_size;
}
Expand All @@ -171,9 +170,8 @@ class t8_data_handler: public t8_abstract_data_handler {
const int mpiret = sc_MPI_Pack (&num_data, 1, sc_MPI_INT, buffer, num_bytes, &pos, comm);
SC_CHECK_MPI (mpiret);

for (const auto &item : *m_data) {
single_handler.pack (item, pos, buffer, num_bytes, comm);
}
std::for_each (m_data->begin (), m_data->end (),
[&] (const T &item) { single_handler.pack (item, pos, buffer, num_bytes, comm); });
}

void
Expand All @@ -189,9 +187,8 @@ class t8_data_handler: public t8_abstract_data_handler {
else {
m_data->resize (outcount);
}
for (auto &item : *m_data) {
single_handler.unpack (buffer, num_bytes, pos, item, comm);
}
std::for_each (m_data->begin (), m_data->end (),
[&] (T &item) { single_handler.unpack (buffer, num_bytes, pos, item, comm); });
}

int
Expand Down

0 comments on commit 291c0f5

Please sign in to comment.