mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-19 16:32:56 -06:00
add mpi serialization for UDQFunction
This commit is contained in:
parent
b2d454eaf2
commit
abe09ae93d
@ -36,6 +36,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
|
||||
@ -1277,6 +1278,13 @@ std::size_t packSize(const WListManager& data,
|
||||
return packSize(data.lists(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const UDQFunction& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.name(), comm) +
|
||||
packSize(data.type(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -2570,6 +2578,14 @@ void pack(const WListManager& data,
|
||||
pack(data.lists(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const UDQFunction& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.name(), buffer, position, comm);
|
||||
pack(data.type(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -4394,6 +4410,17 @@ void unpack(WListManager& data,
|
||||
data = WListManager(lists);
|
||||
}
|
||||
|
||||
void unpack(UDQFunction& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::string name;
|
||||
UDQTokenType type;
|
||||
unpack(name, buffer, position, comm);
|
||||
unpack(type, buffer, position, comm);
|
||||
data = UDQFunction(name, type);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PACK_VECTOR(T) \
|
||||
template std::size_t packSize(const std::vector<T>& data, \
|
||||
Dune::MPIHelper::MPICommunicator comm); \
|
||||
|
@ -112,6 +112,7 @@ class TableManager;
|
||||
class TableSchema;
|
||||
class ThresholdPressure;
|
||||
class UDAValue;
|
||||
class UDQFunction;
|
||||
class UDQParams;
|
||||
class UnitSystem;
|
||||
class Valve;
|
||||
@ -627,6 +628,7 @@ ADD_PACK_PROTOTYPES(ThresholdPressure)
|
||||
ADD_PACK_PROTOTYPES(TimeMap)
|
||||
ADD_PACK_PROTOTYPES(TimeMap::StepData)
|
||||
ADD_PACK_PROTOTYPES(UDAValue)
|
||||
ADD_PACK_PROTOTYPES(UDQFunction)
|
||||
ADD_PACK_PROTOTYPES(UDQParams)
|
||||
ADD_PACK_PROTOTYPES(UnitSystem)
|
||||
ADD_PACK_PROTOTYPES(Valve)
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
|
||||
@ -1664,6 +1665,17 @@ BOOST_AUTO_TEST_CASE(WListManager)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(UDQFunction)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::UDQFunction val1("test", Opm::UDQTokenType::binary_op_add);
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user