Merge pull request #2259 from akva2/noecl_flush

More MPI serialization support
This commit is contained in:
Arne Morten Kvarving
2020-01-02 15:10:06 +01:00
committed by GitHub
3 changed files with 634 additions and 0 deletions

View File

@@ -36,6 +36,12 @@
#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/UDQASTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.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>
@@ -43,6 +49,8 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellFoamProperties.hpp>
#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>
@@ -1263,6 +1271,119 @@ std::size_t packSize(const Group& data,
packSize(data.productionProperties(), comm);
}
std::size_t packSize(const WList& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.wellList(), comm);
}
std::size_t packSize(const WListManager& data,
Dune::MPIHelper::MPICommunicator comm)
{
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);
}
std::size_t packSize(const UDQFunctionTable& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getParams(), comm) +
packSize(data.functionMap(), comm);
}
std::size_t packSize(const UDQASTNode& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.var_type, comm) +
packSize(data.getType(), comm) +
packSize(data.stringValue(), comm) +
packSize(data.scalarValue(), comm) +
packSize(data.getSelectors(), comm) +
packSize(data.getLeft(), comm) +
packSize(data.getRight(), comm);
}
std::size_t packSize(const UDQDefine& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.keyword(), comm) +
packSize(data.getAst(), comm) +
packSize(data.var_type(), comm) +
packSize(data.input_string(), comm);
}
std::size_t packSize(const UDQAssign::AssignRecord& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.selector, comm) +
packSize(data.value, comm);
}
std::size_t packSize(const UDQAssign& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.keyword(), comm) +
packSize(data.var_type(), comm) +
packSize(data.getRecords(), comm);
}
std::size_t packSize(const UDQIndex& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.insert_index, comm) +
packSize(data.typed_insert_index, comm) +
packSize(data.action, comm) +
packSize(data.var_type, comm);
}
std::size_t packSize(const UDQConfig& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.params(), comm) +
packSize(data.function_table(), comm) +
packSize(data.definitionMap(), comm) +
packSize(data.assignmentMap(), comm) +
packSize(data.unitsMap(), comm) +
packSize(data.inputIndex(), comm) +
packSize(data.typeCount(), comm);
}
std::size_t packSize(const UDQActive::InputRecord& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.input_index, comm) +
packSize(data.udq, comm) +
packSize(data.wgname, comm) +
packSize(data.control, comm);
}
std::size_t packSize(const UDQActive::Record& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.udq, comm) +
packSize(data.input_index, comm) +
packSize(data.use_index, comm) +
packSize(data.wgname, comm) +
packSize(data.control, comm) +
packSize(data.uad_code, comm) +
packSize(data.use_count, comm);
}
std::size_t packSize(const UDQActive& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getInputRecords(), comm) +
packSize(data.getOutputRecords(), comm) +
packSize(data.getUdqKeys(), comm) +
packSize(data.getWgKeys(), comm);
}
////// pack routines
template<class T>
@@ -2542,6 +2663,132 @@ void pack(const Group& data,
pack(data.productionProperties(), buffer, position, comm);
}
void pack(const WList& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
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);
}
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);
}
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);
}
void pack(const UDQASTNode& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.var_type, buffer, position, comm);
pack(data.getType(), buffer, position, comm);
pack(data.stringValue(), buffer, position, comm);
pack(data.scalarValue(), buffer, position, comm);
pack(data.getSelectors(), buffer, position, comm);
pack(data.getLeft(), buffer, position, comm);
pack(data.getRight(), buffer, position, comm);
}
void pack(const UDQDefine& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.keyword(), buffer, position, comm);
pack(data.getAst(), buffer, position, comm);
pack(data.var_type(), buffer, position, comm);
pack(data.input_string(), buffer, position, comm);
}
void pack(const UDQAssign::AssignRecord& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.selector, buffer, position, comm);
pack(data.value, buffer, position, comm);
}
void pack(const UDQAssign& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.keyword(), buffer, position, comm);
pack(data.var_type(), buffer, position, comm);
pack(data.getRecords(), buffer, position, comm);
}
void pack(const UDQIndex& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.insert_index, buffer, position, comm);
pack(data.typed_insert_index, buffer, position, comm);
pack(data.action, buffer, position, comm);
pack(data.var_type, buffer, position, comm);
}
void pack(const UDQConfig& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.params(), buffer, position, comm);
pack(data.function_table(), buffer, position, comm);
pack(data.definitionMap(), buffer, position, comm);
pack(data.assignmentMap(), buffer, position, comm);
pack(data.unitsMap(), buffer, position, comm);
pack(data.inputIndex(), buffer, position, comm);
pack(data.typeCount(), buffer, position, comm);
}
void pack(const UDQActive::InputRecord& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.input_index, buffer, position, comm);
pack(data.udq, buffer, position, comm);
pack(data.wgname, buffer, position, comm);
pack(data.control, buffer, position, comm);
}
void pack(const UDQActive::Record& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.udq, buffer, position, comm);
pack(data.input_index, buffer, position, comm);
pack(data.use_index, buffer, position, comm);
pack(data.wgname, buffer, position, comm);
pack(data.control, buffer, position, comm);
pack(data.uad_code, buffer, position, comm);
pack(data.use_count, buffer, position, comm);
}
void pack(const UDQActive& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getInputRecords(), buffer, position, comm);
pack(data.getOutputRecords(), buffer, position, comm);
pack(data.getUdqKeys(), buffer, position, comm);
pack(data.getWgKeys(), buffer, position, comm);
}
/// unpack routines
template<class T>
@@ -4348,6 +4595,176 @@ void unpack(Group& data,
injection, production);
}
void unpack(WList& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
WList::storage ddata;
unpack(ddata, buffer, position, comm);
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);
}
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);
}
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);
}
void unpack(UDQASTNode& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
UDQVarType var_type;
UDQTokenType type;
std::string stringValue;
double scalarValue;
std::vector<std::string> selectors;
std::shared_ptr<UDQASTNode> left;
std::shared_ptr<UDQASTNode> right;
unpack(var_type, buffer, position, comm);
unpack(type, buffer, position, comm);
unpack(stringValue, buffer, position, comm);
unpack(scalarValue, buffer, position, comm);
unpack(selectors, buffer, position, comm);
unpack(left, buffer, position, comm);
unpack(right, buffer, position, comm);
data = UDQASTNode(var_type, type, stringValue, scalarValue, selectors, left, right);
}
void unpack(UDQDefine& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::string keyword;
std::shared_ptr<UDQASTNode> ast;
UDQVarType varType;
std::string string_data;
unpack(keyword, buffer, position, comm);
unpack(ast, buffer, position, comm);
unpack(varType, buffer, position, comm);
unpack(string_data, buffer, position, comm);
data = UDQDefine(keyword, ast, varType, string_data);
}
void unpack(UDQAssign::AssignRecord& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.selector, buffer, position, comm);
unpack(data.value, buffer, position, comm);
}
void unpack(UDQAssign& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::string keyword;
UDQVarType varType;
std::vector<UDQAssign::AssignRecord> records;
unpack(keyword, buffer, position, comm);
unpack(varType, buffer, position, comm);
unpack(records, buffer, position, comm);
data = UDQAssign(keyword, varType, records);
}
void unpack(UDQIndex& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.insert_index, buffer, position, comm);
unpack(data.typed_insert_index, buffer, position, comm);
unpack(data.action, buffer, position, comm);
unpack(data.var_type, buffer, position, comm);
}
void unpack(UDQConfig& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
UDQParams params;
UDQFunctionTable function_table;
std::unordered_map<std::string,UDQDefine> definitionsMap;
std::unordered_map<std::string,UDQAssign> assignmentsMap;
std::unordered_map<std::string,std::string> units;
OrderedMap<std::string,UDQIndex> inputIndex;
std::map<UDQVarType,std::size_t> typeCount;
unpack(params, buffer, position, comm);
unpack(function_table, buffer, position, comm);
unpack(definitionsMap, buffer, position, comm);
unpack(assignmentsMap, buffer, position, comm);
unpack(units, buffer, position, comm);
unpack(inputIndex, buffer, position, comm);
unpack(typeCount, buffer, position, comm);
data = UDQConfig(params, function_table, definitionsMap,
assignmentsMap, units, inputIndex, typeCount);
}
void unpack(UDQActive::InputRecord& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.input_index, buffer, position, comm);
unpack(data.udq, buffer, position, comm);
unpack(data.wgname, buffer, position, comm);
unpack(data.control, buffer, position, comm);
}
void unpack(UDQActive::Record& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.udq, buffer, position, comm);
unpack(data.input_index, buffer, position, comm);
unpack(data.use_index, buffer, position, comm);
unpack(data.wgname, buffer, position, comm);
unpack(data.control, buffer, position, comm);
unpack(data.uad_code, buffer, position, comm);
unpack(data.use_count, buffer, position, comm);
}
void unpack(UDQActive& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<UDQActive::InputRecord> inputRecords;
std::vector<UDQActive::Record> outputRecords;
std::unordered_map<std::string,std::size_t> udqKeys, wgKeys;
unpack(inputRecords, buffer, position, comm);
unpack(outputRecords, buffer, position, comm);
unpack(udqKeys, buffer, position, comm);
unpack(wgKeys, buffer, position, comm);
data = UDQActive(inputRecords, outputRecords, udqKeys, wgKeys);
}
#define INSTANTIATE_PACK_VECTOR(T) \
template std::size_t packSize(const std::vector<T>& data, \
Dune::MPIHelper::MPICommunicator comm); \

View File

@@ -43,6 +43,8 @@
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.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>
@@ -112,6 +114,12 @@ class TableManager;
class TableSchema;
class ThresholdPressure;
class UDAValue;
class UDQASTNode;
class UDQConfig;
class UDQDefine;
class UDQFunction;
class UDQFunctionTable;
class UDQIndex;
class UDQParams;
class UnitSystem;
class Valve;
@@ -129,6 +137,8 @@ class WellPolymerProperties;
class WellSegmentDims;
class WellSegments;
class WellTracerProperties;
class WList;
class WListManager;
namespace Mpi
{
@@ -625,6 +635,17 @@ ADD_PACK_PROTOTYPES(ThresholdPressure)
ADD_PACK_PROTOTYPES(TimeMap)
ADD_PACK_PROTOTYPES(TimeMap::StepData)
ADD_PACK_PROTOTYPES(UDAValue)
ADD_PACK_PROTOTYPES(UDQActive)
ADD_PACK_PROTOTYPES(UDQActive::InputRecord)
ADD_PACK_PROTOTYPES(UDQActive::Record)
ADD_PACK_PROTOTYPES(UDQAssign)
ADD_PACK_PROTOTYPES(UDQAssign::AssignRecord)
ADD_PACK_PROTOTYPES(UDQASTNode)
ADD_PACK_PROTOTYPES(UDQConfig)
ADD_PACK_PROTOTYPES(UDQDefine)
ADD_PACK_PROTOTYPES(UDQFunction)
ADD_PACK_PROTOTYPES(UDQFunctionTable)
ADD_PACK_PROTOTYPES(UDQIndex)
ADD_PACK_PROTOTYPES(UDQParams)
ADD_PACK_PROTOTYPES(UnitSystem)
ADD_PACK_PROTOTYPES(Valve)
@@ -648,8 +669,11 @@ ADD_PACK_PROTOTYPES(WellSegments)
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

@@ -43,6 +43,14 @@
#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/UDQActive.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.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/UDQ/UDQInput.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>
@@ -50,6 +58,8 @@
#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/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>
@@ -297,6 +307,34 @@ Opm::VFPProdTable getVFPProdTable()
{1.0, 2.0, 3.0},
{1.0, 2.0, 3.0, 4.0}, table);
}
Opm::UDQConfig getUDQConfig()
{
Opm::UDQParams params(true, 1, 2.0, 3.0, 4.0);
Opm::UDQFunctionTable::FunctionMap map{{"test", std::make_shared<Opm::UDQFunction>()}};
std::shared_ptr<Opm::UDQASTNode> n0;
Opm::UDQASTNode n1(Opm::UDQVarType::NONE,
Opm::UDQTokenType::error,
"test", 1.0, {"test1", "test2"}, n0, n0);
Opm::UDQDefine def("test", std::make_shared<Opm::UDQASTNode>(n1),
Opm::UDQVarType::NONE, "test2");
Opm::UDQAssign ass("test", Opm::UDQVarType::NONE,
{Opm::UDQAssign::AssignRecord{{"test1"}, 1.0},
Opm::UDQAssign::AssignRecord{{"test2"}, 2.0}});
Opm::OrderedMap<std::string, Opm::UDQIndex> omap;
omap.insert({"test8", Opm::UDQIndex(1, 2, Opm::UDQAction::ASSIGN,
Opm::UDQVarType::WELL_VAR)});
omap.insert({"test9", Opm::UDQIndex(3, 4, Opm::UDQAction::ASSIGN,
Opm::UDQVarType::WELL_VAR)});
return Opm::UDQConfig(params,
Opm::UDQFunctionTable(params, map),
{{"test1", def}, {"test2", def}},
{{"test3", ass}, {"test4", ass}},
{{"test5", "test6"}, {"test7", "test8"}},
omap,
{{Opm::UDQVarType::SCALAR, 5}, {Opm::UDQVarType::WELL_VAR, 6}});
}
#endif
@@ -1638,6 +1676,161 @@ BOOST_AUTO_TEST_CASE(Group)
}
BOOST_AUTO_TEST_CASE(WList)
{
#ifdef HAVE_MPI
Opm::WList val1({"test1", "test2", "test3"});
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
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
}
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
}
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
}
BOOST_AUTO_TEST_CASE(UDQASTNode)
{
#ifdef HAVE_MPI
std::shared_ptr<Opm::UDQASTNode> n0;
std::shared_ptr<Opm::UDQASTNode> n1(new Opm::UDQASTNode(Opm::UDQVarType::NONE,
Opm::UDQTokenType::error,
"test1", 1.0, {"test2"},
n0, n0));
Opm::UDQASTNode val1(Opm::UDQVarType::NONE,
Opm::UDQTokenType::error,
"test", 1.0, {"test3"}, n1, n1);
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(UDQDefine)
{
#ifdef HAVE_MPI
std::shared_ptr<Opm::UDQASTNode> n0;
Opm::UDQASTNode n1(Opm::UDQVarType::NONE,
Opm::UDQTokenType::error,
"test", 1.0, {"test1", "test2"}, n0, n0);
Opm::UDQDefine val1("test", std::make_shared<Opm::UDQASTNode>(n1),
Opm::UDQVarType::NONE, "test2");
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(UDQAssign)
{
#ifdef HAVE_MPI
Opm::UDQAssign val1("test", Opm::UDQVarType::NONE,
{Opm::UDQAssign::AssignRecord{{"test1"}, 1.0},
Opm::UDQAssign::AssignRecord{{"test2"}, 2.0}});
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(UDQIndex)
{
#ifdef HAVE_MPI
Opm::UDQIndex val1(1, 2, Opm::UDQAction::ASSIGN, Opm::UDQVarType::WELL_VAR);
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(UDQConfig)
{
#ifdef HAVE_MPI
Opm::UDQConfig val1 = getUDQConfig();
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(UDQActiveInputRecord)
{
#ifdef HAVE_MPI
Opm::UDQActive::InputRecord val1(1, "test1", "test2",
Opm::UDAControl::WCONPROD_ORAT);
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(UDQActiveRecord)
{
#ifdef HAVE_MPI
Opm::UDQActive::Record val1("test1", 1, 2, "test2",
Opm::UDAControl::WCONPROD_ORAT);
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(UDQActive)
{
#ifdef HAVE_MPI
Opm::UDQActive val1({Opm::UDQActive::InputRecord(1, "test1", "test2",
Opm::UDAControl::WCONPROD_ORAT)},
{Opm::UDQActive::Record("test1", 1, 2, "test2",
Opm::UDAControl::WCONPROD_ORAT)},
{{"test1", 1}}, {{"test2", 2}});
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;