add mpi serialization for WList

This commit is contained in:
Arne Morten Kvarving
2019-12-11 14:07:47 +01:00
parent 9fec893834
commit c2bff16e75
3 changed files with 37 additions and 0 deletions

View File

@@ -43,6 +43,7 @@
#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/Schedule/Well/WList.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>
@@ -1263,6 +1264,12 @@ std::size_t packSize(const Group& data,
packSize(data.productionProperties(), comm);
}
std::size_t packSize(const WList& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.wellList(), comm);
}
////// pack routines
template<class T>
@@ -2542,6 +2549,13 @@ void pack(const Group& data,
pack(data.productionProperties(), buffer, position, comm);
}
void pack(const WList& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.wellList(), buffer, position, comm);
}
/// unpack routines
template<class T>
@@ -4348,6 +4362,15 @@ void unpack(Group& data,
injection, production);
}
void unpack(WList& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
WList::storage ddata;
unpack(ddata, buffer, position, comm);
data = WList(ddata);
}
#define INSTANTIATE_PACK_VECTOR(T) \
template std::size_t packSize(const std::vector<T>& data, \
Dune::MPIHelper::MPICommunicator comm); \

View File

@@ -129,6 +129,7 @@ class WellPolymerProperties;
class WellSegmentDims;
class WellSegments;
class WellTracerProperties;
class WList;
namespace Mpi
{
@@ -648,6 +649,7 @@ ADD_PACK_PROTOTYPES(WellSegments)
ADD_PACK_PROTOTYPES(WellTestConfig)
ADD_PACK_PROTOTYPES(WellTestConfig::WTESTWell)
ADD_PACK_PROTOTYPES(WellTracerProperties)
ADD_PACK_PROTOTYPES(WList)
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,

View File

@@ -50,6 +50,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WList.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>
@@ -1638,6 +1639,17 @@ BOOST_AUTO_TEST_CASE(Group)
}
BOOST_AUTO_TEST_CASE(WList)
{
#ifdef HAVE_MPI
Opm::WList val1({"test1", "test2", "test3"});
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;