Merge pull request #2414 from joakim-hove/serialize-dimension

Update serialization of Dimension class
This commit is contained in:
Joakim Hove 2020-03-09 13:28:15 +01:00 committed by GitHub
commit bbbf3c42fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 13 deletions

View File

@ -1227,8 +1227,7 @@ std::size_t packSize(const std::unique_ptr<T>& data,
std::size_t packSize(const Dimension& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getName(), comm) +
packSize(data.getSIScalingRaw(), comm) +
return packSize(data.getSIScalingRaw(), comm) +
packSize(data.getSIOffset(), comm);
}
@ -2867,7 +2866,6 @@ void pack(const Dimension& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getName(), buffer, position, comm);
pack(data.getSIScalingRaw(), buffer, position, comm);
pack(data.getSIOffset(), buffer, position, comm);
}
@ -5025,13 +5023,11 @@ void unpack(Dimension& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::string name;
double siScaling, siOffset;
unpack(name, buffer, position, comm);
unpack(siScaling, buffer, position, comm);
unpack(siOffset, buffer, position, comm);
data = Dimension(name, siScaling, siOffset, false);
data = Dimension(siScaling, siOffset);
}
void unpack(UnitSystem& data,

View File

@ -424,15 +424,15 @@ Opm::DeckRecord getDeckRecord()
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::Dimension(7.0, 8.0)},
{Opm::Dimension(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)});
{Opm::Dimension(7.0, 8.0)},
{Opm::Dimension(10.0, 11.0)});
return Opm::DeckRecord({item1, item2});
}
@ -1520,7 +1520,7 @@ BOOST_AUTO_TEST_CASE(Segment)
BOOST_AUTO_TEST_CASE(Dimension)
{
#ifdef HAVE_MPI
Opm::Dimension val1("test", 1.0, 2.0);
Opm::Dimension val1(1.0, 2.0);
auto val2 = PackUnpack(val1);
DO_CHECKS(Dimension)
#endif
@ -1905,8 +1905,8 @@ BOOST_AUTO_TEST_CASE(DeckItem)
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::Dimension(7.0, 8.0)},
{Opm::Dimension(10.0, 11.0)});
auto val2 = PackUnpack(val1);
DO_CHECKS(DeckItem)