mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Simplify ensemble case naming
This commit is contained in:
parent
462f8026e3
commit
7f9cab5300
@ -36,7 +36,7 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#define SUMMARY_CASE_SHORT_NAME_LENGTH 6 // TODO: Could make this a preference if required.
|
#define SUMMARY_CASE_SHORT_NAME_LENGTH 4 // TODO: Could make this a preference if required.
|
||||||
|
|
||||||
CAF_PDM_ABSTRACT_SOURCE_INIT( RimSummaryCase, "SummaryCase" );
|
CAF_PDM_ABSTRACT_SOURCE_INIT( RimSummaryCase, "SummaryCase" );
|
||||||
namespace caf
|
namespace caf
|
||||||
@ -329,14 +329,11 @@ QString RimSummaryCase::uniqueShortNameForEnsembleCase( RimSummaryCase* summaryC
|
|||||||
for ( auto keyComponent : keyFileComponents )
|
for ( auto keyComponent : keyFileComponents )
|
||||||
{
|
{
|
||||||
QStringList subComponents;
|
QStringList subComponents;
|
||||||
QString numberGroup = numberRe.match( keyComponent ).captured();
|
QString numberGroup = numberRe.match( keyComponent ).captured();
|
||||||
int numberGroupAndDelimiterLength = numberGroup.length() + 1;
|
|
||||||
if ( !numberGroup.isEmpty() )
|
if ( !numberGroup.isEmpty() )
|
||||||
{
|
{
|
||||||
keyComponent = keyComponent.replace( numberGroup, "" );
|
keyComponent = keyComponent.replace( numberGroup, "" );
|
||||||
|
QString stem = keyComponent.left( SUMMARY_CASE_SHORT_NAME_LENGTH );
|
||||||
QString stem =
|
|
||||||
keyComponent.left( std::max( 1, SUMMARY_CASE_SHORT_NAME_LENGTH - numberGroupAndDelimiterLength ) );
|
|
||||||
if ( !stem.isEmpty() ) subComponents.push_back( stem );
|
if ( !stem.isEmpty() ) subComponents.push_back( stem );
|
||||||
subComponents.push_back( numberGroup );
|
subComponents.push_back( numberGroup );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user