diff --git a/ebos/eclmpiserializer.hh b/ebos/eclmpiserializer.hh index 03a8a858c..62b2c2958 100644 --- a/ebos/eclmpiserializer.hh +++ b/ebos/eclmpiserializer.hh @@ -92,6 +92,8 @@ public: optional(data); } else if constexpr (is_map::value) { map(const_cast(data)); + } else if constexpr (is_array::value) { + array(const_cast(data)); } else { if (m_op == Operation::PACKSIZE) m_packSize += Mpi::packSize(data, m_comm); @@ -503,6 +505,17 @@ protected: constexpr static bool value = true; }; + //! \brief Predicate for arrays + template + struct is_array { + constexpr static bool value = false; + }; + + template + struct is_array> { + constexpr static bool value = true; + }; + //! Detect existence of \c serializeOp member function //! //! Base case (no \c serializeOp member function) diff --git a/opm/simulators/utils/MPIPacker.cpp b/opm/simulators/utils/MPIPacker.cpp index a596b2132..ddbe1e2a7 100644 --- a/opm/simulators/utils/MPIPacker.cpp +++ b/opm/simulators/utils/MPIPacker.cpp @@ -153,12 +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::array& data, Opm::Parallel::MPIComm comm) -{ - return N*packSize(data[0], comm); -} - template struct Packing { @@ -284,14 +278,6 @@ void pack(const std::unordered_set& data, } } -template -void pack(const std::array& data, std::vector& buffer, int& position, - Opm::Parallel::MPIComm comm) -{ - for (const T& entry : data) - pack(entry, buffer, position, comm); -} - template void pack(const std::vector& data, std::vector& buffer, int& position, Opm::Parallel::MPIComm comm) @@ -492,14 +478,6 @@ void unpack(std::unordered_set& data, } } -template -void unpack(std::array& data, std::vector& buffer, int& position, - Opm::Parallel::MPIComm comm) -{ - for (T& entry : data) - unpack(entry, buffer, position, comm); -} - void unpack(char* str, std::size_t length, std::vector& buffer, int& position, Opm::Parallel::MPIComm comm) { @@ -564,7 +542,6 @@ INSTANTIATE_PACK_VECTOR(unsigned int) INSTANTIATE_PACK_VECTOR(unsigned long int) 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::pair>) INSTANTIATE_PACK_VECTOR(std::pair>) @@ -593,11 +570,6 @@ INSTANTIATE_PACK(unsigned char) INSTANTIATE_PACK(unsigned int) INSTANTIATE_PACK(unsigned long int) INSTANTIATE_PACK(unsigned long long int) -INSTANTIATE_PACK(std::array) -INSTANTIATE_PACK(std::array) -INSTANTIATE_PACK(std::array) -INSTANTIATE_PACK(std::array) -INSTANTIATE_PACK(std::array) INSTANTIATE_PACK(std::pair) INSTANTIATE_PACK(std::unordered_set) INSTANTIATE_PACK(std::set) diff --git a/opm/simulators/utils/MPIPacker.hpp b/opm/simulators/utils/MPIPacker.hpp index 4f2570d13..abcf8ad25 100644 --- a/opm/simulators/utils/MPIPacker.hpp +++ b/opm/simulators/utils/MPIPacker.hpp @@ -97,9 +97,6 @@ std::size_t packSize(const std::vector& data, Opm::Parallel::MPIComm com template std::size_t packSize(const std::tuple& data, Opm::Parallel::MPIComm comm); -template -std::size_t packSize(const std::array& data, Opm::Parallel::MPIComm comm); - std::size_t packSize(const char* str, Opm::Parallel::MPIComm comm); template @@ -174,10 +171,6 @@ void pack(const std::unordered_set& data, std::vector& buffer, int& position, Opm::Parallel::MPIComm comm); -template -void pack(const std::array& data, std::vector& buffer, int& position, - Opm::Parallel::MPIComm comm); - void pack(const char* str, std::vector& buffer, int& position, Opm::Parallel::MPIComm comm); @@ -255,10 +248,6 @@ void unpack(std::unordered_set& data, std::vector& buffer, int& position, Opm::Parallel::MPIComm comm); -template -void unpack(std::array& 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);