Added TableContainers for the simplest tables.
This commit is contained in:
parent
d1bb9bd2f0
commit
f77e1af9f0
@ -221,6 +221,7 @@ EclipseState/IOConfig/IOConfig.hpp
|
||||
#
|
||||
EclipseState/Tables/Tabdims.hpp
|
||||
EclipseState/Tables/Eqldims.hpp
|
||||
EclipseState/Tables/Regdims.hpp
|
||||
EclipseState/Tables/PlyadsTable.hpp
|
||||
EclipseState/Tables/PvtoOuterTable.hpp
|
||||
EclipseState/Tables/RocktabTable.hpp
|
||||
|
66
opm/parser/eclipse/EclipseState/Tables/Regdims.hpp
Normal file
66
opm/parser/eclipse/EclipseState/Tables/Regdims.hpp
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright (C) 2015 Statoil ASA
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANREGILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef REGDIMS_HPP
|
||||
#define REGDIMS_HPP
|
||||
|
||||
/*
|
||||
The Regdims class is a small utility class designed to hold on to
|
||||
the values from the REGDIMS keyword.
|
||||
*/
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords.hpp>
|
||||
|
||||
namespace Opm {
|
||||
class Regdims {
|
||||
public:
|
||||
|
||||
Regdims() :
|
||||
m_NTFIP( ParserKeywords::REGDIMS::NTFIP::defaultValue ),
|
||||
m_NMFIPR( ParserKeywords::REGDIMS::NMFIPR::defaultValue ),
|
||||
m_NRFREG( ParserKeywords::REGDIMS::NRFREG::defaultValue ),
|
||||
m_NTFREG( ParserKeywords::REGDIMS::NTFREG::defaultValue ),
|
||||
m_NPLMIX( ParserKeywords::REGDIMS::NPLMIX::defaultValue )
|
||||
{ }
|
||||
|
||||
Regdims(size_t ntfip , size_t nmfipr , size_t nrfregr , size_t ntfreg , size_t nplmix) :
|
||||
m_NTFIP( ntfip ),
|
||||
m_NMFIPR( nmfipr ),
|
||||
m_NRFREG( nrfregr ),
|
||||
m_NTFREG( ntfreg ),
|
||||
m_NPLMIX( nplmix )
|
||||
{}
|
||||
|
||||
|
||||
size_t getNPLMIX() const {
|
||||
return m_NPLMIX;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
size_t m_NTFIP;
|
||||
size_t m_NMFIPR;
|
||||
size_t m_NRFREG;
|
||||
size_t m_NTFREG;
|
||||
size_t m_NPLMIX;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -89,14 +89,76 @@ namespace Opm {
|
||||
return false;
|
||||
else {
|
||||
const auto& tables = pair->second;
|
||||
return tables.empty();
|
||||
return !tables.empty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const TableContainer& TableManager::getTables( const std::string& tableName ) const {
|
||||
auto pair = m_simpleTables.find( tableName );
|
||||
if (pair == m_simpleTables.end())
|
||||
throw std::invalid_argument("No such table collection: " + tableName);
|
||||
else
|
||||
return pair->second;
|
||||
}
|
||||
|
||||
const TableContainer& TableManager::operator[](const std::string& tableName) const {
|
||||
return getTables(tableName);
|
||||
}
|
||||
|
||||
void TableManager::initSimpleTables(const Deck& deck) {
|
||||
addTables( "SWOF" , m_tabdims->getNumSatTables() );
|
||||
addTables( "SWOF", m_tabdims->getNumSatTables() );
|
||||
addTables( "SGOF", m_tabdims->getNumSatTables() );
|
||||
addTables( "SLGOF", m_tabdims->getNumSatTables() );
|
||||
addTables( "SOF2", m_tabdims->getNumSatTables() );
|
||||
addTables( "SOF3", m_tabdims->getNumSatTables() );
|
||||
addTables( "SWFN", m_tabdims->getNumSatTables() );
|
||||
addTables( "SGFN", m_tabdims->getNumSatTables() );
|
||||
addTables( "SSFN", m_tabdims->getNumSatTables() );
|
||||
|
||||
addTables( "PLYADS", m_tabdims->getNumSatTables() );
|
||||
addTables( "PLYROCK", m_tabdims->getNumSatTables());
|
||||
addTables( "PLYVISC", m_tabdims->getNumPVTTables());
|
||||
addTables( "PLYDHFLF", m_tabdims->getNumPVTTables());
|
||||
|
||||
addTables( "PVDG", m_tabdims->getNumPVTTables());
|
||||
addTables( "PVDO", m_tabdims->getNumPVTTables());
|
||||
addTables( "PVDS", m_tabdims->getNumPVTTables());
|
||||
|
||||
addTables( "OILVISCT", m_tabdims->getNumPVTTables());
|
||||
addTables( "WATVISCT", m_tabdims->getNumPVTTables());
|
||||
|
||||
|
||||
addTables( "PLYMAX", m_regdims->getNPLMIX());
|
||||
addTables( "RSVD", m_eqldims->getNumEquilRegions());
|
||||
addTables( "RVVD", m_eqldims->getNumEquilRegions());
|
||||
|
||||
{
|
||||
size_t numEndScaleTables = ParserKeywords::ENDSCALE::NUM_TABLES::defaultValue;
|
||||
|
||||
if (deck.hasKeyword<ParserKeywords::ENDSCALE>()) {
|
||||
auto keyword = deck.getKeyword<ParserKeywords::ENDSCALE>();
|
||||
auto record = keyword->getRecord(0);
|
||||
numEndScaleTables = static_cast<size_t>(record->getItem<ParserKeywords::ENDSCALE::NUM_TABLES>()->getInt(0));
|
||||
}
|
||||
|
||||
addTables( "ENKRVD", numEndScaleTables);
|
||||
addTables( "ENPTVD", numEndScaleTables);
|
||||
addTables( "IMKRVD", numEndScaleTables);
|
||||
addTables( "IMPTVD", numEndScaleTables);
|
||||
}
|
||||
// Unhandled:
|
||||
|
||||
/*
|
||||
initPlyshlogTables(deck, "PLYSHLOG", m_plyshlogTables);
|
||||
initRocktabTables(deck);
|
||||
initRTempTables(deck);
|
||||
initGasvisctTables(deck, "GASVISCT", m_gasvisctTables);
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
initSimpleTable(deck, "SWOF", m_swofTables);
|
||||
initSimpleTable(deck, "SGOF", m_sgofTables);
|
||||
@ -176,8 +238,8 @@ namespace Opm {
|
||||
}
|
||||
|
||||
void TableManager::initPlyshlogTables(const Deck& deck,
|
||||
const std::string& keywordName,
|
||||
std::vector<PlyshlogTable>& tableVector){
|
||||
const std::string& keywordName,
|
||||
std::vector<PlyshlogTable>& tableVector){
|
||||
|
||||
if (!deck.hasKeyword(keywordName)) {
|
||||
return;
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Eqldims.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Regdims.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/SwofTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/SgofTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/SlgofTable.hpp>
|
||||
@ -64,7 +66,11 @@ namespace Opm {
|
||||
public:
|
||||
TableManager( const Deck& deck );
|
||||
|
||||
const TableContainer& getTables( const std::string& tableName ) const;
|
||||
const TableContainer& operator[](const std::string& tableName) const;
|
||||
bool hasTables( const std::string& tableName ) const;
|
||||
|
||||
|
||||
std::shared_ptr<const Tabdims> getTabdims() const;
|
||||
|
||||
// the tables used by the deck. If the tables had some defaulted data in the
|
||||
@ -100,6 +106,7 @@ namespace Opm {
|
||||
const std::vector<ImptvdTable>& getImptvdTables() const;
|
||||
const std::vector<RsvdTable>& getRsvdTables() const;
|
||||
const std::vector<RvvdTable>& getRvvdTables() const;
|
||||
|
||||
const std::map<int, VFPProdTable>& getVFPProdTables() const;
|
||||
const std::map<int, VFPInjTable>& getVFPInjTables() const;
|
||||
private:
|
||||
@ -224,6 +231,7 @@ namespace Opm {
|
||||
std::vector<RsvdTable> m_rsvdTables;
|
||||
std::vector<RvvdTable> m_rvvdTables;
|
||||
|
||||
std::shared_ptr<Regdims> m_regdims;
|
||||
std::shared_ptr<Tabdims> m_tabdims;
|
||||
std::shared_ptr<Eqldims> m_eqldims;
|
||||
};
|
||||
|
@ -913,6 +913,9 @@ BOOST_AUTO_TEST_CASE(TableContainer) {
|
||||
Opm::TableManager tables( *deck );
|
||||
BOOST_CHECK_EQUAL( false , tables.hasTables("SGOF") );
|
||||
BOOST_CHECK_EQUAL( false , tables.hasTables("STUPID") );
|
||||
|
||||
BOOST_CHECK_THROW( tables.getTables("STUPID") , std::invalid_argument);
|
||||
BOOST_CHECK_THROW( tables["STUPID"] , std::invalid_argument);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user