add mpi serialization for WellTracerProperties

This commit is contained in:
Arne Morten Kvarving
2019-12-09 15:25:17 +01:00
parent 072a2d748f
commit cebb19ad01
3 changed files with 37 additions and 0 deletions

View File

@@ -38,6 +38,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellFoamProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp>
@@ -951,6 +952,12 @@ std::size_t packSize(const WellTestConfig& data,
return packSize(data.getWells(), comm);
}
std::size_t packSize(const WellTracerProperties& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getConcentrations(), comm);
}
////// pack routines
template<class T>
@@ -1910,6 +1917,13 @@ void pack(const WellTestConfig& data,
pack(data.getWells(), buffer, position, comm);
}
void pack(const WellTracerProperties& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getConcentrations(), buffer, position, comm);
}
/// unpack routines
template<class T>
@@ -3214,6 +3228,15 @@ void unpack(WellTestConfig& data,
data = WellTestConfig(ddata);
}
void unpack(WellTracerProperties& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
WellTracerProperties::ConcentrationMap ddata;
unpack(ddata, buffer, position, comm);
data = WellTracerProperties(ddata);
}
#define INSTANTIATE_PACK_VECTOR(T) \
template std::size_t packSize(const std::vector<T>& data, \
Dune::MPIHelper::MPICommunicator comm); \

View File

@@ -115,6 +115,7 @@ class Welldims;
class WellFoamProperties;
class WellPolymerProperties;
class WellSegmentDims;
class WellTracerProperties;
namespace Mpi
{
@@ -579,6 +580,7 @@ ADD_PACK_PROTOTYPES(WellPolymerProperties)
ADD_PACK_PROTOTYPES(WellSegmentDims)
ADD_PACK_PROTOTYPES(WellTestConfig)
ADD_PACK_PROTOTYPES(WellTestConfig::WTESTWell)
ADD_PACK_PROTOTYPES(WellTracerProperties)
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,

View File

@@ -44,6 +44,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellFoamProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp>
@@ -1336,6 +1337,17 @@ BOOST_AUTO_TEST_CASE(WellFoamProperties)
}
BOOST_AUTO_TEST_CASE(WellTracerProperties)
{
#ifdef HAVE_MPI
Opm::WellTracerProperties val1({{"test", 1.0}, {"test2", 2.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;