mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-09-05 04:40:19 -05:00
add mpi serialization for DeckRecord
This commit is contained in:
@@ -1474,6 +1474,12 @@ std::size_t packSize(const DeckItem& data,
|
|||||||
packSize(data.defaultDimensions(), comm);
|
packSize(data.defaultDimensions(), comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::size_t packSize(const DeckRecord& data,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
return packSize(data.getItems(), comm);
|
||||||
|
}
|
||||||
|
|
||||||
////// pack routines
|
////// pack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -2975,6 +2981,13 @@ void pack(const DeckItem& data,
|
|||||||
pack(data.defaultDimensions(), buffer, position, comm);
|
pack(data.defaultDimensions(), buffer, position, comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pack(const DeckRecord& data,
|
||||||
|
std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
pack(data.getItems(), buffer, position, comm);
|
||||||
|
}
|
||||||
|
|
||||||
/// unpack routines
|
/// unpack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -5087,6 +5100,15 @@ void unpack(DeckItem& data,
|
|||||||
valueStatus, rawData, activeDimensions, defaultDimensions);
|
valueStatus, rawData, activeDimensions, defaultDimensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void unpack(DeckRecord& data,
|
||||||
|
std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
std::vector<DeckItem> items;
|
||||||
|
unpack(items, buffer, position, comm);
|
||||||
|
data = DeckRecord(std::move(items));
|
||||||
|
}
|
||||||
|
|
||||||
#define INSTANTIATE_PACK_VECTOR(T) \
|
#define INSTANTIATE_PACK_VECTOR(T) \
|
||||||
template std::size_t packSize(const std::vector<T>& data, \
|
template std::size_t packSize(const std::vector<T>& data, \
|
||||||
Dune::MPIHelper::MPICommunicator comm); \
|
Dune::MPIHelper::MPICommunicator comm); \
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ class Aqudims;
|
|||||||
class ColumnSchema;
|
class ColumnSchema;
|
||||||
class Connection;
|
class Connection;
|
||||||
class DeckItem;
|
class DeckItem;
|
||||||
|
class DeckRecord;
|
||||||
class DENSITYRecord;
|
class DENSITYRecord;
|
||||||
class DensityTable;
|
class DensityTable;
|
||||||
class Dimension;
|
class Dimension;
|
||||||
@@ -594,6 +595,7 @@ ADD_PACK_PROTOTYPES(data::Solution)
|
|||||||
ADD_PACK_PROTOTYPES(data::Well)
|
ADD_PACK_PROTOTYPES(data::Well)
|
||||||
ADD_PACK_PROTOTYPES(data::WellRates)
|
ADD_PACK_PROTOTYPES(data::WellRates)
|
||||||
ADD_PACK_PROTOTYPES(DeckItem)
|
ADD_PACK_PROTOTYPES(DeckItem)
|
||||||
|
ADD_PACK_PROTOTYPES(DeckRecord)
|
||||||
ADD_PACK_PROTOTYPES(DENSITYRecord)
|
ADD_PACK_PROTOTYPES(DENSITYRecord)
|
||||||
ADD_PACK_PROTOTYPES(DensityTable)
|
ADD_PACK_PROTOTYPES(DensityTable)
|
||||||
ADD_PACK_PROTOTYPES(Dimension)
|
ADD_PACK_PROTOTYPES(Dimension)
|
||||||
|
|||||||
@@ -365,6 +365,26 @@ Opm::GuideRateConfig::WellTarget getGuideRateConfigWell()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Opm::DeckRecord getDeckRecord()
|
||||||
|
{
|
||||||
|
Opm::DeckItem item1({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)});
|
||||||
|
|
||||||
|
Opm::DeckItem item2({1.0}, {2}, {"test3"}, {Opm::UDAValue(4)},
|
||||||
|
Opm::type_tag::string, "test6",
|
||||||
|
{Opm::value::status::deck_value},
|
||||||
|
true,
|
||||||
|
{Opm::Dimension("DimensionLess", 7.0, 8.0)},
|
||||||
|
{Opm::Dimension("Metric", 10.0, 11.0)});
|
||||||
|
|
||||||
|
return Opm::DeckRecord({item1, item2});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1998,6 +2018,17 @@ BOOST_AUTO_TEST_CASE(DeckItem)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(DeckRecord)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_MPI
|
||||||
|
Opm::DeckRecord val1 = getDeckRecord();
|
||||||
|
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()
|
bool init_unit_test_func()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user