Serialize density-temparture class DenT

This commit is contained in:
Joakim Hove 2020-02-24 16:50:06 +01:00
parent 22d4e784d3
commit 2ce7b35e69
3 changed files with 55 additions and 1 deletions

View File

@ -454,6 +454,7 @@ HANDLE_AS_POD(data::CurrentControl)
HANDLE_AS_POD(data::Rates)
HANDLE_AS_POD(data::Segment)
HANDLE_AS_POD(DENSITYRecord)
HANDLE_AS_POD(DenT::entry)
HANDLE_AS_POD(Eqldims)
HANDLE_AS_POD(MLimits)
HANDLE_AS_POD(PVTWRecord)
@ -521,6 +522,11 @@ std::size_t packSize(const ThresholdPressure& data, Dune::MPIHelper::MPICommunic
packSize(data.pressureTable(), comm);
}
std::size_t packSize(const DenT& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.records(), comm);
}
std::size_t packSize(const Aquifetp& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.data(), comm);
@ -860,6 +866,9 @@ std::size_t packSize(const TableManager& data, Dune::MPIHelper::MPICommunicator
packSize(data.useEnptvd(), comm) +
packSize(data.useEqlnum(), comm) +
packSize(data.useJFunc(), comm) +
packSize(data.OilDenT(), comm) +
packSize(data.GasDenT(), comm) +
packSize(data.WatDenT(), comm) +
(data.useJFunc() ? packSize(data.getJFunc(), comm) : 0) +
packSize(data.rtemp(), comm);
}
@ -2356,6 +2365,12 @@ void pack(const Aquifetp::AQUFETP_data& data, std::vector<char>& buffer, int& po
pack(data.p0, buffer, position, comm);
}
void pack(const DenT& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm) {
pack(data.records(), buffer, position, comm);
}
void pack(const Aquifetp& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm) {
pack(data.data(), buffer, position, comm);
@ -2699,6 +2714,9 @@ void pack(const TableManager& data, std::vector<char>& buffer, int& position,
pack(data.useEnptvd(), buffer, position, comm);
pack(data.useEqlnum(), buffer, position, comm);
pack(data.useJFunc(), buffer, position, comm);
pack(data.OilDenT(), buffer, position, comm);
pack(data.GasDenT(), buffer, position, comm);
pack(data.WatDenT(), buffer, position, comm);
if (data.useJFunc())
pack(data.getJFunc(), buffer, position, comm);
pack(data.rtemp(), buffer, position, comm);
@ -4334,6 +4352,15 @@ void unpack(AquiferCT::AQUCT_data& data, std::vector<char>& buffer, int& positio
cell_id);
}
void unpack(DenT& data, std::vector<char>& buffer, int& position, Dune::MPIHelper::MPICommunicator comm)
{
std::vector<DenT::entry> records;
unpack(records, buffer, position, comm);
data = DenT( records );
}
void unpack(AquiferCT& data, std::vector<char>& buffer, int& position, Dune::MPIHelper::MPICommunicator comm)
{
std::vector<AquiferCT::AQUCT_data> aquiferList;
@ -4817,6 +4844,7 @@ void unpack(TableManager& data, std::vector<char>& buffer, int& position,
bool hasImptvd;
bool hasEntpvd;
bool hasEqlnum;
DenT oilDenT, gasDenT, watDenT;
std::shared_ptr<JFunc> jfunc;
double rtemp;
unpack(simpleTables, buffer, position, comm);
@ -4842,6 +4870,9 @@ void unpack(TableManager& data, std::vector<char>& buffer, int& position,
unpack(hasImptvd, buffer, position, comm);
unpack(hasEntpvd, buffer, position, comm);
unpack(hasEqlnum, buffer, position, comm);
unpack(oilDenT, buffer, position, comm);
unpack(gasDenT, buffer, position, comm);
unpack(watDenT, buffer, position, comm);
bool hasJf;
unpack(hasJf, buffer, position, comm);
if (hasJf) {
@ -4854,7 +4885,8 @@ void unpack(TableManager& data, std::vector<char>& buffer, int& position,
rockTable, viscrefTable, watdentTable, pvtwsaltTables,
bdensityTables, plymwinjTables,
skprwatTables, skprpolyTables, tabdims, regdims, eqldims,
aqudims, hasImptvd, hasEntpvd, hasEqlnum, jfunc, rtemp);
aqudims, hasImptvd, hasEntpvd, hasEqlnum, oilDenT, gasDenT,
watDenT, jfunc, rtemp);
}
template<class Scalar>

View File

@ -86,6 +86,7 @@ class Connection;
class DeckItem;
class DeckRecord;
class DENSITYRecord;
class DenT;
class DensityTable;
class Dimension;
class EclHysterConfig;
@ -699,6 +700,8 @@ ADD_PACK_PROTOTYPES(DeckKeyword)
ADD_PACK_PROTOTYPES(DeckRecord)
ADD_PACK_PROTOTYPES(DENSITYRecord)
ADD_PACK_PROTOTYPES(DensityTable)
ADD_PACK_PROTOTYPES(DenT)
ADD_PACK_PROTOTYPES(DenT::entry)
ADD_PACK_PROTOTYPES(Dimension)
ADD_PACK_PROTOTYPES(EclHysterConfig)
ADD_PACK_PROTOTYPES(EclipseConfig)

View File

@ -87,6 +87,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Eqldims.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/FlatTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/DenT.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/JFunc.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp>
@ -229,6 +230,13 @@ Opm::TableColumn getTableColumn()
}
Opm::DenT getDenT() {
std::vector<Opm::DenT::entry> records;
records.emplace_back(1,2,3);
records.emplace_back(4,5,6);
return Opm::DenT(records);
}
Opm::SimpleTable getSimpleTable()
{
Opm::OrderedMap<std::string, Opm::TableColumn> data;
@ -1208,6 +1216,9 @@ BOOST_AUTO_TEST_CASE(TableManager)
true,
true,
true,
getDent(),
getDenT(),
getDenT(),
jfunc,
1.0);
auto val2 = PackUnpack(val1);
@ -2463,6 +2474,14 @@ BOOST_AUTO_TEST_CASE(Fault)
#endif
}
BOOST_AUTO_TEST_CASE(DenT)
{
#ifdef HAVE_MPI
Opm::DenT val1 = getDenT();
auto val2 = PackUnpack(val1);
DO_CHECKS(DenT)
#endif
}
BOOST_AUTO_TEST_CASE(FaultCollection)
{