diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index e17a29d1a..8317521c7 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -271,6 +271,12 @@ std::size_t packSize(const std::unordered_map& data, Dune::MPIHelpe return totalSize; } +template +std::size_t packSize(const std::array& data, Dune::MPIHelper::MPICommunicator comm) +{ + return N*packSize(data[0], comm); +} + HANDLE_AS_POD(Actdims) HANDLE_AS_POD(Aqudims) HANDLE_AS_POD(data::Connection) @@ -1486,6 +1492,14 @@ void pack(const std::unordered_set& data, } } +template +void pack(const std::array& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + for (const T& entry : data) + pack(entry, buffer, position, comm); +} + template void pack(const std::vector& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm) @@ -2931,6 +2945,14 @@ void unpack(std::unordered_set& data, } } +template +void unpack(std::array& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + for (T& entry : data) + unpack(entry, buffer, position, comm); +} + template void unpack(OrderedMap& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm) diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 78685ac32..7accf8d36 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -184,6 +184,9 @@ template std::size_t packSize(const std::shared_ptr& data, Dune::MPIHelper::MPICommunicator comm); +template +std::size_t packSize(const std::array& data, Dune::MPIHelper::MPICommunicator comm); + std::size_t packSize(const char* str, Dune::MPIHelper::MPICommunicator comm); std::size_t packSize(const std::string& str, Dune::MPIHelper::MPICommunicator comm); @@ -313,6 +316,10 @@ template void pack(const std::shared_ptr& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); +template +void pack(const std::array& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm); + template void pack(const std::map& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); @@ -463,6 +470,10 @@ template void unpack(std::shared_ptr& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); +template +void unpack(std::array& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm); + template void unpack(std::map& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm);