mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for IOConfig
This commit is contained in:
parent
3470760307
commit
2a2effd54b
@ -26,6 +26,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/IOConfig/IOConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
@ -367,6 +368,23 @@ std::size_t packSize(const RestartConfig& data, Dune::MPIHelper::MPICommunicator
|
||||
packSize(data.saveKeywords(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const IOConfig& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getWriteINITFile(), comm) +
|
||||
packSize(data.getWriteEGRIDFile(), comm) +
|
||||
packSize(data.getUNIFIN(), comm) +
|
||||
packSize(data.getUNIFOUT(), comm) +
|
||||
packSize(data.getFMTIN(), comm) +
|
||||
packSize(data.getFMTOUT(), comm) +
|
||||
packSize(data.getFirstRestartStep(), comm) +
|
||||
packSize(data.getDeckFileName(), comm) +
|
||||
packSize(data.getOutputEnabled(), comm) +
|
||||
packSize(data.getOutputDir(), comm) +
|
||||
packSize(data.getNoSim(), comm) +
|
||||
packSize(data.getBaseName(), comm) +
|
||||
packSize(data.getEclCompatibleRST(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -724,6 +742,24 @@ void pack(const RestartConfig& data, std::vector<char>& buffer, int& position,
|
||||
pack(data.saveKeywords(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const IOConfig& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getWriteINITFile(), buffer, position, comm);
|
||||
pack(data.getWriteEGRIDFile(), buffer, position, comm);
|
||||
pack(data.getUNIFIN(), buffer, position, comm);
|
||||
pack(data.getUNIFOUT(), buffer, position, comm);
|
||||
pack(data.getFMTIN(), buffer, position, comm);
|
||||
pack(data.getFMTOUT(), buffer, position, comm);
|
||||
pack(data.getFirstRestartStep(), buffer, position, comm);
|
||||
pack(data.getDeckFileName(), buffer, position, comm);
|
||||
pack(data.getOutputEnabled(), buffer, position, comm);
|
||||
pack(data.getOutputDir(), buffer, position, comm);
|
||||
pack(data.getNoSim(), buffer, position, comm);
|
||||
pack(data.getBaseName(), buffer, position, comm);
|
||||
pack(data.getEclCompatibleRST(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -1157,6 +1193,32 @@ void unpack(RestartConfig& data, std::vector<char>& buffer, int& position,
|
||||
restart_keyw, save_keyw);
|
||||
}
|
||||
|
||||
void unpack(IOConfig& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
bool write_init, write_egrid, unifin, unifout, fmtin, fmtout;
|
||||
int firstRestartStep;
|
||||
std::string deck_name, output_dir, base_name;
|
||||
bool output_enabled, no_sim, ecl_compatible_rst;
|
||||
|
||||
unpack(write_init, buffer, position, comm);
|
||||
unpack(write_egrid, buffer, position, comm);
|
||||
unpack(unifin, buffer, position, comm);
|
||||
unpack(unifout, buffer, position, comm);
|
||||
unpack(fmtin, buffer, position, comm);
|
||||
unpack(fmtout, buffer, position, comm);
|
||||
unpack(firstRestartStep, buffer, position, comm);
|
||||
unpack(deck_name, buffer, position, comm);
|
||||
unpack(output_enabled, buffer, position, comm);
|
||||
unpack(output_dir, buffer, position, comm);
|
||||
unpack(no_sim, buffer, position, comm);
|
||||
unpack(base_name, buffer, position, comm);
|
||||
unpack(ecl_compatible_rst, buffer, position, comm);
|
||||
data = IOConfig(write_init, write_egrid, unifin, unifout, fmtin, fmtout,
|
||||
firstRestartStep, deck_name, output_enabled, output_dir,
|
||||
no_sim, base_name, ecl_compatible_rst);
|
||||
}
|
||||
|
||||
} // end namespace Mpi
|
||||
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
|
||||
const std::vector<Opm::RestartKey>& solutionKeys,
|
||||
|
@ -46,6 +46,7 @@ class EquilRecord;
|
||||
class FoamConfig;
|
||||
class FoamData;
|
||||
class InitConfig;
|
||||
class IOConfig;
|
||||
class NNC;
|
||||
struct NNCdata;
|
||||
class RestartConfig;
|
||||
@ -247,6 +248,7 @@ ADD_PACK_PROTOTYPES(EquilRecord)
|
||||
ADD_PACK_PROTOTYPES(FoamConfig)
|
||||
ADD_PACK_PROTOTYPES(FoamData)
|
||||
ADD_PACK_PROTOTYPES(InitConfig)
|
||||
ADD_PACK_PROTOTYPES(IOConfig)
|
||||
ADD_PACK_PROTOTYPES(NNC)
|
||||
ADD_PACK_PROTOTYPES(NNCdata)
|
||||
ADD_PACK_PROTOTYPES(RestartConfig)
|
||||
|
@ -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/IOConfig/IOConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
|
||||
@ -534,6 +535,18 @@ BOOST_AUTO_TEST_CASE(RestartConfig)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(IOConfig)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
Opm::IOConfig val1(true, false, true, false, false, true, 1, "test1", true,
|
||||
"test2", true, "test3", false);
|
||||
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