Moved PVTO and PVTG tables EclipseState -> Tables

This commit is contained in:
Joakim Hove 2015-08-31 16:44:15 +02:00
parent 0250a9408c
commit 07e5fa04ce
6 changed files with 47 additions and 45 deletions

View File

@ -165,15 +165,6 @@ namespace Opm {
}
const std::vector<PvtgTable>& EclipseState::getPvtgTables() const {
return m_pvtgTables;
}
const std::vector<PvtoTable>& EclipseState::getPvtoTables() const {
return m_pvtoTables;
}
ScheduleConstPtr EclipseState::getSchedule() const {
return schedule;
@ -219,8 +210,6 @@ namespace Opm {
void EclipseState::initTables(DeckConstPtr deck) {
m_tables = std::make_shared<const Tables>( *deck );
initFullTables(deck, "PVTG", m_pvtgTables);
initFullTables(deck, "PVTO", m_pvtoTables);
}
void EclipseState::initIOConfig(DeckConstPtr deck) {

View File

@ -34,8 +34,6 @@
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Tables.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
@ -88,11 +86,6 @@ namespace Opm {
bool hasNNC() const;
std::shared_ptr<const Tables> getTables() const;
// the tables used by the deck. If the tables had some defaulted data in the
// deck, the objects returned here exhibit the correct values. If the table is
// not present in the deck, the corresponding vector is of size zero.
const std::vector<PvtgTable>& getPvtgTables() const;
const std::vector<PvtoTable>& getPvtoTables() const;
size_t getNumPhases() const;
// the unit system used by the deck. note that it is rarely needed to convert
@ -149,27 +142,6 @@ namespace Opm {
}
}
template <class TableType>
void initFullTables(DeckConstPtr deck,
const std::string& keywordName,
std::vector<TableType>& tableVector) {
if (!deck->hasKeyword(keywordName))
return; // the table is not featured by the deck...
if (deck->numKeywords(keywordName) > 1) {
complainAboutAmbiguousKeyword(deck, keywordName);
return;
}
const auto& tableKeyword = deck->getKeyword(keywordName);
int numTables = TableType::numTables(tableKeyword);
for (int tableIdx = 0; tableIdx < numTables; ++tableIdx) {
tableVector.push_back(TableType());
tableVector[tableIdx].init(tableKeyword, tableIdx);
}
}
void setMULTFLT(std::shared_ptr<const Section> section) const;
void initMULTREGT(DeckConstPtr deck);
@ -204,8 +176,6 @@ namespace Opm {
SimulationConfigConstPtr m_simulationConfig;
std::shared_ptr<const Tables> m_tables;
std::vector<PvtgTable> m_pvtgTables;
std::vector<PvtoTable> m_pvtoTables;
std::set<enum Phase::PhaseEnum> phases;
std::string m_title;

View File

@ -25,7 +25,7 @@
namespace Opm {
// forward declaration
class EclipseState;
class Tables;
/*!
* \brief Read the table for the PVTG and provide convenient access to it.
@ -34,7 +34,7 @@ namespace Opm {
{
typedef Opm::FullTable<Opm::PvtgOuterTable, Opm::PvtgInnerTable> ParentType;
friend class EclipseState;
friend class Tables;
using ParentType::init;

View File

@ -25,7 +25,7 @@
namespace Opm {
// forward declaration
class EclipseState;
class Tables;
/*!
* \brief Read the table for the PVTO and provide convenient access to it.
@ -33,7 +33,7 @@ namespace Opm {
class PvtoTable : public Opm::FullTable<Opm::PvtoOuterTable, Opm::PvtoInnerTable>
{
typedef Opm::FullTable<Opm::PvtoOuterTable, Opm::PvtoInnerTable> ParentType;
friend class EclipseState;
friend class Tables;
using ParentType::init;
public:

View File

@ -55,6 +55,8 @@ namespace Opm {
initRocktabTables(deck);
initRTempTables(deck);
initGasvisctTables(deck, "GASVISCT", m_gasvisctTables);
initFullTables(deck, "PVTG", m_pvtgTables);
initFullTables(deck, "PVTO", m_pvtoTables);
initVFPProdTables(deck, m_vfpprodTables);
initVFPInjTables(deck, m_vfpinjTables);
@ -373,6 +375,14 @@ namespace Opm {
return m_rvvdTables;
}
const std::vector<PvtgTable>& Tables::getPvtgTables() const {
return m_pvtgTables;
}
const std::vector<PvtoTable>& Tables::getPvtoTables() const {
return m_pvtoTables;
}
void Tables::complainAboutAmbiguousKeyword(const Deck& deck, const std::string& keywordName) const {
OpmLog::addMessage(Log::MessageType::Error, "The " + keywordName + " keyword must be unique in the deck. Ignoring all!");

View File

@ -51,6 +51,8 @@
#include <opm/parser/eclipse/EclipseState/Tables/EnptvdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/ImkrvdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/ImptvdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/VFPProdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/VFPInjTable.hpp>
@ -63,6 +65,12 @@ namespace Opm {
std::shared_ptr<const Tabdims> getTabdims() const;
// the tables used by the deck. If the tables had some defaulted data in the
// deck, the objects returned here exhibit the correct values. If the table is
// not present in the deck, the corresponding vector is of size zero.
const std::vector<PvtgTable>& getPvtgTables() const;
const std::vector<PvtoTable>& getPvtoTables() const;
const std::vector<Sof2Table>& getSof2Tables() const;
const std::vector<Sof3Table>& getSof3Tables() const;
const std::vector<SwofTable>& getSwofTables() const;
@ -146,8 +154,33 @@ namespace Opm {
}
}
template <class TableType>
void initFullTables(const Deck& deck,
const std::string& keywordName,
std::vector<TableType>& tableVector) {
if (!deck.hasKeyword(keywordName))
return; // the table is not featured by the deck...
if (deck.numKeywords(keywordName) > 1) {
complainAboutAmbiguousKeyword(deck, keywordName);
return;
}
const auto& tableKeyword = deck.getKeyword(keywordName);
int numTables = TableType::numTables(tableKeyword);
for (int tableIdx = 0; tableIdx < numTables; ++tableIdx) {
tableVector.push_back(TableType());
tableVector[tableIdx].init(tableKeyword, tableIdx);
}
}
std::map<int, VFPProdTable> m_vfpprodTables;
std::map<int, VFPInjTable> m_vfpinjTables;
std::vector<PvtgTable> m_pvtgTables;
std::vector<PvtoTable> m_pvtoTables;
std::vector<PvdsTable> m_pvdsTables;
std::vector<SwfnTable> m_swfnTables;
std::vector<SgfnTable> m_sgfnTables;