add mpi serialization for IOrderedSet

This commit is contained in:
Arne Morten Kvarving
2019-12-11 13:29:06 +01:00
parent 4e14746405
commit 2df5aaf876
2 changed files with 40 additions and 0 deletions

View File

@@ -64,6 +64,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/TableContainer.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp>
#include <opm/parser/eclipse/EclipseState/Util/IOrderSet.hpp>
#include <dune/common/parallel/mpitraits.hh>
#define HANDLE_AS_POD(T) \
@@ -1206,6 +1207,14 @@ std::size_t packSize(const Well& data,
return size;
}
template<class T>
std::size_t packSize(const IOrderSet<T>& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.index(), comm) +
packSize(data.data(), comm);
}
////// pack routines
template<class T>
@@ -2426,6 +2435,14 @@ void pack(const Well& data,
pack(data.getSegments(), buffer, position, comm);
}
template<class T>
void pack(const IOrderSet<T>& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.index(), buffer, position, comm);
pack(data.data(), buffer, position, comm);
}
/// unpack routines
template<class T>
@@ -4152,6 +4169,17 @@ void unpack(Well& data,
connection, production, injection, segments);
}
template<class T>
void unpack(IOrderSet<T>& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
typename IOrderSet<T>::index_type index;
typename IOrderSet<T>::storage_type storage;
unpack(index, buffer, position, comm);
unpack(storage, buffer, position, comm);
data = IOrderSet<T>(index, storage);
}
#define INSTANTIATE_PACK_VECTOR(T) \
template std::size_t packSize(const std::vector<T>& data, \
Dune::MPIHelper::MPICommunicator comm); \

View File

@@ -74,6 +74,7 @@ class FoamConfig;
class FoamData;
class InitConfig;
class IOConfig;
template<class T> class IOrderSet;
class JFunc;
class MessageLimits;
class MLimits;
@@ -246,6 +247,9 @@ std::size_t packSize(const ConstantCompressibilityWaterPvt<Scalar>& data,
template<class Scalar>
std::size_t packSize(const WaterPvtThermal<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
template<class T>
std::size_t packSize(const IOrderSet<T>& data, Dune::MPIHelper::MPICommunicator comm);
////// pack routines
template<class T>
@@ -389,6 +393,10 @@ template<class Scalar>
void pack(const WaterPvtThermal<Scalar>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm);
template<class T>
void pack(const IOrderSet<T>& 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);
@@ -531,6 +539,10 @@ template<class Scalar>
void unpack(ConstantCompressibilityWaterPvt<Scalar>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm);
template<class T>
void unpack(IOrderSet<T>& 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);