mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-19 16:22:57 -06:00
add mpi serialization for RFTConfig
This commit is contained in:
parent
b925d75def
commit
55630acded
@ -36,6 +36,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
||||
@ -1447,6 +1448,17 @@ std::size_t packSize(const GConSump& data,
|
||||
return packSize(data.getGroups(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const RFTConfig& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.timeMap(), comm) +
|
||||
packSize(data.wellOpenRftTime(), comm) +
|
||||
packSize(data.wellOpenRftName(), comm) +
|
||||
packSize(data.wellOpen(), comm) +
|
||||
packSize(data.rftConfig(), comm) +
|
||||
packSize(data.pltConfig(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -2920,6 +2932,18 @@ void pack(const GConSump& data,
|
||||
pack(data.getGroups(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const RFTConfig& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.timeMap(), buffer, position, comm);
|
||||
pack(data.wellOpenRftTime(), buffer, position, comm);
|
||||
pack(data.wellOpenRftName(), buffer, position, comm);
|
||||
pack(data.wellOpen(), buffer, position, comm);
|
||||
pack(data.rftConfig(), buffer, position, comm);
|
||||
pack(data.pltConfig(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -4982,6 +5006,27 @@ void unpack(GConSump& data,
|
||||
data = GConSump(groups);
|
||||
}
|
||||
|
||||
void unpack(RFTConfig& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
TimeMap timeMap;
|
||||
std::pair<bool, std::size_t> wellOpenRftTime;
|
||||
std::unordered_set<std::string> wellOpenRftName;
|
||||
std::unordered_map<std::string, std::size_t> wellOpen;
|
||||
RFTConfig::RFTMap rftConfig;
|
||||
RFTConfig::PLTMap pltConfig;
|
||||
|
||||
unpack(timeMap, buffer, position, comm);
|
||||
unpack(wellOpenRftTime, buffer, position, comm);
|
||||
unpack(wellOpenRftName, buffer, position, comm);
|
||||
unpack(wellOpen, buffer, position, comm);
|
||||
unpack(rftConfig, buffer, position, comm);
|
||||
unpack(pltConfig, buffer, position, comm);
|
||||
data = RFTConfig(timeMap, wellOpenRftTime, wellOpenRftName,
|
||||
wellOpen, rftConfig, pltConfig);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PACK_VECTOR(T) \
|
||||
template std::size_t packSize(const std::vector<T>& data, \
|
||||
Dune::MPIHelper::MPICommunicator comm); \
|
||||
|
@ -99,6 +99,7 @@ class PvtwTable;
|
||||
class Regdims;
|
||||
class RestartConfig;
|
||||
class RestartSchedule;
|
||||
class RFTConfig;
|
||||
class ROCKRecord;
|
||||
class RockTable;
|
||||
class Rock2dTable;
|
||||
@ -636,6 +637,7 @@ ADD_PACK_PROTOTYPES(RestartConfig)
|
||||
ADD_PACK_PROTOTYPES(RestartKey)
|
||||
ADD_PACK_PROTOTYPES(RestartSchedule)
|
||||
ADD_PACK_PROTOTYPES(RestartValue)
|
||||
ADD_PACK_PROTOTYPES(RFTConfig)
|
||||
ADD_PACK_PROTOTYPES(ROCKRecord)
|
||||
ADD_PACK_PROTOTYPES(RockTable)
|
||||
ADD_PACK_PROTOTYPES(Rock2dTable)
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp>
|
||||
@ -1963,6 +1964,22 @@ BOOST_AUTO_TEST_CASE(GConSump)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(RFTConfig)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::RFTConfig val1(getTimeMap(),
|
||||
{true, 1},
|
||||
{"test1", "test2"},
|
||||
{{"test3", 2}},
|
||||
{{"test1", {{{Opm::RFTConfig::RFT::TIMESTEP, 3}}, 4}}},
|
||||
{{"test2", {{{Opm::RFTConfig::PLT::REPT, 5}}, 6}}});
|
||||
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