diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 23b763a093..6014c7688c 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -913,8 +913,7 @@ bool RiaApplication::openOdbCaseFromFile( const QString& fileName, bool applyTim //-------------------------------------------------------------------------------------------------- /// Add a list of well path file paths (JSON files) to the well path collection //-------------------------------------------------------------------------------------------------- -std::vector - RiaApplication::addWellPathsToModel( QList wellPathFilePaths, bool importGrouped, gsl::not_null errorMessages ) +std::vector RiaApplication::addWellPathsToModel( QList wellPathFilePaths, gsl::not_null errorMessages ) { if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return {}; @@ -932,7 +931,7 @@ std::vector std::vector wellPaths; if ( oilField->wellPathCollection ) { - wellPaths = oilField->wellPathCollection->addWellPaths( wellPathFilePaths, importGrouped, errorMessages ); + wellPaths = oilField->wellPathCollection->addWellPaths( wellPathFilePaths, errorMessages ); } oilField->wellPathCollection->updateConnectedEditors(); diff --git a/ApplicationLibCode/Application/RiaApplication.h b/ApplicationLibCode/Application/RiaApplication.h index 924d4d6dd9..8672592930 100644 --- a/ApplicationLibCode/Application/RiaApplication.h +++ b/ApplicationLibCode/Application/RiaApplication.h @@ -147,8 +147,7 @@ public: bool openOdbCaseFromFile( const QString& fileName, bool applyTimeStepFilter = false ); - std::vector - addWellPathsToModel( QList wellPathFilePaths, bool importGrouped, gsl::not_null errorMessages ); + std::vector addWellPathsToModel( QList wellPathFilePaths, gsl::not_null errorMessages ); void addWellPathFormationsToModel( QList wellPathFilePaths ); std::vector addWellLogsToModel( const QList& wellLogFilePaths, gsl::not_null errorMessages ); diff --git a/ApplicationLibCode/Commands/FractureCommands/RicNewStimPlanModelFeature.cpp b/ApplicationLibCode/Commands/FractureCommands/RicNewStimPlanModelFeature.cpp index a67359880e..a391e04840 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicNewStimPlanModelFeature.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicNewStimPlanModelFeature.cpp @@ -81,7 +81,7 @@ RimStimPlanModel* RicNewStimPlanModelFeature::addStimPlanModel( RimWellPath* stimPlanModel->setThicknessDirectionWellPath( thicknessDirectionWellPath ); std::vector wellPaths = { thicknessDirectionWellPath }; - wellPathCollection->addWellPaths( wellPaths, false ); + wellPathCollection->addWellPaths( wellPaths ); if ( project ) { diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogFeature.cpp b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogFeature.cpp index abb835576f..bb92d8a84c 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogFeature.cpp +++ b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogFeature.cpp @@ -127,9 +127,8 @@ void RicCreateEnsembleWellLogFeature::executeCommand( const RicCreateEnsembleWel // Load well path from file QStringList wellPathFilePaths; wellPathFilePaths << ui.wellPathFilePath(); - bool importGrouped = false; QStringList errorMessages; - std::vector wellPaths = RicImportWellPaths::importWellPaths( wellPathFilePaths, importGrouped, &errorMessages ); + std::vector wellPaths = RicImportWellPaths::importWellPaths( wellPathFilePaths, &errorMessages ); if ( wellPaths.empty() ) return; wellPath = wellPaths[0]; diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.cpp index f6a29f142f..23ba04559f 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.cpp @@ -118,7 +118,7 @@ void RicWellPathsImportSsihubFeature::onActionTriggered( bool isChecked ) if ( wellPaths.size() > 0 ) { QStringList errorMessages; - app->addWellPathsToModel( wellPaths, false, &errorMessages ); + app->addWellPathsToModel( wellPaths, &errorMessages ); app->project()->scheduleCreateDisplayModelAndRedrawAllViews(); } diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLaterals.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLaterals.cpp index 5dfed3fba5..04901d01f4 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLaterals.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLaterals.cpp @@ -163,7 +163,7 @@ void RicCreateMultipleWellPathLaterals::slotAppendFractures() newModeledWellPath->wellPathTieIn()->setTieInMeasuredDepth( measuredDepth ); - wellPathCollection->addWellPath( newModeledWellPath, false ); + wellPathCollection->addWellPath( newModeledWellPath ); newModeledWellPath->resolveReferencesRecursively(); newModeledWellPath->updateReferencePoint(); diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicImportWellPaths.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicImportWellPaths.cpp index 95b1aa3e53..737e11bf87 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicImportWellPaths.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicImportWellPaths.cpp @@ -66,7 +66,6 @@ RicImportWellPaths::RicImportWellPaths() { CAF_PDM_InitScriptableFieldNoDefault( &m_wellPathFolder, "wellPathFolder", "" ); CAF_PDM_InitScriptableFieldNoDefault( &m_wellPathFiles, "wellPathFiles", "" ); - CAF_PDM_InitScriptableField( &m_importGrouped, "importGrouped", false, "" ); } //-------------------------------------------------------------------------------------------------- @@ -124,7 +123,7 @@ caf::PdmScriptResponse RicImportWellPaths::execute() caf::PdmScriptResponse response; if ( !wellPathFiles.empty() ) { - std::vector importedWellPaths = importWellPaths( wellPathFiles, m_importGrouped(), &warningMessages ); + std::vector importedWellPaths = importWellPaths( wellPathFiles, &warningMessages ); if ( !importedWellPaths.empty() ) { RicImportWellPathsResult* wellPathsResult = new RicImportWellPathsResult; @@ -157,15 +156,14 @@ caf::PdmScriptResponse RicImportWellPaths::execute() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector - RicImportWellPaths::importWellPaths( const QStringList& wellPathFilePaths, bool importGrouped, QStringList* errorMessages ) +std::vector RicImportWellPaths::importWellPaths( const QStringList& wellPathFilePaths, QStringList* errorMessages ) { RiaApplication* app = RiaApplication::instance(); // Remember the path to next time app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() ); - std::vector wellPaths = app->addWellPathsToModel( wellPathFilePaths, importGrouped, errorMessages ); + std::vector wellPaths = app->addWellPathsToModel( wellPathFilePaths, errorMessages ); RimProject* project = app->project(); diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicImportWellPaths.h b/ApplicationLibCode/Commands/WellPathCommands/RicImportWellPaths.h index 364dc7f351..3ee26d40dd 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicImportWellPaths.h +++ b/ApplicationLibCode/Commands/WellPathCommands/RicImportWellPaths.h @@ -42,7 +42,7 @@ public: RicImportWellPaths(); caf::PdmScriptResponse execute() override; - static std::vector importWellPaths( const QStringList& wellPathFilePaths, bool importGrouped, QStringList* errorMessages ); + static std::vector importWellPaths( const QStringList& wellPathFilePaths, QStringList* errorMessages ); protected: static QStringList wellPathNameFilters(); @@ -54,5 +54,4 @@ protected: protected: caf::PdmField m_wellPathFolder; caf::PdmField> m_wellPathFiles; - caf::PdmField m_importGrouped; }; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp index e0dba8fdce..d200bcfe66 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp @@ -80,7 +80,7 @@ void RicNewEditableWellPathFeature::onActionTriggered( bool isChecked ) newWellPaths.back()->setName( "Well-" + QString::number( modelledWellpathCount + 1 ) ); newModeledWellPath->setWellPathColor( RiaColorTables::editableWellPathsPaletteColors().cycledColor3f( modelledWellpathCount ) ); - wellPathCollection->addWellPaths( newWellPaths, false ); + wellPathCollection->addWellPaths( newWellPaths ); wellPathCollection->uiCapability()->updateConnectedEditors(); newModeledWellPath->geometryDefinition()->enableTargetPointPicking( true ); diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathLateralAtDepthFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathLateralAtDepthFeature.cpp index 879d8287fc..de8fb40064 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathLateralAtDepthFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathLateralAtDepthFeature.cpp @@ -116,8 +116,7 @@ RimModeledWellPath* RicNewWellPathLateralAtDepthFeature::createLateralAtMeasured newModeledWellPath->createWellPathGeometry(); - bool importGrouped = false; - wellPathColl->addWellPath( newModeledWellPath, importGrouped ); + wellPathColl->addWellPath( newModeledWellPath ); wellPathColl->updateAllRequiredEditors(); project->scheduleCreateDisplayModelAndRedrawAllViews(); diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.cpp index f66177898f..4a74237a02 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.cpp @@ -155,7 +155,7 @@ RimModeledWellPath* RicPasteModeledWellPathFeature::duplicateAndInitializeWellPa QString name = sourceWellPath->name() + "(copy)"; destinationWellPath->setName( name ); - wpc->addWellPath( destinationWellPath, false ); + wpc->addWellPath( destinationWellPath ); // Resolve references, will connect to the fracture template destinationWellPath->resolveReferencesRecursively(); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp index c3f44cddc6..7cee569782 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp @@ -149,8 +149,8 @@ void RimWellPathCollection::loadDataAndUpdate() { progress.setProgressDescription( QString( "Reading file %1" ).arg( wellPath->name() ) ); - RimFileWellPath* fWPath = dynamic_cast( wellPath ); - RimModeledWellPath* mWPath = dynamic_cast( wellPath ); + auto* fWPath = dynamic_cast( wellPath ); + auto* mWPath = dynamic_cast( wellPath ); if ( fWPath ) { if ( !fWPath->filePath().isEmpty() ) @@ -201,19 +201,19 @@ void RimWellPathCollection::loadDataAndUpdate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimWellPathCollection::addWellPaths( QStringList filePaths, bool importGrouped, QStringList* errorMessages ) +std::vector RimWellPathCollection::addWellPaths( QStringList filePaths, QStringList* errorMessages ) { CAF_ASSERT( errorMessages ); std::vector wellPathArray; - for ( QString filePath : filePaths ) + for ( const QString& filePath : filePaths ) { // Check if this file is already open bool alreadyOpen = false; - for ( auto wellPath : m_wellPaths ) + for ( const auto& wellPath : m_wellPaths ) { - RimFileWellPath* fWPath = dynamic_cast( wellPath.p() ); + auto* fWPath = dynamic_cast( wellPath.p() ); if ( !fWPath ) continue; QFile f1; @@ -238,7 +238,7 @@ std::vector RimWellPathCollection::addWellPaths( QStringList fileP if ( fi.suffix().compare( "json" ) == 0 ) { - RimFileWellPath* wellPath = new RimFileWellPath(); + auto* wellPath = new RimFileWellPath(); wellPath->setFilepath( filePath ); wellPathArray.push_back( wellPath ); } @@ -248,7 +248,7 @@ std::vector RimWellPathCollection::addWellPaths( QStringList fileP size_t wellPathCount = m_wellPathImporter->wellDataCount( filePath ); for ( size_t i = 0; i < wellPathCount; ++i ) { - RimFileWellPath* wellPath = new RimFileWellPath(); + auto* wellPath = new RimFileWellPath(); wellPath->setFilepath( filePath ); wellPath->setWellPathIndexInFile( static_cast( i ) ); wellPathArray.push_back( wellPath ); @@ -257,7 +257,7 @@ std::vector RimWellPathCollection::addWellPaths( QStringList fileP } } - readAndAddWellPaths( wellPathArray, importGrouped ); + readAndAddWellPaths( wellPathArray ); CAF_ASSERT( wellPathArray.empty() ); scheduleRedrawAffectedViews(); @@ -269,7 +269,7 @@ std::vector RimWellPathCollection::addWellPaths( QStringList fileP //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPathCollection::addWellPath( gsl::not_null wellPath, bool importGrouped ) +void RimWellPathCollection::addWellPath( gsl::not_null wellPath ) { m_wellPaths.push_back( wellPath ); @@ -289,11 +289,10 @@ std::vector RimWellPathCollection::allWellPaths() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPathCollection::readAndAddWellPaths( std::vector& wellPathArray, bool importGrouped ) +void RimWellPathCollection::readAndAddWellPaths( std::vector& wellPathArray ) { caf::ProgressInfo progress( wellPathArray.size(), "Reading well paths from file" ); - std::vector wellPathsToGroup; for ( RimFileWellPath* wellPath : wellPathArray ) { wellPath->readWellPathFile( nullptr, m_wellPathImporter.get(), true ); @@ -321,16 +320,14 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector& { wellPath->setWellPathColor( RiaColorTables::wellPathsPaletteColors().cycledColor3f( m_wellPaths.size() ) ); wellPath->setUnitSystem( findUnitSystemForWellPath( wellPath ) ); - addWellPath( wellPath, false ); - - wellPathsToGroup.push_back( wellPath ); + addWellPath( wellPath ); } progress.incrementProgress(); } wellPathArray.clear(); // This should not be used again. We may have deleted items - groupWellPaths( wellPathsToGroup ); + groupWellPaths( allWellPaths() ); sortWellsByName(); rebuildWellPathNodes(); } @@ -338,14 +335,14 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector& //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPathCollection::addWellPaths( const std::vector incomingWellPaths, bool importGrouped ) +void RimWellPathCollection::addWellPaths( const std::vector incomingWellPaths ) { for ( const auto& wellPath : incomingWellPaths ) { - addWellPath( wellPath, importGrouped ); + addWellPath( wellPath ); } - groupWellPaths( incomingWellPaths ); + groupWellPaths( allWellPaths() ); sortWellsByName(); rebuildWellPathNodes(); @@ -375,7 +372,7 @@ std::vector RimWellPathCollection::addWellLogs( const QStringLi if ( !wellPath ) { wellPath = new RimWellPath(); - addWellPath( wellPath, false ); + addWellPath( wellPath ); } wellPath->addWellLogFile( logFileInfo ); @@ -400,30 +397,30 @@ void RimWellPathCollection::addWellPathFormations( const QStringList& filePaths bool fileReadSuccess = false; - for ( QString filePath : filePaths ) + for ( const QString& filePath : filePaths ) { std::map> newFormations = m_wellPathFormationsImporter->readWellPathFormationsFromPath( filePath ); - for ( auto it = newFormations.begin(); it != newFormations.end(); it++ ) + for ( const auto& newFormation : newFormations ) { fileReadSuccess = true; - RimWellPath* wellPath = tryFindMatchingWellPath( it->first ); + RimWellPath* wellPath = tryFindMatchingWellPath( newFormation.first ); if ( !wellPath ) { wellPath = new RimWellPath(); - wellPath->setName( it->first ); - addWellPath( wellPath, false ); + wellPath->setName( newFormation.first ); + addWellPath( wellPath ); RiaLogging::info( QString( "Created new well: %1" ).arg( wellPath->name() ) ); } - wellPath->setFormationsGeometry( it->second ); + wellPath->setFormationsGeometry( newFormation.second ); - QString wellFormationsCount = QString( "%1" ).arg( it->second->formationNamesCount() ); + QString wellFormationsCount = QString( "%1" ).arg( newFormation.second->formationNamesCount() ); m_mostRecentlyUpdatedWellPath = wellPath; - outputMessage += it->first + "\t\t"; + outputMessage += newFormation.first + "\t\t"; outputMessage += wellPath->name() + " \t\t\t"; outputMessage += wellFormationsCount + "\n"; } @@ -498,7 +495,7 @@ void RimWellPathCollection::scheduleRedrawAffectedViews() //-------------------------------------------------------------------------------------------------- bool RimWellPathCollection::anyWellsContainingPerforationIntervals() const { - for ( auto wellPath : m_wellPaths ) + for ( const auto& wellPath : m_wellPaths ) { if ( !wellPath->perforationIntervalCollection()->perforations().empty() ) return true; } @@ -511,7 +508,7 @@ bool RimWellPathCollection::anyWellsContainingPerforationIntervals() const size_t RimWellPathCollection::modelledWellPathCount() const { size_t count = 0; - for ( auto wellPath : m_wellPaths ) + for ( const auto& wellPath : m_wellPaths ) { if ( dynamic_cast( wellPath.p() ) ) { @@ -526,7 +523,7 @@ size_t RimWellPathCollection::modelledWellPathCount() const //-------------------------------------------------------------------------------------------------- RimWellPath* RimWellPathCollection::wellPathByName( const QString& wellPathName ) const { - for ( auto wellPath : m_wellPaths ) + for ( const auto& wellPath : m_wellPaths ) { if ( wellPath->name() == wellPathName ) { @@ -574,56 +571,77 @@ void RimWellPathCollection::deleteWell( RimWellPath* wellPath ) //-------------------------------------------------------------------------------------------------- void RimWellPathCollection::groupWellPaths( const std::vector& wellPaths ) { - auto rootWells = wellPathsForWellNameStem( wellPaths ); + const auto& rootWells = wellPathsForWellNameStem( wellPaths ); - for ( auto [groupName, wellPathCommonName] : rootWells ) + for ( const auto& [groupName, wellPathsInGroup] : rootWells ) { if ( groupName == unGroupedText() ) continue; - for ( auto wellPath : wellPathCommonName ) + for ( const auto& wellPathToConnect : wellPathsInGroup ) { // Assign the group names as well name for export - wellPath->completionSettings()->setWellNameForExport( groupName ); + wellPathToConnect->completionSettings()->setWellNameForExport( groupName ); - auto wellPathGeometry = wellPath->wellPathGeometry(); + const auto wellPathGeometry = wellPathToConnect->wellPathGeometry(); if ( wellPathGeometry ) { - const double eps = 1.0e-2; - std::map wellPathsWithCommonGeometry; + std::map sharedWellPathLengths; - for ( auto existingWellPath : wellPathCommonName ) + for ( const auto& otherWellPath : wellPathsInGroup ) { - if ( existingWellPath == wellPath ) continue; + if ( otherWellPath == wellPathToConnect ) continue; - if ( wellPath->name() < existingWellPath->name() ) continue; - - double identicalTubeLength = existingWellPath->wellPathGeometry()->identicalTubeLength( *wellPathGeometry ); - if ( identicalTubeLength > eps ) + if ( otherWellPath && otherWellPath->wellPathGeometry() ) { - wellPathsWithCommonGeometry[existingWellPath] = identicalTubeLength; + const double sharedWellPathLength = otherWellPath->wellPathGeometry()->identicalTubeLength( *wellPathGeometry ); + const double eps = 1.0e-2; + if ( sharedWellPathLength > eps ) + { + sharedWellPathLengths[otherWellPath] = sharedWellPathLength; + } } } - RimWellPath* mostSimilarWellPath = nullptr; - double longestIdenticalTubeLength = 0.0; - for ( auto [existingWellPath, identicalTubeLength] : wellPathsWithCommonGeometry ) + RimWellPath* longestSharedWellPath = nullptr; + double longestSharedWellPathLength = 0.0; + for ( const auto& [wellPathCandidate, sharedWellPathLength] : sharedWellPathLengths ) { - if ( existingWellPath && ( existingWellPath != wellPath ) && identicalTubeLength > longestIdenticalTubeLength ) + if ( wellPathCandidate ) { - mostSimilarWellPath = existingWellPath; - longestIdenticalTubeLength = identicalTubeLength; + const double distanceDifference = fabs( sharedWellPathLength - longestSharedWellPathLength ); + + const double differenceThreshold = 1.0; + if ( longestSharedWellPath && ( distanceDifference < differenceThreshold ) ) + { + // If the main well is named WELL_A, each side steps of a MSW can be given the following names + // WELL_A_Y1 + // WELL_A_Y2 + // WELL_A_Y3 + // + // If Y3 has equal shared geometry with both Y2 and Y1, make sure that Y3 is connected to Y1. + if ( wellPathCandidate->name() < longestSharedWellPath->name() ) + { + longestSharedWellPath = wellPathCandidate; + longestSharedWellPathLength = sharedWellPathLength; + } + } + else if ( sharedWellPathLength > longestSharedWellPathLength ) + { + longestSharedWellPath = wellPathCandidate; + longestSharedWellPathLength = sharedWellPathLength; + } } } - if ( mostSimilarWellPath ) + if ( longestSharedWellPath ) { - if ( wellPath->name() > mostSimilarWellPath->name() ) + if ( wellPathToConnect->name() > longestSharedWellPath->name() ) { - wellPath->connectWellPaths( mostSimilarWellPath, longestIdenticalTubeLength ); + wellPathToConnect->connectWellPaths( longestSharedWellPath, longestSharedWellPathLength ); } else { - mostSimilarWellPath->connectWellPaths( wellPath, longestIdenticalTubeLength ); + longestSharedWellPath->connectWellPaths( wellPathToConnect, longestSharedWellPathLength ); } } } @@ -666,7 +684,7 @@ void RimWellPathCollection::reloadAllWellPathFormations() { caf::ProgressInfo progress( m_wellPaths.size(), "Reloading well picks from file" ); - for ( auto wellPath : m_wellPaths ) + for ( const auto& wellPath : m_wellPaths ) { QString errorMessage; if ( !wellPath->reloadWellPathFormationsFile( &errorMessage, m_wellPathFormationsImporter.get() ) ) @@ -723,10 +741,10 @@ bool lessWellPath( const caf::PdmPointer& w1, const caf::PdmPointer collator.setNumericMode( true ); return collator.compare( w1->name(), w2->name() ) < 0; } - else if ( w1.notNull() ) - return true; - else - return false; + + if ( w1.notNull() ) return true; + + return false; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.h index 797195674b..5cab76e43f 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.h @@ -93,7 +93,7 @@ public: caf::PdmField wellPathClipZDistance; void loadDataAndUpdate(); - std::vector addWellPaths( QStringList filePaths, bool importGrouped, QStringList* errorMessages ); + std::vector addWellPaths( QStringList filePaths, QStringList* errorMessages ); std::vector allWellPaths() const; void removeWellPath( gsl::not_null wellPath ); @@ -107,13 +107,12 @@ public: RimWellPath* mostRecentlyUpdatedWellPath(); - void readWellPathFormationFiles(); - void reloadAllWellPathFormations(); - + void readWellPathFormationFiles(); + void reloadAllWellPathFormations(); RimWellPath* wellPathByName( const QString& wellPathName ) const; RimWellPath* tryFindMatchingWellPath( const QString& wellName ) const; - void addWellPaths( const std::vector incomingWellPaths, bool importGrouped ); - void addWellPath( gsl::not_null wellPath, bool importGrouped ); + void addWellPaths( const std::vector incomingWellPaths ); + void addWellPath( gsl::not_null wellPath ); std::vector addWellLogs( const QStringList& filePaths, QStringList* errorMessages ); void addWellPathFormations( const QStringList& filePaths ); @@ -139,7 +138,7 @@ private: caf::PdmFieldHandle* objectToggleField() override; - void readAndAddWellPaths( std::vector& wellPathArray, bool importGrouped ); + void readAndAddWellPaths( std::vector& wellPathArray ); void sortWellsByName(); caf::AppEnum findUnitSystemForWellPath( const RimWellPath* wellPath );