add mpi serialization for Equil

This commit is contained in:
Arne Morten Kvarving 2019-11-29 13:16:00 +01:00
parent 21eab1aa6d
commit f989b004e0
3 changed files with 32 additions and 0 deletions

View File

@ -308,6 +308,11 @@ std::size_t packSize(const TableContainer& data, Dune::MPIHelper::MPICommunicato
return res;
}
std::size_t packSize(const Equil& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.records(), comm);
}
////// pack routines
template<class T>
@ -605,6 +610,12 @@ void pack(const TableContainer& data, std::vector<char>& buffer, int& position,
}
}
void pack(const Equil& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.records(), buffer, position, comm);
}
/// unpack routines
template<class T>
@ -948,6 +959,14 @@ void unpack(TableContainer& data, std::vector<char>& buffer, int& position,
}
}
void unpack(Equil& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<EquilRecord> records;
unpack(records, buffer, position, comm);
data = Equil(records);
}
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys,

View File

@ -39,6 +39,7 @@ namespace Opm
class ColumnSchema;
class EDITNNC;
class Equil;
class EquilRecord;
class NNC;
struct NNCdata;
@ -222,6 +223,7 @@ ADD_PACK_PROTOTYPES(data::Solution)
ADD_PACK_PROTOTYPES(data::Well)
ADD_PACK_PROTOTYPES(data::WellRates)
ADD_PACK_PROTOTYPES(EDITNNC)
ADD_PACK_PROTOTYPES(Equil)
ADD_PACK_PROTOTYPES(EquilRecord)
ADD_PACK_PROTOTYPES(NNC)
ADD_PACK_PROTOTYPES(NNCdata)

View File

@ -411,6 +411,17 @@ BOOST_AUTO_TEST_CASE(EquilRecord)
}
BOOST_AUTO_TEST_CASE(Equil)
{
#if HAVE_MPI
Opm::Equil val1({getEquilRecord(), getEquilRecord()});
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;