add mpi serialization for FaultFace

This commit is contained in:
Arne Morten Kvarving 2020-01-14 15:00:42 +01:00
parent a9bc24618f
commit 1c311743eb
3 changed files with 40 additions and 0 deletions

View File

@ -1990,6 +1990,13 @@ std::size_t packSize(const TransMult& data,
packSize(data.getScanner(), comm); packSize(data.getScanner(), comm);
} }
std::size_t packSize(const FaultFace& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getIndices(), comm) +
packSize(data.getDir(), comm);
}
////// pack routines ////// pack routines
template<class T> template<class T>
@ -3887,6 +3894,14 @@ void pack(const TransMult& data,
pack(data.getScanner(), buffer, position, comm); pack(data.getScanner(), buffer, position, comm);
} }
void pack(const FaultFace& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getIndices(), buffer, position, comm);
pack(data.getDir(), buffer, position, comm);
}
/// unpack routines /// unpack routines
template<class T> template<class T>
@ -6601,6 +6616,18 @@ void unpack(TransMult& data,
data = TransMult(size, trans, names, scanner); data = TransMult(size, trans, names, scanner);
} }
void unpack(FaultFace& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<size_t> indices;
FaceDir::DirEnum dir;
unpack(indices, buffer, position, comm);
unpack(dir, buffer, position, comm);
data = FaultFace(indices, dir);
}
#define INSTANTIATE_PACK_VECTOR(...) \ #define INSTANTIATE_PACK_VECTOR(...) \
template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \ template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \
Dune::MPIHelper::MPICommunicator comm); \ Dune::MPIHelper::MPICommunicator comm); \

View File

@ -91,6 +91,7 @@ class EndpointScaling;
class Equil; class Equil;
class EquilRecord; class EquilRecord;
class Events; class Events;
class FaultFace;
class FoamConfig; class FoamConfig;
class FoamData; class FoamData;
class InitConfig; class InitConfig;
@ -665,6 +666,7 @@ ADD_PACK_PROTOTYPES(Equil)
ADD_PACK_PROTOTYPES(Eqldims) ADD_PACK_PROTOTYPES(Eqldims)
ADD_PACK_PROTOTYPES(EquilRecord) ADD_PACK_PROTOTYPES(EquilRecord)
ADD_PACK_PROTOTYPES(Events) ADD_PACK_PROTOTYPES(Events)
ADD_PACK_PROTOTYPES(FaultFace)
ADD_PACK_PROTOTYPES(FoamConfig) ADD_PACK_PROTOTYPES(FoamConfig)
ADD_PACK_PROTOTYPES(FoamData) ADD_PACK_PROTOTYPES(FoamData)
ADD_PACK_PROTOTYPES(GConSale) ADD_PACK_PROTOTYPES(GConSale)

View File

@ -2490,6 +2490,17 @@ BOOST_AUTO_TEST_CASE(TransMult)
} }
BOOST_AUTO_TEST_CASE(FaultFace)
{
#ifdef HAVE_MPI
Opm::FaultFace val1({1,2,3,4,5,6}, Opm::FaceDir::YPlus);
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;