mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for Action::AST
This commit is contained in:
parent
2d682a0838
commit
2a16051d84
@ -31,6 +31,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.hpp>
|
||||
@ -1576,6 +1577,12 @@ std::size_t packSize(const Action::ASTNode& data,
|
||||
packSize(data.childrens(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const Action::AST& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getCondition(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -3179,6 +3186,13 @@ void pack(const Action::ASTNode& data,
|
||||
pack(data.childrens(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const Action::AST& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getCondition(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -5464,6 +5478,14 @@ void unpack(Action::ASTNode& data, std::vector<char>& buffer, int& position,
|
||||
data = Action::ASTNode(token, func_type, func, argList, number, children);
|
||||
}
|
||||
|
||||
void unpack(Action::AST& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::shared_ptr<Action::ASTNode> condition;
|
||||
unpack(condition, buffer, position, comm);
|
||||
data = Action::AST(condition);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PACK_VECTOR(T) \
|
||||
template std::size_t packSize(const std::vector<T>& data, \
|
||||
Dune::MPIHelper::MPICommunicator comm); \
|
||||
|
@ -65,6 +65,7 @@ namespace Opm
|
||||
class Actdims;
|
||||
|
||||
namespace Action {
|
||||
class AST;
|
||||
class ASTNode;
|
||||
}
|
||||
|
||||
@ -603,6 +604,7 @@ void unpack(char* str, std::size_t length, std::vector<char>& buffer, int& posit
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
ADD_PACK_PROTOTYPES(Actdims)
|
||||
ADD_PACK_PROTOTYPES(Action::AST)
|
||||
ADD_PACK_PROTOTYPES(Action::ASTNode)
|
||||
ADD_PACK_PROTOTYPES(Aqudims)
|
||||
ADD_PACK_PROTOTYPES(ColumnSchema)
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GConSale.hpp>
|
||||
@ -2136,6 +2137,21 @@ BOOST_AUTO_TEST_CASE(ASTNode)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(AST)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
std::shared_ptr<Opm::Action::ASTNode> node;
|
||||
node.reset(new Opm::Action::ASTNode(number, FuncType::field,
|
||||
"test1", {"test2"}, 1.0, {}));
|
||||
Opm::Action::AST val1(node);
|
||||
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