add mpi serialization for DynamicVector

This commit is contained in:
Arne Morten Kvarving
2019-12-06 23:25:44 +01:00
parent 1e145194c4
commit 74aca3fefb
2 changed files with 34 additions and 0 deletions

View File

@@ -191,6 +191,12 @@ std::size_t packSize(const DynamicState<T>& data, Dune::MPIHelper::MPICommunicat
return packSize(data.data(), comm) + packSize(data.initialRange(), comm);
}
template<class T>
std::size_t packSize(const DynamicVector<T>& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.data(), comm);
}
std::size_t packSize(const char* str, Dune::MPIHelper::MPICommunicator comm)
{
#if HAVE_MPI
@@ -1016,6 +1022,13 @@ void pack(const DynamicState<T>& data, std::vector<char>& buffer, int& position,
pack(data.initialRange(), buffer, position, comm);
}
template<class T>
void pack(const DynamicVector<T>& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.data(), buffer, position, comm);
}
void pack(const char* str, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
@@ -1912,6 +1925,15 @@ void unpack(DynamicState<T>& data, std::vector<char>& buffer, int& position,
data = DynamicState<T>(ddata, initial_range);
}
template<class T>
void unpack(DynamicVector<T>& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<T> ddata;
unpack(ddata, buffer, position, comm);
data = DynamicVector<T>(ddata);
}
void unpack(char* str, std::size_t length, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{

View File

@@ -40,6 +40,7 @@
#include <opm/output/eclipse/EclipseIO.hpp>
#include <opm/output/eclipse/Summary.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp>
@@ -156,6 +157,9 @@ std::size_t packSize(const std::unordered_map<T1,T2,H,P,A>& data, Dune::MPIHelpe
template<class Key, class Value>
std::size_t packSize(const OrderedMap<Key,Value>& data, Dune::MPIHelper::MPICommunicator comm);
template<class T>
std::size_t packSize(const DynamicVector<T>& data, Dune::MPIHelper::MPICommunicator comm);
template<class T>
std::size_t packSize(const DynamicState<T>& data, Dune::MPIHelper::MPICommunicator comm);
@@ -273,6 +277,10 @@ template<class T>
void pack(const DynamicState<T>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm);
template<class T>
void pack(const DynamicVector<T>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm);
template<class Scalar>
void pack(const Tabulated1DFunction<Scalar>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm);
@@ -406,6 +414,10 @@ template<class T>
void unpack(DynamicState<T>& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm);
template<class T>
void unpack(DynamicVector<T>& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm);
template<class Scalar>
void unpack(Tabulated1DFunction<Scalar>& data, std::vector<char>& buffer,
int& position, Dune::MPIHelper::MPICommunicator comm);