mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for VFPInjTable
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp>
|
||||
@@ -898,6 +899,18 @@ std::size_t packSize(const MessageLimits& data,
|
||||
return packSize(data.getLimits(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const VFPInjTable& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getTableNum(), comm) +
|
||||
packSize(data.getDatumDepth(), comm) +
|
||||
packSize(data.getFloType(), comm) +
|
||||
packSize(data.getFloAxis(), comm) +
|
||||
packSize(data.getTHPAxis(), comm) +
|
||||
data.getTable().num_elements() *
|
||||
packSize(double(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@@ -1806,6 +1819,18 @@ void pack(const MessageLimits& data,
|
||||
{
|
||||
pack(data.getLimits(), buffer, position, comm);
|
||||
}
|
||||
void pack(const VFPInjTable& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getTableNum(), buffer, position, comm);
|
||||
pack(data.getDatumDepth(), buffer, position, comm);
|
||||
pack(data.getFloType(), buffer, position, comm);
|
||||
pack(data.getFloAxis(), buffer, position, comm);
|
||||
pack(data.getTHPAxis(), buffer, position, comm);
|
||||
for (size_t i = 0; i < data.getTable().num_elements(); ++i)
|
||||
pack(*(data.getTable().data() + i), buffer, position, comm);
|
||||
}
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@@ -3023,6 +3048,33 @@ void unpack(MessageLimits& data,
|
||||
unpack(limits, buffer, position, comm);
|
||||
data = MessageLimits(limits);
|
||||
}
|
||||
|
||||
void unpack(VFPInjTable& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
int tableNum;
|
||||
double datumDepth;
|
||||
VFPInjTable::FLO_TYPE floType;
|
||||
std::vector<double> floAxis, thpAxis;
|
||||
VFPInjTable::array_type table;
|
||||
|
||||
unpack(tableNum, buffer, position, comm);
|
||||
unpack(datumDepth, buffer, position, comm);
|
||||
unpack(floType, buffer, position, comm);
|
||||
unpack(floAxis, buffer, position, comm);
|
||||
unpack(thpAxis, buffer, position, comm);
|
||||
VFPInjTable::extents extents;
|
||||
extents[0] = thpAxis.size();
|
||||
extents[1] = floAxis.size();
|
||||
table.resize(extents);
|
||||
for (size_t i = 0; i < table.num_elements(); ++i)
|
||||
unpack(*(table.data() + i), buffer, position, comm);
|
||||
|
||||
data = VFPInjTable(tableNum, datumDepth, floType,
|
||||
floAxis, thpAxis, table);
|
||||
}
|
||||
|
||||
} // end namespace Mpi
|
||||
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
|
||||
const std::vector<Opm::RestartKey>& solutionKeys,
|
||||
|
||||
@@ -104,6 +104,7 @@ class TableManager;
|
||||
class TableSchema;
|
||||
class ThresholdPressure;
|
||||
class UDQParams;
|
||||
class VFPInjTable;
|
||||
class VISCREFRecord;
|
||||
class ViscrefTable;
|
||||
class WATDENTRecord;
|
||||
@@ -562,6 +563,7 @@ ADD_PACK_PROTOTYPES(ThresholdPressure)
|
||||
ADD_PACK_PROTOTYPES(TimeMap)
|
||||
ADD_PACK_PROTOTYPES(TimeMap::StepData)
|
||||
ADD_PACK_PROTOTYPES(UDQParams)
|
||||
ADD_PACK_PROTOTYPES(VFPInjTable)
|
||||
ADD_PACK_PROTOTYPES(VISCREFRecord)
|
||||
ADD_PACK_PROTOTYPES(ViscrefTable)
|
||||
ADD_PACK_PROTOTYPES(WATDENTRecord)
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp>
|
||||
@@ -185,6 +186,7 @@ Opm::FoamData getFoamData()
|
||||
return Opm::FoamData(1.0, 2.0, 3.0, true, 4.0);
|
||||
}
|
||||
|
||||
|
||||
Opm::TimeMap getTimeMap()
|
||||
{
|
||||
return Opm::TimeMap({123},
|
||||
@@ -226,6 +228,21 @@ Opm::TableContainer getTableContainer()
|
||||
result.addTable(1, std::make_shared<const Opm::SimpleTable>(tab1));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Opm::VFPInjTable getVFPInjTable()
|
||||
{
|
||||
Opm::VFPInjTable::array_type table;
|
||||
Opm::VFPInjTable::extents shape;
|
||||
shape[0] = 3;
|
||||
shape[1] = 2;
|
||||
table.resize(shape);
|
||||
double foo = 1.0;
|
||||
for (size_t i = 0; i < table.num_elements(); ++i)
|
||||
*(table.data() + i) = foo++;
|
||||
return Opm::VFPInjTable(1, 2.0, Opm::VFPInjTable::FLO_WAT, {1.0, 2.0},
|
||||
{3.0, 4.0, 5.0}, table);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1222,6 +1239,17 @@ BOOST_AUTO_TEST_CASE(MessageLimits)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(VFPInjTable)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::VFPInjTable val1 = getVFPInjTable();
|
||||
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