mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for UDQFunctionTable
This commit is contained in:
parent
abe09ae93d
commit
5873b56025
@ -37,6 +37,7 @@
|
|||||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp>
|
||||||
|
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
|
||||||
@ -1285,6 +1286,13 @@ std::size_t packSize(const UDQFunction& data,
|
|||||||
packSize(data.type(), comm);
|
packSize(data.type(), comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::size_t packSize(const UDQFunctionTable& data,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
return packSize(data.getParams(), comm) +
|
||||||
|
packSize(data.functionMap(), comm);
|
||||||
|
}
|
||||||
|
|
||||||
////// pack routines
|
////// pack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -2586,6 +2594,14 @@ void pack(const UDQFunction& data,
|
|||||||
pack(data.type(), buffer, position, comm);
|
pack(data.type(), buffer, position, comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pack(const UDQFunctionTable& data,
|
||||||
|
std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
pack(data.getParams(), buffer, position, comm);
|
||||||
|
pack(data.functionMap(), buffer, position, comm);
|
||||||
|
}
|
||||||
|
|
||||||
/// unpack routines
|
/// unpack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -4421,6 +4437,17 @@ void unpack(UDQFunction& data,
|
|||||||
data = UDQFunction(name, type);
|
data = UDQFunction(name, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void unpack(UDQFunctionTable& data,
|
||||||
|
std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
UDQParams params;
|
||||||
|
UDQFunctionTable::FunctionMap map;
|
||||||
|
unpack(params, buffer, position, comm);
|
||||||
|
unpack(map, buffer, position, comm);
|
||||||
|
data = UDQFunctionTable(params, map);
|
||||||
|
}
|
||||||
|
|
||||||
#define INSTANTIATE_PACK_VECTOR(T) \
|
#define INSTANTIATE_PACK_VECTOR(T) \
|
||||||
template std::size_t packSize(const std::vector<T>& data, \
|
template std::size_t packSize(const std::vector<T>& data, \
|
||||||
Dune::MPIHelper::MPICommunicator comm); \
|
Dune::MPIHelper::MPICommunicator comm); \
|
||||||
|
@ -113,6 +113,7 @@ class TableSchema;
|
|||||||
class ThresholdPressure;
|
class ThresholdPressure;
|
||||||
class UDAValue;
|
class UDAValue;
|
||||||
class UDQFunction;
|
class UDQFunction;
|
||||||
|
class UDQFunctionTable;
|
||||||
class UDQParams;
|
class UDQParams;
|
||||||
class UnitSystem;
|
class UnitSystem;
|
||||||
class Valve;
|
class Valve;
|
||||||
@ -629,6 +630,7 @@ ADD_PACK_PROTOTYPES(TimeMap)
|
|||||||
ADD_PACK_PROTOTYPES(TimeMap::StepData)
|
ADD_PACK_PROTOTYPES(TimeMap::StepData)
|
||||||
ADD_PACK_PROTOTYPES(UDAValue)
|
ADD_PACK_PROTOTYPES(UDAValue)
|
||||||
ADD_PACK_PROTOTYPES(UDQFunction)
|
ADD_PACK_PROTOTYPES(UDQFunction)
|
||||||
|
ADD_PACK_PROTOTYPES(UDQFunctionTable)
|
||||||
ADD_PACK_PROTOTYPES(UDQParams)
|
ADD_PACK_PROTOTYPES(UDQParams)
|
||||||
ADD_PACK_PROTOTYPES(UnitSystem)
|
ADD_PACK_PROTOTYPES(UnitSystem)
|
||||||
ADD_PACK_PROTOTYPES(Valve)
|
ADD_PACK_PROTOTYPES(Valve)
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp>
|
||||||
|
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
|
||||||
@ -1676,6 +1677,19 @@ BOOST_AUTO_TEST_CASE(UDQFunction)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(UDQFunctionTable)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_MPI
|
||||||
|
Opm::UDQFunctionTable::FunctionMap map{{"test",
|
||||||
|
std::make_shared<Opm::UDQFunction>()}};
|
||||||
|
Opm::UDQFunctionTable val1(Opm::UDQParams(true, 1, 2.0, 3.0, 4.0), map);
|
||||||
|
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()
|
bool init_unit_test_func()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user