Address review comments.
- Use a raw literal. - Use 'index', not 'id'. - Use FoamConfig(const Deck&) constructor.
This commit is contained in:
parent
7245598952
commit
17a2e5d334
@ -25,7 +25,7 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class DeckKeyword;
|
||||
class Deck;
|
||||
class DeckRecord;
|
||||
|
||||
class FoamRecord {
|
||||
@ -47,9 +47,9 @@ namespace Opm {
|
||||
using const_iterator = std::vector< FoamRecord >::const_iterator;
|
||||
|
||||
FoamConfig() = default;
|
||||
explicit FoamConfig( const DeckKeyword& );
|
||||
explicit FoamConfig( const Deck& );
|
||||
|
||||
const FoamRecord& getRecord( std::size_t id ) const;
|
||||
const FoamRecord& getRecord( std::size_t index ) const;
|
||||
|
||||
std::size_t size() const;
|
||||
bool empty() const;
|
||||
|
@ -18,18 +18,20 @@
|
||||
*/
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/InitConfig/FoamConfig.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/F.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
// FoamRecord member functions.
|
||||
|
||||
FoamRecord::FoamRecord( const DeckRecord& record ) :
|
||||
reference_surfactant_concentration_( record.getItem( 0 ).getSIDouble( 0 ) ),
|
||||
exponent_( record.getItem( 1 ).getSIDouble( 0 ) ),
|
||||
minimum_surfactant_concentration_( record.getItem( 2 ).getSIDouble( 0 ) )
|
||||
FoamRecord::FoamRecord( const DeckRecord& record )
|
||||
: reference_surfactant_concentration_( record.getItem( 0 ).getSIDouble( 0 ) )
|
||||
, exponent_( record.getItem( 1 ).getSIDouble( 0 ) )
|
||||
, minimum_surfactant_concentration_( record.getItem( 2 ).getSIDouble( 0 ) )
|
||||
{}
|
||||
|
||||
double FoamRecord::referenceSurfactantConcentration() const {
|
||||
@ -46,12 +48,16 @@ namespace Opm {
|
||||
|
||||
// FoamConfig member functions.
|
||||
|
||||
FoamConfig::FoamConfig( const DeckKeyword& keyword ) :
|
||||
records( keyword.begin(), keyword.end() )
|
||||
{}
|
||||
FoamConfig::FoamConfig( const Deck& deck )
|
||||
{
|
||||
if (deck.hasKeyword<ParserKeywords::FOAMFSC>()) {
|
||||
const auto& kw = deck.getKeyword<ParserKeywords::FOAMFSC>();
|
||||
this->records = std::vector<FoamRecord>(kw.begin(), kw.end());
|
||||
}
|
||||
}
|
||||
|
||||
const FoamRecord& FoamConfig::getRecord( std::size_t id ) const {
|
||||
return this->records.at( id );
|
||||
const FoamRecord& FoamConfig::getRecord( std::size_t index ) const {
|
||||
return this->records.at( index );
|
||||
}
|
||||
|
||||
std::size_t FoamConfig::size() const {
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/E.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/F.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/R.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/S.hpp>
|
||||
|
||||
@ -39,14 +38,9 @@ namespace Opm {
|
||||
return Equil( deck.getKeyword<ParserKeywords::EQUIL>( ) );
|
||||
}
|
||||
|
||||
static inline FoamConfig foamconfigs( const Deck& deck ) {
|
||||
if( !deck.hasKeyword<ParserKeywords::FOAMFSC>( ) ) return {};
|
||||
return FoamConfig( deck.getKeyword<ParserKeywords::FOAMFSC>( ) );
|
||||
}
|
||||
|
||||
InitConfig::InitConfig(const Deck& deck)
|
||||
: equil(equils(deck))
|
||||
, foamconfig(foamconfigs(deck))
|
||||
, foamconfig(deck)
|
||||
, m_filleps(PROPSSection{deck}.hasKeyword("FILLEPS"))
|
||||
{
|
||||
if( !deck.hasKeyword( "RESTART" ) ) {
|
||||
|
@ -31,61 +31,61 @@ using namespace Opm;
|
||||
|
||||
|
||||
static Deck createDeck() {
|
||||
const char *deckData =
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 10 10 10 /\n"
|
||||
"TABDIMS\n"
|
||||
"3 /\n"
|
||||
"GRID\n"
|
||||
"DX\n"
|
||||
"1000*0.25 /\n"
|
||||
"DY\n"
|
||||
"1000*0.25 /\n"
|
||||
"DZ\n"
|
||||
"1000*0.25 /\n"
|
||||
"TOPS\n"
|
||||
"100*0.25 /\n"
|
||||
"FAULTS \n"
|
||||
" 'F1' 1 1 1 4 1 4 'X' / \n"
|
||||
" 'F2' 5 5 1 4 1 4 'X-' / \n"
|
||||
"/\n"
|
||||
"MULTFLT \n"
|
||||
" 'F1' 0.50 / \n"
|
||||
" 'F2' 0.50 / \n"
|
||||
"/\n"
|
||||
"EDIT\n"
|
||||
"MULTFLT /\n"
|
||||
" 'F2' 0.25 / \n"
|
||||
"/\n"
|
||||
"WATER\n"
|
||||
"\n"
|
||||
"OIL\n"
|
||||
"\n"
|
||||
"GAS\n"
|
||||
"\n"
|
||||
"FOAM\n"
|
||||
"\n"
|
||||
"TITLE\n"
|
||||
"The title\n"
|
||||
"\n"
|
||||
"START\n"
|
||||
"8 MAR 1998 /\n"
|
||||
"\n"
|
||||
"PROPS\n"
|
||||
"FOAMFSC\n"
|
||||
"1 2 0.3 /\n"
|
||||
"4 5 /\n"
|
||||
"6 /\n"
|
||||
"\n"
|
||||
"REGIONS\n"
|
||||
"SWAT\n"
|
||||
"1000*1 /\n"
|
||||
"SATNUM\n"
|
||||
"1000*2 /\n"
|
||||
"\n";
|
||||
// Using a raw string literal with xxx as delimiter.
|
||||
const char *deckData = R"xxx(
|
||||
RUNSPEC
|
||||
|
||||
DIMENS
|
||||
10 10 10 /
|
||||
TABDIMS
|
||||
3 /
|
||||
GRID
|
||||
DX
|
||||
1000*0.25 /
|
||||
DY
|
||||
1000*0.25 /
|
||||
DZ
|
||||
1000*0.25 /
|
||||
TOPS
|
||||
100*0.25 /
|
||||
FAULTS
|
||||
'F1' 1 1 1 4 1 4 'X' /
|
||||
'F2' 5 5 1 4 1 4 'X-' /
|
||||
/
|
||||
MULTFLT
|
||||
'F1' 0.50 /
|
||||
'F2' 0.50 /
|
||||
/
|
||||
EDIT
|
||||
MULTFLT /
|
||||
'F2' 0.25 /
|
||||
/
|
||||
WATER
|
||||
|
||||
OIL
|
||||
|
||||
GAS
|
||||
|
||||
FOAM
|
||||
|
||||
TITLE
|
||||
The title
|
||||
|
||||
START
|
||||
8 MAR 1998 /
|
||||
|
||||
PROPS
|
||||
FOAMFSC
|
||||
1 2 0.3 /
|
||||
4 5 /
|
||||
6 /
|
||||
|
||||
REGIONS
|
||||
SWAT
|
||||
1000*1 /
|
||||
SATNUM
|
||||
1000*2 /
|
||||
)xxx"; // End of raw string literal with xxx as delimiter.
|
||||
Parser parser;
|
||||
return parser.parseString( deckData );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user