add mpi serialization for Fault

This commit is contained in:
Arne Morten Kvarving
2020-01-21 14:57:40 +01:00
parent 1c311743eb
commit d00ee94561
3 changed files with 44 additions and 0 deletions
+31
View File
@@ -1997,6 +1997,14 @@ std::size_t packSize(const FaultFace& data,
packSize(data.getDir(), comm);
}
std::size_t packSize(const Fault& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getName(), comm) +
packSize(data.getTransMult(), comm) +
packSize(data.getFaceList(), comm);
}
////// pack routines
template<class T>
@@ -3902,6 +3910,15 @@ void pack(const FaultFace& data,
pack(data.getDir(), buffer, position, comm);
}
void pack(const Fault& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getName(), buffer, position, comm);
pack(data.getTransMult(), buffer, position, comm);
pack(data.getFaceList(), buffer, position, comm);
}
/// unpack routines
template<class T>
@@ -6628,6 +6645,20 @@ void unpack(FaultFace& data,
data = FaultFace(indices, dir);
}
void unpack(Fault& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::string name;
double transMult;
std::vector<FaultFace> faceList;
unpack(name, buffer, position, comm);
unpack(transMult, buffer, position, comm);
unpack(faceList, buffer, position, comm);
data = Fault(name, transMult, faceList);
}
#define INSTANTIATE_PACK_VECTOR(...) \
template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \
Dune::MPIHelper::MPICommunicator comm); \
+2
View File
@@ -91,6 +91,7 @@ class EndpointScaling;
class Equil;
class EquilRecord;
class Events;
class Fault;
class FaultFace;
class FoamConfig;
class FoamData;
@@ -666,6 +667,7 @@ ADD_PACK_PROTOTYPES(Equil)
ADD_PACK_PROTOTYPES(Eqldims)
ADD_PACK_PROTOTYPES(EquilRecord)
ADD_PACK_PROTOTYPES(Events)
ADD_PACK_PROTOTYPES(Fault)
ADD_PACK_PROTOTYPES(FaultFace)
ADD_PACK_PROTOTYPES(FoamConfig)
ADD_PACK_PROTOTYPES(FoamData)