mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-14 09:52:01 -05:00
add mpi serialization for Opm::ThresholdPressure
This commit is contained in:
1 parent
2a0f8a0465
commit
d9268980f3
3 files changed
+55
No files matched your search
@@ -22,6 +22,7 @@
|
||||
#endif
|
||||
|
||||
#include "ParallelRestart.hpp"
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <dune/common/parallel/mpitraits.hh>
|
||||
|
||||
namespace Opm
|
||||
@@ -205,6 +206,14 @@ std::size_t packSize(const RestartValue& data, Dune::MPIHelper::MPICommunicator
|
||||
return packSize(data.solution, comm) + packSize(data.wells, comm) + packSize(data.extra, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const ThresholdPressure& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.active(), comm) +
|
||||
packSize(data.restart(), comm) +
|
||||
packSize(data.thresholdPressureTable(), comm) +
|
||||
packSize(data.pressureTable(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@@ -416,6 +425,15 @@ void pack(const RestartValue& data, std::vector<char>& buffer, int& position,
|
||||
pack(data.extra, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const ThresholdPressure& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.active(), buffer, position, comm);
|
||||
pack(data.restart(), buffer, position, comm);
|
||||
pack(data.thresholdPressureTable(), buffer, position, comm);
|
||||
pack(data.pressureTable(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@@ -634,6 +652,20 @@ void unpack(RestartValue& data, std::vector<char>& buffer, int& position,
|
||||
unpack(data.extra, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(ThresholdPressure& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
ThresholdPressure::ThresholdPressureTable thpTable;
|
||||
ThresholdPressure::PressureTable pTable;
|
||||
bool active, restart;
|
||||
unpack(active, buffer, position, comm);
|
||||
unpack(restart, buffer, position, comm);
|
||||
unpack(thpTable, buffer, position, comm);
|
||||
unpack(pTable, buffer, position, comm);
|
||||
|
||||
data = ThresholdPressure(active, restart, thpTable, pTable);
|
||||
}
|
||||
|
||||
} // end namespace Mpi
|
||||
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
|
||||
const std::vector<Opm::RestartKey>& solutionKeys,
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
class ThresholdPressure;
|
||||
|
||||
namespace Mpi
|
||||
{
|
||||
template<class T>
|
||||
@@ -186,6 +189,7 @@ ADD_PACK_PROTOTYPES(data::WellRates)
|
||||
ADD_PACK_PROTOTYPES(RestartKey)
|
||||
ADD_PACK_PROTOTYPES(RestartValue)
|
||||
ADD_PACK_PROTOTYPES(std::string)
|
||||
ADD_PACK_PROTOTYPES(ThresholdPressure)
|
||||
|
||||
} // end namespace Mpi
|
||||
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/simulators/utils/ParallelRestart.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <opm/output/eclipse/RestartValue.hpp>
|
||||
|
||||
|
||||
@@ -106,6 +107,13 @@ Opm::data::Well getWell()
|
||||
#endif
|
||||
|
||||
|
||||
Opm::ThresholdPressure getThresholdPressure()
|
||||
{
|
||||
return Opm::ThresholdPressure(false, true, {{true, 1.0}, {false, 2.0}},
|
||||
{{{1,2},{false,3.0}},{{2,3},{true,4.0}}});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -230,6 +238,17 @@ BOOST_AUTO_TEST_CASE(RestartValue)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ThresholdPressure)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
Opm::ThresholdPressure val1 = getThresholdPressure();
|
||||
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;
|
||||
|
||||
Reference in new issue
Block a user