mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-10 02:05:34 -06:00
add mpi serialization for TransMult
This commit is contained in:
parent
b93efe29f8
commit
a9bc24618f
@ -1981,6 +1981,15 @@ std::size_t packSize(const EclipseConfig& data,
|
||||
packSize(data.restart(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const TransMult& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getSize(), comm) +
|
||||
packSize(data.getTrans(), comm) +
|
||||
packSize(data.getNames(), comm) +
|
||||
packSize(data.getScanner(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -3868,6 +3877,16 @@ void pack(const EclipseConfig& data,
|
||||
pack(data.restart(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const TransMult& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getSize(), buffer, position, comm);
|
||||
pack(data.getTrans(), buffer, position, comm);
|
||||
pack(data.getNames(), buffer, position, comm);
|
||||
pack(data.getScanner(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -6566,6 +6585,22 @@ void unpack(EclipseConfig& data,
|
||||
data = EclipseConfig(io, init, restart);
|
||||
}
|
||||
|
||||
void unpack(TransMult& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::array<size_t, 3> size;
|
||||
std::map<FaceDir::DirEnum, std::vector<double>> trans;
|
||||
std::map<FaceDir::DirEnum, std::string> names;
|
||||
MULTREGTScanner scanner;
|
||||
|
||||
unpack(size, buffer, position, comm);
|
||||
unpack(trans, buffer, position, comm);
|
||||
unpack(names, buffer, position, comm);
|
||||
unpack(scanner, buffer, position, comm);
|
||||
data = TransMult(size, trans, names, scanner);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PACK_VECTOR(...) \
|
||||
template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \
|
||||
Dune::MPIHelper::MPICommunicator comm); \
|
||||
|
@ -140,6 +140,7 @@ class TableManager;
|
||||
class TableSchema;
|
||||
class ThresholdPressure;
|
||||
class TimeStampUTC;
|
||||
class TransMult;
|
||||
class Tuning;
|
||||
class UDAValue;
|
||||
class UDQASTNode;
|
||||
@ -728,6 +729,7 @@ ADD_PACK_PROTOTYPES(ThresholdPressure)
|
||||
ADD_PACK_PROTOTYPES(TimeMap)
|
||||
ADD_PACK_PROTOTYPES(TimeMap::StepData)
|
||||
ADD_PACK_PROTOTYPES(TimeStampUTC)
|
||||
ADD_PACK_PROTOTYPES(TransMult)
|
||||
ADD_PACK_PROTOTYPES(Tuning)
|
||||
ADD_PACK_PROTOTYPES(UDAValue)
|
||||
ADD_PACK_PROTOTYPES(UDQActive)
|
||||
|
@ -2466,6 +2466,30 @@ BOOST_AUTO_TEST_CASE(EclipseConfig)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TransMult)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
std::vector<Opm::MULTREGTRecord> records{{1, 2, 3.0, 4, Opm::MULTREGT::ALL, "test1"}};
|
||||
std::map<std::pair<int, int>, int> searchRecord{{{5,6},0}};
|
||||
Opm::MULTREGTScanner::ExternalSearchMap searchMap;
|
||||
searchMap.insert({"test2", searchRecord});
|
||||
Opm::MULTREGTScanner scanner({1, 2, 3},
|
||||
records,
|
||||
searchMap,
|
||||
{{"test3", {7,8}}},
|
||||
"test4");
|
||||
|
||||
Opm::TransMult val1({1, 2, 3},
|
||||
{{Opm::FaceDir::YPlus, {4.0, 5.0}}},
|
||||
{{Opm::FaceDir::ZPlus, "test1"}},
|
||||
scanner);
|
||||
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