mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-09-05 04:40:19 -05:00
add mpi serialization for OrderedMap
This commit is contained in:
@@ -111,6 +111,12 @@ std::size_t packSize(const std::vector<T,A>& data, Dune::MPIHelper::MPICommunica
|
||||
return size;
|
||||
}
|
||||
|
||||
template<class Key, class Value>
|
||||
std::size_t packSize(const OrderedMap<Key,Value>& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getIndex(), comm) + packSize(data.getStorage(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const char* str, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
@@ -342,6 +348,14 @@ void pack(const std::vector<T, A>& data, std::vector<char>& buffer, int& positio
|
||||
pack(entry, buffer, position, comm);
|
||||
}
|
||||
|
||||
template<class Key, class Value>
|
||||
void pack(const OrderedMap<Key, Value>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getIndex(), buffer, position, comm);
|
||||
pack(data.getStorage(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const char* str, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
@@ -597,6 +611,17 @@ void unpack(std::vector<T,A>& data, std::vector<char>& buffer, int& position,
|
||||
unpack(entry, buffer, position, comm);
|
||||
}
|
||||
|
||||
template<class Key, class Value>
|
||||
void unpack(OrderedMap<Key,Value>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
typename OrderedMap<Key,Value>::index_type index;
|
||||
typename OrderedMap<Key,Value>::storage_type storage;
|
||||
unpack(index, buffer, position, comm);
|
||||
unpack(storage, buffer, position, comm);
|
||||
data = OrderedMap<Key,Value>(index, storage);
|
||||
}
|
||||
|
||||
void unpack(char* str, std::size_t length, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <opm/output/eclipse/RestartValue.hpp>
|
||||
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||
#include <opm/output/eclipse/Summary.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp>
|
||||
|
||||
#include <dune/common/parallel/mpihelper.hh>
|
||||
|
||||
@@ -84,6 +85,9 @@ std::size_t packSize(const std::map<T1,T2,C,A>& data, Dune::MPIHelper::MPICommun
|
||||
template<class T1, class T2, class H, class P, class A>
|
||||
std::size_t packSize(const std::unordered_map<T1,T2,H,P,A>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Key, class Value>
|
||||
std::size_t packSize(const OrderedMap<Key,Value>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@@ -127,6 +131,10 @@ template<class T1, class T2, class H, class P, class A>
|
||||
void pack(const std::unordered_map<T1,T2,H,P,A>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Key, class Value>
|
||||
void pack(const OrderedMap<Key,Value>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
void pack(const char* str, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
@@ -173,6 +181,10 @@ template<class T1, class T2, class H, class P, class A>
|
||||
void unpack(std::unordered_map<T1,T2,H,P,A>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Key, class Value>
|
||||
void unpack(OrderedMap<Key,Value>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
void unpack(char* str, std::size_t length, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user