Moved tabdims instance EclipseState -> Tables
This commit is contained in:
@@ -159,8 +159,9 @@ namespace Opm {
|
||||
return std::make_shared<EclipseGrid>( m_eclipseGrid->c_ptr() );
|
||||
}
|
||||
|
||||
std::shared_ptr<const Tabdims> EclipseState::getTabdims() const {
|
||||
return m_tabdims;
|
||||
|
||||
std::shared_ptr<const Tables> EclipseState::getTables() const {
|
||||
return m_tables;
|
||||
}
|
||||
|
||||
const std::vector<EnkrvdTable>& EclipseState::getEnkrvdTables() const {
|
||||
@@ -331,38 +332,10 @@ namespace Opm {
|
||||
return m_title;
|
||||
}
|
||||
|
||||
void EclipseState::initTabdims(DeckConstPtr deck) {
|
||||
/*
|
||||
The default values for the various number of tables is
|
||||
embedded in the ParserKeyword("TABDIMS") instance; however
|
||||
the EclipseState object does not have a dependency on the
|
||||
Parser classes, have therefor decided not to add an explicit
|
||||
dependency here, and instead duplicated all the default
|
||||
values.
|
||||
*/
|
||||
size_t ntsfun = 1;
|
||||
size_t ntpvt = 1;
|
||||
size_t nssfun = 1;
|
||||
size_t nppvt = 1;
|
||||
size_t ntfip = 1;
|
||||
size_t nrpvt = 1;
|
||||
|
||||
if (deck->hasKeyword("TABDIMS")) {
|
||||
auto keyword = deck->getKeyword("TABDIMS");
|
||||
auto record = keyword->getRecord(0);
|
||||
ntsfun = record->getItem("NTSFUN")->getInt(0);
|
||||
ntpvt = record->getItem("NTPVT")->getInt(0);
|
||||
nssfun = record->getItem("NSSFUN")->getInt(0);
|
||||
nppvt = record->getItem("NPPVT")->getInt(0);
|
||||
ntfip = record->getItem("NTFIP")->getInt(0);
|
||||
nrpvt = record->getItem("NRPVT")->getInt(0);
|
||||
}
|
||||
m_tabdims = std::make_shared<Tabdims>(ntsfun , ntpvt , nssfun , nppvt , ntfip , nrpvt);
|
||||
}
|
||||
|
||||
|
||||
void EclipseState::initTables(DeckConstPtr deck) {
|
||||
initTabdims( deck );
|
||||
m_tables = std::make_shared<const Tables>( *deck );
|
||||
initSimpleTables(deck, "ENKRVD", m_enkrvdTables);
|
||||
initSimpleTables(deck, "ENPTVD", m_enptvdTables);
|
||||
initSimpleTables(deck, "IMKRVD", m_imkrvdTables);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Tables.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/EnkrvdTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/EnptvdTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/GasvisctTable.hpp>
|
||||
@@ -117,10 +117,10 @@ namespace Opm {
|
||||
std::shared_ptr<const NNC> getNNC() const;
|
||||
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.
|
||||
std::shared_ptr<const Tabdims> getTabdims() const;
|
||||
const std::vector<EnkrvdTable>& getEnkrvdTables() const;
|
||||
const std::vector<EnptvdTable>& getEnptvdTables() const;
|
||||
const std::vector<GasvisctTable>& getGasvisctTables() const;
|
||||
@@ -277,8 +277,7 @@ namespace Opm {
|
||||
ScheduleConstPtr schedule;
|
||||
SimulationConfigConstPtr m_simulationConfig;
|
||||
|
||||
|
||||
std::shared_ptr<const Tabdims> m_tabdims;
|
||||
std::shared_ptr<const Tables> m_tables;
|
||||
std::vector<EnkrvdTable> m_enkrvdTables;
|
||||
std::vector<EnptvdTable> m_enptvdTables;
|
||||
std::vector<GasvisctTable> m_gasvisctTables;
|
||||
|
||||
@@ -81,8 +81,8 @@ protected:
|
||||
|
||||
|
||||
void findSaturationEndpoints( ) const {
|
||||
|
||||
auto tabdims = m_eclipseState.getTabdims();
|
||||
auto tables = m_eclipseState.getTables();
|
||||
auto tabdims = tables->getTabdims();
|
||||
size_t numSatTables = tabdims->getNumSatTables();
|
||||
m_minWaterSat.resize( numSatTables , 0 );
|
||||
m_maxWaterSat.resize( numSatTables , 0 );
|
||||
@@ -142,8 +142,8 @@ protected:
|
||||
|
||||
|
||||
void findCriticalPoints( ) const {
|
||||
|
||||
auto tabdims = m_eclipseState.getTabdims();
|
||||
auto tables = m_eclipseState.getTables();
|
||||
auto tabdims = tables->getTabdims();
|
||||
size_t numSatTables = tabdims->getNumSatTables();
|
||||
|
||||
m_criticalWaterSat.resize( numSatTables , 0 );
|
||||
@@ -308,8 +308,8 @@ protected:
|
||||
}
|
||||
|
||||
void findVerticalPoints( ) const {
|
||||
|
||||
auto tabdims = m_eclipseState.getTabdims();
|
||||
auto tables = m_eclipseState.getTables();
|
||||
auto tabdims = tables->getTabdims();
|
||||
size_t numSatTables = tabdims->getNumSatTables();
|
||||
|
||||
m_maxPcog.resize( numSatTables , 0 );
|
||||
@@ -518,7 +518,8 @@ public:
|
||||
bool useOneMinusTableValue) const
|
||||
{
|
||||
auto eclipseGrid = this->m_eclipseState.getEclipseGrid();
|
||||
auto tabdims = this->m_eclipseState.getTabdims();
|
||||
auto tables = this->m_eclipseState.getTables();
|
||||
auto tabdims = tables->getTabdims();
|
||||
auto satnum = this->m_eclipseState.getIntGridProperty("SATNUM");
|
||||
auto endnum = this->m_eclipseState.getIntGridProperty("ENDNUM");
|
||||
int numSatTables = tabdims->getNumSatTables();
|
||||
@@ -576,9 +577,11 @@ public:
|
||||
bool useOneMinusTableValue) const
|
||||
{
|
||||
auto eclipseGrid = this->m_eclipseState.getEclipseGrid();
|
||||
auto tabdims = this->m_eclipseState.getTabdims();
|
||||
auto tables = this->m_eclipseState.getTables();
|
||||
auto imbnum = this->m_eclipseState.getIntGridProperty("IMBNUM");
|
||||
auto endnum = this->m_eclipseState.getIntGridProperty("ENDNUM");
|
||||
|
||||
auto tabdims = tables->getTabdims();
|
||||
int numSatTables = tabdims->getNumSatTables();
|
||||
|
||||
imbnum->checkLimits(1 , numSatTables);
|
||||
|
||||
@@ -25,6 +25,43 @@
|
||||
namespace Opm {
|
||||
|
||||
Tables::Tables( const Deck& deck ) {
|
||||
initTabdims( deck );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Tables::initTabdims(const Deck& deck) {
|
||||
/*
|
||||
The default values for the various number of tables is
|
||||
embedded in the ParserKeyword("TABDIMS") instance; however
|
||||
the EclipseState object does not have a dependency on the
|
||||
Parser classes, have therefor decided not to add an explicit
|
||||
dependency here, and instead duplicated all the default
|
||||
values.
|
||||
*/
|
||||
size_t ntsfun = 1;
|
||||
size_t ntpvt = 1;
|
||||
size_t nssfun = 1;
|
||||
size_t nppvt = 1;
|
||||
size_t ntfip = 1;
|
||||
size_t nrpvt = 1;
|
||||
|
||||
if (deck.hasKeyword("TABDIMS")) {
|
||||
auto keyword = deck.getKeyword("TABDIMS");
|
||||
auto record = keyword->getRecord(0);
|
||||
ntsfun = record->getItem("NTSFUN")->getInt(0);
|
||||
ntpvt = record->getItem("NTPVT")->getInt(0);
|
||||
nssfun = record->getItem("NSSFUN")->getInt(0);
|
||||
nppvt = record->getItem("NPPVT")->getInt(0);
|
||||
ntfip = record->getItem("NTFIP")->getInt(0);
|
||||
nrpvt = record->getItem("NRPVT")->getInt(0);
|
||||
}
|
||||
m_tabdims = std::make_shared<Tabdims>(ntsfun , ntpvt , nssfun , nppvt , ntfip , nrpvt);
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<const Tabdims> Tables::getTabdims() const {
|
||||
return m_tabdims;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#ifndef OPM_TABLES_HPP
|
||||
#define OPM_TABLES_HPP
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -27,8 +28,13 @@ namespace Opm {
|
||||
public:
|
||||
Tables( const Deck& deck );
|
||||
|
||||
|
||||
std::shared_ptr<const Tabdims> getTabdims() const;
|
||||
private:
|
||||
|
||||
void initTabdims(const Deck& deck);
|
||||
|
||||
|
||||
std::shared_ptr<Tabdims> m_tabdims;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,8 @@ std::shared_ptr<const Opm::Deck> createSingleRecordDeck() {
|
||||
BOOST_AUTO_TEST_CASE( CreateTables ) {
|
||||
std::shared_ptr<const Opm::Deck> deck = createSingleRecordDeck();
|
||||
Opm::Tables tables(*deck);
|
||||
auto tabdims = tables.getTabdims();
|
||||
BOOST_CHECK_EQUAL( tabdims->getNumSatTables() , 2 );
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user