mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
#14683 Share OPM parser for keyword lookups
This commit is contained in:
1 parent
275b120688
commit
2462170647
4 files changed
+19
-31
No files matched your search
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h"
|
||||
|
||||
#include "RiaOpmKeywordTools.h"
|
||||
#include "RiaResultNames.h"
|
||||
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
@@ -64,18 +65,6 @@
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
namespace
|
||||
{
|
||||
// A single shared parser instance is used for all keyword schema lookups. Constructing an
|
||||
// Opm::Parser populates the complete keyword database and costs milliseconds, which is far too
|
||||
// expensive to repeat for every keyword being serialised.
|
||||
const Opm::Parser& sharedParser()
|
||||
{
|
||||
static const Opm::Parser parser;
|
||||
return parser;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace RimKeywordFactory
|
||||
{
|
||||
|
||||
@@ -944,7 +933,7 @@ QString deckKeywordToAlignedString( const Opm::DeckKeyword& keyword )
|
||||
std::vector<std::string> canonicalItemOrder;
|
||||
try
|
||||
{
|
||||
const Opm::ParserKeyword& parserKeyword = sharedParser().getKeyword( keyword.name() );
|
||||
const Opm::ParserKeyword& parserKeyword = RiaOpmKeywordTools::defaultParser().getKeyword( keyword.name() );
|
||||
if ( std::distance( parserKeyword.begin(), parserKeyword.end() ) == 1 )
|
||||
{
|
||||
const Opm::ParserRecord& parserRecord = parserKeyword.getRecord( 0 );
|
||||
@@ -1089,7 +1078,7 @@ QString deckKeywordToAlignedString( const Opm::DeckKeyword& keyword )
|
||||
bool slashTerminated = true;
|
||||
try
|
||||
{
|
||||
slashTerminated = !sharedParser().getKeyword( keyword.name() ).hasFixedSize();
|
||||
slashTerminated = !RiaOpmKeywordTools::defaultParser().getKeyword( keyword.name() ).hasFixedSize();
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user