add mpi serialization for UDQConfig

This commit is contained in:
Arne Morten Kvarving
2019-12-12 09:44:24 +01:00
parent dc5a3d0e0e
commit 01d05c9585
3 changed files with 91 additions and 0 deletions

View File

@@ -45,6 +45,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.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>
@@ -305,6 +306,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
@@ -1751,6 +1780,17 @@ BOOST_AUTO_TEST_CASE(UDQIndex)
}
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
}
bool init_unit_test_func()
{
return true;