mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for SummaryNode
This commit is contained in:
parent
68225309a1
commit
725af1442e
@ -63,6 +63,7 @@
|
||||
#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/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Eqldims.hpp>
|
||||
@ -1663,6 +1664,18 @@ std::size_t packSize(const Schedule& data,
|
||||
packSize(data.getWellGroupEvents(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const SummaryNode& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.keyword(), comm) +
|
||||
packSize(data.category(), comm) +
|
||||
packSize(data.location(), comm) +
|
||||
packSize(data.type(), comm) +
|
||||
packSize(data.namedEntity(), comm) +
|
||||
packSize(data.number(), comm) +
|
||||
packSize(data.isUserDefined(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -3347,6 +3360,19 @@ void pack(const Schedule& data,
|
||||
pack(data.getWellGroupEvents(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const SummaryNode& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.keyword(), buffer, position, comm);
|
||||
pack(data.category(), buffer, position, comm);
|
||||
pack(data.location(), buffer, position, comm) ;
|
||||
pack(data.type(), buffer, position, comm);
|
||||
pack(data.namedEntity(), buffer, position, comm);
|
||||
pack(data.number(), buffer, position, comm);
|
||||
pack(data.isUserDefined(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -5763,6 +5789,32 @@ void unpack(Schedule& data, std::vector<char>& buffer, int& position,
|
||||
rftConfig, nupCol, wellGroupEvents);
|
||||
}
|
||||
|
||||
void unpack(SummaryNode& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::string keyword;
|
||||
SummaryNode::Category category;
|
||||
Location location;
|
||||
SummaryNode::Type type;
|
||||
std::string namedEntity;
|
||||
int number;
|
||||
bool isUserDefined;
|
||||
|
||||
unpack(keyword, buffer, position, comm);
|
||||
unpack(category, buffer, position, comm);
|
||||
unpack(location, buffer, position, comm) ;
|
||||
unpack(type, buffer, position, comm);
|
||||
unpack(namedEntity, buffer, position, comm);
|
||||
unpack(number, buffer, position, comm);
|
||||
unpack(isUserDefined, buffer, position, comm);
|
||||
data = SummaryNode{keyword, category, location}
|
||||
.parameterType(type)
|
||||
.namedEntity(namedEntity)
|
||||
.number(number)
|
||||
.isUserDefined(isUserDefined);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PACK_VECTOR(T) \
|
||||
template std::size_t packSize(const std::vector<T>& data, \
|
||||
Dune::MPIHelper::MPICommunicator comm); \
|
||||
|
@ -125,6 +125,7 @@ class SimpleTable;
|
||||
class SkprpolyTable;
|
||||
class SkprwatTable;
|
||||
class SpiralICD;
|
||||
class SummaryNode;
|
||||
class Tabdims;
|
||||
class TableColumn;
|
||||
class TableContainer;
|
||||
@ -689,6 +690,7 @@ ADD_PACK_PROTOTYPES(SkprpolyTable)
|
||||
ADD_PACK_PROTOTYPES(SkprwatTable)
|
||||
ADD_PACK_PROTOTYPES(SpiralICD)
|
||||
ADD_PACK_PROTOTYPES(std::string)
|
||||
ADD_PACK_PROTOTYPES(SummaryNode)
|
||||
ADD_PACK_PROTOTYPES(Tabdims)
|
||||
ADD_PACK_PROTOTYPES(TableColumn)
|
||||
ADD_PACK_PROTOTYPES(TableContainer)
|
||||
|
@ -74,6 +74,7 @@
|
||||
#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/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Eqldims.hpp>
|
||||
@ -2340,6 +2341,23 @@ BOOST_AUTO_TEST_CASE(Schedule)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SummaryNode)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
auto val1 = Opm::SummaryNode{"test1", Opm::SummaryNode::Category::Region,
|
||||
Opm::Location{"test2", 1}}
|
||||
.parameterType(Opm::SummaryNode::Type::Pressure)
|
||||
.namedEntity("test3")
|
||||
.number(2)
|
||||
.isUserDefined(true);
|
||||
|
||||
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