From 9bd8d73a26906e51bd6573caa1533d4f4997a5f4 Mon Sep 17 00:00:00 2001
From: Joakim Hove <joakim.hove@gmail.com>
Date: Tue, 1 Sep 2015 13:14:51 +0200
Subject: [PATCH] Using TableManager to get tables.

---
 opm/autodiff/BlackoilModelBase_impl.hpp  |  2 +-
 opm/autodiff/BlackoilPropsAdFromDeck.cpp | 15 ++++++++-------
 opm/autodiff/SolventPropsAdFromDeck.cpp  |  5 +++--
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp
index f920d9553..0b7b1acf7 100644
--- a/opm/autodiff/BlackoilModelBase_impl.hpp
+++ b/opm/autodiff/BlackoilModelBase_impl.hpp
@@ -157,7 +157,7 @@ namespace detail {
         , geo_   (geo)
         , rock_comp_props_(rock_comp_props)
         , wells_ (wells)
-        , vfp_properties_(eclState->getVFPInjTables(), eclState->getVFPProdTables())
+        , vfp_properties_(eclState->getTableManager()->getVFPInjTables(), eclState->getTableManager()->getVFPProdTables())
         , linsolver_ (linsolver)
         , active_(detail::activePhases(fluid.phaseUsage()))
         , canph_ (detail::active2Canonical(fluid.phaseUsage()))
diff --git a/opm/autodiff/BlackoilPropsAdFromDeck.cpp b/opm/autodiff/BlackoilPropsAdFromDeck.cpp
index 40d6a9a3a..fed50e945 100644
--- a/opm/autodiff/BlackoilPropsAdFromDeck.cpp
+++ b/opm/autodiff/BlackoilPropsAdFromDeck.cpp
@@ -121,6 +121,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
         // Surface densities. Accounting for different orders in eclipse and our code.
         Opm::DeckKeywordConstPtr densityKeyword = deck->getKeyword("DENSITY");
         int numRegions = densityKeyword->size();
+        auto tables = eclState->getTableManager();
 
         densities_.resize(numRegions);
         for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
@@ -153,7 +154,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
             props_[phase_usage_.phase_pos[Aqua]] = pvtw;
 
             // handle temperature dependence of the oil phase
-            if (!eclState->getWatvisctTables().empty() || deck->hasKeyword("WATDENT")) {
+            if (!tables->getWatvisctTables().empty() || deck->hasKeyword("WATDENT")) {
                 // deal with temperature dependent properties
                 std::shared_ptr<ThermalWaterPvtWrapper> waterNiPvt(new ThermalWaterPvtWrapper);
                 waterNiPvt->initFromDeck(props_[phase_usage_.phase_pos[Aqua]], deck, eclState);
@@ -165,8 +166,8 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
         if (phase_usage_.phase_used[Liquid]) {
             // for oil, we support the "PVDO", "PVTO" and "PVCDO"
             // keywords...
-            const auto& pvdoTables = eclState->getPvdoTables();
-            const auto& pvtoTables = eclState->getPvtoTables();
+            const auto& pvdoTables = tables->getPvdoTables();
+            const auto& pvtoTables = tables->getPvtoTables();
             if (!pvdoTables.empty()) {
                 if (numSamples > 0) {
                     auto splinePvdo = std::shared_ptr<PvtDeadSpline>(new PvtDeadSpline);
@@ -189,7 +190,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
             }
 
             // handle temperature dependence of the oil phase
-            if (!eclState->getOilvisctTables().empty() || deck->hasKeyword("THERMEX1")) {
+            if (!tables->getOilvisctTables().empty() || deck->hasKeyword("THERMEX1")) {
                 std::shared_ptr<ThermalOilPvtWrapper> oilNiPvt(new ThermalOilPvtWrapper);
                 oilNiPvt->initFromDeck(props_[phase_usage_.phase_pos[Liquid]], deck, eclState);
 
@@ -199,8 +200,8 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
         // Gas PVT
         if (phase_usage_.phase_used[Vapour]) {
             // gas can be specified using the "PVDG" or "PVTG" keywords...
-            const auto& pvdgTables = eclState->getPvdgTables();
-            const auto& pvtgTables = eclState->getPvtgTables();
+            const auto& pvdgTables = tables->getPvdgTables();
+            const auto& pvtgTables = tables->getPvtgTables();
             if (!pvdgTables.empty()) {
                 if (numSamples > 0) {
                     std::shared_ptr<PvtDeadSpline> splinePvt(new PvtDeadSpline);
@@ -218,7 +219,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
             }
 
             // handle temperature dependence of the gas phase
-            if (!eclState->getGasvisctTables().empty() || deck->hasKeyword("TREF")) {
+            if (!tables->getGasvisctTables().empty() || deck->hasKeyword("TREF")) {
                 std::shared_ptr<ThermalGasPvtWrapper> gasNiPvt(new ThermalGasPvtWrapper);
                 gasNiPvt->initFromDeck(props_[phase_usage_.phase_pos[Vapour]], deck, eclState);
 
diff --git a/opm/autodiff/SolventPropsAdFromDeck.cpp b/opm/autodiff/SolventPropsAdFromDeck.cpp
index 5cf40034a..8cc9254f3 100644
--- a/opm/autodiff/SolventPropsAdFromDeck.cpp
+++ b/opm/autodiff/SolventPropsAdFromDeck.cpp
@@ -51,8 +51,9 @@ SolventPropsAdFromDeck::SolventPropsAdFromDeck(DeckConstPtr deck,
         OPM_THROW(std::runtime_error, "SDENSITY must be specified in SOLVENT runs\n");
     }
 
+    auto tables = eclState->getTableManager();
     // pvt
-    const auto& pvdsTables = eclState->getPvdsTables();
+    const auto& pvdsTables = tables->getPvdsTables();
     if (!pvdsTables.empty()) {
 
         int numRegions = pvdsTables.size();
@@ -88,7 +89,7 @@ SolventPropsAdFromDeck::SolventPropsAdFromDeck(DeckConstPtr deck,
         OPM_THROW(std::runtime_error, "PVDS must be specified in SOLVENT runs\n");
     }
 
-    const auto& ssfnTables = eclState->getSsfnTables();
+    const auto& ssfnTables = tables->getSsfnTables();
     // relative permeabilty multiplier
     if (!ssfnTables.empty()) {