mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for EclipseConfig
This commit is contained in:
parent
ff8fac563f
commit
b93efe29f8
@ -1973,6 +1973,14 @@ std::size_t packSize(const MULTREGTScanner& data,
|
||||
packSize(data.getDefaultRegion(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const EclipseConfig& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.init(), comm) +
|
||||
packSize(data.io(), comm) +
|
||||
packSize(data.restart(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -3851,6 +3859,15 @@ void pack(const MULTREGTScanner& data,
|
||||
pack(data.getDefaultRegion(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const EclipseConfig& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.init(), buffer, position, comm);
|
||||
pack(data.io(), buffer, position, comm);
|
||||
pack(data.restart(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -6535,6 +6552,20 @@ void unpack(MULTREGTScanner& data,
|
||||
data = MULTREGTScanner(size, records, searchMap, regions, defaultRegion);
|
||||
}
|
||||
|
||||
void unpack(EclipseConfig& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
InitConfig init;
|
||||
IOConfig io;
|
||||
RestartConfig restart;
|
||||
|
||||
unpack(init, buffer, position, comm);
|
||||
unpack(io, buffer, position, comm);
|
||||
unpack(restart, buffer, position, comm);
|
||||
data = EclipseConfig(io, init, restart);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PACK_VECTOR(...) \
|
||||
template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \
|
||||
Dune::MPIHelper::MPICommunicator comm); \
|
||||
|
@ -84,6 +84,7 @@ class DENSITYRecord;
|
||||
class DensityTable;
|
||||
class Dimension;
|
||||
class EclHysterConfig;
|
||||
class EclipseConfig;
|
||||
class Eqldims;
|
||||
class EDITNNC;
|
||||
class EndpointScaling;
|
||||
@ -656,6 +657,7 @@ ADD_PACK_PROTOTYPES(DENSITYRecord)
|
||||
ADD_PACK_PROTOTYPES(DensityTable)
|
||||
ADD_PACK_PROTOTYPES(Dimension)
|
||||
ADD_PACK_PROTOTYPES(EclHysterConfig)
|
||||
ADD_PACK_PROTOTYPES(EclipseConfig)
|
||||
ADD_PACK_PROTOTYPES(EDITNNC)
|
||||
ADD_PACK_PROTOTYPES(EndpointScaling)
|
||||
ADD_PACK_PROTOTYPES(Equil)
|
||||
|
@ -2446,6 +2446,26 @@ BOOST_AUTO_TEST_CASE(MULTREGTScanner)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EclipseConfig)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::IOConfig io(true, false, true, false, false, true, 1, "test1", true,
|
||||
"test2", true, "test3", false);
|
||||
Opm::InitConfig init(Opm::Equil({getEquilRecord(), getEquilRecord()}),
|
||||
Opm::FoamConfig({getFoamData(), getFoamData()}),
|
||||
true, true, 20, "test1");
|
||||
Opm::DynamicState<Opm::RestartSchedule> rsched({Opm::RestartSchedule(1, 2, 3)}, 2);
|
||||
Opm::DynamicState<std::map<std::string,int>> rkw({{{"test",3}}}, 3);
|
||||
Opm::RestartConfig restart(getTimeMap(), 1, true, rsched, rkw, {false, true});
|
||||
Opm::EclipseConfig val1{io, init, restart};
|
||||
|
||||
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