mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for DeckItem
This commit is contained in:
parent
55630acded
commit
13de64985a
@ -1459,6 +1459,21 @@ std::size_t packSize(const RFTConfig& data,
|
||||
packSize(data.pltConfig(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const DeckItem& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.dVal(), comm) +
|
||||
packSize(data.iVal(), comm) +
|
||||
packSize(data.sVal(), comm) +
|
||||
packSize(data.uVal(), comm) +
|
||||
packSize(data.getType(), comm) +
|
||||
packSize(data.name(), comm) +
|
||||
packSize(data.valueStatus(), comm) +
|
||||
packSize(data.rawData(), comm) +
|
||||
packSize(data.activeDimensions(), comm) +
|
||||
packSize(data.defaultDimensions(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -2944,6 +2959,22 @@ void pack(const RFTConfig& data,
|
||||
pack(data.pltConfig(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const DeckItem& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.dVal(), buffer, position, comm);
|
||||
pack(data.iVal(), buffer, position, comm);
|
||||
pack(data.sVal(), buffer, position, comm);
|
||||
pack(data.uVal(), buffer, position, comm);
|
||||
pack(data.getType(), buffer, position, comm);
|
||||
pack(data.name(), buffer, position, comm);
|
||||
pack(data.valueStatus(), buffer, position, comm);
|
||||
pack(data.rawData(), buffer, position, comm);
|
||||
pack(data.activeDimensions(), buffer, position, comm);
|
||||
pack(data.defaultDimensions(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -5027,6 +5058,35 @@ void unpack(RFTConfig& data,
|
||||
wellOpen, rftConfig, pltConfig);
|
||||
}
|
||||
|
||||
|
||||
void unpack(DeckItem& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::vector<double> dVal;
|
||||
std::vector<int> iVal;
|
||||
std::vector<std::string> sVal;
|
||||
std::vector<UDAValue> uVal;
|
||||
type_tag type;
|
||||
std::string name;
|
||||
std::vector<value::status> valueStatus;
|
||||
bool rawData;
|
||||
std::vector<Dimension> activeDimensions, defaultDimensions;
|
||||
|
||||
unpack(dVal, buffer, position, comm);
|
||||
unpack(iVal, buffer, position, comm);
|
||||
unpack(sVal, buffer, position, comm);
|
||||
unpack(uVal, buffer, position, comm);
|
||||
unpack(type, buffer, position, comm);
|
||||
unpack(name, buffer, position, comm);
|
||||
unpack(valueStatus, buffer, position, comm);
|
||||
unpack(rawData, buffer, position, comm);
|
||||
unpack(activeDimensions, buffer, position, comm);
|
||||
unpack(defaultDimensions, buffer, position, comm);
|
||||
data = DeckItem(dVal, iVal, sVal, uVal, type, name,
|
||||
valueStatus, rawData, activeDimensions, defaultDimensions);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PACK_VECTOR(T) \
|
||||
template std::size_t packSize(const std::vector<T>& data, \
|
||||
Dune::MPIHelper::MPICommunicator comm); \
|
||||
|
@ -66,6 +66,7 @@ class Actdims;
|
||||
class Aqudims;
|
||||
class ColumnSchema;
|
||||
class Connection;
|
||||
class DeckItem;
|
||||
class DENSITYRecord;
|
||||
class DensityTable;
|
||||
class Dimension;
|
||||
@ -592,6 +593,7 @@ ADD_PACK_PROTOTYPES(data::Segment)
|
||||
ADD_PACK_PROTOTYPES(data::Solution)
|
||||
ADD_PACK_PROTOTYPES(data::Well)
|
||||
ADD_PACK_PROTOTYPES(data::WellRates)
|
||||
ADD_PACK_PROTOTYPES(DeckItem)
|
||||
ADD_PACK_PROTOTYPES(DENSITYRecord)
|
||||
ADD_PACK_PROTOTYPES(DensityTable)
|
||||
ADD_PACK_PROTOTYPES(Dimension)
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <opm/material/fluidsystems/blackoilpvt/DryGasPvt.hpp>
|
||||
#include <opm/material/fluidsystems/blackoilpvt/SolventPvt.hpp>
|
||||
#include <opm/material/fluidsystems/blackoilpvt/WetGasPvt.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
@ -1980,6 +1981,23 @@ BOOST_AUTO_TEST_CASE(RFTConfig)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DeckItem)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::DeckItem val1({1.0}, {2}, {"test3"}, {Opm::UDAValue(4)},
|
||||
Opm::type_tag::string, "test5",
|
||||
{Opm::value::status::deck_value},
|
||||
true,
|
||||
{Opm::Dimension("DimensionLess", 7.0, 8.0)},
|
||||
{Opm::Dimension("Metric", 10.0, 11.0)});
|
||||
|
||||
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