add mpi serialization for EndpointScaling

This commit is contained in:
Arne Morten Kvarving 2019-12-02 11:10:47 +01:00
parent d255e1cad6
commit 64c7ead11c
3 changed files with 32 additions and 0 deletions

View File

@ -392,6 +392,11 @@ std::size_t packSize(const Phases& data, Dune::MPIHelper::MPICommunicator comm)
return packSize(data.getBits(), comm); return packSize(data.getBits(), comm);
} }
std::size_t packSize(const EndpointScaling& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getBits(), comm);
}
////// pack routines ////// pack routines
template<class T> template<class T>
@ -773,6 +778,12 @@ void pack(const Phases& data, std::vector<char>& buffer, int& position,
pack(data.getBits(), buffer, position, comm); pack(data.getBits(), buffer, position, comm);
} }
void pack(const EndpointScaling& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getBits(), buffer, position, comm);
}
/// unpack routines /// unpack routines
template<class T> template<class T>
@ -1240,6 +1251,14 @@ void unpack(Phases& data, std::vector<char>& buffer, int& position,
data = Phases(std::bitset<NUM_PHASES_IN_ENUM>(bits)); data = Phases(std::bitset<NUM_PHASES_IN_ENUM>(bits));
} }
void unpack(EndpointScaling& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unsigned long bits;
unpack(bits, buffer, position, comm);
data = EndpointScaling(std::bitset<4>(bits));
}
} // end namespace Mpi } // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState, RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys, const std::vector<Opm::RestartKey>& solutionKeys,

View File

@ -41,6 +41,7 @@ namespace Opm
class ColumnSchema; class ColumnSchema;
class EDITNNC; class EDITNNC;
class EndpointScaling;
class Equil; class Equil;
class EquilRecord; class EquilRecord;
class FoamConfig; class FoamConfig;
@ -245,6 +246,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(EDITNNC) ADD_PACK_PROTOTYPES(EDITNNC)
ADD_PACK_PROTOTYPES(EndpointScaling)
ADD_PACK_PROTOTYPES(Equil) ADD_PACK_PROTOTYPES(Equil)
ADD_PACK_PROTOTYPES(EquilRecord) ADD_PACK_PROTOTYPES(EquilRecord)
ADD_PACK_PROTOTYPES(FoamConfig) ADD_PACK_PROTOTYPES(FoamConfig)

View File

@ -571,6 +571,17 @@ BOOST_AUTO_TEST_CASE(Tabdims)
} }
BOOST_AUTO_TEST_CASE(EndpointScaling)
{
#if HAVE_MPI
Opm::EndpointScaling val1(std::bitset<4>(13));
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;