add mpi serialization for WellTestConfig::WTESTWell

This commit is contained in:
Arne Morten Kvarving
2019-12-09 11:07:37 +01:00
parent b4b8f17cf3
commit 5445e0e2d7
3 changed files with 50 additions and 0 deletions

View File

@@ -930,6 +930,17 @@ std::size_t packSize(const VFPProdTable& data,
packSize(double(), comm);
}
std::size_t packSize(const WellTestConfig::WTESTWell& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.name, comm) +
packSize(data.shut_reason, comm) +
packSize(data.test_interval, comm) +
packSize(data.num_test, comm) +
packSize(data.startup_time, comm) +
packSize(data.begin_report_step, comm);
}
////// pack routines
template<class T>
@@ -1870,6 +1881,18 @@ void pack(const VFPProdTable& data,
pack(*(data.getTable().data() + i), buffer, position, comm);
}
void pack(const WellTestConfig::WTESTWell& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.name, buffer, position, comm);
pack(data.shut_reason, buffer, position, comm);
pack(data.test_interval, buffer, position, comm);
pack(data.num_test, buffer, position, comm);
pack(data.startup_time, buffer, position, comm);
pack(data.begin_report_step, buffer, position, comm);
}
/// unpack routines
template<class T>
@@ -3153,7 +3176,20 @@ void unpack(VFPProdTable& data,
wfrAxis, gfrAxis, alqAxis, table);
}
void unpack(WellTestConfig::WTESTWell& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.name, buffer, position, comm);
unpack(data.shut_reason, buffer, position, comm);
unpack(data.test_interval, buffer, position, comm);
unpack(data.num_test, buffer, position, comm);
unpack(data.startup_time, buffer, position, comm);
unpack(data.begin_report_step, buffer, position, comm);
}
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys,
const std::vector<Opm::RestartKey>& extraKeys,

View File

@@ -42,6 +42,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp>
#include <dune/common/parallel/mpihelper.hh>
@@ -572,6 +573,7 @@ ADD_PACK_PROTOTYPES(WATDENTRecord)
ADD_PACK_PROTOTYPES(WatdentTable)
ADD_PACK_PROTOTYPES(Welldims)
ADD_PACK_PROTOTYPES(WellSegmentDims)
ADD_PACK_PROTOTYPES(WellTestConfig::WTESTWell)
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,

View File

@@ -1287,6 +1287,18 @@ BOOST_AUTO_TEST_CASE(VFPProdTable)
}
BOOST_AUTO_TEST_CASE(WTESTWell)
{
#ifdef HAVE_MPI
Opm::WellTestConfig::WTESTWell val1{"test", Opm::WellTestConfig::ECONOMIC,
1.0, 2, 3.0, 4};
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;