add mpi serialization for GridDims

This commit is contained in:
Arne Morten Kvarving 2020-02-25 12:32:46 +01:00
parent 94f0bd2af6
commit 55b5ebd3df
3 changed files with 35 additions and 0 deletions

View File

@ -2037,6 +2037,12 @@ std::size_t packSize(const SolventDensityTable& data,
return packSize(data.getSolventDensityColumn(), comm);
}
std::size_t packSize(const GridDims& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getNXYZ(), comm);
}
////// pack routines
template<class T>
@ -3956,6 +3962,13 @@ void pack(const SolventDensityTable& data,
pack(data.getSolventDensityColumn(), buffer, position, comm);
}
void pack(const GridDims& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getNXYZ(), buffer, position, comm);
}
/// unpack routines
template<class T>
@ -6722,6 +6735,16 @@ void unpack(SolventDensityTable& data, std::vector<char>& buffer, int& position,
data = SolventDensityTable(tableValues);
}
void unpack(GridDims& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::array<int,3> NXYZ;
unpack(NXYZ, buffer, position, comm);
data = GridDims(NXYZ);
}
#define INSTANTIATE_PACK_VECTOR(...) \
template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \
Dune::MPIHelper::MPICommunicator comm); \

View File

@ -103,6 +103,7 @@ class FaultCollection;
class FaultFace;
class FoamConfig;
class FoamData;
class GridDims;
class InitConfig;
class IOConfig;
template<class T> class IOrderSet;
@ -721,6 +722,7 @@ ADD_PACK_PROTOTYPES(GConSale)
ADD_PACK_PROTOTYPES(GConSale::GCONSALEGroup)
ADD_PACK_PROTOTYPES(GConSump)
ADD_PACK_PROTOTYPES(GConSump::GCONSUMPGroup)
ADD_PACK_PROTOTYPES(GridDims)
ADD_PACK_PROTOTYPES(GuideRateConfig)
ADD_PACK_PROTOTYPES(GuideRateConfig::GroupTarget)
ADD_PACK_PROTOTYPES(GuideRateConfig::WellTarget)

View File

@ -2520,6 +2520,16 @@ BOOST_AUTO_TEST_CASE(SolventDensityTable)
}
BOOST_AUTO_TEST_CASE(GridDims)
{
#ifdef HAVE_MPI
Opm::GridDims val1{ 1, 2, 3};
auto val2 = PackUnpack(val1);
DO_CHECKS(GridDims)
#endif
}
bool init_unit_test_func()
{
return true;