Merge pull request #2450 from akva2/serializer_summaryconfig

use eclmpiserializer for SummaryConfig broadcast
This commit is contained in:
Bård Skaflestad
2020-03-10 20:32:06 -05:00
committed by GitHub
4 changed files with 34 additions and 35 deletions

View File

@@ -110,6 +110,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp>
#include <opm/output/eclipse/RestartValue.hpp>
#include <opm/simulators/utils/ParallelRestart.hpp>
#include <ebos/eclmpiserializer.hh>
namespace {
@@ -543,6 +544,20 @@ std::tuple<T,int,int> PackUnpack(const T& in)
return std::make_tuple(out, pos1, pos2);
}
template<class T>
std::tuple<T,int,int> PackUnpack2(T& in)
{
auto comm = Dune::MPIHelper::getCollectiveCommunication();
Opm::EclMpiSerializer ser(comm);
ser.pack(in);
size_t pos1 = ser.position();
T out;
ser.unpack(out);
size_t pos2 = ser.position();
return std::make_tuple(out, pos1, pos2);
}
#define DO_CHECKS(TYPE_NAME) \
BOOST_CHECK_MESSAGE(std::get<1>(val2) == std::get<2>(val2), "Packed size differ from unpack size for " #TYPE_NAME); \
@@ -2187,7 +2202,7 @@ BOOST_AUTO_TEST_CASE(SummaryConfig)
.isUserDefined(true);
Opm::SummaryConfig val1({node}, {"test1", "test2"}, {"test3", "test4"});
auto val2 = PackUnpack(val1);
auto val2 = PackUnpack2(val1);
DO_CHECKS(SummaryConfig)
#endif
}