mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for Phases
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#endif
|
||||
|
||||
#include "ParallelRestart.hpp"
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/InitConfig/FoamConfig.hpp>
|
||||
@@ -385,6 +386,11 @@ std::size_t packSize(const IOConfig& data, Dune::MPIHelper::MPICommunicator comm
|
||||
packSize(data.getEclCompatibleRST(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const Phases& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getBits(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@@ -760,6 +766,12 @@ void pack(const IOConfig& data, std::vector<char>& buffer, int& position,
|
||||
pack(data.getEclCompatibleRST(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const Phases& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getBits(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@@ -1219,6 +1231,14 @@ void unpack(IOConfig& data, std::vector<char>& buffer, int& position,
|
||||
no_sim, base_name, ecl_compatible_rst);
|
||||
}
|
||||
|
||||
void unpack(Phases& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
unsigned long bits;
|
||||
unpack(bits, buffer, position, comm);
|
||||
data = Phases(std::bitset<NUM_PHASES_IN_ENUM>(bits));
|
||||
}
|
||||
|
||||
} // end namespace Mpi
|
||||
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
|
||||
const std::vector<Opm::RestartKey>& solutionKeys,
|
||||
|
||||
@@ -49,6 +49,7 @@ class InitConfig;
|
||||
class IOConfig;
|
||||
class NNC;
|
||||
struct NNCdata;
|
||||
class Phases;
|
||||
class RestartConfig;
|
||||
class RestartSchedule;
|
||||
class Rock2dTable;
|
||||
@@ -251,6 +252,7 @@ ADD_PACK_PROTOTYPES(InitConfig)
|
||||
ADD_PACK_PROTOTYPES(IOConfig)
|
||||
ADD_PACK_PROTOTYPES(NNC)
|
||||
ADD_PACK_PROTOTYPES(NNCdata)
|
||||
ADD_PACK_PROTOTYPES(Phases)
|
||||
ADD_PACK_PROTOTYPES(RestartConfig)
|
||||
ADD_PACK_PROTOTYPES(RestartKey)
|
||||
ADD_PACK_PROTOTYPES(RestartSchedule)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/simulators/utils/ParallelRestart.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp>
|
||||
@@ -547,6 +548,17 @@ BOOST_AUTO_TEST_CASE(IOConfig)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Phases)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
Opm::Phases val1(true, true, true, false, true, false, true, 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;
|
||||
|
||||
Reference in New Issue
Block a user