mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-29 04:23:48 -06:00
add mpi serialization for SimulationConfig
This commit is contained in:
parent
c011306ba7
commit
498bee5310
@ -27,6 +27,7 @@
|
||||
#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/SimulationConfig.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>
|
||||
@ -331,6 +332,15 @@ std::size_t packSize(const InitConfig& data, Dune::MPIHelper::MPICommunicator co
|
||||
packSize(data.getRestartRootName(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const SimulationConfig& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getThresholdPressure(), comm) +
|
||||
packSize(data.useCPR(), comm) +
|
||||
packSize(data.hasDISGAS(), comm) +
|
||||
packSize(data.hasVAPOIL(), comm) +
|
||||
packSize(data.isThermal(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -651,6 +661,16 @@ void pack(const InitConfig& data, std::vector<char>& buffer, int& position,
|
||||
pack(data.getRestartRootName(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const SimulationConfig& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getThresholdPressure(), buffer, position, comm);
|
||||
pack(data.useCPR(), buffer, position, comm);
|
||||
pack(data.hasDISGAS(), buffer, position, comm);
|
||||
pack(data.hasVAPOIL(), buffer, position, comm);
|
||||
pack(data.isThermal(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -1028,6 +1048,19 @@ void unpack(InitConfig& data, std::vector<char>& buffer, int& position,
|
||||
restartStep, restartRootName);
|
||||
}
|
||||
|
||||
void unpack(SimulationConfig& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
ThresholdPressure thresholdPressure;
|
||||
bool useCPR, DISGAS, VAPOIL, isThermal;
|
||||
unpack(thresholdPressure, buffer, position, comm);
|
||||
unpack(useCPR, buffer, position, comm);
|
||||
unpack(DISGAS, buffer, position, comm);
|
||||
unpack(VAPOIL, buffer, position, comm);
|
||||
unpack(isThermal, buffer, position, comm);
|
||||
data = SimulationConfig(thresholdPressure, useCPR, DISGAS, VAPOIL, isThermal);
|
||||
}
|
||||
|
||||
} // end namespace Mpi
|
||||
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
|
||||
const std::vector<Opm::RestartKey>& solutionKeys,
|
||||
|
@ -48,6 +48,7 @@ class NNC;
|
||||
struct NNCdata;
|
||||
class Rock2dTable;
|
||||
class Rock2dtrTable;
|
||||
class SimulationConfig;
|
||||
class SimpleTable;
|
||||
class TableColumn;
|
||||
class TableContainer;
|
||||
@ -238,6 +239,7 @@ ADD_PACK_PROTOTYPES(RestartValue)
|
||||
ADD_PACK_PROTOTYPES(Rock2dTable)
|
||||
ADD_PACK_PROTOTYPES(Rock2dtrTable)
|
||||
ADD_PACK_PROTOTYPES(std::string)
|
||||
ADD_PACK_PROTOTYPES(SimulationConfig)
|
||||
ADD_PACK_PROTOTYPES(SimpleTable)
|
||||
ADD_PACK_PROTOTYPES(TableColumn)
|
||||
ADD_PACK_PROTOTYPES(TableContainer)
|
||||
|
@ -30,6 +30,7 @@
|
||||
#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/SimulationConfig.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>
|
||||
@ -466,6 +467,17 @@ BOOST_AUTO_TEST_CASE(InitConfig)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfig)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
Opm::SimulationConfig val1(getThresholdPressure(), false, true, false, true);
|
||||
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