add mpi serialization for InitConfig

This commit is contained in:
Arne Morten Kvarving
2019-11-29 14:14:47 +01:00
parent c113aa1a11
commit c011306ba7
3 changed files with 56 additions and 0 deletions

View File

@@ -25,6 +25,7 @@
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/FoamConfig.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
@@ -320,6 +321,16 @@ std::size_t packSize(const FoamConfig& data, Dune::MPIHelper::MPICommunicator co
return packSize(data.records(), comm);
}
std::size_t packSize(const InitConfig& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getEquil(), comm) +
packSize(data.getFoamConfig(), comm) +
packSize(data.filleps(), comm) +
packSize(data.restartRequested(), comm) +
packSize(data.getRestartStep(), comm) +
packSize(data.getRestartRootName(), comm);
}
////// pack routines
template<class T>
@@ -629,6 +640,17 @@ void pack(const FoamConfig& data, std::vector<char>& buffer, int& position,
pack(data.records(), buffer, position, comm);
}
void pack(const InitConfig& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getEquil(), buffer, position, comm);
pack(data.getFoamConfig(), buffer, position, comm);
pack(data.filleps(), buffer, position, comm);
pack(data.restartRequested(), buffer, position, comm);
pack(data.getRestartStep(), buffer, position, comm);
pack(data.getRestartRootName(), buffer, position, comm);
}
/// unpack routines
template<class T>
@@ -988,6 +1010,24 @@ void unpack(FoamConfig& data, std::vector<char>& buffer, int& position,
data = FoamConfig(records);
}
void unpack(InitConfig& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
Equil equil;
FoamConfig foam;
bool filleps, restartRequested;
int restartStep;
std::string restartRootName;
unpack(equil, buffer, position, comm);
unpack(foam, buffer, position, comm);
unpack(filleps, buffer, position, comm);
unpack(restartRequested, buffer, position, comm);
unpack(restartStep, buffer, position, comm);
unpack(restartRootName, buffer, position, comm);
data = InitConfig(equil, foam, filleps, restartRequested,
restartStep, restartRootName);
}
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys,

View File

@@ -43,6 +43,7 @@ class Equil;
class EquilRecord;
class FoamConfig;
class FoamData;
class InitConfig;
class NNC;
struct NNCdata;
class Rock2dTable;
@@ -229,6 +230,7 @@ ADD_PACK_PROTOTYPES(Equil)
ADD_PACK_PROTOTYPES(EquilRecord)
ADD_PACK_PROTOTYPES(FoamConfig)
ADD_PACK_PROTOTYPES(FoamData)
ADD_PACK_PROTOTYPES(InitConfig)
ADD_PACK_PROTOTYPES(NNC)
ADD_PACK_PROTOTYPES(NNCdata)
ADD_PACK_PROTOTYPES(RestartKey)