mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for DeckKeyword
This commit is contained in:
parent
8ba18cf038
commit
1860141771
@ -1488,6 +1488,16 @@ std::size_t packSize(const Location& data,
|
|||||||
packSize(data.lineno, comm);
|
packSize(data.lineno, comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::size_t packSize(const DeckKeyword& data,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
return packSize(data.name(), comm) +
|
||||||
|
packSize(data.location(), comm) +
|
||||||
|
packSize(data.records(), comm) +
|
||||||
|
packSize(data.isDataKeyword(), comm) +
|
||||||
|
packSize(data.isSlashTerminated(), comm);
|
||||||
|
}
|
||||||
|
|
||||||
////// pack routines
|
////// pack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -3004,6 +3014,17 @@ void pack(const Location& data,
|
|||||||
pack(data.lineno, buffer, position, comm);
|
pack(data.lineno, buffer, position, comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pack(const DeckKeyword& data,
|
||||||
|
std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
pack(data.name(), buffer, position, comm);
|
||||||
|
pack(data.location(), buffer, position, comm);
|
||||||
|
pack(data.records(), buffer, position, comm);
|
||||||
|
pack(data.isDataKeyword(), buffer, position, comm);
|
||||||
|
pack(data.isSlashTerminated(), buffer, position, comm);
|
||||||
|
}
|
||||||
|
|
||||||
/// unpack routines
|
/// unpack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -5134,6 +5155,24 @@ void unpack(Location& data,
|
|||||||
unpack(data.lineno, buffer, position, comm);
|
unpack(data.lineno, buffer, position, comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void unpack(DeckKeyword& data,
|
||||||
|
std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
Location location;
|
||||||
|
std::vector<DeckRecord> records;
|
||||||
|
bool isDataKeyword, isSlashTerminated;
|
||||||
|
|
||||||
|
unpack(name, buffer, position, comm);
|
||||||
|
unpack(location, buffer, position, comm);
|
||||||
|
unpack(records, buffer, position, comm);
|
||||||
|
unpack(isDataKeyword, buffer, position, comm);
|
||||||
|
unpack(isSlashTerminated, buffer, position, comm);
|
||||||
|
data = DeckKeyword(name, location, records,
|
||||||
|
isDataKeyword, isSlashTerminated);
|
||||||
|
}
|
||||||
|
|
||||||
#define INSTANTIATE_PACK_VECTOR(T) \
|
#define INSTANTIATE_PACK_VECTOR(T) \
|
||||||
template std::size_t packSize(const std::vector<T>& data, \
|
template std::size_t packSize(const std::vector<T>& data, \
|
||||||
Dune::MPIHelper::MPICommunicator comm); \
|
Dune::MPIHelper::MPICommunicator comm); \
|
||||||
|
@ -596,6 +596,7 @@ ADD_PACK_PROTOTYPES(data::Solution)
|
|||||||
ADD_PACK_PROTOTYPES(data::Well)
|
ADD_PACK_PROTOTYPES(data::Well)
|
||||||
ADD_PACK_PROTOTYPES(data::WellRates)
|
ADD_PACK_PROTOTYPES(data::WellRates)
|
||||||
ADD_PACK_PROTOTYPES(DeckItem)
|
ADD_PACK_PROTOTYPES(DeckItem)
|
||||||
|
ADD_PACK_PROTOTYPES(DeckKeyword)
|
||||||
ADD_PACK_PROTOTYPES(DeckRecord)
|
ADD_PACK_PROTOTYPES(DeckRecord)
|
||||||
ADD_PACK_PROTOTYPES(DENSITYRecord)
|
ADD_PACK_PROTOTYPES(DENSITYRecord)
|
||||||
ADD_PACK_PROTOTYPES(DensityTable)
|
ADD_PACK_PROTOTYPES(DensityTable)
|
||||||
|
@ -2041,6 +2041,18 @@ BOOST_AUTO_TEST_CASE(Location)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(DeckKeyword)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_MPI
|
||||||
|
Opm::DeckKeyword val1("test", {"test",1},
|
||||||
|
{getDeckRecord(), getDeckRecord()}, true, false);
|
||||||
|
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()
|
bool init_unit_test_func()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user