mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-03 19:00:29 -06:00
add mpi serialization for InitConfig
This commit is contained in:
parent
c113aa1a11
commit
c011306ba7
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -29,6 +29,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/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
|
||||
@ -452,6 +453,19 @@ BOOST_AUTO_TEST_CASE(FoamConfig)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(InitConfig)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
Opm::InitConfig val1(Opm::Equil({getEquilRecord(), getEquilRecord()}),
|
||||
Opm::FoamConfig({getFoamData(), getFoamData()}),
|
||||
true, true, 20, "test1");
|
||||
auto val2 = PackUnpack(val1);
|
||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool init_unit_test_func()
|
||||
{
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user