add mpi serialization for Well::WellInjectionProperties

This commit is contained in:
Arne Morten Kvarving
2019-12-10 13:31:55 +01:00
parent 89efc489e4
commit 9915b046eb
3 changed files with 79 additions and 0 deletions

View File

@@ -992,6 +992,24 @@ std::size_t packSize(const Connection& data,
packSize(data.wellPi(), comm);
}
std::size_t packSize(const Well::WellInjectionProperties& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.name, comm) +
packSize(data.surfaceInjectionRate, comm) +
packSize(data.reservoirInjectionRate, comm) +
packSize(data.BHPLimit, comm) +
packSize(data.THPLimit, comm) +
packSize(data.temperature, comm) +
packSize(data.BHPH, comm) +
packSize(data.THPH, comm) +
packSize(data.VFPTableNumber, comm) +
packSize(data.predictionMode, comm) +
packSize(data.injectionControls, comm) +
packSize(data.injectorType, comm) +
packSize(data.controlMode, comm);
}
////// pack routines
template<class T>
@@ -1995,6 +2013,25 @@ void pack(const Connection& data,
pack(data.wellPi(), buffer, position, comm);
}
void pack(const Well::WellInjectionProperties& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.name, buffer, position, comm);
pack(data.surfaceInjectionRate, buffer, position, comm);
pack(data.reservoirInjectionRate, buffer, position, comm);
pack(data.BHPLimit, buffer, position, comm);
pack(data.THPLimit, buffer, position, comm);
pack(data.temperature, buffer, position, comm);
pack(data.BHPH, buffer, position, comm);
pack(data.THPH, buffer, position, comm);
pack(data.VFPTableNumber, buffer, position, comm);
pack(data.predictionMode, buffer, position, comm);
pack(data.injectionControls, buffer, position, comm);
pack(data.injectorType, buffer, position, comm);
pack(data.controlMode, buffer, position, comm);
}
/// unpack routines
template<class T>
@@ -3370,6 +3407,25 @@ void unpack(Connection& data,
segment, wellPi);
}
void unpack(Well::WellInjectionProperties& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.name, buffer, position, comm);
unpack(data.surfaceInjectionRate, buffer, position, comm);
unpack(data.reservoirInjectionRate, buffer, position, comm);
unpack(data.BHPLimit, buffer, position, comm);
unpack(data.THPLimit, buffer, position, comm);
unpack(data.temperature, buffer, position, comm);
unpack(data.BHPH, buffer, position, comm);
unpack(data.THPH, buffer, position, comm);
unpack(data.VFPTableNumber, buffer, position, comm);
unpack(data.predictionMode, buffer, position, comm);
unpack(data.injectionControls, buffer, position, comm);
unpack(data.injectorType, buffer, position, comm);
unpack(data.controlMode, buffer, position, comm);
}
#define INSTANTIATE_PACK_VECTOR(T) \
template std::size_t packSize(const std::vector<T>& data, \
Dune::MPIHelper::MPICommunicator comm); \

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/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp>
@@ -578,6 +579,7 @@ ADD_PACK_PROTOTYPES(VISCREFRecord)
ADD_PACK_PROTOTYPES(ViscrefTable)
ADD_PACK_PROTOTYPES(WATDENTRecord)
ADD_PACK_PROTOTYPES(WatdentTable)
ADD_PACK_PROTOTYPES(Well::WellInjectionProperties)
ADD_PACK_PROTOTYPES(Welldims)
ADD_PACK_PROTOTYPES(WellFoamProperties)
ADD_PACK_PROTOTYPES(WellPolymerProperties)

View File

@@ -1379,6 +1379,27 @@ BOOST_AUTO_TEST_CASE(Connection)
}
BOOST_AUTO_TEST_CASE(WellInjectionProperties)
{
#ifdef HAVE_MPI
Opm::Well::WellInjectionProperties val1("test",
Opm::UDAValue(1.0),
Opm::UDAValue("test"),
Opm::UDAValue(2.0),
Opm::UDAValue(3.0),
4.0, 5.0, 6.0,
7,
true,
8,
Opm::Well::InjectorType::OIL,
Opm::Well::InjectorCMode::BHP);
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;