Minor refactor JFunc + TableManager
This commit is contained in:
@@ -39,7 +39,6 @@ public:
|
||||
double owSurfaceTension() const;
|
||||
const Flag& flag() const;
|
||||
const Direction& direction() const;
|
||||
operator bool() const { return m_exists; }
|
||||
|
||||
private:
|
||||
Flag m_flag; // JFUNC flag: WATER, GAS, or BOTH. Default BOTH
|
||||
@@ -48,7 +47,6 @@ private:
|
||||
double m_alphaFactor; // alternative porosity term. Default 0.5
|
||||
double m_betaFactor; // alternative permeability term. Default 0.5
|
||||
Direction m_direction; // XY, X, Y, Z. Default XY
|
||||
const bool m_exists; // will be true if JFunc is specified in the deck
|
||||
};
|
||||
} // Opm::
|
||||
|
||||
|
||||
@@ -50,10 +50,10 @@ namespace Opm {
|
||||
|
||||
class Eqldims;
|
||||
class Regdims;
|
||||
|
||||
class TableManager {
|
||||
public:
|
||||
explicit TableManager( const Deck& deck );
|
||||
TableManager() = default;
|
||||
|
||||
const TableContainer& getTables( const std::string& tableName ) const;
|
||||
const TableContainer& operator[](const std::string& tableName) const;
|
||||
@@ -293,12 +293,10 @@ namespace Opm {
|
||||
std::shared_ptr<Eqldims> m_eqldims;
|
||||
Aqudims m_aqudims;
|
||||
|
||||
const bool hasImptvd;// if deck has keyword IMPTVD
|
||||
const bool hasEnptvd;// if deck has keyword ENPTVD
|
||||
const bool hasEqlnum;// if deck has keyword EQLNUM
|
||||
|
||||
|
||||
const JFunc m_jfunc;
|
||||
const bool hasImptvd = false;// if deck has keyword IMPTVD
|
||||
const bool hasEnptvd = false;// if deck has keyword ENPTVD
|
||||
const bool hasEqlnum = false;// if deck has keyword EQLNUM
|
||||
std::shared_ptr<JFunc> jfunc;
|
||||
|
||||
double m_rtemp;
|
||||
};
|
||||
|
||||
@@ -23,11 +23,8 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
JFunc::JFunc(const Deck& deck) :
|
||||
m_exists(deck.hasKeyword("JFUNC"))
|
||||
JFunc::JFunc(const Deck& deck)
|
||||
{
|
||||
if (!m_exists)
|
||||
return;
|
||||
const auto& kw = *deck.getKeywordList<ParserKeywords::JFUNC>()[0];
|
||||
const auto& rec = kw.getRecord(0);
|
||||
const auto& kw_flag = rec.getItem("FLAG").get<std::string>(0);
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <opm/common/OpmLog/LogUtil.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/E.hpp>
|
||||
@@ -86,15 +88,19 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
|
||||
|
||||
TableManager::TableManager( const Deck& deck )
|
||||
:
|
||||
m_tabdims( Tabdims(deck)),
|
||||
m_aqudims( Aqudims(deck)),
|
||||
hasImptvd (deck.hasKeyword("IMPTVD")),
|
||||
hasEnptvd (deck.hasKeyword("ENPTVD")),
|
||||
hasEqlnum (deck.hasKeyword("EQLNUM")),
|
||||
m_jfunc( deck )
|
||||
hasEqlnum (deck.hasKeyword("EQLNUM"))
|
||||
{
|
||||
if (deck.hasKeyword("JFUNC"))
|
||||
jfunc.reset( new JFunc(deck) );
|
||||
|
||||
// determine the default resevoir temperature in Kelvin
|
||||
m_rtemp = ParserKeywords::RTEMP::TEMP::defaultValue;
|
||||
m_rtemp += Metric::TemperatureOffset; // <- default values always use METRIC as the unit system!
|
||||
@@ -656,10 +662,10 @@ namespace Opm {
|
||||
const TableContainer& TableManager::getPlyshlogTables() const {
|
||||
return getTables("PLYSHLOG");
|
||||
}
|
||||
|
||||
|
||||
const TableContainer& TableManager::getAqutabTables() const {
|
||||
return getTables("AQUTAB");
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<PvtgTable>& TableManager::getPvtgTables() const {
|
||||
return m_pvtgTables;
|
||||
@@ -713,9 +719,9 @@ namespace Opm {
|
||||
}
|
||||
|
||||
const JFunc& TableManager::getJFunc() const {
|
||||
if (!useJFunc())
|
||||
if (!jfunc)
|
||||
throw std::invalid_argument("Cannot get JFUNC table when JFUNC not in deck");
|
||||
return m_jfunc;
|
||||
return *jfunc;
|
||||
}
|
||||
|
||||
bool TableManager::useImptvd() const {
|
||||
@@ -731,7 +737,10 @@ namespace Opm {
|
||||
}
|
||||
|
||||
bool TableManager::useJFunc() const {
|
||||
return m_jfunc;
|
||||
if (jfunc)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user