mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for Actions
This commit is contained in:
parent
9fb68ef289
commit
16ce8af5e9
@ -32,6 +32,7 @@
|
||||
#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/Actions.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/Condition.hpp>
|
||||
@ -1616,6 +1617,12 @@ std::size_t packSize(const Action::ActionX& data,
|
||||
packSize(data.getLastRun(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const Action::Actions& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getActions(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -3260,6 +3267,13 @@ void pack(const Action::ActionX& data,
|
||||
pack(data.getLastRun(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const Action::Actions& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getActions(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -5596,6 +5610,14 @@ void unpack(Action::ActionX& data, std::vector<char>& buffer, int& position,
|
||||
condition, conditions, run_count, last_run);
|
||||
}
|
||||
|
||||
void unpack(Action::Actions& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::vector<Action::ActionX> actions;
|
||||
unpack(actions, buffer, position, comm);
|
||||
data = Action::Actions(actions);
|
||||
}
|
||||
|
||||
#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 Actions;
|
||||
class ActionX;
|
||||
class AST;
|
||||
class ASTNode;
|
||||
@ -607,6 +608,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::Actions)
|
||||
ADD_PACK_PROTOTYPES(Action::ActionX)
|
||||
ADD_PACK_PROTOTYPES(Action::AST)
|
||||
ADD_PACK_PROTOTYPES(Action::ASTNode)
|
||||
|
@ -39,6 +39,7 @@
|
||||
#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/Actions.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/Condition.hpp>
|
||||
@ -2218,6 +2219,17 @@ BOOST_AUTO_TEST_CASE(ActionX)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Actions)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::Action::Actions val1({getActionX()});
|
||||
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