Merge pull request #978 from joakim-hove/ACTDIMS
Add micro class to contain information from ACTDIMS keyword
This commit is contained in:
@@ -80,6 +80,7 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionResult.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/Actdims.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/Actions.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionParser.cpp
|
||||
@@ -528,6 +529,7 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/ActionResult.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/Actdims.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/Actions.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EndpointScaling.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/Actdims.hpp>
|
||||
|
||||
namespace Opm {
|
||||
class Deck;
|
||||
@@ -171,6 +172,7 @@ public:
|
||||
const WellSegmentDims& wellSegmentDimensions() const noexcept;
|
||||
int eclPhaseMask( ) const noexcept;
|
||||
const EclHysterConfig& hysterPar() const noexcept;
|
||||
const Actdims& actdims() const noexcept;
|
||||
|
||||
private:
|
||||
Phases active_phases;
|
||||
@@ -180,6 +182,7 @@ private:
|
||||
WellSegmentDims wsegdims;
|
||||
UDQParams udq_params;
|
||||
EclHysterConfig hystpar;
|
||||
Actdims m_actdims;
|
||||
};
|
||||
|
||||
|
||||
|
||||
46
opm/parser/eclipse/EclipseState/Schedule/Action/Actdims.hpp
Normal file
46
opm/parser/eclipse/EclipseState/Schedule/Action/Actdims.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright 2019 Equinor 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/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ACTDIMS_HPP_
|
||||
#define ACTDIMS_HPP_
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
namespace Opm {
|
||||
class Actdims {
|
||||
public:
|
||||
Actdims();
|
||||
explicit Actdims(const Deck& deck);
|
||||
|
||||
std::size_t max_keywords() const;
|
||||
std::size_t max_line_count() const;
|
||||
std::size_t max_characters() const;
|
||||
std::size_t max_conditions() const;
|
||||
|
||||
private:
|
||||
std::size_t keywords;
|
||||
std::size_t line_count;
|
||||
std::size_t characters;
|
||||
std::size_t conditions;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -209,7 +209,8 @@ Runspec::Runspec( const Deck& deck ) :
|
||||
welldims( deck ),
|
||||
wsegdims( deck ),
|
||||
udq_params( deck ),
|
||||
hystpar( deck )
|
||||
hystpar( deck ),
|
||||
m_actdims( deck )
|
||||
{}
|
||||
|
||||
const Phases& Runspec::phases() const noexcept {
|
||||
@@ -220,6 +221,10 @@ const Tabdims& Runspec::tabdims() const noexcept {
|
||||
return this->m_tabdims;
|
||||
}
|
||||
|
||||
const Actdims& Runspec::actdims() const noexcept {
|
||||
return this->m_actdims;
|
||||
}
|
||||
|
||||
const EndpointScaling& Runspec::endpointScaling() const noexcept {
|
||||
return this->endscale;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright 2019 Equinor 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/Schedule/Action/Actdims.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/A.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
Actdims::Actdims():
|
||||
keywords(ParserKeywords::ACTDIMS::MAX_ACTION::defaultValue),
|
||||
line_count(ParserKeywords::ACTDIMS::MAX_ACTION_LINES::defaultValue),
|
||||
characters(ParserKeywords::ACTDIMS::MAX_ACTION_LINE_CHARACTERS::defaultValue),
|
||||
conditions(ParserKeywords::ACTDIMS::MAX_ACTION_COND::defaultValue)
|
||||
{}
|
||||
|
||||
|
||||
Actdims::Actdims(const Deck& deck)
|
||||
: Actdims()
|
||||
{
|
||||
if (deck.hasKeyword<ParserKeywords::ACTDIMS>()) {
|
||||
const auto& keyword = deck.getKeyword<ParserKeywords::ACTDIMS>();
|
||||
const auto& record = keyword.getRecord(0);
|
||||
|
||||
this->keywords = record.getItem<ParserKeywords::ACTDIMS::MAX_ACTION>().get<int>(0);
|
||||
this->line_count = record.getItem<ParserKeywords::ACTDIMS::MAX_ACTION_LINES>().get<int>(0);
|
||||
this->characters = record.getItem<ParserKeywords::ACTDIMS::MAX_ACTION_LINE_CHARACTERS>().get<int>(0);
|
||||
this->conditions = record.getItem<ParserKeywords::ACTDIMS::MAX_ACTION_COND>().get<int>(0);
|
||||
}
|
||||
}
|
||||
|
||||
std::size_t Actdims::max_keywords() const {
|
||||
return this->keywords;
|
||||
}
|
||||
|
||||
std::size_t Actdims::max_line_count() const {
|
||||
return this->line_count;
|
||||
}
|
||||
|
||||
std::size_t Actdims::max_characters() const {
|
||||
return this->characters;
|
||||
}
|
||||
|
||||
std::size_t Actdims::max_conditions() const {
|
||||
return this->conditions;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -571,4 +571,23 @@ BOOST_AUTO_TEST_CASE(Foam) {
|
||||
BOOST_CHECK( phases.active( Phase::WATER ) );
|
||||
BOOST_CHECK( phases.active( Phase::FOAM) );
|
||||
|
||||
// not in deck - default constructor.
|
||||
const auto& actdims = runspec.actdims();
|
||||
BOOST_CHECK_EQUAL(actdims.max_keywords(), 2);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ACTDIMS) {
|
||||
const std::string input = R"(
|
||||
RUNSPEC
|
||||
ACTDIMS
|
||||
2* 13 14 /
|
||||
)";
|
||||
|
||||
Parser parser;
|
||||
auto deck = parser.parseString(input);
|
||||
|
||||
Runspec runspec( deck );
|
||||
const auto& actdims = runspec.actdims();
|
||||
BOOST_CHECK_EQUAL(actdims.max_keywords(), 2);
|
||||
BOOST_CHECK_EQUAL(actdims.max_conditions(), 14);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user