add mpi serialization for WListManager

This commit is contained in:
Arne Morten Kvarving 2019-12-11 14:17:10 +01:00
parent c2bff16e75
commit b2d454eaf2
3 changed files with 40 additions and 0 deletions

View File

@ -44,6 +44,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/WList.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.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>
@ -1270,6 +1271,12 @@ std::size_t packSize(const WList& data,
return packSize(data.wellList(), comm);
}
std::size_t packSize(const WListManager& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.lists(), comm);
}
////// pack routines
template<class T>
@ -2556,6 +2563,13 @@ void pack(const WList& data,
pack(data.wellList(), buffer, position, comm);
}
void pack(const WListManager& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.lists(), buffer, position, comm);
}
/// unpack routines
template<class T>
@ -4371,6 +4385,15 @@ void unpack(WList& data,
data = WList(ddata);
}
void unpack(WListManager& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::map<std::string,WList> lists;
unpack(lists, buffer, position, comm);
data = WListManager(lists);
}
#define INSTANTIATE_PACK_VECTOR(T) \
template std::size_t packSize(const std::vector<T>& data, \
Dune::MPIHelper::MPICommunicator comm); \

View File

@ -130,6 +130,7 @@ class WellSegmentDims;
class WellSegments;
class WellTracerProperties;
class WList;
class WListManager;
namespace Mpi
{
@ -650,8 +651,10 @@ ADD_PACK_PROTOTYPES(WellTestConfig)
ADD_PACK_PROTOTYPES(WellTestConfig::WTESTWell)
ADD_PACK_PROTOTYPES(WellTracerProperties)
ADD_PACK_PROTOTYPES(WList)
ADD_PACK_PROTOTYPES(WListManager)
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys,
const std::vector<Opm::RestartKey>& extraKeys,

View File

@ -51,6 +51,7 @@
#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/Schedule/Well/WListManager.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>
@ -1650,6 +1651,19 @@ BOOST_AUTO_TEST_CASE(WList)
}
BOOST_AUTO_TEST_CASE(WListManager)
{
#ifdef HAVE_MPI
Opm::WList wl({"test1", "test2", "test3"});
std::map<std::string,Opm::WList> data{{"test", wl}, {"test2", wl}};
Opm::WListManager val1(data);
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;