mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for UDQParams
This commit is contained in:
parent
0bf43fc516
commit
efdabae2a2
@ -399,6 +399,15 @@ std::size_t packSize(const EndpointScaling& data, Dune::MPIHelper::MPICommunicat
|
||||
return packSize(data.getBits(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const UDQParams& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.reseed(), comm) +
|
||||
packSize(data.rand_seed(), comm) +
|
||||
packSize(data.range(), comm) +
|
||||
packSize(data.undefinedValue(), comm) +
|
||||
packSize(data.cmpEpsilon(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -786,6 +795,16 @@ void pack(const EndpointScaling& data, std::vector<char>& buffer, int& position,
|
||||
pack(data.getBits(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const UDQParams& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.reseed(), buffer, position, comm);
|
||||
pack(data.rand_seed(), buffer, position, comm);
|
||||
pack(data.range(), buffer, position, comm);
|
||||
pack(data.undefinedValue(), buffer, position, comm);
|
||||
pack(data.cmpEpsilon(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -1261,6 +1280,21 @@ void unpack(EndpointScaling& data, std::vector<char>& buffer, int& position,
|
||||
data = EndpointScaling(std::bitset<4>(bits));
|
||||
}
|
||||
|
||||
void unpack(UDQParams& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
bool reseed;
|
||||
int rand_seed;
|
||||
double range, undefVal, cmp_eps;
|
||||
|
||||
unpack(reseed, buffer, position, comm);
|
||||
unpack(rand_seed, buffer, position, comm);
|
||||
unpack(range, buffer, position, comm);
|
||||
unpack(undefVal, buffer, position, comm);
|
||||
unpack(cmp_eps, buffer, position, comm);
|
||||
data = UDQParams(reseed, rand_seed, range, undefVal, cmp_eps);
|
||||
}
|
||||
|
||||
} // end namespace Mpi
|
||||
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
|
||||
const std::vector<Opm::RestartKey>& solutionKeys,
|
||||
|
@ -62,6 +62,7 @@ class TableColumn;
|
||||
class TableContainer;
|
||||
class TableSchema;
|
||||
class ThresholdPressure;
|
||||
class UDQParams;
|
||||
class Welldims;
|
||||
class WellSegmentDims;
|
||||
|
||||
@ -274,6 +275,7 @@ ADD_PACK_PROTOTYPES(TableSchema)
|
||||
ADD_PACK_PROTOTYPES(ThresholdPressure)
|
||||
ADD_PACK_PROTOTYPES(TimeMap)
|
||||
ADD_PACK_PROTOTYPES(TimeMap::StepData)
|
||||
ADD_PACK_PROTOTYPES(UDQParams)
|
||||
ADD_PACK_PROTOTYPES(Welldims)
|
||||
ADD_PACK_PROTOTYPES(WellSegmentDims)
|
||||
|
||||
|
@ -604,6 +604,17 @@ BOOST_AUTO_TEST_CASE(WellSegmentDims)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(UDQParams)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
Opm::UDQParams val1(true, 1, 2.0, 3.0, 4.0);
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user