diff --git a/ebos/eclmpiserializer.hh b/ebos/eclmpiserializer.hh index 2d5b30eb8..03a8a858c 100644 --- a/ebos/eclmpiserializer.hh +++ b/ebos/eclmpiserializer.hh @@ -89,7 +89,9 @@ public: } else if constexpr (is_variant::value) { variant(data); } else if constexpr (is_optional::value) { - optional(data); + optional(data); + } else if constexpr (is_map::value) { + map(const_cast(data)); } else { if (m_op == Operation::PACKSIZE) m_packSize += Mpi::packSize(data, m_comm); @@ -243,11 +245,11 @@ public: auto handle = [&](auto& d) { if constexpr (is_vector::value) - this->vector(d); + vector(d); else if constexpr (is_ptr::value) - this->ptr(d); + ptr(d); else if constexpr (is_map::value) - this->map(d); + map(d); else if constexpr (has_serializeOp::value) d.serializeOp(*this); else diff --git a/opm/simulators/utils/MPIPacker.cpp b/opm/simulators/utils/MPIPacker.cpp index c138ed9a8..a596b2132 100644 --- a/opm/simulators/utils/MPIPacker.cpp +++ b/opm/simulators/utils/MPIPacker.cpp @@ -27,7 +27,6 @@ #if HAVE_MPI #include #endif -#include namespace Opm { @@ -154,28 +153,6 @@ std::size_t packSize(const std::string& str, Opm::Parallel::MPIComm comm) return packSize(str.c_str(), comm); } -template -std::size_t packSize(const std::map& data, Opm::Parallel::MPIComm comm) -{ - std::size_t totalSize = packSize(data.size(), comm); - for (const auto& entry: data) - { - totalSize += packSize(entry, comm); - } - return totalSize; -} - -template -std::size_t packSize(const std::unordered_map& data, Opm::Parallel::MPIComm comm) -{ - std::size_t totalSize = packSize(data.size(), comm); - for (const auto& entry: data) - { - totalSize += packSize(entry, comm); - } - return totalSize; -} - template std::size_t packSize(const std::array& data, Opm::Parallel::MPIComm comm) { @@ -372,30 +349,6 @@ void pack(const std::string& str, std::vector& buffer, int& position, pack(str.c_str(), buffer, position, comm); } -template -void pack(const std::map& data, std::vector& buffer, int& position, - Opm::Parallel::MPIComm comm) -{ - pack(data.size(), buffer, position, comm); - - for (const auto& entry: data) - { - pack(entry, buffer, position, comm); - } -} - -template -void pack(const std::unordered_map& data, std::vector& buffer, int& position, - Opm::Parallel::MPIComm comm) -{ - pack(data.size(), buffer, position, comm); - - for (const auto& entry: data) - { - pack(entry, buffer, position, comm); - } -} - template void pack(const std::bitset& data, std::vector& buffer, int& position, Opm::Parallel::MPIComm comm) @@ -572,36 +525,6 @@ void unpack(std::string& str, std::vector& buffer, int& position, str.append(cStr.data()); } -template -void unpack(std::map& data, std::vector& buffer, int& position, - Opm::Parallel::MPIComm comm) -{ - std::size_t size=0; - unpack(size, buffer, position, comm); - - for (;size>0; size--) - { - std::pair entry; - unpack(entry, buffer, position, comm); - data.insert(entry); - } -} - -template -void unpack(std::unordered_map& data, std::vector& buffer, int& position, - Opm::Parallel::MPIComm comm) -{ - std::size_t size=0; - unpack(size, buffer, position, comm); - - for (;size>0; size--) - { - std::pair entry; - unpack(entry, buffer, position, comm); - data.insert(entry); - } -} - template void unpack(std::bitset& data, std::vector& buffer, int& position, Opm::Parallel::MPIComm comm) @@ -643,7 +566,6 @@ INSTANTIATE_PACK_VECTOR(unsigned long long int) INSTANTIATE_PACK_VECTOR(std::time_t) INSTANTIATE_PACK_VECTOR(std::array) INSTANTIATE_PACK_VECTOR(std::pair) -INSTANTIATE_PACK_VECTOR(std::map) INSTANTIATE_PACK_VECTOR(std::pair>) INSTANTIATE_PACK_VECTOR(std::pair>) INSTANTIATE_PACK_VECTOR(std::pair>) @@ -676,17 +598,7 @@ INSTANTIATE_PACK(std::array) INSTANTIATE_PACK(std::array) INSTANTIATE_PACK(std::array) INSTANTIATE_PACK(std::array) -INSTANTIATE_PACK(std::map,std::pair>) INSTANTIATE_PACK(std::pair) -INSTANTIATE_PACK(std::map>) -INSTANTIATE_PACK(std::map,int>>) -INSTANTIATE_PACK(std::map) -INSTANTIATE_PACK(std::map) -INSTANTIATE_PACK(std::map) -INSTANTIATE_PACK(std::unordered_map) -INSTANTIATE_PACK(std::unordered_map, Opm::OrderedMapDetail::TruncatedStringEquals>) -INSTANTIATE_PACK(std::unordered_map, Opm::OrderedMapDetail::TruncatedStringEquals<8>>) -INSTANTIATE_PACK(std::unordered_map) INSTANTIATE_PACK(std::unordered_set) INSTANTIATE_PACK(std::set) INSTANTIATE_PACK(std::bitset<4>) diff --git a/opm/simulators/utils/MPIPacker.hpp b/opm/simulators/utils/MPIPacker.hpp index 03ffefe89..4f2570d13 100644 --- a/opm/simulators/utils/MPIPacker.hpp +++ b/opm/simulators/utils/MPIPacker.hpp @@ -26,12 +26,10 @@ #include #include -#include #include #include #include #include -#include #include #include @@ -104,12 +102,6 @@ std::size_t packSize(const std::array& data, Opm::Parallel::MPIComm comm); std::size_t packSize(const char* str, Opm::Parallel::MPIComm comm); -template -std::size_t packSize(const std::map& data, Opm::Parallel::MPIComm comm); - -template -std::size_t packSize(const std::unordered_map& data, Opm::Parallel::MPIComm comm); - template std::size_t packSize(const std::bitset& data, Opm::Parallel::MPIComm comm); @@ -186,14 +178,6 @@ template void pack(const std::array& data, std::vector& buffer, int& position, Opm::Parallel::MPIComm comm); -template -void pack(const std::map& data, std::vector& buffer, int& position, - Opm::Parallel::MPIComm comm); - -template -void pack(const std::unordered_map& data, std::vector& buffer, int& position, - Opm::Parallel::MPIComm comm); - void pack(const char* str, std::vector& buffer, int& position, Opm::Parallel::MPIComm comm); @@ -275,14 +259,6 @@ template void unpack(std::array& data, std::vector& buffer, int& position, Opm::Parallel::MPIComm comm); -template -void unpack(std::map& data, std::vector& buffer, int& position, - Opm::Parallel::MPIComm comm); - -template -void unpack(std::unordered_map& data, std::vector& buffer, int& position, - Opm::Parallel::MPIComm comm); - void unpack(char* str, std::size_t length, std::vector& buffer, int& position, Opm::Parallel::MPIComm comm);