Tabdims: put some code in separate compile unit

to avoid include files in header
This commit is contained in:
Arne Morten Kvarving
2021-04-23 11:34:58 +02:00
parent 6547376330
commit 3307889464
5 changed files with 65 additions and 27 deletions

View File

@@ -187,6 +187,7 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/EclipseState/Tables/BrineDensityTable.cpp
src/opm/parser/eclipse/EclipseState/Tables/RwgsaltTable.cpp
src/opm/parser/eclipse/EclipseState/Tables/SolventDensityTable.cpp
src/opm/parser/eclipse/EclipseState/Tables/Tabdims.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParser.cpp

View File

@@ -20,17 +20,19 @@
#ifndef TABDIMS_HPP
#define TABDIMS_HPP
#include <cstddef>
/*
The Tabdims class is a small utility class designed to hold on to
the values from the TABDIMS keyword.
*/
#include <opm/parser/eclipse/Parser/ParserKeywords/T.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
namespace Opm {
class Deck;
class DeckKeyword;
class DeckRecord;
class Tabdims {
public:
@@ -39,29 +41,9 @@ namespace Opm {
are ECLIPSE300 only and quite exotic. Here we only
internalize the most common items.
*/
Tabdims() :
m_ntsfun( ParserKeywords::TABDIMS::NTSFUN::defaultValue ),
m_ntpvt( ParserKeywords::TABDIMS::NTPVT::defaultValue ),
m_nssfun( ParserKeywords::TABDIMS::NSSFUN::defaultValue ),
m_nppvt( ParserKeywords::TABDIMS::NPPVT::defaultValue ),
m_ntfip( ParserKeywords::TABDIMS::NTFIP::defaultValue ),
m_nrpvt( ParserKeywords::TABDIMS::NRPVT::defaultValue )
{ }
Tabdims();
explicit Tabdims(const Deck& deck) :
Tabdims()
{
if (deck.hasKeyword("TABDIMS")) {
const auto& record = deck.getKeyword( "TABDIMS" , 0 ).getRecord( 0 );
m_ntsfun = record.getItem("NTSFUN").get<int>(0);
m_ntpvt = record.getItem("NTPVT").get<int>(0);
m_nssfun = record.getItem("NSSFUN").get<int>(0);
m_nppvt = record.getItem("NPPVT").get<int>(0);
m_ntfip = record.getItem("NTFIP").get<int>(0);
m_nrpvt = record.getItem("NRPVT").get<int>(0);
}
}
explicit Tabdims(const Deck& deck);
static Tabdims serializeObject()
{

View File

@@ -32,6 +32,7 @@
#include <opm/parser/eclipse/Parser/ParserKeywords/M.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/O.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/P.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/T.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>

View File

@@ -50,6 +50,7 @@
#include <opm/parser/eclipse/Parser/ParserKeywords/L.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/N.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/P.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/T.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/V.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/W.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/W.hpp>

View File

@@ -0,0 +1,53 @@
/*
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
MERCHANTABILITY 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/>.
*/
#include <opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/T.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
namespace Opm {
Tabdims::Tabdims() :
m_ntsfun( ParserKeywords::TABDIMS::NTSFUN::defaultValue ),
m_ntpvt( ParserKeywords::TABDIMS::NTPVT::defaultValue ),
m_nssfun( ParserKeywords::TABDIMS::NSSFUN::defaultValue ),
m_nppvt( ParserKeywords::TABDIMS::NPPVT::defaultValue ),
m_ntfip( ParserKeywords::TABDIMS::NTFIP::defaultValue ),
m_nrpvt( ParserKeywords::TABDIMS::NRPVT::defaultValue )
{ }
Tabdims::Tabdims(const Deck& deck) :
Tabdims()
{
if (deck.hasKeyword("TABDIMS")) {
const auto& record = deck.getKeyword( "TABDIMS" , 0 ).getRecord( 0 );
m_ntsfun = record.getItem("NTSFUN").get<int>(0);
m_ntpvt = record.getItem("NTPVT").get<int>(0);
m_nssfun = record.getItem("NSSFUN").get<int>(0);
m_nppvt = record.getItem("NPPVT").get<int>(0);
m_ntfip = record.getItem("NTFIP").get<int>(0);
m_nrpvt = record.getItem("NRPVT").get<int>(0);
}
}
}