diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 52ef1eb13..28d19343d 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -243,28 +243,6 @@ std::size_t packSize(const RestartValue& data, Dune::MPIHelper::MPICommunicator return packSize(data.solution, comm) + packSize(data.wells, comm) + packSize(data.extra, comm); } -template -std::size_t packSize(const std::shared_ptr& data, - Dune::MPIHelper::MPICommunicator comm) -{ - std::size_t size = packSize(bool(), comm); - if (data) - size += packSize(*data, comm); - - return size; -} - -template -std::size_t packSize(const std::unique_ptr& data, - Dune::MPIHelper::MPICommunicator comm) -{ - std::size_t size = packSize(bool(), comm); - if (data) - size += packSize(*data, comm); - - return size; -} - ////// pack routines template @@ -495,24 +473,6 @@ void pack(const RestartValue& data, std::vector& buffer, int& position, pack(data.extra, buffer, position, comm); } -template -void pack(const std::shared_ptr& data, std::vector& buffer, int& position, - Dune::MPIHelper::MPICommunicator comm) -{ - pack(data != nullptr, buffer, position, comm); - if (data) - pack(*data, buffer, position, comm); -} - -template -void pack(const std::unique_ptr& data, std::vector& buffer, int& position, - Dune::MPIHelper::MPICommunicator comm) -{ - pack(data != nullptr, buffer, position, comm); - if (data) - pack(*data, buffer, position, comm); -} - /// unpack routines template @@ -760,30 +720,6 @@ void unpack(RestartValue& data, std::vector& buffer, int& position, unpack(data.extra, buffer, position, comm); } -template -void unpack(std::shared_ptr& data, std::vector& buffer, int& position, - Dune::MPIHelper::MPICommunicator comm) -{ - bool hasVal; - unpack(hasVal, buffer, position, comm); - if (hasVal) { - data = std::make_shared(); - unpack(*data, buffer, position, comm); - } -} - -template -void unpack(std::unique_ptr& data, std::vector& buffer, int& position, - Dune::MPIHelper::MPICommunicator comm) -{ - bool hasVal; - unpack(hasVal, buffer, position, comm); - if (hasVal) { - data.reset(new T); - unpack(*data, buffer, position, comm); - } -} - #define INSTANTIATE_PACK_VECTOR(...) \ template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \ Dune::MPIHelper::MPICommunicator comm); \ @@ -813,18 +749,6 @@ INSTANTIATE_PACK_VECTOR(std::string) #undef INSTANTIATE_PACK_VECTOR -#define INSTANTIATE_PACK_SET(...) \ -template std::size_t packSize(const std::set<__VA_ARGS__>& data, \ - Dune::MPIHelper::MPICommunicator comm); \ -template void pack(const std::set<__VA_ARGS__>& data, \ - std::vector& buffer, int& position, \ - Dune::MPIHelper::MPICommunicator comm); \ -template void unpack(std::set<__VA_ARGS__>& data, \ - std::vector& buffer, int& position, \ - Dune::MPIHelper::MPICommunicator comm); - -INSTANTIATE_PACK_SET(std::string) - #undef INSTANTIATE_PACK_SET #define INSTANTIATE_PACK(...) \ @@ -857,6 +781,7 @@ INSTANTIATE_PACK(std::map) INSTANTIATE_PACK(std::unordered_map) INSTANTIATE_PACK(std::unordered_map) INSTANTIATE_PACK(std::unordered_set) +INSTANTIATE_PACK(std::set) INSTANTIATE_PACK(std::pair) INSTANTIATE_PACK(std::pair) INSTANTIATE_PACK(std::pair) diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 92fbce806..647b38fef 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -98,17 +98,9 @@ std::size_t packSize(const std::vector& data, Dune::MPIHelper::MPICommun template std::size_t packSize(const std::tuple& data, Dune::MPIHelper::MPICommunicator comm); -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); -template -std::size_t packSize(const std::unique_ptr& 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); @@ -188,18 +180,10 @@ void pack(const std::unordered_set& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); -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::unique_ptr& 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); @@ -281,18 +265,10 @@ void unpack(std::unordered_set& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); -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::unique_ptr& 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);