diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 7e2a271ad5..cb6ef35069 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -934,7 +934,7 @@ bool RiaApplication::openOdbCaseFromFile( const QString& fileName, bool applyTim //-------------------------------------------------------------------------------------------------- std::vector RiaApplication::addWellPathsToModel( QList wellPathFilePaths, gsl::not_null errorMessages ) { - if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return {}; + if ( m_project == nullptr || m_project->oilFields.empty() ) return {}; RimOilField* oilField = m_project->activeOilField(); if ( oilField == nullptr ) return {}; @@ -963,7 +963,7 @@ std::vector RiaApplication::addWellPathsToModel( QList we //-------------------------------------------------------------------------------------------------- void RiaApplication::addWellPathFormationsToModel( QList wellPathFormationsFilePaths ) { - if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return; + if ( m_project == nullptr || m_project->oilFields.empty() ) return; RimOilField* oilField = m_project->activeOilField(); if ( oilField == nullptr ) return; @@ -989,7 +989,7 @@ void RiaApplication::addWellPathFormationsToModel( QList wellPathFormat std::vector RiaApplication::addWellLogsToModel( const QList& wellLogFilePaths, gsl::not_null errorMessages ) { - if ( m_project == nullptr || m_project->oilFields.size() < 1 ) return {}; + if ( m_project == nullptr || m_project->oilFields.empty() ) return {}; RimOilField* oilField = m_project->activeOilField(); if ( oilField == nullptr ) return {}; diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index c752003829..1b2a34efc9 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -380,7 +380,7 @@ RimViewWindow* RiaGuiApplication::activePlotWindow() const if ( m_mainPlotWindow ) { QList subwindows = m_mainPlotWindow->subWindowList( QMdiArea::StackingOrder ); - if ( subwindows.size() > 0 ) + if ( !subwindows.empty() ) { viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() ); } @@ -1059,7 +1059,7 @@ RimViewWindow* RiaGuiApplication::activeViewWindow() RiuPlotMainWindow* mainPlotWindow = dynamic_cast( mainWindowWidget ); QList subwindows = mainPlotWindow->subWindowList( QMdiArea::StackingOrder ); - if ( subwindows.size() > 0 ) + if ( !subwindows.empty() ) { viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() ); } diff --git a/ApplicationLibCode/Application/Tools/RiaImageCompareReporter.cpp b/ApplicationLibCode/Application/Tools/RiaImageCompareReporter.cpp index 5b5c4e7b89..e575042a6f 100644 --- a/ApplicationLibCode/Application/Tools/RiaImageCompareReporter.cpp +++ b/ApplicationLibCode/Application/Tools/RiaImageCompareReporter.cpp @@ -59,7 +59,7 @@ std::string removeCommonStart( const std::string& mask, const std::string& filen //-------------------------------------------------------------------------------------------------- void RiaImageCompareReporter::generateHTMLReport( const std::string& fileName, const std::string& diff2htmlHeaderText ) { - if ( m_directorySets.size() == 0 ) return; + if ( m_directorySets.empty() ) return; std::ofstream output( fileName.c_str() ); if ( !output ) diff --git a/ApplicationLibCode/Application/Tools/RiaProjectFileVersionTools.cpp b/ApplicationLibCode/Application/Tools/RiaProjectFileVersionTools.cpp index 5364f3f9f0..8741e46817 100644 --- a/ApplicationLibCode/Application/Tools/RiaProjectFileVersionTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaProjectFileVersionTools.cpp @@ -66,7 +66,7 @@ void RiaProjectFileVersionTools::decodeVersionString( const QString& projectFile QStringList subStrings = projectFileVersion.split( "." ); - if ( subStrings.size() > 0 ) + if ( !subStrings.empty() ) { *majorVersion = subStrings[0].toInt(); } diff --git a/ApplicationLibCode/Application/Tools/RiaProjectModifier.cpp b/ApplicationLibCode/Application/Tools/RiaProjectModifier.cpp index 96e1df4b4f..f04b3d4479 100644 --- a/ApplicationLibCode/Application/Tools/RiaProjectModifier.cpp +++ b/ApplicationLibCode/Application/Tools/RiaProjectModifier.cpp @@ -123,17 +123,17 @@ void RiaProjectModifier::invalidateExternalFilePaths( RimProject* project ) //-------------------------------------------------------------------------------------------------- bool RiaProjectModifier::applyModificationsToProject( RimProject* project ) { - if ( m_caseIdToGridFileNameMap.size() > 0 ) + if ( !m_caseIdToGridFileNameMap.empty() ) { replaceCase( project ); } - if ( m_groupIdToGridFileNamesMap.size() > 0 ) + if ( !m_groupIdToGridFileNamesMap.empty() ) { replaceSourceCases( project ); } - if ( m_caseIdToPropertiesFolderMap.size() > 0 ) + if ( !m_caseIdToPropertiesFolderMap.empty() ) { replacePropertiesFolder( project ); } @@ -309,7 +309,7 @@ int RiaProjectModifier::firstGroupId( RimProject* project ) RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : nullptr; if ( analysisModels ) { - if ( analysisModels->caseGroups.size() > 0 ) + if ( !analysisModels->caseGroups.empty() ) { return analysisModels->caseGroups[0]->groupId(); } diff --git a/ApplicationLibCode/Application/Tools/RiaSimWellBranchTools.cpp b/ApplicationLibCode/Application/Tools/RiaSimWellBranchTools.cpp index 42197a98ac..ff10d9043e 100644 --- a/ApplicationLibCode/Application/Tools/RiaSimWellBranchTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSimWellBranchTools.cpp @@ -54,7 +54,7 @@ QList RiaSimWellBranchTools::valueOptionsForBranchIndexF QList options; size_t branchCount = simulationWellPaths.size(); - if ( simulationWellPaths.size() == 0 ) + if ( simulationWellPaths.empty() ) { options.push_front( caf::PdmOptionItemInfo( "None", -1 ) ); } @@ -111,7 +111,7 @@ int RiaSimWellBranchTools::clampBranchIndex( const QString& simWellName, int bra { auto branches = RiaSimWellBranchTools::simulationWellBranches( simWellName, branchDetection ); - if ( branches.size() == 0 ) + if ( branches.empty() ) { return -1; } diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicWellPathImportPerforationIntervalsFeature.cpp b/ApplicationLibCode/Commands/CompletionCommands/RicWellPathImportPerforationIntervalsFeature.cpp index ac91ac40f7..5c711cb70a 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicWellPathImportPerforationIntervalsFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionCommands/RicWellPathImportPerforationIntervalsFeature.cpp @@ -63,7 +63,7 @@ void RicWellPathImportPerforationIntervalsFeature::onActionTriggered( bool isChe defaultDir, "Well Path Perforation Intervals (*.ev);;All Files (*.*)" ); - if ( wellPathFilePaths.size() < 1 ) return; + if ( wellPathFilePaths.empty() ) return; // Remember the path to next time app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() ); diff --git a/ApplicationLibCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.cpp b/ApplicationLibCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.cpp index b076772cb0..f608894755 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.cpp @@ -31,7 +31,7 @@ bool RicEclipseWellFeatureImpl::isAnyWellSelected() { std::vector selection = selectedWells(); - return selection.size() > 0; + return !selection.empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.cpp b/ApplicationLibCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.cpp index b54a033891..57a0341456 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.cpp +++ b/ApplicationLibCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.cpp @@ -63,7 +63,7 @@ bool RicEclipseWellShowLabelFeature::isCommandEnabled() const bool RicEclipseWellShowLabelFeature::isCommandChecked() const { std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { RimSimWellInView* well = selection[0]; @@ -111,7 +111,7 @@ bool RicEclipseWellShowHeadFeature::isCommandEnabled() const bool RicEclipseWellShowHeadFeature::isCommandChecked() const { std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { RimSimWellInView* well = selection[0]; @@ -159,7 +159,7 @@ bool RicEclipseWellShowPipeFeature::isCommandEnabled() const bool RicEclipseWellShowPipeFeature::isCommandChecked() const { std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { RimSimWellInView* well = selection[0]; @@ -207,7 +207,7 @@ bool RicEclipseWellShowSpheresFeature::isCommandEnabled() const bool RicEclipseWellShowSpheresFeature::isCommandChecked() const { std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { RimSimWellInView* well = selection[0]; @@ -255,7 +255,7 @@ bool RicEclipseWellShowWellCellsFeature::isCommandEnabled() const bool RicEclipseWellShowWellCellsFeature::isCommandChecked() const { std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { RimSimWellInView* well = selection[0]; @@ -303,7 +303,7 @@ bool RicEclipseWellShowWellCellFenceFeature::isCommandEnabled() const bool RicEclipseWellShowWellCellFenceFeature::isCommandChecked() const { std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { RimSimWellInView* well = selection[0]; diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicComputeStatisticsFeature.cpp b/ApplicationLibCode/Commands/EclipseCommands/RicComputeStatisticsFeature.cpp index d92e133580..fc157b7075 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicComputeStatisticsFeature.cpp +++ b/ApplicationLibCode/Commands/EclipseCommands/RicComputeStatisticsFeature.cpp @@ -38,7 +38,7 @@ CAF_CMD_SOURCE_INIT( RicComputeStatisticsFeature, "RicComputeStatisticsFeature" bool RicComputeStatisticsFeature::isCommandEnabled() const { std::vector selection = selectedCases(); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { RimEclipseStatisticsCase* statisticsCase = selection[0]; if ( statisticsCase ) @@ -46,7 +46,7 @@ bool RicComputeStatisticsFeature::isCommandEnabled() const RimIdenticalGridCaseGroup* gridCaseGroup = statisticsCase->firstAncestorOrThisOfType(); RimCaseCollection* caseCollection = gridCaseGroup ? gridCaseGroup->caseCollection() : nullptr; - return caseCollection ? caseCollection->reservoirs.size() > 0 : false; + return caseCollection ? !caseCollection->reservoirs.empty() : false; } } @@ -59,7 +59,7 @@ bool RicComputeStatisticsFeature::isCommandEnabled() const void RicComputeStatisticsFeature::onActionTriggered( bool isChecked ) { std::vector selection = selectedCases(); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { RimEclipseStatisticsCase* statisticsCase = selection[0]; diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicEclipseCaseNewGroupFeature.cpp b/ApplicationLibCode/Commands/EclipseCommands/RicEclipseCaseNewGroupFeature.cpp index 3173c9f6fd..e8befa4b5d 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicEclipseCaseNewGroupFeature.cpp +++ b/ApplicationLibCode/Commands/EclipseCommands/RicEclipseCaseNewGroupFeature.cpp @@ -42,7 +42,7 @@ bool RicEclipseCaseNewGroupFeature::isCommandEnabled() const std::vector caseCollSelection; caf::SelectionManager::instance()->objectsByType( &caseCollSelection ); - return caseSelection.size() > 0 || caseCollSelection.size() > 0; + return !caseSelection.empty() || !caseCollSelection.empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicNewStatisticsCaseFeature.cpp b/ApplicationLibCode/Commands/EclipseCommands/RicNewStatisticsCaseFeature.cpp index 4a7d90d6e7..e3802967d2 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicNewStatisticsCaseFeature.cpp +++ b/ApplicationLibCode/Commands/EclipseCommands/RicNewStatisticsCaseFeature.cpp @@ -73,7 +73,7 @@ caf::PdmUiItem* RicNewStatisticsCaseFeature::selectedValidUIItem() std::vector statisticsCaseCollections; caf::SelectionManager::instance()->objectsByType( &statisticsCaseCollections ); - if ( statisticsCaseCollections.size() > 0 ) + if ( !statisticsCaseCollections.empty() ) { return statisticsCaseCollections[0]; } @@ -81,7 +81,7 @@ caf::PdmUiItem* RicNewStatisticsCaseFeature::selectedValidUIItem() std::vector caseCollections; caf::SelectionManager::instance()->objectsByType( &caseCollections ); - if ( caseCollections.size() > 0 ) + if ( !caseCollections.empty() ) { if ( RimIdenticalGridCaseGroup::isStatisticsCaseCollection( caseCollections[0] ) ) { diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportFaultsFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportFaultsFeature.cpp index da99d7bd1a..4c81b3945b 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportFaultsFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportFaultsFeature.cpp @@ -50,7 +50,7 @@ bool RicExportFaultsFeature::isCommandEnabled() const caf::SelectionManager::instance()->objectsByType( &selectedFaults ); - return ( selectedFaults.size() > 0 ); + return ( !selectedFaults.empty() ); } //-------------------------------------------------------------------------------------------------- @@ -64,7 +64,7 @@ void RicExportFaultsFeature::onActionTriggered( bool isChecked ) caf::SelectionManager::instance()->objectsByType( &selectedFaults ); - if ( selectedFaults.size() == 0 ) return; + if ( selectedFaults.empty() ) return; QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder( "FAULTS" ); diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp index 0bc682ee88..0993156c11 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp @@ -123,7 +123,7 @@ bool RicExportToLasFileFeature::isCommandEnabled() const if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false; if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false; - return RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves().size() > 0; + return !RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves().empty(); } //-------------------------------------------------------------------------------------------------- @@ -136,7 +136,7 @@ void RicExportToLasFileFeature::onActionTriggered( bool isChecked ) if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return; std::vector curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves(); - if ( curves.size() == 0 ) return; + if ( curves.empty() ) return; QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder( "WELL_LOGS_DIR" ); diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputPropertyFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputPropertyFeature.cpp index 799ca37419..e5812e5dce 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputPropertyFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputPropertyFeature.cpp @@ -155,5 +155,5 @@ RimEclipseInputProperty* RicSaveEclipseInputPropertyFeature::selectedInputProper std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - return selection.size() > 0 ? selection[0] : nullptr; + return !selection.empty() ? selection[0] : nullptr; } diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyFeature.cpp index af9ac0eb4b..0f77d533ff 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyFeature.cpp @@ -47,7 +47,7 @@ RimEclipseView* RicSaveEclipseResultAsInputPropertyFeature::selectedEclipseView( std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { return selection[0]; } @@ -63,7 +63,7 @@ RimEclipseCellColors* RicSaveEclipseResultAsInputPropertyFeature::selectedEclips std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { return selection[0]; } diff --git a/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.cpp b/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.cpp index da1974e887..57bcdc7a8c 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.cpp @@ -119,7 +119,7 @@ QList RicSelectViewUI::calculateValueOptions( const caf: //-------------------------------------------------------------------------------------------------- void RicSelectViewUI::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - if ( m_currentCase && m_currentCase->views().size() == 0 ) + if ( m_currentCase && m_currentCase->views().empty() ) { m_createNewView = true; } diff --git a/ApplicationLibCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.cpp index 60aeca8844..620c5fc5b8 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.cpp @@ -39,7 +39,7 @@ bool RicShowTotalAllocationDataFeature::isCommandEnabled() const { std::set wellAllocPlots = RicShowTotalAllocationDataFeature::selectedWellAllocationPlots(); - return wellAllocPlots.size() > 0; + return !wellAllocPlots.empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp index 191d70a879..983428c0b3 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp @@ -48,7 +48,7 @@ bool RicShowWellAllocationPlotFeature::isCommandEnabled() const std::vector simWellCollection; caf::SelectionManager::instance()->objectsByType( &simWellCollection ); - if ( simWellCollection.size() > 0 ) + if ( !simWellCollection.empty() ) { return true; } @@ -81,11 +81,11 @@ void RicShowWellAllocationPlotFeature::onActionTriggered( bool isChecked ) RimSimWellInView* simWell = nullptr; - if ( collection.size() > 0 ) + if ( !collection.empty() ) { simWell = collection[0]; } - else if ( wellPathCollection.size() > 0 ) + else if ( !wellPathCollection.empty() ) { Rim3dView* view = RiaApplication::instance()->activeMainOrComparisonGridView(); if ( !view ) return; diff --git a/ApplicationLibCode/Commands/FractureCommands/RicPasteEllipseFractureFeature.cpp b/ApplicationLibCode/Commands/FractureCommands/RicPasteEllipseFractureFeature.cpp index 7d0fb23e9e..a9d6bc747a 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicPasteEllipseFractureFeature.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicPasteEllipseFractureFeature.cpp @@ -45,7 +45,7 @@ bool RicPasteEllipseFractureFeature::isCommandEnabled() const std::vector> typedObjects; objectGroup.objectsByType( &typedObjects ); - if ( typedObjects.size() == 0 ) + if ( typedObjects.empty() ) { return false; } diff --git a/ApplicationLibCode/Commands/FractureCommands/RicPasteStimPlanFractureFeature.cpp b/ApplicationLibCode/Commands/FractureCommands/RicPasteStimPlanFractureFeature.cpp index a0d4d5ea66..a81d724a27 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicPasteStimPlanFractureFeature.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicPasteStimPlanFractureFeature.cpp @@ -45,7 +45,7 @@ bool RicPasteStimPlanFractureFeature::isCommandEnabled() const std::vector> typedObjects; objectGroup.objectsByType( &typedObjects ); - if ( typedObjects.size() == 0 ) + if ( typedObjects.empty() ) { return false; } diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicImportGeoMechCaseFeature.cpp b/ApplicationLibCode/Commands/GeoMechCommands/RicImportGeoMechCaseFeature.cpp index af021fc097..f02d949fa2 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicImportGeoMechCaseFeature.cpp +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicImportGeoMechCaseFeature.cpp @@ -39,7 +39,7 @@ void RicImportGeoMechCaseFeature::onActionTriggered( bool isChecked ) "Import Geo-Mechanical Model", defaultDir, "Abaqus results (*.odb);;Abaqus input file (*.inp)" ); - if ( fileNames.size() ) defaultDir = QFileInfo( fileNames.last() ).absolutePath(); + if ( !fileNames.empty() ) defaultDir = QFileInfo( fileNames.last() ).absolutePath(); app->setLastUsedDialogDirectory( "GEOMECH_MODEL", defaultDir ); for ( const auto& fileName : fileNames ) diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicImportGeoMechCaseTimeStepFilterFeature.cpp b/ApplicationLibCode/Commands/GeoMechCommands/RicImportGeoMechCaseTimeStepFilterFeature.cpp index f6ca60a0a1..a5c5a1ff8d 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicImportGeoMechCaseTimeStepFilterFeature.cpp +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicImportGeoMechCaseTimeStepFilterFeature.cpp @@ -39,7 +39,7 @@ void RicImportGeoMechCaseTimeStepFilterFeature::onActionTriggered( bool isChecke QString defaultDir = app->lastUsedDialogDirectory( "GEOMECH_MODEL" ); QStringList fileNames = RiuFileDialogTools::getOpenFileNames( nullptr, "Import Geo-Mechanical Model", defaultDir, "Abaqus results (*.odb)" ); - if ( fileNames.size() ) defaultDir = QFileInfo( fileNames.last() ).absolutePath(); + if ( !fileNames.empty() ) defaultDir = QFileInfo( fileNames.last() ).absolutePath(); for ( QString fileName : fileNames ) { if ( !fileName.isEmpty() ) diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicRunFaultReactModelingFeature.cpp b/ApplicationLibCode/Commands/GeoMechCommands/RicRunFaultReactModelingFeature.cpp index 0fc6266860..9105ee13ae 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicRunFaultReactModelingFeature.cpp +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicRunFaultReactModelingFeature.cpp @@ -123,7 +123,7 @@ void RicRunFaultReactModelingFeature::onActionTriggered( bool isChecked ) { gCase->reloadDataAndUpdate(); auto& views = gCase->geoMechViews(); - if ( views.size() > 0 ) + if ( !views.empty() ) { Riu3DMainWindowTools::selectAsCurrentItem( views[0] ); } diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicShowFaultReactModelFeature.cpp b/ApplicationLibCode/Commands/GeoMechCommands/RicShowFaultReactModelFeature.cpp index 294d7581c3..3bbd380a7f 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicShowFaultReactModelFeature.cpp +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicShowFaultReactModelFeature.cpp @@ -71,7 +71,7 @@ void RicShowFaultReactModelFeature::onActionTriggered( bool isChecked ) { gCase->reloadDataAndUpdate(); auto& views = gCase->geoMechViews(); - if ( views.size() > 0 ) + if ( !views.empty() ) { Riu3DMainWindowTools::selectAsCurrentItem( views[0] ); } diff --git a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensSession.cpp b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensSession.cpp index 5fee06a9d4..eeb02ae159 100644 --- a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensSession.cpp +++ b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensSession.cpp @@ -263,14 +263,14 @@ void RicHoloLensSession::handleSuccessfulSendMetaData( int metaDataSequenceNumbe else { // An empty server response means we should send all array referenced by the last sent meta data - if ( m_lastExtractionAllReferencedPacketIdsArr.size() > 0 ) + if ( !m_lastExtractionAllReferencedPacketIdsArr.empty() ) { arrayIdsToSend = m_lastExtractionAllReferencedPacketIdsArr; RiaLogging::info( "HoloLens: Empty server response, sending all arrays referenced by last meta data" ); } } - if ( arrayIdsToSend.size() == 0 ) + if ( arrayIdsToSend.empty() ) { RiaLogging::info( "HoloLens: Nothing to do, no data requested by server" ); return; diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicAddScriptPathFeature.cpp b/ApplicationLibCode/Commands/OctaveScriptCommands/RicAddScriptPathFeature.cpp index 94b904011f..d26efeab63 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicAddScriptPathFeature.cpp +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicAddScriptPathFeature.cpp @@ -41,7 +41,7 @@ CAF_CMD_SOURCE_INIT( RicAddScriptPathFeature, "RicAddScriptPathFeature" ); bool RicAddScriptPathFeature::isCommandEnabled() const { std::vector selection = RicScriptFeatureImpl::selectedScriptCollections(); - return selection.size() > 0; + return !selection.empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp b/ApplicationLibCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp index f801a4b18b..cab588a561 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp @@ -45,7 +45,7 @@ bool RicDeleteScriptPathFeature::isCommandEnabled() const { if ( selection.front()->directory().isEmpty() ) return false; } - return selection.size() > 0; + return !selection.empty(); } //-------------------------------------------------------------------------------------------------- @@ -54,7 +54,7 @@ bool RicDeleteScriptPathFeature::isCommandEnabled() const void RicDeleteScriptPathFeature::onActionTriggered( bool isChecked ) { std::vector calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections(); - RimScriptCollection* scriptCollection = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : nullptr; + RimScriptCollection* scriptCollection = !calcScriptCollections.empty() ? calcScriptCollections[0] : nullptr; if ( scriptCollection ) { QString toBeRemoved = scriptCollection->directory; diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptFeature.cpp b/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptFeature.cpp index 6b675ccdfe..c93ce87ebc 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptFeature.cpp +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptFeature.cpp @@ -49,7 +49,7 @@ CAF_CMD_SOURCE_INIT( RicExecuteScriptFeature, "RicExecuteScriptFeature" ); bool RicExecuteScriptFeature::isCommandEnabled() const { std::vector selection = RicScriptFeatureImpl::selectedScripts(); - return selection.size() > 0; + return !selection.empty(); } //-------------------------------------------------------------------------------------------------- @@ -58,7 +58,7 @@ bool RicExecuteScriptFeature::isCommandEnabled() const void RicExecuteScriptFeature::onActionTriggered( bool isChecked ) { std::vector selection = RicScriptFeatureImpl::selectedScripts(); - CVF_ASSERT( selection.size() > 0 ); + CVF_ASSERT( !selection.empty() ); executeScript( selection[0] ); } diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewOctaveScriptFeature.cpp b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewOctaveScriptFeature.cpp index 64cc7b2435..302013eb26 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewOctaveScriptFeature.cpp +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewOctaveScriptFeature.cpp @@ -59,8 +59,8 @@ void RicNewOctaveScriptFeature::onActionTriggered( bool isChecked ) std::vector calcScripts = RicScriptFeatureImpl::selectedScripts(); std::vector calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections(); - RimCalcScript* calcScript = calcScripts.size() > 0 ? calcScripts[0] : nullptr; - RimScriptCollection* scriptColl = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : nullptr; + RimCalcScript* calcScript = !calcScripts.empty() ? calcScripts[0] : nullptr; + RimScriptCollection* scriptColl = !calcScriptCollections.empty() ? calcScriptCollections[0] : nullptr; QString fullPathNewScript; diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.cpp b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.cpp index 14ed63da80..063a879c8f 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.cpp +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.cpp @@ -60,8 +60,8 @@ void RicNewPythonScriptFeature::onActionTriggered( bool isChecked ) std::vector calcScripts = RicScriptFeatureImpl::selectedScripts(); std::vector calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections(); - RimCalcScript* calcScript = calcScripts.size() > 0 ? calcScripts[0] : nullptr; - RimScriptCollection* scriptColl = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : nullptr; + RimCalcScript* calcScript = !calcScripts.empty() ? calcScripts[0] : nullptr; + RimScriptCollection* scriptColl = !calcScriptCollections.empty() ? calcScriptCollections[0] : nullptr; QString fullPathNewScript; diff --git a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseCasesFeature.cpp b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseCasesFeature.cpp index 1d7baa4b8b..72c540ace8 100644 --- a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseCasesFeature.cpp +++ b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseCasesFeature.cpp @@ -53,7 +53,7 @@ bool RicPasteEclipseCasesFeature::isCommandEnabled() const std::vector> typedObjects; objectGroup.objectsByType( &typedObjects ); - if ( typedObjects.size() == 0 ) + if ( typedObjects.empty() ) { return false; } @@ -77,7 +77,7 @@ void RicPasteEclipseCasesFeature::onActionTriggered( bool isChecked ) caf::PdmObjectGroup objectGroup; RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup ); - if ( objectGroup.objects.size() == 0 ) return; + if ( objectGroup.objects.empty() ) return; addCasesToGridCaseGroup( objectGroup, gridCaseGroup ); @@ -115,7 +115,7 @@ void RicPasteEclipseCasesFeature::addCasesToGridCaseGroup( caf::PdmObjectGroup& } } - if ( resultCases.size() == 0 ) + if ( resultCases.empty() ) { return; } diff --git a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp index 03941c86ee..6d305b1870 100644 --- a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp +++ b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp @@ -46,7 +46,7 @@ bool RicPasteGeoMechViewsFeature::isCommandEnabled() const std::vector> typedObjects; objectGroup.objectsByType( &typedObjects ); - if ( typedObjects.size() == 0 ) + if ( typedObjects.empty() ) { return false; } @@ -70,7 +70,7 @@ void RicPasteGeoMechViewsFeature::onActionTriggered( bool isChecked ) caf::PdmObjectGroup objectGroup; RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup ); - if ( objectGroup.objects.size() == 0 ) return; + if ( objectGroup.objects.empty() ) return; std::vector> geomViews; objectGroup.objectsByType( &geomViews ); diff --git a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteIntersectionsFeature.cpp b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteIntersectionsFeature.cpp index 780fac584e..416a17e8ad 100644 --- a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteIntersectionsFeature.cpp +++ b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteIntersectionsFeature.cpp @@ -71,7 +71,7 @@ void RicPasteIntersectionsFeature::onActionTriggered( bool isChecked ) caf::PdmObjectGroup objectGroup; RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup ); - if ( objectGroup.objects.size() == 0 ) return; + if ( objectGroup.objects.empty() ) return; std::vector> intersectionObjects; objectGroup.objectsByType( &intersectionObjects ); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp index 99c622ba24..c2bd8af901 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp @@ -55,7 +55,7 @@ bool RicNewSummaryMultiPlotFromDataVectorFeature::isCommandEnabled() const if ( adr->isEnsemble() ) nEnsembles++; } - bool bOk = ( selectedAddressItems.size() > 0 ); + bool bOk = ( !selectedAddressItems.empty() ); if ( nEnsembles > 0 ) { bOk = bOk && ( nEnsembles == selectedItems.size() ); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp index 466831b939..94d044bd12 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp @@ -52,7 +52,7 @@ bool RicNewSummaryPlotFromDataVectorFeature::isCommandEnabled() const if ( adr->isEnsemble() ) nEnsembles++; } - bool bOk = ( selectedAddressItems.size() > 0 ); + bool bOk = ( !selectedAddressItems.empty() ); if ( nEnsembles > 0 ) { bOk = bOk && ( nEnsembles == selectedItems.size() ); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 77fd0c6dba..22192b7607 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -413,7 +413,7 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPl if ( prefs->defaultSummaryPlotType() == RiaPreferencesSummary::DefaultSummaryPlotType::PLOT_TEMPLATES ) { RimSummaryMultiPlot* plotToSelect = nullptr; - bool ensembleTemplates = ( ensembles.size() > 0 ); + bool ensembleTemplates = ( !ensembles.empty() ); for ( auto& filename : prefs->defaultSummaryPlotTemplates( ensembleTemplates ) ) { plotToSelect = RicSummaryPlotTemplateTools::create( filename, cases, ensembles ); diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp index 80f0264f9f..b354fcafce 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp @@ -95,7 +95,7 @@ void RicSaveMultiPlotTemplateFeature::onActionTriggered( bool isChecked ) plot->storeStepDimensionFromToolbar(); QString ext = ".rpt"; - if ( selectedSummaryPlot()->curveSets().size() > 0 ) ext = ".erpt"; + if ( !selectedSummaryPlot()->curveSets().empty() ) ext = ".erpt"; QString fileName = settings.filePath() + "/" + settings.name() + ext; if ( !fileName.isEmpty() ) diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp index 33f804f97a..87f728b00e 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp @@ -66,7 +66,7 @@ void RicSelectCaseOrEnsembleUi::setEnsembleSelectionMode( bool ensembleMode ) else { std::vector cases = proj->allSummaryCases(); - if ( cases.size() > 0 ) m_selectedSummaryCase = cases.front(); + if ( !cases.empty() ) m_selectedSummaryCase = cases.front(); } } diff --git a/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp b/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp index 3c638e0278..07ec3410a0 100644 --- a/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp @@ -105,7 +105,7 @@ bool RicCloseObservedDataFeature::isCommandEnabled() const std::vector fmuRftSelection; caf::SelectionManager::instance()->objectsByType( &fmuRftSelection ); - if ( summarySelection.size() == 0 && fmuRftSelection.size() == 0 ) + if ( summarySelection.empty() && fmuRftSelection.empty() ) { return false; } diff --git a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp index 994c083365..3262200f88 100644 --- a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp @@ -116,7 +116,7 @@ bool RicCloseSummaryCaseFeature::isCommandEnabled() const std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - if ( selection.size() == 0 ) + if ( selection.empty() ) { return false; } @@ -138,7 +138,7 @@ void RicCloseSummaryCaseFeature::onActionTriggered( bool isChecked ) { std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - CVF_ASSERT( selection.size() > 0 ); + CVF_ASSERT( !selection.empty() ); RicCloseSummaryCaseFeature::deleteSummaryCases( selection ); } diff --git a/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp b/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp index 764f89a22e..ab8c002115 100644 --- a/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp @@ -67,7 +67,7 @@ bool RicCloseSummaryCaseInCollectionFeature::isCommandEnabled() const { return dynamic_cast( coll ) != nullptr; } ), summaryCaseCollections.end() ); - return ( summaryCaseMainCollections.size() > 0 || summaryCaseCollections.size() > 0 ); + return ( !summaryCaseMainCollections.empty() || !summaryCaseCollections.empty() ); } //-------------------------------------------------------------------------------------------------- @@ -78,7 +78,7 @@ void RicCloseSummaryCaseInCollectionFeature::onActionTriggered( bool isChecked ) std::vector summaryCaseMainCollections; caf::SelectionManager::instance()->objectsByType( &summaryCaseMainCollections ); - if ( summaryCaseMainCollections.size() > 0 ) + if ( !summaryCaseMainCollections.empty() ) { std::vector allSummaryCases = summaryCaseMainCollections[0]->allSummaryCases(); RicCloseSummaryCaseFeature::deleteSummaryCases( allSummaryCases ); diff --git a/ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp b/ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp index 759bf09728..c47bbe3015 100644 --- a/ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp +++ b/ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp @@ -59,7 +59,7 @@ bool RicCreateSummaryCaseCollectionFeature::isCommandEnabled() const std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - if ( selection.size() == 0 ) + if ( selection.empty() ) { return false; } @@ -81,7 +81,7 @@ void RicCreateSummaryCaseCollectionFeature::onActionTriggered( bool isChecked ) { std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - if ( selection.size() == 0 ) return; + if ( selection.empty() ) return; std::vector duplicates; diff --git a/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.cpp b/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.cpp index d1aab67f9e..d0608ab62c 100644 --- a/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.cpp +++ b/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.cpp @@ -126,7 +126,7 @@ void RicDeleteSubItemsFeature::deleteSubItems( bool onlyDeleteUnchecked ) std::vector items; caf::SelectionManager::instance()->selectedItems( items ); - CVF_ASSERT( items.size() > 0 ); + CVF_ASSERT( !items.empty() ); for ( auto item : items ) { diff --git a/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp b/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp index 85244f9473..ac41678550 100644 --- a/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp +++ b/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp @@ -73,7 +73,7 @@ bool RicDeleteSummaryCaseCollectionFeature::isCommandEnabled() const []( RimSummaryCaseCollection* coll ) { return dynamic_cast( coll ) != nullptr; } ), selection.end() ); - return ( selection.size() > 0 ); + return ( !selection.empty() ); } //-------------------------------------------------------------------------------------------------- @@ -83,7 +83,7 @@ void RicDeleteSummaryCaseCollectionFeature::onActionTriggered( bool isChecked ) { std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - if ( selection.size() == 0 ) return; + if ( selection.empty() ) return; QMessageBox msgBox; msgBox.setIcon( QMessageBox::Question ); @@ -143,7 +143,7 @@ void RicDeleteSummaryCaseCollectionFeature::setupActionLook( QAction* actionToSe void RicDeleteSummaryCaseCollectionFeature::moveAllCasesToMainSummaryCollection( RimSummaryCaseCollection* summaryCaseCollection ) { std::vector summaryCases = summaryCaseCollection->allSummaryCases(); - if ( summaryCases.size() == 0 ) return; + if ( summaryCases.empty() ) return; RimSummaryCaseMainCollection* summaryCaseMainCollection = summaryCaseCollection->firstAncestorOrThisOfType(); diff --git a/ApplicationLibCode/Commands/RicImportObservedDataFeature.cpp b/ApplicationLibCode/Commands/RicImportObservedDataFeature.cpp index ddeb27382c..d770ca5bc5 100644 --- a/ApplicationLibCode/Commands/RicImportObservedDataFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportObservedDataFeature.cpp @@ -107,7 +107,7 @@ bool RicImportObservedDataFeature::isCommandEnabled() const std::vector selectionObservedData; caf::SelectionManager::instance()->objectsByType( &selectionObservedData ); - return ( selectionObservedDataCollection.size() > 0 || selectionObservedData.size() > 0 ); + return ( !selectionObservedDataCollection.empty() || !selectionObservedData.empty() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/RicImportObservedFmuDataFeature.cpp b/ApplicationLibCode/Commands/RicImportObservedFmuDataFeature.cpp index dad855f52c..49c964ad9a 100644 --- a/ApplicationLibCode/Commands/RicImportObservedFmuDataFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportObservedFmuDataFeature.cpp @@ -102,7 +102,7 @@ bool RicImportObservedFmuDataFeature::isCommandEnabled() const std::vector selectionObservedData; caf::SelectionManager::instance()->objectsByType( &selectionObservedData ); - return ( selectionObservedDataCollection.size() > 0 || selectionObservedData.size() > 0 ); + return ( !selectionObservedDataCollection.empty() || !selectionObservedData.empty() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/RicNewViewFeature.cpp b/ApplicationLibCode/Commands/RicNewViewFeature.cpp index 85051eec71..e784879aac 100644 --- a/ApplicationLibCode/Commands/RicNewViewFeature.cpp +++ b/ApplicationLibCode/Commands/RicNewViewFeature.cpp @@ -124,7 +124,7 @@ RimEclipseCase* RicNewViewFeature::selectedEclipseCase() std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { return selection[0]; } @@ -140,7 +140,7 @@ RimGeoMechCase* RicNewViewFeature::selectedGeoMechCase() std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { return selection[0]; } @@ -175,7 +175,7 @@ RimGeoMechView* RicNewViewFeature::selectedGeoMechView() std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { return selection[0]; } diff --git a/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp b/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp index 8e4ba5ab5e..826f3a0e20 100644 --- a/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp +++ b/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp @@ -643,7 +643,7 @@ QStringList RicRecursiveFileSearchDialog::createFileNameFilterList() QStringList nameFilter; QString effectiveFileNameFilter = !fileNameFilter.isEmpty() ? fileNameFilter : "*"; - if ( fileExtensions.size() == 0 || !extensionFromFileNameFilter().isEmpty() ) + if ( fileExtensions.empty() || !extensionFromFileNameFilter().isEmpty() ) { nameFilter.append( effectiveFileNameFilter ); } diff --git a/ApplicationLibCode/Commands/RicReloadFormationNamesFeature.cpp b/ApplicationLibCode/Commands/RicReloadFormationNamesFeature.cpp index 500af2f206..9937fb2115 100644 --- a/ApplicationLibCode/Commands/RicReloadFormationNamesFeature.cpp +++ b/ApplicationLibCode/Commands/RicReloadFormationNamesFeature.cpp @@ -39,7 +39,7 @@ bool RicReloadFormationNamesFeature::isCommandEnabled() const std::vector selectedFormationNamesCollObjs; caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs ); - return ( selectedFormationNamesObjs.size() > 0 || selectedFormationNamesCollObjs.size() > 0 ); + return ( !selectedFormationNamesObjs.empty() || !selectedFormationNamesCollObjs.empty() ); } //-------------------------------------------------------------------------------------------------- @@ -50,7 +50,7 @@ void RicReloadFormationNamesFeature::onActionTriggered( bool isChecked ) std::vector selectedFormationNamesCollObjs; caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs ); - if ( selectedFormationNamesCollObjs.size() ) + if ( !selectedFormationNamesCollObjs.empty() ) { selectedFormationNamesCollObjs[0]->readAllFormationNames(); for ( RimFormationNames* fnames : selectedFormationNamesCollObjs[0]->formationNamesList() ) diff --git a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp index c46bd225be..83eb9c676c 100644 --- a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp @@ -94,7 +94,7 @@ std::vector RicReloadSummaryCaseFeature::selectedSummaryCases() std::vector mainCollectionSelection; caf::SelectionManager::instance()->objectsByType( &mainCollectionSelection ); - if ( mainCollectionSelection.size() > 0 ) + if ( !mainCollectionSelection.empty() ) { return mainCollectionSelection[0]->allSummaryCases(); } diff --git a/ApplicationLibCode/Commands/RicReloadWellPathFormationNamesFeature.cpp b/ApplicationLibCode/Commands/RicReloadWellPathFormationNamesFeature.cpp index 083d222fbc..978b808da1 100644 --- a/ApplicationLibCode/Commands/RicReloadWellPathFormationNamesFeature.cpp +++ b/ApplicationLibCode/Commands/RicReloadWellPathFormationNamesFeature.cpp @@ -39,7 +39,7 @@ bool RicReloadWellPathFormationNamesFeature::isCommandEnabled() const std::vector wellPathCollection; caf::SelectionManager::instance()->objectsByType( &wellPathCollection ); - return ( wellPaths.size() > 0 || wellPathCollection.size() > 0 ); + return ( !wellPaths.empty() || !wellPathCollection.empty() ); } //-------------------------------------------------------------------------------------------------- @@ -53,12 +53,12 @@ void RicReloadWellPathFormationNamesFeature::onActionTriggered( bool isChecked ) std::vector wellPathCollections; caf::SelectionManager::instance()->objectsByType( &wellPathCollections ); - if ( wellPaths.size() > 0 ) + if ( !wellPaths.empty() ) { RimWellPathCollection* wellPathCollection = wellPaths[0]->firstAncestorOrThisOfTypeAsserted(); wellPathCollection->reloadAllWellPathFormations(); } - else if ( wellPathCollections.size() > 0 ) + else if ( !wellPathCollections.empty() ) { wellPathCollections[0]->reloadAllWellPathFormations(); } diff --git a/ApplicationLibCode/Commands/RicSelectOrCreateViewFeatureImpl.cpp b/ApplicationLibCode/Commands/RicSelectOrCreateViewFeatureImpl.cpp index c7f74fc734..dd345b42b7 100644 --- a/ApplicationLibCode/Commands/RicSelectOrCreateViewFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/RicSelectOrCreateViewFeatureImpl.cpp @@ -122,7 +122,7 @@ RimEclipseView* RicSelectOrCreateViewFeatureImpl::getDefaultSelectedView( RimEcl } else { - if ( resultCase->views().size() > 0 ) + if ( !resultCase->views().empty() ) { defaultSelectedView = dynamic_cast( resultCase->views()[0] ); } diff --git a/ApplicationLibCode/Commands/RicWellLogTools.cpp b/ApplicationLibCode/Commands/RicWellLogTools.cpp index e60a24f7cd..2c9637d3c0 100644 --- a/ApplicationLibCode/Commands/RicWellLogTools.cpp +++ b/ApplicationLibCode/Commands/RicWellLogTools.cpp @@ -68,7 +68,7 @@ RimSimWellInView* RicWellLogTools::selectedSimulationWell( int* branchIndex ) std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); ( *branchIndex ) = 0; - return selection.size() > 0 ? selection[0] : nullptr; + return !selection.empty() ? selection[0] : nullptr; } } @@ -164,10 +164,10 @@ RimWellPath* RicWellLogTools::selectedWellPathWithLogFile() { std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - if ( selection.size() > 0 ) + if ( !selection.empty() ) { RimWellPath* wellPath = selection[0]; - if ( wellPath->wellLogFiles().size() > 0 ) + if ( !wellPath->wellLogFiles().empty() ) { return wellPath; } @@ -182,7 +182,7 @@ RimWellPath* RicWellLogTools::selectedWellPathWithLogFile() RimWellPath* RicWellLogTools::findWellPathWithLogFileFromSelection() { RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType(); - if ( wellPath && wellPath->wellLogFiles().size() > 0 ) + if ( wellPath && !wellPath->wellLogFiles().empty() ) { return wellPath; } diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.cpp index 314ef45aa0..061321542c 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.cpp +++ b/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.cpp @@ -61,7 +61,7 @@ void RicNewSeismicViewFeature::onActionTriggered( bool isChecked ) RimSeismicData* selectedData = nullptr; - if ( uiItems.size() > 0 ) + if ( !uiItems.empty() ) { selectedData = dynamic_cast( uiItems[0] ); } diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicSeismicSectionFromIntersectionFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicSeismicSectionFromIntersectionFeature.cpp index b6d73a85bc..445ead3336 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/RicSeismicSectionFromIntersectionFeature.cpp +++ b/ApplicationLibCode/Commands/SeismicCommands/RicSeismicSectionFromIntersectionFeature.cpp @@ -76,7 +76,7 @@ void RicSeismicSectionFromIntersectionFeature::onActionTriggered( bool isChecked newSection->setUserDescription( intersection->name() ); auto polyline = intersection->polyLines(); - if ( polyline.size() > 0 ) + if ( !polyline.empty() ) { for ( auto& p : polyline[0] ) { diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.cpp index 1235366d01..4f56806884 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.cpp @@ -107,7 +107,7 @@ void RicWellPathsImportSsihubFeature::onActionTriggered( bool isChecked ) if ( QDialog::Accepted == wellImportwizard.exec() ) { QStringList wellPaths = wellImportwizard.absoluteFilePathsToWellPaths(); - if ( wellPaths.size() > 0 ) + if ( !wellPaths.empty() ) { QStringList errorMessages; app->addWellPathsToModel( wellPaths, &errorMessages ); diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp index aa994d946b..6d17e3b49e 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp @@ -515,7 +515,7 @@ void RiuWellImportWizard::downloadWellPaths() //-------------------------------------------------------------------------------------------------- void RiuWellImportWizard::checkDownloadQueueAndIssueRequests() { - if ( m_wellRequestQueue.size() > 0 ) + if ( !m_wellRequestQueue.empty() ) { DownloadEntity firstItem = m_wellRequestQueue[0]; m_wellRequestQueue.pop_front(); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.cpp index c763c6f43f..29eeb0c228 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.cpp @@ -56,7 +56,7 @@ void RicEditSummaryCurveCalculationFeature::onActionTriggered( bool isChecked ) std::vector selectedCurves = caf::selectedObjectsByType(); RimUserDefinedCalculation* calculation = nullptr; - if ( selectedCurves.size() > 0 ) + if ( !selectedCurves.empty() ) { RifEclipseSummaryAddress selectedAddress = selectedCurves.front()->summaryAddressY(); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.cpp index 7e445d2e66..eae546aa50 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.cpp @@ -84,7 +84,7 @@ void RicNewDerivedEnsembleFeature::onActionTriggered( bool isChecked ) { std::vector ensembles = caf::selectedObjectsByType(); - if ( ensembles.size() >= 1 ) newEnsemble->setEnsemble1( ensembles[0] ); + if ( !ensembles.empty() ) newEnsemble->setEnsemble1( ensembles[0] ); if ( ensembles.size() == 2 ) { newEnsemble->setEnsemble2( ensembles[1] ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedSummaryFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedSummaryFeature.cpp index 0354f0bb12..57064423d2 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedSummaryFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedSummaryFeature.cpp @@ -53,7 +53,7 @@ void RicNewDerivedSummaryFeature::onActionTriggered( bool isChecked ) { auto allCases = mainColl->allSummaryCases(); - if ( allCases.size() > 0 ) + if ( !allCases.empty() ) { selectedCases.push_back( allCases[0] ); } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp index 4cc30de94c..3931f466ae 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp @@ -218,7 +218,7 @@ bool RicNewGridTimeHistoryCurveFeature::isCommandEnabled() const std::vector items; Riu3dSelectionManager::instance()->selectedItems( items ); - if ( items.size() > 0 ) + if ( !items.empty() ) { const RiuEclipseSelectionItem* eclSelectionItem = dynamic_cast( items[0] ); if ( eclSelectionItem && eclSelectionItem->m_resultDefinition ) @@ -246,7 +246,7 @@ void RicNewGridTimeHistoryCurveFeature::onActionTriggered( bool isChecked ) std::vector items; Riu3dSelectionManager::instance()->selectedItems( items ); - CVF_ASSERT( items.size() > 0 ); + CVF_ASSERT( !items.empty() ); for ( auto item : items ) { diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp index 0bb271cae0..33766273d8 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp @@ -57,13 +57,13 @@ bool RicOpenSummaryPlotEditorFeature::isCommandEnabled() const RimCustomObjectiveFunctionCollection* customObjFuncCollection = nullptr; std::vector selectedCases = caf::selectedObjectsByType(); - if ( selectedCases.size() > 0 ) return true; + if ( !selectedCases.empty() ) return true; std::vector selectedGroups = caf::selectedObjectsByType(); - if ( selectedGroups.size() > 0 ) return true; + if ( !selectedGroups.empty() ) return true; std::vector selectedPlotCollections = caf::selectedObjectsByType(); - if ( selectedPlotCollections.size() > 0 ) return true; + if ( !selectedPlotCollections.empty() ) return true; caf::PdmObject* selObj = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); if ( !selObj ) return false; @@ -151,7 +151,7 @@ void RicOpenSummaryPlotEditorFeature::onActionTriggered( bool isChecked ) if ( multiPlot ) { - if ( multiPlot->summaryPlots().size() > 0 ) + if ( !multiPlot->summaryPlots().empty() ) { dialog->updateFromSummaryPlot( multiPlot->summaryPlots()[0] ); } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.cpp index baad7acce8..e460992f88 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.cpp @@ -46,7 +46,7 @@ bool RicPasteAsciiDataCurveFeature::isCommandEnabled() const return false; } - return RicPasteAsciiDataCurveFeature::asciiDataCurves().size() > 0; + return !RicPasteAsciiDataCurveFeature::asciiDataCurves().empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp index c1bf23758a..c9d2b4d12b 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp @@ -84,7 +84,7 @@ void RicPasteAsciiDataToSummaryPlotFeature::onActionTriggered( bool isChecked ) std::vector curves = parseCurves( text, pasteOptions ); - if ( curves.size() > 0 ) + if ( !curves.empty() ) { if ( !summaryPlot ) { diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp index bfb28df5c3..94443d034a 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp @@ -496,7 +496,7 @@ void RicPasteAsciiDataToSummaryPlotFeatureUi::initialize( RifCsvUserDataParser* } parser->parseColumnInfo( parseOptions() ); - if ( parser->tableData().columnInfos().size() > 0 ) + if ( !parser->tableData().columnInfos().empty() ) { m_timeSeriesColumnName = QString::fromStdString( parser->tableData().columnInfos()[0].columnName() ); } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCaseFeature.cpp index 3b263fe329..6bcc1445a9 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCaseFeature.cpp @@ -54,7 +54,7 @@ bool RicPasteSummaryCaseFeature::isCommandEnabled() const std::vector> summaryCases = RicPasteSummaryCaseFeature::summaryCases(); - if ( summaryCases.size() == 0 ) + if ( summaryCases.empty() ) { return false; } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotCurveFeature.cpp index 255df615e0..99be33db09 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotCurveFeature.cpp @@ -48,7 +48,7 @@ bool RicPasteSummaryCrossPlotCurveFeature::isCommandEnabled() const return false; } - if ( summaryCurvesOnClipboard().size() == 0 ) + if ( summaryCurvesOnClipboard().empty() ) { return false; } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotFeature.cpp index 09b0b74198..596c8dfce0 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotFeature.cpp @@ -76,7 +76,7 @@ bool RicPasteSummaryCrossPlotFeature::isCommandEnabled() const return false; } - return RicPasteSummaryCrossPlotFeature::summaryPlots().size() > 0; + return !RicPasteSummaryCrossPlotFeature::summaryPlots().empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp index 12d6306cd7..2e2a95cc68 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp @@ -92,7 +92,7 @@ bool RicPasteSummaryCurveFeature::isCommandEnabled() const return false; } - if ( summaryCurvesOnClipboard().size() == 0 ) + if ( summaryCurvesOnClipboard().empty() ) { return false; } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.cpp index 6884840430..55ca58a95d 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.cpp @@ -69,7 +69,7 @@ bool RicPasteSummaryPlotFeature::isCommandEnabled() const auto multiPlot = caf::firstAncestorOfTypeFromSelectedObject(); if ( !multiPlot ) return false; - return RicPasteSummaryPlotFeature::summaryPlots().size() > 0; + return !RicPasteSummaryPlotFeature::summaryPlots().empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.cpp index 41efe099cb..2b2a3bc73e 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.cpp @@ -51,7 +51,7 @@ bool RicPasteTimeHistoryCurveFeature::isCommandEnabled() const return false; } - return RicPasteTimeHistoryCurveFeature::timeHistoryCurves().size() > 0; + return !RicPasteTimeHistoryCurveFeature::timeHistoryCurves().empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.cpp index ebbf1018d1..b91b58f32c 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.cpp @@ -40,7 +40,7 @@ bool RicSummaryCurveSwitchAxisFeature::isCommandEnabled() const RicSummaryCurveSwitchAxisFeature::extractSelectedCurves( &summaryCurves, &asciiDataCurves, &gridTimeHistoryCurves ); - return summaryCurves.size() || asciiDataCurves.size() || gridTimeHistoryCurves.size(); + return !summaryCurves.empty() || !asciiDataCurves.empty() || !gridTimeHistoryCurves.empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp index a0f61c00b0..7658cbdb1a 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp @@ -310,7 +310,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin &summaryAddressFilters, &gridResultAddressFilters ); - if ( summaryAddressFilters.size() ) + if ( !summaryAddressFilters.empty() ) { RimSummaryCaseCollection* ensemble = nullptr; @@ -368,7 +368,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin // Grid Cell Result vectors - if ( gridResultAddressFilters.size() ) + if ( !gridResultAddressFilters.empty() ) { // Todo: Use identical grid case import if -e -c or -cl @@ -415,7 +415,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin } } - if ( createdCurves.size() ) + if ( !createdCurves.empty() ) { RimSummaryPlot* newPlot = new RimSummaryPlot(); newPlot->enableAutoPlotTitle( true ); @@ -471,7 +471,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin if ( isEnsembleMode ) ++curveColorIndex; - if ( createdCurves.size() ) + if ( !createdCurves.empty() ) { RimSummaryPlot* newPlot = new RimSummaryPlot(); newPlot->enableAutoPlotTitle( true ); @@ -633,7 +633,7 @@ std::vector RicSummaryPlotFeatureImpl::createMultipleSummaryPlo if ( historyCurve ) createdCurves.push_back( historyCurve ); } - if ( createdCurves.size() || createdEnsembleCurveSets.size() ) + if ( !createdCurves.empty() || !createdEnsembleCurveSets.empty() ) { RimSummaryPlot* newPlot = new RimSummaryPlot(); newPlot->enableAutoPlotTitle( true ); diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp index 582b24e35f..9d8e7e9b5d 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp @@ -41,7 +41,7 @@ bool RicToggleItemsOnOthersOffFeature::isCommandEnabled() const caf::PdmFieldHandle* commonParent = commonParentForAllSelections( selectedObjects ); std::vector children = childObjects( commonParent ); - return commonParent != nullptr && children.size() > 0 && objectToggleField( children.front() ) && children.size() > selectedObjects.size(); + return commonParent != nullptr && !children.empty() && objectToggleField( children.front() ) && children.size() > selectedObjects.size(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp index 7525f74df1..e0b4288f33 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp @@ -50,7 +50,7 @@ CAF_CMD_SOURCE_INIT( RicAddWellLogToPlotFeature, "RicAddWellLogToPlotFeature" ); bool RicAddWellLogToPlotFeature::isCommandEnabled() const { std::vector selection = selectedWellLogs(); - return selection.size() > 0; + return !selection.empty(); } //-------------------------------------------------------------------------------------------------- @@ -59,7 +59,7 @@ bool RicAddWellLogToPlotFeature::isCommandEnabled() const void RicAddWellLogToPlotFeature::onActionTriggered( bool isChecked ) { std::vector selection = selectedWellLogs(); - if ( selection.size() < 1 ) return; + if ( selection.empty() ) return; RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot(); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp index 70cdddaa8e..adcc733e7f 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp @@ -47,7 +47,7 @@ bool RicDeleteSubPlotFeature::isCommandEnabled() const std::vector selection; getSelection( selection ); - return ( selection.size() > 0 ); + return ( !selection.empty() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp index 4dc7b96b9b..6ed55777e2 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp @@ -140,7 +140,7 @@ void RicNewPltPlotFeature::setupActionLook( QAction* actionToSetup ) RimWellPath* RicNewPltPlotFeature::selectedWellPath() const { auto selection = caf::selectedObjectsByType(); - return selection.size() > 0 ? selection[0] : nullptr; + return !selection.empty() ? selection[0] : nullptr; } //-------------------------------------------------------------------------------------------------- @@ -160,7 +160,7 @@ RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell( int* branchIndex std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); ( *branchIndex ) = 0; - return selection.size() > 0 ? selection[0] : nullptr; + return !selection.empty() ? selection[0] : nullptr; } } diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.cpp index aa32d93bee..47bc5baed1 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.cpp @@ -84,5 +84,5 @@ RimWellLogPlot* RicNewWellLogPlotTrackFeature::selectedWellLogPlot() { std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - return selection.size() > 0 ? selection[0] : nullptr; + return !selection.empty() ? selection[0] : nullptr; } diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.cpp index 9e06e9cf43..fd30d93988 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.cpp @@ -48,7 +48,7 @@ bool RicPasteWellLogPlotFeature::isCommandEnabled() const return false; } - return RicPasteWellLogPlotFeature::plots().size() > 0; + return !RicPasteWellLogPlotFeature::plots().empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogTrackFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogTrackFeature.cpp index 811e2b99d5..822253f595 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogTrackFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogTrackFeature.cpp @@ -50,7 +50,7 @@ bool RicPasteWellLogTrackFeature::isCommandEnabled() const return false; } - return RicPasteWellLogTrackFeature::tracks().size() > 0; + return !RicPasteWellLogTrackFeature::tracks().empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicWellLogFileCloseFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicWellLogFileCloseFeature.cpp index 68ff9c6075..daf5eab195 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicWellLogFileCloseFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicWellLogFileCloseFeature.cpp @@ -41,7 +41,7 @@ CAF_CMD_SOURCE_INIT( RicWellLogFileCloseFeature, "RicWellLogFileCloseFeature" ); bool RicWellLogFileCloseFeature::isCommandEnabled() const { std::vector objects = caf::selectedObjectsByType(); - return objects.size() > 0; + return !objects.empty(); } //-------------------------------------------------------------------------------------------------- @@ -51,7 +51,7 @@ void RicWellLogFileCloseFeature::onActionTriggered( bool isChecked ) { std::vector objects = caf::selectedObjectsByType(); - if ( objects.size() == 0 ) return; + if ( objects.empty() ) return; for ( const auto& wellLogFile : objects ) { diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicWellLogsImportFileFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicWellLogsImportFileFeature.cpp index 914f0e2b2f..6c91362c94 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicWellLogsImportFileFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicWellLogsImportFileFeature.cpp @@ -74,7 +74,7 @@ void RicWellLogsImportFileFeature::onActionTriggered( bool isChecked ) QStringList wellLogFilePaths = RiuFileDialogTools::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(), "Import Well Logs", defaultDir, nameFilterString ); - if ( wellLogFilePaths.size() >= 1 ) + if ( !wellLogFilePaths.empty() ) { QStringList errorMessages; importWellLogFiles( wellLogFilePaths, &errorMessages ); diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp index c4d9bdac07..5326be8b8f 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp @@ -37,7 +37,7 @@ bool RicDeleteWellPathAttributeFeature::isCommandEnabled() const std::vector objects; caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL ); - if ( objects.size() > 0 ) + if ( !objects.empty() ) { return true; } @@ -60,7 +60,7 @@ void RicDeleteWellPathAttributeFeature::onActionTriggered( bool isChecked ) std::vector attributes; caf::SelectionManager::instance()->objectsByType( &attributes, caf::SelectionManager::FIRST_LEVEL ); RimWellPathAttributeCollection* wellPathAttributeCollection = nullptr; - if ( attributes.size() > 0 ) + if ( !attributes.empty() ) { wellPathAttributeCollection = attributes[0]->firstAncestorOrThisOfTypeAsserted(); for ( RimWellPathAttribute* attributeToDelete : attributes ) @@ -102,7 +102,7 @@ void RicDeleteWellPathAttributeFeature::setupActionLook( QAction* actionToSetup { std::vector attributes; caf::SelectionManager::instance()->objectsByType( &attributes, caf::SelectionManager::FIRST_LEVEL ); - if ( attributes.size() > 0 ) + if ( !attributes.empty() ) { actionToSetup->setText( "Delete Attribute" ); actionToSetup->setIcon( QIcon( ":/Erase.svg" ) ); diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.cpp index 18ffde9415..737d85fd8c 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.cpp @@ -46,7 +46,7 @@ void RicDeleteWellPathTargetFeature::onActionTriggered( bool isChecked ) std::vector targets; caf::SelectionManager::instance()->objectsByType( &targets, caf::SelectionManager::FIRST_LEVEL ); - if ( targets.size() > 0 ) + if ( !targets.empty() ) { RimWellPathGeometryDef* wellGeomDef = targets[0]->firstAncestorOrThisOfTypeAsserted(); diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicImportWellMeasurementsFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicImportWellMeasurementsFeature.cpp index 18cf167a93..01dfdd0d84 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicImportWellMeasurementsFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicImportWellMeasurementsFeature.cpp @@ -58,7 +58,7 @@ void RicImportWellMeasurementsFeature::onActionTriggered( bool isChecked ) defaultDir, "Well Measurements (*.csv);;All Files (*.*)" ); - if ( wellPathFilePaths.size() < 1 ) return; + if ( wellPathFilePaths.empty() ) return; // Remember the path to next time app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() ); diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp index c8ee3aa276..d33380e3c4 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp @@ -43,7 +43,7 @@ bool RicNewEditableWellPathFeature::isCommandEnabled() const std::vector objects; caf::SelectionManager::instance()->objectsByType( &objects ); - if ( objects.size() > 0 ) + if ( !objects.empty() ) { return true; } @@ -52,7 +52,7 @@ bool RicNewEditableWellPathFeature::isCommandEnabled() const std::vector objects; caf::SelectionManager::instance()->objectsByType( &objects ); - if ( objects.size() > 0 ) + if ( !objects.empty() ) { return true; } diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.cpp index f92693689a..c4dc11447e 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.cpp @@ -38,7 +38,7 @@ bool RicNewWellPathAttributeFeature::isCommandEnabled() const std::vector objects; caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL ); - if ( objects.size() > 0 ) + if ( !objects.empty() ) { return true; } diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.cpp index d77cd86a2a..2a91eb36e7 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.cpp @@ -37,7 +37,7 @@ bool RicNewWellPathListTargetFeature::isCommandEnabled() const std::vector objects; caf::SelectionManager::instance()->objectsByType( &objects ); - if ( objects.size() > 0 ) + if ( !objects.empty() ) { return true; } @@ -46,7 +46,7 @@ bool RicNewWellPathListTargetFeature::isCommandEnabled() const std::vector objects; caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL ); - if ( objects.size() > 0 ) + if ( !objects.empty() ) { return true; } @@ -62,7 +62,7 @@ void RicNewWellPathListTargetFeature::onActionTriggered( bool isChecked ) { std::vector selectedTargets; caf::SelectionManager::instance()->objectsByType( &selectedTargets, caf::SelectionManager::FIRST_LEVEL ); - if ( selectedTargets.size() > 0 ) + if ( !selectedTargets.empty() ) { RimWellPathTarget* firstTarget = selectedTargets.front(); RimWellPathGeometryDef* wellGeomDef = firstTarget->firstAncestorOrThisOfTypeAsserted(); @@ -135,7 +135,7 @@ void RicNewWellPathListTargetFeature::onActionTriggered( bool isChecked ) std::vector geomDefs; caf::SelectionManager::instance()->objectsByType( &geomDefs ); - if ( geomDefs.size() > 0 ) + if ( !geomDefs.empty() ) { RimWellPathGeometryDef* wellGeomDef = geomDefs[0]; std::vector activeTargets = wellGeomDef->activeWellTargets(); @@ -179,7 +179,7 @@ void RicNewWellPathListTargetFeature::setupActionLook( QAction* actionToSetup ) std::vector selectedTargets; caf::SelectionManager::instance()->objectsByType( &selectedTargets, caf::SelectionManager::FIRST_LEVEL ); - if ( selectedTargets.size() > 0 ) + if ( !selectedTargets.empty() ) { auto firstTarget = selectedTargets.front(); RimWellPathGeometryDef* wellGeomDef = firstTarget->firstAncestorOrThisOfTypeAsserted(); diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.cpp index d3c3c8832e..2d6b935970 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.cpp @@ -47,7 +47,7 @@ bool RicPasteModeledWellPathFeature::isCommandEnabled() const std::vector objects; caf::SelectionManager::instance()->objectsByType( &objects ); - if ( objects.size() > 0 ) + if ( !objects.empty() ) { return true; } diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicWellPathFormationsImportFileFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicWellPathFormationsImportFileFeature.cpp index 3c5b5ad614..2f6235bd64 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicWellPathFormationsImportFileFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicWellPathFormationsImportFileFeature.cpp @@ -47,7 +47,7 @@ void RicWellPathFormationsImportFileFeature::onActionTriggered( bool isChecked ) defaultDir, "Well Picks (*.csv);;All Files (*.*)" ); - if ( wellPathFormationsFilePaths.size() < 1 ) return; + if ( wellPathFormationsFilePaths.empty() ) return; // Remember the path to next time app->setLastUsedDialogDirectory( "WELLPATHFORMATIONS_DIR", QFileInfo( wellPathFormationsFilePaths.last() ).absolutePath() ); @@ -65,7 +65,7 @@ void RicWellPathFormationsImportFileFeature::onActionTriggered( bool isChecked ) if ( !oilField ) return; - if ( oilField->wellPathCollection->allWellPaths().size() > 0 ) + if ( !oilField->wellPathCollection->allWellPaths().empty() ) { RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath(); if ( wellPath ) diff --git a/ApplicationLibCode/FileInterface/RifColorLegendData.cpp b/ApplicationLibCode/FileInterface/RifColorLegendData.cpp index a83319a740..6e3d4d24aa 100644 --- a/ApplicationLibCode/FileInterface/RifColorLegendData.cpp +++ b/ApplicationLibCode/FileInterface/RifColorLegendData.cpp @@ -69,7 +69,7 @@ cvf::ref RifColorLegendData::readLyrFormationNameFile( const QString line = stream.readLine(); QStringList lineSegs = line.split( "'" ); - if ( lineSegs.size() == 0 ) continue; // Empty line + if ( lineSegs.empty() ) continue; // Empty line if ( lineSegs.size() == 1 ) continue; // No name present. Comment line ? if ( lineSegs.size() == 2 ) { diff --git a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp index 83dc8c0115..8a5656339d 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -514,7 +514,7 @@ cvf::ref RifEclipseOutputFileTools::createDynamicRe { // Look for set of restart files (one file per time step) QStringList restartFiles = RifEclipseOutputFileTools::filterFileNamesOfType( filesWithSameBaseName, ECL_RESTART_FILE ); - if ( restartFiles.size() > 0 ) + if ( !restartFiles.empty() ) { resultsAccess = new RifEclipseRestartFilesetAccess(); resultsAccess->setRestartFiles( restartFiles ); diff --git a/ApplicationLibCode/FileInterface/RifEclipseRestartFilesetAccess.cpp b/ApplicationLibCode/FileInterface/RifEclipseRestartFilesetAccess.cpp index 059b176ac5..23355bfdc5 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseRestartFilesetAccess.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseRestartFilesetAccess.cpp @@ -57,7 +57,7 @@ RifEclipseRestartFilesetAccess::~RifEclipseRestartFilesetAccess() //-------------------------------------------------------------------------------------------------- bool RifEclipseRestartFilesetAccess::open() { - if ( m_fileNames.size() > 0 ) + if ( !m_fileNames.empty() ) { caf::ProgressInfo progInfo( m_fileNames.size(), "" ); @@ -124,7 +124,7 @@ size_t RifEclipseRestartFilesetAccess::timeStepCount() //-------------------------------------------------------------------------------------------------- void RifEclipseRestartFilesetAccess::timeSteps( std::vector* timeSteps, std::vector* daysSinceSimulationStart ) { - if ( m_timeSteps.size() == 0 ) + if ( m_timeSteps.empty() ) { size_t numSteps = m_fileNames.size(); size_t i; @@ -314,7 +314,7 @@ int RifEclipseRestartFilesetAccess::readUnitsType() { ecl_file_type* ecl_file = nullptr; - if ( m_ecl_files.size() > 0 ) + if ( !m_ecl_files.empty() ) { openTimeStep( 0 ); ecl_file = m_ecl_files[0]; diff --git a/ApplicationLibCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp b/ApplicationLibCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp index a6b2644be3..406cd9dd6c 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp @@ -198,7 +198,7 @@ void RifEclipseUnifiedRestartFileAccess::close() //-------------------------------------------------------------------------------------------------- size_t RifEclipseUnifiedRestartFileAccess::timeStepCount() { - if ( m_timeSteps.size() == 0 ) + if ( m_timeSteps.empty() ) { extractTimestepsFromEclipse(); } @@ -211,7 +211,7 @@ size_t RifEclipseUnifiedRestartFileAccess::timeStepCount() //-------------------------------------------------------------------------------------------------- void RifEclipseUnifiedRestartFileAccess::timeSteps( std::vector* timeSteps, std::vector* daysSinceSimulationStart ) { - if ( m_timeSteps.size() == 0 ) + if ( m_timeSteps.empty() ) { extractTimestepsFromEclipse(); } @@ -354,7 +354,7 @@ void RifEclipseUnifiedRestartFileAccess::updateFromGridCount( size_t gridCount ) //-------------------------------------------------------------------------------------------------- std::vector RifEclipseUnifiedRestartFileAccess::reportNumbers() { - if ( m_timeSteps.size() == 0 ) + if ( m_timeSteps.empty() ) { extractTimestepsFromEclipse(); } diff --git a/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp index c9f43e425d..9f2ea1a74f 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp @@ -194,7 +194,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con break; case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_AQUIFER: { - if ( columnHeaderText.size() > 0 ) + if ( !columnHeaderText.empty() ) { aquiferNumber = RiaStdStringTools::toInt( columnHeaderText[0] ); } @@ -206,7 +206,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con break; case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_REGION: { - if ( columnHeaderText.size() > 0 ) + if ( !columnHeaderText.empty() ) { regionNumber = RiaStdStringTools::toInt( columnHeaderText[0] ); } @@ -216,7 +216,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con break; case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_GROUP: { - if ( columnHeaderText.size() > 0 ) + if ( !columnHeaderText.empty() ) { groupName = columnHeaderText[0]; } @@ -224,7 +224,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con } case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL: { - if ( columnHeaderText.size() > 0 ) + if ( !columnHeaderText.empty() ) { wellName = columnHeaderText[0]; } @@ -265,7 +265,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con } break; case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_BLOCK: - if ( columnHeaderText.size() > 0 ) + if ( !columnHeaderText.empty() ) { RifEclipseUserDataKeywordTools::extractThreeInts( &cellI, &cellJ, &cellK, columnHeaderText[0] ); } diff --git a/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.cpp index b74020ee82..af6cd040f3 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.cpp @@ -333,7 +333,7 @@ TableData RifEclipseUserDataParserTools::tableDataFromText( std::stringstream& s else { std::vector words = splitLineAndRemoveComments( firstLine ); - if ( words.size() > 0 ) + if ( !words.empty() ) { allHeaderRows.push_back( words ); } @@ -364,7 +364,7 @@ TableData RifEclipseUserDataParserTools::tableDataFromText( std::stringstream& s if ( rowWords.size() == columnCount ) { - if ( unitNames.size() == 0 ) + if ( unitNames.empty() ) { for ( const std::string& word : rowWords ) { @@ -376,7 +376,7 @@ TableData RifEclipseUserDataParserTools::tableDataFromText( std::stringstream& s } } - if ( scaleFactors.size() == 0 ) + if ( scaleFactors.empty() ) { std::vector values; @@ -408,7 +408,7 @@ TableData RifEclipseUserDataParserTools::tableDataFromText( std::stringstream& s std::vector parserErrors; std::vector> tableHeaderText = RifEclipseUserDataKeywordTools::buildColumnHeaderText( quantityNames, headerRows, &parserErrors ); - if ( parserErrors.size() > 0 ) + if ( !parserErrors.empty() ) { if ( errorText ) errorText->insert( errorText->end(), parserErrors.begin(), parserErrors.end() ); @@ -419,7 +419,7 @@ TableData RifEclipseUserDataParserTools::tableDataFromText( std::stringstream& s for ( size_t i = 0; i < tableHeaderText.size(); i++ ) { auto columnText = tableHeaderText[i]; - if ( columnText.size() == 0 ) + if ( columnText.empty() ) { if ( errorText ) errorText->push_back( "Detected column with no content" ); continue; @@ -586,11 +586,11 @@ std::vector> RifEclipseUserDataParserTools::splitIntoCo { std::vector> headerLinesPerColumn; - if ( headerLines.size() > 0 ) + if ( !headerLines.empty() ) { std::vector columnOffsets = RifEclipseUserDataParserTools::columnIndexForWords( headerLines[0] ); - if ( columnOffsets.size() > 0 ) + if ( !columnOffsets.empty() ) { headerLinesPerColumn.resize( columnOffsets.size() ); @@ -655,7 +655,7 @@ std::vector RifEclipseUserDataParserTools::columnInfoFromColumnHeaders( for ( auto columnLines : columnData ) { - if ( columnLines.size() == 0 ) continue; + if ( columnLines.empty() ) continue; std::string vectorName = columnLines[0]; std::string unit; @@ -721,7 +721,7 @@ std::vector RifEclipseUserDataParserTools::mergeEqualTimeSteps( const return tables; } - if ( tables[0].columnInfos().size() == 0 ) return tables; + if ( tables[0].columnInfos().empty() ) return tables; QDateTime firstTableStartTime; for ( auto c : tables[0].columnInfos() ) @@ -771,7 +771,7 @@ std::vector RifEclipseUserDataParserTools::mergeEqualTimeSteps( const } } - if ( tables[i].columnInfos().size() > 0 && tables[i].columnInfos()[0].itemCount() == itemsInFirstTable && isDatesEqual ) + if ( !tables[i].columnInfos().empty() && tables[i].columnInfos()[0].itemCount() == itemsInFirstTable && isDatesEqual ) { for ( auto& c : tables[i].columnInfos() ) { @@ -796,7 +796,7 @@ std::vector RifEclipseUserDataParserTools::mergeEqualTimeSteps( const std::string RifEclipseUserDataParserTools::trimString( const std::string& s ) { auto sCopy = s.substr( 0, s.find_last_not_of( ' ' ) + 1 ); - if ( sCopy.size() > 0 ) + if ( !sCopy.empty() ) { sCopy = sCopy.substr( sCopy.find_first_not_of( ' ' ) ); } diff --git a/ApplicationLibCode/FileInterface/RifElementPropertyTableReader.cpp b/ApplicationLibCode/FileInterface/RifElementPropertyTableReader.cpp index ddeec76068..771190a7b6 100644 --- a/ApplicationLibCode/FileInterface/RifElementPropertyTableReader.cpp +++ b/ApplicationLibCode/FileInterface/RifElementPropertyTableReader.cpp @@ -124,7 +124,7 @@ void RifElementPropertyTableReader::readData( const RifElementPropertyMetadata* QString line = stream.readLine(); if ( !line.startsWith( "*" ) ) { - if ( collectedCols.size() > 0 && collectedCols.size() != 8 ) + if ( !collectedCols.empty() && collectedCols.size() != 8 ) { if ( dataBlockFound ) { diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp index ec2f49fb2e..580277ba93 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp @@ -613,7 +613,7 @@ const size_t* RifReaderEclipseOutput::eclipseCellIndexMapping() //-------------------------------------------------------------------------------------------------- void RifReaderEclipseOutput::importFaults( const QStringList& fileSet, cvf::Collection* faults ) { - if ( filenamesWithFaults().size() > 0 ) + if ( !filenamesWithFaults().empty() ) { for ( size_t i = 0; i < filenamesWithFaults().size(); i++ ) { @@ -833,7 +833,7 @@ bool RifReaderEclipseOutput::readActiveCellInfo() void RifReaderEclipseOutput::buildMetaData( ecl_grid_type* grid ) { CVF_ASSERT( m_eclipseCase ); - CVF_ASSERT( m_filesWithSameBaseName.size() > 0 ); + CVF_ASSERT( !m_filesWithSameBaseName.empty() ); caf::ProgressInfo progInfo( m_filesWithSameBaseName.size() + 3, "" ); diff --git a/ApplicationLibCode/FileInterface/RifWellPathImporter.cpp b/ApplicationLibCode/FileInterface/RifWellPathImporter.cpp index a165f3a1df..16dc02d8e5 100644 --- a/ApplicationLibCode/FileInterface/RifWellPathImporter.cpp +++ b/ApplicationLibCode/FileInterface/RifWellPathImporter.cpp @@ -206,7 +206,7 @@ void RifWellPathImporter::readAllAsciiWellData( const QString& filePath ) if ( x != HUGE_VAL && y != HUGE_VAL && tvd != HUGE_VAL && md != HUGE_VAL ) { - if ( !fileWellDataArray.size() ) + if ( fileWellDataArray.empty() ) { fileWellDataArray.push_back( RifWellPathImporter::WellData() ); fileWellDataArray.back().m_wellPathGeometry = new RigWellPath(); @@ -305,7 +305,7 @@ void RifWellPathImporter::readAllAsciiWellData( const QString& filePath ) { // Create a new Well data if we have read some data into the previous one. // if not, just overwrite the name - if ( hasReadWellPointInCurrentWell || fileWellDataArray.size() == 0 ) + if ( hasReadWellPointInCurrentWell || fileWellDataArray.empty() ) { fileWellDataArray.push_back( RifWellPathImporter::WellData() ); fileWellDataArray.back().m_wellPathGeometry = new RigWellPath(); diff --git a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPart.cpp b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPart.cpp index ebe1038bd9..0e44fd634d 100644 --- a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPart.cpp +++ b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPart.cpp @@ -356,7 +356,7 @@ void RigFemPart::calculateElmNeighbors() } } - if ( candidates.size() ) + if ( !candidates.empty() ) { fComp.setMainFace( elmNodes, localFaceIndices, faceNodeCount ); } diff --git a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartCollection.cpp b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartCollection.cpp index d4d1c1e9c3..6a932d88c9 100644 --- a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartCollection.cpp +++ b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartCollection.cpp @@ -42,7 +42,7 @@ void RigFemPartCollection::addFemPart( RigFemPart* part ) size_t globalElementOffset = 0; size_t globalNodeOffset = 0; size_t globalConnectivityOffset = 0; - if ( m_femParts.size() > 0 ) + if ( !m_femParts.empty() ) { size_t lastIndex = m_femParts.size() - 1; globalElementOffset += m_femParts[lastIndex]->elementCount(); diff --git a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp index 96e852d228..278078cc6c 100644 --- a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp +++ b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp @@ -911,7 +911,7 @@ std::vector RigFemPartResultsCollection::getResAddrToCompon if ( compNames.empty() ) // This is a scalar field. Add one component named "" { - CVF_ASSERT( resVarAddr.componentName == "" ); + CVF_ASSERT( resVarAddr.componentName.empty() ); resAddressToComponents.push_back( resVarAddr ); } } diff --git a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemResultAddress.h b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemResultAddress.h index 29eed74d8c..c920c4d004 100644 --- a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemResultAddress.h +++ b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemResultAddress.h @@ -102,7 +102,7 @@ class RigFemResultAddress bool isTypeValid = resultPosType == RIG_NODAL || resultPosType == RIG_ELEMENT_NODAL || resultPosType == RIG_INTEGRATION_POINT || resultPosType == RIG_ELEMENT_NODAL_FACE || resultPosType == RIG_FORMATION_NAMES || resultPosType == RIG_ELEMENT || resultPosType == RIG_DIFFERENTIALS; - bool isFieldValid = fieldName != ""; + bool isFieldValid = !fieldName.empty(); return isTypeValid && isFieldValid; } diff --git a/ApplicationLibCode/GeoMech/GeoMechVisualization/RivFemElmVisibilityCalculator.cpp b/ApplicationLibCode/GeoMech/GeoMechVisualization/RivFemElmVisibilityCalculator.cpp index 266b95b4e8..ece33dd2d1 100644 --- a/ApplicationLibCode/GeoMech/GeoMechVisualization/RivFemElmVisibilityCalculator.cpp +++ b/ApplicationLibCode/GeoMech/GeoMechVisualization/RivFemElmVisibilityCalculator.cpp @@ -153,7 +153,7 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility( cvf::UByteArray* if ( !propertyFilter->isActive() ) continue; if ( !propertyFilter->resultDefinition->hasResult() ) continue; - if ( resVals.size() == 0 ) continue; + if ( resVals.empty() ) continue; const double lowerBound = propertyFilter->lowerBound(); const double upperBound = propertyFilter->upperBound(); diff --git a/ApplicationLibCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp b/ApplicationLibCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp index e87533b364..45053a4c3c 100644 --- a/ApplicationLibCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp +++ b/ApplicationLibCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp @@ -317,7 +317,7 @@ void RivFemPartPartMgr::updateCellResultColor( int timeStepIndex, int frameIndex vxCount = static_cast( vxToResultMapping->size() ); m_surfaceFacesTextureCoords->resize( vxCount ); - if ( resultValues.size() == 0 ) + if ( resultValues.empty() ) { m_surfaceFacesTextureCoords->setAll( cvf::Vec2f( 0.0, 1.0f ) ); } diff --git a/ApplicationLibCode/GeoMech/OdbReader/RifOdbReader.cpp b/ApplicationLibCode/GeoMech/OdbReader/RifOdbReader.cpp index 1b7ba02356..02a5a853b1 100644 --- a/ApplicationLibCode/GeoMech/OdbReader/RifOdbReader.cpp +++ b/ApplicationLibCode/GeoMech/OdbReader/RifOdbReader.cpp @@ -71,7 +71,7 @@ class RifOdbBulkDataGetter } else if ( precision == odb_Enum::DOUBLE_PRECISION ) { - if ( m_data.size() < 1 ) + if ( m_data.empty() ) { int dataSize = m_bulkData.length() * m_bulkData.width(); m_data.resize( dataSize ); @@ -720,7 +720,7 @@ size_t RifOdbReader::resultItemCount( const std::string& fieldName, int partInde size_t RifOdbReader::componentsCount( const std::string& fieldName, ResultPosition position ) { std::vector compNames = componentNames( RifOdbResultKey( position, fieldName ) ); - return compNames.size() > 0 ? compNames.size() : 1; + return !compNames.empty() ? compNames.size() : 1; } //-------------------------------------------------------------------------------------------------- @@ -898,7 +898,7 @@ void RifOdbReader::readElementNodeField( const std::string& field const odb_SequenceFieldBulkData& seqFieldBulkData = fieldOutput.bulkDataBlocks(); std::map& elementIdToIdxMap = m_elementIdToIdxMaps[partIndex]; - CVF_ASSERT( elementIdToIdxMap.size() > 0 ); + CVF_ASSERT( !elementIdToIdxMap.empty() ); int numBlocks = seqFieldBulkData.size(); for ( int block = 0; block < numBlocks; block++ ) @@ -970,7 +970,7 @@ void RifOdbReader::readIntegrationPointField( const std::string& const odb_SequenceFieldBulkData& seqFieldBulkData = fieldOutput.bulkDataBlocks(); std::map& elementIdToIdxMap = m_elementIdToIdxMaps[partIndex]; - CVF_ASSERT( elementIdToIdxMap.size() > 0 ); + CVF_ASSERT( !elementIdToIdxMap.empty() ); int numBlocks = seqFieldBulkData.size(); for ( int block = 0; block < numBlocks; block++ ) diff --git a/ApplicationLibCode/ModelVisualization/GridBox/RivGridBoxGenerator.cpp b/ApplicationLibCode/ModelVisualization/GridBox/RivGridBoxGenerator.cpp index 48ea7c6359..2e00e5d351 100644 --- a/ApplicationLibCode/ModelVisualization/GridBox/RivGridBoxGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/GridBox/RivGridBoxGenerator.cpp @@ -364,9 +364,9 @@ void RivGridBoxGenerator::createGridBoxFaceParts() m_gridBoxFaceParts.clear(); CVF_ASSERT( m_displayCoordsBoundingBox.isValid() ); - CVF_ASSERT( m_displayCoordsXValues.size() > 0 ); - CVF_ASSERT( m_displayCoordsYValues.size() > 0 ); - CVF_ASSERT( m_displayCoordsZValues.size() > 0 ); + CVF_ASSERT( !m_displayCoordsXValues.empty() ); + CVF_ASSERT( !m_displayCoordsYValues.empty() ); + CVF_ASSERT( !m_displayCoordsZValues.empty() ); cvf::Vec3d min = m_displayCoordsBoundingBox.min(); cvf::Vec3d max = m_displayCoordsBoundingBox.max(); @@ -456,9 +456,9 @@ void RivGridBoxGenerator::createGridBoxLegendParts() m_gridBoxLegendParts.clear(); CVF_ASSERT( m_displayCoordsBoundingBox.isValid() ); - CVF_ASSERT( m_displayCoordsXValues.size() > 0 ); - CVF_ASSERT( m_displayCoordsYValues.size() > 0 ); - CVF_ASSERT( m_displayCoordsZValues.size() > 0 ); + CVF_ASSERT( !m_displayCoordsXValues.empty() ); + CVF_ASSERT( !m_displayCoordsYValues.empty() ); + CVF_ASSERT( !m_displayCoordsZValues.empty() ); for ( int edge = POS_Z_POS_X; edge <= NEG_X_NEG_Y; edge++ ) { diff --git a/ApplicationLibCode/ModelVisualization/GridBox/RivPatchGenerator.cpp b/ApplicationLibCode/ModelVisualization/GridBox/RivPatchGenerator.cpp index 7b8fe0aaf9..789f73efac 100644 --- a/ApplicationLibCode/ModelVisualization/GridBox/RivPatchGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/GridBox/RivPatchGenerator.cpp @@ -67,8 +67,8 @@ void RivPatchGenerator::setSubdivisions( const std::vector& uValues, con //-------------------------------------------------------------------------------------------------- void RivPatchGenerator::generate( cvf::GeometryBuilder* builder ) { - CVF_ASSERT( m_uValues.size() > 0 ); - CVF_ASSERT( m_vValues.size() > 0 ); + CVF_ASSERT( !m_uValues.empty() ); + CVF_ASSERT( !m_vValues.empty() ); size_t numVertices = m_uValues.size() * m_vValues.size(); diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivIntersectionResultsColoringTools.cpp b/ApplicationLibCode/ModelVisualization/Intersections/RivIntersectionResultsColoringTools.cpp index f2ba79035a..87ca5b5f19 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivIntersectionResultsColoringTools.cpp +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivIntersectionResultsColoringTools.cpp @@ -368,7 +368,7 @@ void RivIntersectionResultsColoringTools::calculateElementBasedGeoMechTextureCoo { textureCoords->resize( triangleToCellIdx.size() * 3 ); - if ( resultValues.size() == 0 ) + if ( resultValues.empty() ) { textureCoords->setAll( cvf::Vec2f( 0.0, 1.0f ) ); } diff --git a/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp index 6b8076f322..3761b700eb 100644 --- a/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp @@ -302,7 +302,7 @@ std::vector>> lineBBox.add( displayVertex2 ); bool addOriginalSegment = true; - if ( labelBBoxes.size() > 0 ) + if ( !labelBBoxes.empty() ) { for ( const cvf::BoundingBox& existingBBox : labelBBoxes[i] ) { diff --git a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp index 4d9bab31bf..7fe212b818 100644 --- a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp @@ -268,7 +268,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode for ( int nIdx = 0; nIdx < static_cast( nncData->eclipseConnectionCount() ); ++nIdx ) { const RigConnection& conn = nncData->availableConnections()[nIdx]; - if ( conn.polygon().size() ) + if ( !conn.polygon().empty() ) { double resultValue = 0.0; for ( size_t flIdx = 0; flIdx < nncResultVals.size(); flIdx++ ) diff --git a/ApplicationLibCode/ModelVisualization/RivFishbonesSubsPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivFishbonesSubsPartMgr.cpp index b6bdb8646a..fc7582cc5d 100644 --- a/ApplicationLibCode/ModelVisualization/RivFishbonesSubsPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivFishbonesSubsPartMgr.cpp @@ -60,7 +60,7 @@ void RivFishbonesSubsPartMgr::appendGeometryPartsToModel( cvf::ModelBasicList* if ( !m_rimFishbonesSubs->isActive() ) return; - if ( m_parts.size() == 0 ) + if ( m_parts.empty() ) { buildParts( displayCoordTransform, characteristicCellSize ); } diff --git a/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp index 81be1ed747..8dd25a6999 100644 --- a/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp @@ -96,7 +96,7 @@ void RivNNCGeometryGenerator::computeArrays() const RigConnection& conn = m_nncData->allConnections()[conIdx]; - if ( conn.polygon().size() ) + if ( !conn.polygon().empty() ) { bool isVisible = true; if ( isVisibilityCalcActive ) @@ -176,7 +176,7 @@ void RivNNCGeometryGenerator::textureCoordinates( cvf::Vec2fArray* nncResultVals = m_nncData->generatedConnectionScalarResult( resVarAddr, nativeTimeStepIndex ); } - if ( !nncResultVals || nncResultVals->size() == 0 ) + if ( !nncResultVals || nncResultVals->empty() ) { textureCoords->setAll( cvf::Vec2f( 0.0f, 1.0f ) ); return; diff --git a/ApplicationLibCode/ModelVisualization/RivPolylinePartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivPolylinePartMgr.cpp index 651c1ef39d..12ba78f953 100644 --- a/ApplicationLibCode/ModelVisualization/RivPolylinePartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivPolylinePartMgr.cpp @@ -82,7 +82,7 @@ bool RivPolylinePartMgr::isPolylinesInBoundingBox( std::vectorpolyLinesData(); - if ( polylineDef.isNull() || polylineDef->polyLines().size() == 0 ) + if ( polylineDef.isNull() || polylineDef->polyLines().empty() ) { clearAllGeometry(); return; diff --git a/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp index 8ed6dd9c9b..45f8ce0b3a 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp @@ -1141,8 +1141,8 @@ std::vector RivWellFracturePartMgr::transformToFractureDisplayCoords cvf::ref RivWellFracturePartMgr::buildDrawableGeoFromTriangles( const std::vector& triangleIndices, const std::vector& nodeCoords ) { - CVF_ASSERT( triangleIndices.size() > 0 ); - CVF_ASSERT( nodeCoords.size() > 0 ); + CVF_ASSERT( !triangleIndices.empty() ); + CVF_ASSERT( !nodeCoords.empty() ); cvf::ref geo = new cvf::DrawableGeo; diff --git a/ApplicationLibCode/ModelVisualization/WindowEdgeAxesOverlayItem/RivWindowEdgeAxesOverlayItem.cpp b/ApplicationLibCode/ModelVisualization/WindowEdgeAxesOverlayItem/RivWindowEdgeAxesOverlayItem.cpp index c10056d89f..02e15ba76a 100644 --- a/ApplicationLibCode/ModelVisualization/WindowEdgeAxesOverlayItem/RivWindowEdgeAxesOverlayItem.cpp +++ b/ApplicationLibCode/ModelVisualization/WindowEdgeAxesOverlayItem/RivWindowEdgeAxesOverlayItem.cpp @@ -249,7 +249,7 @@ bool RivWindowEdgeAxesOverlayItem::pick( int oglXCoord, int oglYCoord, const Vec //-------------------------------------------------------------------------------------------------- void RivWindowEdgeAxesOverlayItem::renderGeneric( OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software ) { - if ( size.x() <= 0 || size.y() <= 0 || ( m_windowTickXValues.size() == 0 && m_windowTickYValues.size() == 0 ) ) + if ( size.x() <= 0 || size.y() <= 0 || ( m_windowTickXValues.empty() && m_windowTickYValues.empty() ) ) { return; } diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index 4febca849a..464c2806aa 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -346,7 +346,7 @@ void RimAnalysisPlot::maxMinValueFromAddress( const RifEclipseSummaryAddress& const std::vector& timesteps = reader->timeSteps( address ); - if ( timesteps.size() && values.size() ) + if ( !timesteps.empty() && !values.empty() ) { if ( timeStepSourceType == RimPlotDataFilterItem::LAST_TIMESTEP ) { @@ -392,13 +392,13 @@ void RimAnalysisPlot::maxMinValueFromAddress( const RifEclipseSummaryAddress& if ( !historyAddr.isHistoryVector() ) historyAddr.setVectorName( address.vectorName() + "H" ); const std::vector& historyTimesteps = reader->timeSteps( historyAddr ); - if ( historyTimesteps.size() ) + if ( !historyTimesteps.empty() ) { min = minOrAbsMin( min, values[historyTimesteps.size() - 1] ); max = maxOrAbsMax( max, values[historyTimesteps.size() - 1] ); } } - else if ( selectedTimesteps.size() ) + else if ( !selectedTimesteps.empty() ) { std::vector selectedTimestepIndices = RimAnalysisPlot::findTimestepIndices( selectedTimesteps, timesteps ); @@ -1187,7 +1187,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter, storeResultCoreLambda( value ); } } - else if ( timesteps.size() ) + else if ( !timesteps.empty() ) { std::vector selectedTimestepIndices; @@ -1200,7 +1200,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter, size_t timeStepIdx = timesteps.size() - 1; selectedTimestepIndices.push_back( timeStepIdx ); } - else if ( selectedTimesteps.size() ) + else if ( !selectedTimesteps.empty() ) { selectedTimestepIndices = RimAnalysisPlot::findTimestepIndices( selectedTimesteps, timesteps ); } @@ -1211,7 +1211,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter, if ( !historyAddr.isHistoryVector() ) historyAddr.setVectorName( addrToFilterValue.vectorName() + "H" ); std::vector historyTimesteps = reader->timeSteps( historyAddr ); - if ( historyTimesteps.size() ) + if ( !historyTimesteps.empty() ) { selectedTimestepIndices = RimAnalysisPlot::findTimestepIndices( { historyTimesteps.back() }, timesteps ); } @@ -1448,7 +1448,7 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui reader->values( curveDef.summaryAddressY(), &values ); } - if ( !( timeSteps.size() && values.size() ) ) continue; + if ( !( !timeSteps.empty() && !values.empty() ) ) continue; // Find selected timestep indices diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp index 8e4525d625..81b42cb9d2 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp @@ -68,7 +68,7 @@ RimCellFilterCollection::~RimCellFilterCollection() //-------------------------------------------------------------------------------------------------- bool RimCellFilterCollection::isEmpty() const { - return m_cellFilters.size() > 0; + return !m_cellFilters.empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterIntervalTool.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterIntervalTool.cpp index afac7eee03..f82ed7f8ad 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterIntervalTool.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterIntervalTool.cpp @@ -82,7 +82,7 @@ RimCellFilterIntervalTool::~RimCellFilterIntervalTool() //-------------------------------------------------------------------------------------------------- bool RimCellFilterIntervalTool::isNumberIncluded( size_t number ) const { - if ( m_intervals.size() == 0 ) return m_includeAllByDefault; + if ( m_intervals.empty() ) return m_includeAllByDefault; number = number + 1; diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellIndexFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellIndexFilter.cpp index 0ec002fe0c..4169132718 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellIndexFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellIndexFilter.cpp @@ -68,7 +68,7 @@ void RimCellIndexFilter::updateCellIndexFilter( cvf::UByteArray* includeVisibili { if ( gridIndex != m_gridIndex() ) return; - if ( m_cells.size() == 0 ) + if ( m_cells.empty() ) { updateCells(); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp index 7caa700273..c325b89c6f 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp @@ -208,7 +208,7 @@ void RimSimWellFracture::updateFracturePositionFromLocation() { computeSimWellBranchesIfRequired(); - if ( m_branchCenterLines.size() > 0 ) + if ( !m_branchCenterLines.empty() ) { cvf::Vec3d interpolated = m_branchCenterLines[m_branchIndex()].interpolatedPointAlongWellPath( m_location() ); @@ -266,7 +266,7 @@ void RimSimWellFracture::defineEditorAttribute( const caf::PdmFieldHandle* field { computeSimWellBranchesIfRequired(); - if ( m_branchCenterLines.size() > 0 ) + if ( !m_branchCenterLines.empty() ) { const RigSimulationWellCoordsAndMD& pointAndMd = m_branchCenterLines[m_branchIndex]; @@ -287,12 +287,12 @@ QList RimSimWellFracture::calculateValueOptions( const c if ( fieldNeedingOptions == &m_branchIndex ) { - if ( m_branchCenterLines.size() == 0 ) + if ( m_branchCenterLines.empty() ) { computeSimWellBranchesIfRequired(); } - if ( m_branchCenterLines.size() > 0 ) + if ( !m_branchCenterLines.empty() ) { size_t branchCount = m_branchCenterLines.size(); @@ -324,7 +324,7 @@ RigMainGrid* RimSimWellFracture::ownerCaseMainGrid() const //-------------------------------------------------------------------------------------------------- void RimSimWellFracture::computeSimWellBranchesIfRequired() { - if ( m_branchCenterLines.size() == 0 ) + if ( m_branchCenterLines.empty() ) { computeSimWellBranchCenterLines(); } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationOverTimePlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationOverTimePlot.cpp index f613bcec41..2b1dee8e0e 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationOverTimePlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationOverTimePlot.cpp @@ -641,7 +641,7 @@ void RimWellAllocationOverTimePlot::fieldChangedByUi( const caf::PdmFieldHandle* } std::set sortedWellNames = findSortedWellNames(); - if ( !sortedWellNames.size() ) + if ( sortedWellNames.empty() ) m_wellName = ""; else if ( sortedWellNames.count( m_wellName() ) == 0 ) { @@ -709,7 +709,7 @@ QList RimWellAllocationOverTimePlot::calculateValueOptio { options.push_back( caf::PdmOptionItemInfo( name, name, false, simWellIcon ) ); } - if ( options.size() == 0 ) + if ( options.empty() ) { options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) ); } @@ -810,7 +810,7 @@ QString RimWellAllocationOverTimePlot::dateFormatString() const //-------------------------------------------------------------------------------------------------- void RimWellAllocationOverTimePlot::setValidTimeStepRangeForCase() { - if ( m_case == nullptr || m_case->timeStepDates().size() == 0 ) + if ( m_case == nullptr || m_case->timeStepDates().empty() ) { return; } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index a44e9c72be..95c6b8a33c 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -639,7 +639,7 @@ QList RimWellAllocationPlot::calculateValueOptions( cons options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) ); } - if ( options.size() == 0 ) + if ( options.empty() ) { options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) ); } @@ -648,7 +648,7 @@ QList RimWellAllocationPlot::calculateValueOptions( cons { RimTools::timeStepsForCase( m_case, &options ); - if ( options.size() == 0 ) + if ( options.empty() ) { options.push_front( caf::PdmOptionItemInfo( "None", -1 ) ); } @@ -755,7 +755,7 @@ void RimWellAllocationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changed } std::set sortedWellNames = findSortedWellNames(); - if ( !sortedWellNames.size() ) + if ( sortedWellNames.empty() ) m_wellName = ""; else if ( sortedWellNames.count( m_wellName() ) == 0 ) { diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp index f1d3c8d7c1..6060151728 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp @@ -380,7 +380,7 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellD plotWidget->setAxisAutoScale( RiuPlotAxis::defaultLeft(), true ); const std::vector& tofValuesDays = calculator.sortedUniqueTofValues(); - if ( tofValuesDays.size() == 0 ) + if ( tofValuesDays.empty() ) { // cvf::Trace::show("No TOF values!"); return; @@ -467,7 +467,7 @@ QList RimWellDistributionPlot::calculateValueOptions( co { RimTools::timeStepsForCase( m_case, &options ); - if ( options.size() == 0 ) + if ( options.empty() ) { options.push_back( caf::PdmOptionItemInfo( "None", -1 ) ); } @@ -485,7 +485,7 @@ QList RimWellDistributionPlot::calculateValueOptions( co } } - if ( options.size() == 0 ) + if ( options.empty() ) { options.push_back( caf::PdmOptionItemInfo( "None", QVariant() ) ); } @@ -526,7 +526,7 @@ void RimWellDistributionPlot::fixupDependentFieldsAfterCaseChange() } const std::set sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames(); - if ( sortedWellNameSet.size() > 0 ) + if ( !sortedWellNameSet.empty() ) { newWellName = *sortedWellNameSet.begin(); } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp index f05bf295d5..ffda3a2717 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp @@ -293,7 +293,7 @@ QList RimWellDistributionPlotCollection::calculateValueO { RimTools::timeStepsForCase( m_case, &options ); - if ( options.size() == 0 ) + if ( options.empty() ) { options.push_back( caf::PdmOptionItemInfo( "None", -1 ) ); } @@ -311,7 +311,7 @@ QList RimWellDistributionPlotCollection::calculateValueO } } - if ( options.size() == 0 ) + if ( options.empty() ) { options.push_back( caf::PdmOptionItemInfo( "None", QVariant() ) ); } @@ -451,7 +451,7 @@ void RimWellDistributionPlotCollection::fixupDependentFieldsAfterCaseChange() } const std::set sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames(); - if ( sortedWellNameSet.size() > 0 ) + if ( !sortedWellNameSet.empty() ) { newWellName = *sortedWellNameSet.begin(); } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp index 49f32ce8d7..180090c9ad 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp @@ -561,7 +561,7 @@ std::set RimWellPlotTools::findMatchingOrAdjacentTimeSteps( const std // The above will only work if there are at least one available timestep equal or after any of the basetimeline // times. If no timesteps matched but we have some, add the last available because the above code missed it. - if ( !resultTimeSteps.size() && baseTimeLine.size() && availableTimeSteps.size() ) + if ( resultTimeSteps.empty() && !baseTimeLine.empty() && !availableTimeSteps.empty() ) { resultTimeSteps.insert( *availableTimeSteps.rbegin() ); } @@ -1291,7 +1291,7 @@ std::map> std::set filteredSummaryRftTimeSteps = RimWellPlotTools::findMatchingOrAdjacentTimeSteps( baseTimeSteps, summaryRftTimeSteps ); - if ( addFirstTimestep && gridTimeSteps.size() ) + if ( addFirstTimestep && !gridTimeSteps.empty() ) { filteredGridTimeSteps.insert( *gridTimeSteps.begin() ); } diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp index 079177f508..bdf0646c2e 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp @@ -182,7 +182,7 @@ std::pair RimGeoMechPartCollection::needsReloadOrRebuildUpdate( int bool missingDisplacement = false; for ( const auto& part : m_parts ) { - missingDisplacement = missingDisplacement || ( part->displacements().size() == 0 ); + missingDisplacement = missingDisplacement || ( part->displacements().empty() ); } rebuild = rebuild || missingDisplacement; diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp index 746766c141..169715bb35 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp @@ -362,7 +362,7 @@ void RimGeoMechResultDefinition::fieldChangedByUi( const caf::PdmFieldHandle* ch &m_normalizationAirGap == changedField || &m_referenceTimeStep == changedField || &m_isChecked == changedField ) { QStringList fieldComponentNames = m_resultVariableUiField().split( QRegExp( "\\s+" ) ); - if ( fieldComponentNames.size() > 0 ) + if ( !fieldComponentNames.empty() ) { m_resultPositionType = m_resultPositionTypeUiField; if ( m_resultPositionType() == RIG_FORMATION_NAMES ) diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index a127e8c328..826ce4dde6 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -419,7 +419,7 @@ QString RimGridCrossPlot::generateInfoBoxText() const } infoText += QString( "" ); } - else if ( curveInfoTexts.size() > 0 ) + else if ( !curveInfoTexts.empty() ) { infoText += curveInfoTexts.front(); } diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp index 1e5f6c10bc..360db3bc0d 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp @@ -97,7 +97,7 @@ void RimIntersectionResultsDefinitionCollection::fieldChangedByUi( const caf::Pd auto gridView = firstAncestorOrThisOfType(); if ( gridView ) gridView->scheduleCreateDisplayModelAndRedraw(); - if ( intersectionResultsDefinitions().size() > 0 ) intersectionResultsDefinitions()[0]->update2dIntersectionViews(); + if ( !intersectionResultsDefinitions().empty() ) intersectionResultsDefinitions()[0]->update2dIntersectionViews(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 039ad932d0..65a3ab401d 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -1343,7 +1343,7 @@ void Rim3dView::createHighlightAndGridBoxDisplayModel() cvf::Collection parts; onCreatePartCollectionFromSelection( &parts ); - if ( parts.size() > 0 ) + if ( !parts.empty() ) { for ( size_t i = 0; i < parts.size(); i++ ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimCase.cpp b/ApplicationLibCode/ProjectDataModel/RimCase.cpp index 36cbff7206..a84defae7e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCase.cpp @@ -224,7 +224,7 @@ size_t RimCase::uiToNativeTimeStepIndex( size_t uiTimeStepIndex ) { std::vector nativeTimeIndices = m_timeStepFilter->filteredTimeSteps(); - if ( nativeTimeIndices.size() > 0 ) + if ( !nativeTimeIndices.empty() ) { return nativeTimeIndices.at( uiTimeStepIndex ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index d5ce8911ce..aa4d627056 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1442,7 +1442,7 @@ void RimContextCommandBuilder::createExecuteScriptForCasesFeatureMenu( caf::CmdF std::vector cases; ruiMainWindow->selectedCases( cases ); - if ( cases.size() > 0 ) + if ( !cases.empty() ) { menuBuilder.subMenuStart( "Execute script" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp index 2060ad3892..2b34e1c9fb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp @@ -199,7 +199,7 @@ QString RimCustomObjectiveFunction::autoGeneratedTitle() const //-------------------------------------------------------------------------------------------------- bool RimCustomObjectiveFunction::isValid() const { - return m_weights.size() > 0 && m_isValid; + return !m_weights.empty() && m_isValid; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp index fbc6f76ef3..c1485f3f4f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp @@ -256,7 +256,7 @@ void RimEclipseStatisticsCase::computeStatistics() std::vector sourceCases = getSourceCases(); - if ( sourceCases.size() == 0 || !sourceCases.at( 0 )->results( RiaDefines::PorosityModelType::MATRIX_MODEL ) ) + if ( sourceCases.empty() || !sourceCases.at( 0 )->results( RiaDefines::PorosityModelType::MATRIX_MODEL ) ) { return; } @@ -540,7 +540,7 @@ QList RimEclipseStatisticsCase::calculateValueOptions( c return toOptionList( sourceCaseNames ); } - if ( !options.size() ) options = RimEclipseCase::calculateValueOptions( fieldNeedingOptions ); + if ( options.empty() ) options = RimEclipseCase::calculateValueOptions( fieldNeedingOptions ); return options; } @@ -621,7 +621,7 @@ void RimEclipseStatisticsCase::loadSimulationWellDataFromSourceCase() //-------------------------------------------------------------------------------------------------- void addPropertySetToHtmlText( QString& html, const QString& heading, const std::vector& varNames ) { - if ( varNames.size() ) + if ( !varNames.empty() ) { html += "

" + heading + "

"; html += "

"; @@ -806,7 +806,7 @@ void RimEclipseStatisticsCase::computeStatisticsAndUpdateViews() scheduleACTIVEGeometryRegenOnReservoirViews(); updateConnectedEditorsAndReservoirViews(); - if ( reservoirViews.size() == 0 ) + if ( reservoirViews.empty() ) { RicNewViewFeature::addReservoirView( this, nullptr ); } @@ -825,7 +825,7 @@ void RimEclipseStatisticsCase::populateResultSelection() RigEclipseCaseData* caseData = idgcg->mainCase()->eclipseCaseData(); - if ( m_selectedDynamicProperties().size() == 0 ) + if ( m_selectedDynamicProperties().empty() ) { QStringList varList = caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->resultNames( RiaDefines::ResultCatType::DYNAMIC_NATIVE ); @@ -833,7 +833,7 @@ void RimEclipseStatisticsCase::populateResultSelection() if ( varList.contains( "PRESSURE" ) ) m_selectedDynamicProperties.v().push_back( "PRESSURE" ); } - if ( m_selectedStaticProperties().size() == 0 ) + if ( m_selectedStaticProperties().empty() ) { QStringList varList = caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->resultNames( RiaDefines::ResultCatType::STATIC_NATIVE ); @@ -841,7 +841,7 @@ void RimEclipseStatisticsCase::populateResultSelection() if ( varList.contains( "PORO" ) ) m_selectedStaticProperties.v().push_back( "PORO" ); } - if ( m_selectedFractureDynamicProperties().size() == 0 ) + if ( m_selectedFractureDynamicProperties().empty() ) { QStringList varList = caseData->results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->resultNames( RiaDefines::ResultCatType::DYNAMIC_NATIVE ); @@ -849,7 +849,7 @@ void RimEclipseStatisticsCase::populateResultSelection() if ( varList.contains( "PRESSURE" ) ) m_selectedFractureDynamicProperties.v().push_back( "PRESSURE" ); } - if ( m_selectedFractureStaticProperties().size() == 0 ) + if ( m_selectedFractureStaticProperties().empty() ) { QStringList varList = caseData->results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->resultNames( RiaDefines::ResultCatType::STATIC_NATIVE ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp index f1789494bd..2801701125 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp @@ -47,7 +47,7 @@ void RimEclipseStatisticsCaseEvaluator::addNamedResult( RigCaseCellResultsData* size_t activeUnionCellCount ) { // Use time step dates from first result in first source case - CVF_ASSERT( m_sourceCases.size() > 0 ); + CVF_ASSERT( !m_sourceCases.empty() ); std::vector resAddresses = m_sourceCases[0]->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->existingResults(); @@ -314,7 +314,7 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults( const QList { RimEclipseCase* eclipseCase = m_sourceCases.at( caseIdx ); - if ( !eclipseCase->reservoirViews.size() ) + if ( eclipseCase->reservoirViews.empty() ) { eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->freeAllocatedResultsData(); eclipseCase->results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->freeAllocatedResultsData(); @@ -384,7 +384,7 @@ RimEclipseStatisticsCaseEvaluator::RimEclipseStatisticsCaseEvaluator( const std: , m_identicalGridCaseGroup( identicalGridCaseGroup ) , m_useZeroAsInactiveCellValue( false ) { - if ( sourceCases.size() > 0 ) + if ( !sourceCases.empty() ) { m_reservoirCellCount = sourceCases[0]->eclipseCaseData()->mainGrid()->globalCellArray().size(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp index 658ed2a10d..3fcc4e52d5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp @@ -536,7 +536,7 @@ bool RimElementVectorResult::resultAddressesCombined( std::vector 0; + return !addresses.empty(); } //-------------------------------------------------------------------------------------------------- @@ -570,7 +570,7 @@ bool RimElementVectorResult::resultAddressesIJK( std::vector 0; + return !addresses.empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp index 4d1435b8e5..ad934e1a31 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp @@ -405,7 +405,7 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate( bool updateParentPlot ) if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE ) { std::vector dateTimes = timeStepValues(); - if ( dateTimes.size() > 0 && dateTimes.size() == values.size() ) + if ( !dateTimes.empty() && dateTimes.size() == values.size() ) { m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, values, useLogarithmicScale ); } @@ -417,7 +417,7 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate( bool updateParentPlot ) else { std::vector days = daysSinceSimulationStart(); - if ( days.size() > 0 && days.size() == values.size() ) + if ( !days.empty() && days.size() == values.size() ) { double timeScale = plot->timeAxisProperties()->fromDaysToDisplayUnitScale(); diff --git a/ApplicationLibCode/ProjectDataModel/RimHistogramCalculator.cpp b/ApplicationLibCode/ProjectDataModel/RimHistogramCalculator.cpp index 23ed4c61a5..e0b389bc47 100644 --- a/ApplicationLibCode/ProjectDataModel/RimHistogramCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimHistogramCalculator.cpp @@ -418,7 +418,7 @@ void RimHistogramCalculator::updateVisCellStatsIfNeeded( RimEclipseView* eclipse QString resultName = resAddr.resultName(); std::vector addresses = sourcesForMultiPropertyResults( resultName ); - if ( addresses.size() ) + if ( !addresses.empty() ) { cvf::ref multicalc = new RigEclipseMultiPropertyStatCalc(); diff --git a/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp b/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp index 3375117abe..1f9065017e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp @@ -135,7 +135,7 @@ void RimIdenticalGridCaseGroup::removeCase( RimEclipseCase* reservoir ) caseCollection()->reservoirs().removeChild( reservoir ); - if ( caseCollection()->reservoirs().size() == 0 ) + if ( caseCollection()->reservoirs().empty() ) { m_mainGrid = nullptr; } @@ -168,7 +168,7 @@ caf::PdmFieldHandle* RimIdenticalGridCaseGroup::userDescriptionField() //-------------------------------------------------------------------------------------------------- void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo() { - if ( caseCollection()->reservoirs().size() == 0 ) + if ( caseCollection()->reservoirs().empty() ) { return; } @@ -262,7 +262,7 @@ void RimIdenticalGridCaseGroup::computeUnionOfActiveCells() return; } - if ( caseCollection->reservoirs.size() == 0 || !m_mainGrid ) + if ( caseCollection->reservoirs.empty() || !m_mainGrid ) { clearActiveCellUnions(); @@ -493,7 +493,7 @@ bool RimIdenticalGridCaseGroup::isStatisticsCaseCollection( RimCaseCollection* r //-------------------------------------------------------------------------------------------------- RimEclipseCase* RimIdenticalGridCaseGroup::mainCase() { - if ( caseCollection()->reservoirs().size() ) + if ( !caseCollection()->reservoirs().empty() ) { return caseCollection()->reservoirs()[0]; } diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 9ad3c7c769..bcfd5fcfe4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -310,7 +310,7 @@ void RimProject::beforeInitAfterRead() distributePathsFromGlobalPathList(); // Create an empty oil field in case the project did not contain one - if ( oilFields.size() < 1 ) + if ( oilFields.empty() ) { oilFields.push_back( new RimOilField ); } @@ -700,7 +700,7 @@ std::vector RimProject::allSummaryCases() const } auto& observedDataColl = oilField->observedDataCollection(); - if ( observedDataColl != nullptr && observedDataColl->allObservedSummaryData().size() > 0 ) + if ( observedDataColl != nullptr && !observedDataColl->allObservedSummaryData().empty() ) { auto observedData = observedDataColl->allObservedSummaryData(); sumCases.insert( sumCases.end(), observedData.begin(), observedData.end() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp index b4a4c90cc2..05b647fc46 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp @@ -944,7 +944,7 @@ QString RimRegularLegendConfig::categoryNameFromCategoryValue( double categoryRe { if ( categoryResultValue == HUGE_VAL ) return "Undefined"; - if ( m_categoryNames.size() > 0 ) + if ( !m_categoryNames.empty() ) { for ( size_t categoryIndex = 0; categoryIndex < m_categories.size(); categoryIndex++ ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp b/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp index a440891d44..c4dc9e7c0c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp @@ -103,7 +103,7 @@ void RimReservoirCellResultsStorage::setupBeforeSave() } } - if ( resAddrs.size() && hasResultsToStore ) + if ( !resAddrs.empty() && hasResultsToStore ) { QDir::root().mkpath( getCacheDirectoryPath() ); @@ -158,7 +158,7 @@ void RimReservoirCellResultsStorage::setupBeforeSave() data = &( m_cellResults->cellScalarResults( resAddrs[rIdx], tsIdx ) ); } - if ( data && data->size() ) + if ( data && !data->empty() ) { stream << (quint64)( data->size() ); for ( size_t cIdx = 0; cIdx < data->size(); ++cIdx ) @@ -230,7 +230,7 @@ void RimReservoirCellResultsStorage::setCellResults( RigCaseCellResultsData* cel // Warn if we thought we were to find some data on the storage file - if ( !caf::Utils::fileExists( newValidCacheFileName ) && m_resultCacheMetaData.size() ) + if ( !caf::Utils::fileExists( newValidCacheFileName ) && !m_resultCacheMetaData.empty() ) { qWarning() << "Reading stored results: Missing the storage file : " + newValidCacheFileName; return; diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp index 35d100cc2b..111f7cbc33 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp @@ -291,7 +291,7 @@ RimSimWellInView* RimSimWellInViewCollection::findWell( QString name ) bool RimSimWellInViewCollection::hasVisibleWellCells() { if ( !isActive() ) return false; - if ( wells().size() == 0 ) return false; + if ( wells().empty() ) return false; bool hasCells = false; for ( size_t i = 0; !hasCells && i < wells().size(); ++i ) @@ -323,7 +323,7 @@ bool RimSimWellInViewCollection::hasVisibleWellCells() bool RimSimWellInViewCollection::hasVisibleWellPipes() { if ( !isActive() ) return false; - if ( wells().size() == 0 ) return false; + if ( wells().empty() ) return false; return true; } @@ -815,7 +815,7 @@ void RimSimWellInViewCollection::scheduleIsWellPipesVisibleRecalculation() //-------------------------------------------------------------------------------------------------- void RimSimWellInViewCollection::calculateWellGeometryVisibility( size_t frameIndex ) { - if ( m_framesOfResultWellPipeVisibilities.size() > frameIndex && m_framesOfResultWellPipeVisibilities[frameIndex].size() ) return; + if ( m_framesOfResultWellPipeVisibilities.size() > frameIndex && !m_framesOfResultWellPipeVisibilities[frameIndex].empty() ) return; if ( m_framesOfResultWellPipeVisibilities.size() <= frameIndex ) m_framesOfResultWellPipeVisibilities.resize( frameIndex + 1 ); diff --git a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp index f1f7c40496..ece71ebffa 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp @@ -346,7 +346,7 @@ QString RimStimPlanColors::toResultName( const QString& resultNameAndUnit ) { QStringList items = resultNameAndUnit.split( "[" ); - if ( items.size() > 0 ) + if ( !items.empty() ) { return items[0].trimmed(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp index 4c90fe6590..c4e0811734 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp @@ -368,7 +368,7 @@ std::optional, std::vector>> if ( evaluatedOk ) { - if ( timeHistoryCurveMerger.validIntervalsForAllXValues().size() > 0 ) + if ( !timeHistoryCurveMerger.validIntervalsForAllXValues().empty() ) { size_t firstValidTimeStep = timeHistoryCurveMerger.validIntervalsForAllXValues().front().first; size_t lastValidTimeStep = timeHistoryCurveMerger.validIntervalsForAllXValues().back().second + 1; diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp index 18101a7cef..1578e48f6b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp @@ -75,7 +75,7 @@ void RimSummaryCalculationVariable::fieldChangedByUi( const caf::PdmFieldHandle* if ( dlg.exec() == QDialog::Accepted ) { std::vector curveSelection = dlg.curveSelection(); - if ( curveSelection.size() > 0 ) + if ( !curveSelection.empty() ) { m_case = curveSelection[0].summaryCaseY(); m_summaryAddress->setAddress( curveSelection[0].summaryAddressY() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimTools.cpp b/ApplicationLibCode/ProjectDataModel/RimTools.cpp index a9c3e4a597..1486c105da 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTools.cpp @@ -532,7 +532,7 @@ RimWellPath* RimTools::firstWellPath() auto wellpathcoll = wellPathCollection(); auto wellpaths = wellpathcoll->allWellPaths(); - if ( wellpaths.size() > 0 ) return wellpaths[0]; + if ( !wellpaths.empty() ) return wellpaths[0]; return nullptr; } diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp index a21c4dcc8d..3cd0259d85 100644 --- a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp @@ -199,7 +199,7 @@ bool RimUserDefinedCalculation::parseExpression() } std::vector variableNames = ExpressionParser::detectReferencedVariables( m_expression ); - if ( variableNames.size() < 1 ) + if ( variableNames.empty() ) { RiaLogging::errorInMessageBox( nullptr, "Expression Parser", "Failed to detect any variable names" ); @@ -256,7 +256,7 @@ QString RimUserDefinedCalculation::findLeftHandSide( const QString& expression ) QStringList words = s.split( " " ); - if ( words.size() > 0 ) + if ( !words.empty() ) { return words.back(); } diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSection.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSection.cpp index 6f66b1cd5c..f99b69f88b 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicSection.cpp @@ -594,7 +594,7 @@ cvf::ref RimSeismicSection::texturedSection() if ( m_type() == RiaDefines::SeismicSectionType::SS_POLYLINE ) { - if ( m_targets.size() == 0 ) return m_texturedSection; + if ( m_targets.empty() ) return m_texturedSection; std::vector points; diff --git a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineGenerator.cpp b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineGenerator.cpp index 0c5cab5666..1e4210bbd1 100644 --- a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineGenerator.cpp +++ b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineGenerator.cpp @@ -81,7 +81,7 @@ void RimStreamlineGenerator::generateTracer( RigCell cell, double direction, QSt } } - while ( m_seeds.size() > 0 ) + while ( !m_seeds.empty() ) { const size_t cellIdx = m_seeds.top().m_cellIdx; const cvf::StructGridInterface::FaceType faceIdx = m_seeds.top().m_faceIdx; diff --git a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp index e973f8ee81..ea6154c4eb 100644 --- a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp @@ -308,7 +308,7 @@ void RimStreamlineInViewCollection::mappingRange( double& min, double& max ) con //-------------------------------------------------------------------------------------------------- void RimStreamlineInViewCollection::updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer, bool isUsingOverrideViewer ) { - if ( m_isActive() && ( m_streamlines.size() > 0 ) && m_legendConfig->showLegend() ) + if ( m_isActive() && ( !m_streamlines.empty() ) && m_legendConfig->showLegend() ) { QString title = "Streamlines: \n"; title += m_phases().uiText() + " flow\n"; @@ -432,7 +432,7 @@ void RimStreamlineInViewCollection::findStartCells( int //-------------------------------------------------------------------------------------------------- void RimStreamlineInViewCollection::updateStreamlines() { - bool bNeedRedraw = ( m_streamlines.size() > 0 ); + bool bNeedRedraw = ( !m_streamlines.empty() ); // get the view auto eclView = firstAncestorOrThisOfType(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp index 80b811fdc7..98257caf97 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp @@ -136,7 +136,7 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot ) auto plot = firstAncestorOrThisOfType(); bool useLogarithmicScale = plot->isLogarithmicScaleEnabled( yAxis() ); - if ( dateTimes.size() > 0 && dateTimes.size() == values.size() ) + if ( !dateTimes.empty() && dateTimes.size() == values.size() ) { if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE ) { @@ -147,7 +147,7 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot ) double timeScale = plot->timeAxisProperties()->fromTimeTToDisplayUnitScale(); std::vector times; - if ( dateTimes.size() ) + if ( !dateTimes.empty() ) { time_t startDate = dateTimes[0]; for ( time_t& date : dateTimes ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp index feed23f748..75a6a5d793 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp @@ -178,7 +178,7 @@ void RimDerivedSummaryCase::calculate( const RifEclipseSummaryAddress& address ) // Check if we got any data. If not, erase the map entry to comply with previous behavior - if ( !itAndIsInsertedPair.first->second.first.size() ) + if ( itAndIsInsertedPair.first->second.first.empty() ) { m_dataCache.erase( itAndIsInsertedPair.first ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp index 44a39ab8fc..1597a6700c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp @@ -346,7 +346,7 @@ void RimEnsembleCurveFilter::fieldChangedByUi( const caf::PdmFieldHandle* change } else if ( changedField == &m_filterMode ) { - if ( m_objectiveValuesSummaryAddresses.size() == 0 ) + if ( m_objectiveValuesSummaryAddresses.empty() ) { RimSummaryAddress* summaryAddress = new RimSummaryAddress(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 5aacf58197..2e9ce28336 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -503,7 +503,7 @@ void RimEnsembleCurveSet::deleteEnsembleCurves() curvesIndexesToDelete.push_back( c ); } - while ( curvesIndexesToDelete.size() > 0 ) + while ( !curvesIndexesToDelete.empty() ) { size_t currIndex = curvesIndexesToDelete.back(); delete m_curves[currIndex]; @@ -525,7 +525,7 @@ void RimEnsembleCurveSet::deleteStatisticsCurves() curvesIndexesToDelete.push_back( c ); } - while ( curvesIndexesToDelete.size() > 0 ) + while ( !curvesIndexesToDelete.empty() ) { size_t currIndex = curvesIndexesToDelete.back(); delete m_curves[currIndex]; @@ -808,7 +808,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi if ( m_colorMode() == ColorMode::BY_OBJECTIVE_FUNCTION || m_colorMode == ColorMode::BY_CUSTOM_OBJECTIVE_FUNCTION ) { - if ( m_objectiveValuesSummaryAddresses.size() == 0 ) + if ( m_objectiveValuesSummaryAddresses.empty() ) { RimSummaryAddress* summaryAddress = new RimSummaryAddress(); summaryAddress->setAddress( m_yValuesSummaryAddress->address() ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp index dcf49b677e..34c08755c6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp @@ -155,7 +155,7 @@ double RimObjectiveFunction::value( RimSummaryCase* } } - if ( m_normalizeByNumberOfVectors && vectorSummaryAddresses.size() > 0 ) + if ( m_normalizeByNumberOfVectors && !vectorSummaryAddresses.empty() ) { aggregatedObjectiveFunctionValue /= vectorSummaryAddresses.size(); } diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp index fbecda8977..3ded3927bd 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp @@ -512,7 +512,7 @@ void RimSurfaceCollection::deleteSubCollection( const QString& name ) //-------------------------------------------------------------------------------------------------- bool RimSurfaceCollection::containsSurface() { - bool containsSurface = ( surfaces().size() > 0 ); + bool containsSurface = ( !surfaces().empty() ); for ( auto coll : m_subCollections ) { diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp index 4ef819feef..f7fec435db 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp @@ -211,7 +211,7 @@ QList Rim3dWellLogFileCurve::calculateValueOptions( cons } } - if ( options.size() == 0 ) + if ( options.empty() ) { options.push_back( caf::PdmOptionItemInfo( "None", "None" ) ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp index 39d8646059..842f1ee2e5 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp @@ -284,7 +284,7 @@ void RimEnsembleWellLogCurveSet::deleteEnsembleCurves() } } - while ( curvesIndexesToDelete.size() > 0 ) + while ( !curvesIndexesToDelete.empty() ) { size_t currIndex = curvesIndexesToDelete.back(); m_curves.erase( currIndex ); @@ -311,7 +311,7 @@ void RimEnsembleWellLogCurveSet::deleteStatisticsCurves() } } - while ( curvesIndexesToDelete.size() > 0 ) + while ( !curvesIndexesToDelete.empty() ) { size_t currIndex = curvesIndexesToDelete.back(); m_curves.erase( currIndex ); @@ -582,7 +582,7 @@ QList RimEnsembleWellLogCurveSet::calculateValueOptions( } } - if ( options.size() == 0 ) + if ( options.empty() ) { options.push_back( caf::PdmOptionItemInfo( "None", "None" ) ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index edb55180ad..81881294f5 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -982,7 +982,7 @@ QList RimWellLogExtractionCurve::calculateValueOptions( QList options; options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions ); - if ( options.size() > 0 ) return options; + if ( !options.empty() ) return options; if ( fieldNeedingOptions == &m_wellPath ) { diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp index 1b3d5a0a1b..933f3721d3 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp @@ -352,7 +352,7 @@ QList RimWellLogFileCurve::calculateValueOptions( const QList options; options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions ); - if ( options.size() > 0 ) return options; + if ( !options.empty() ) return options; if ( fieldNeedingOptions == &m_wellPath ) { @@ -362,13 +362,13 @@ QList RimWellLogFileCurve::calculateValueOptions( const for ( auto wellPath : wellPathColl->allWellPaths() ) { // Only include well paths coming from a well log file - if ( wellPath->wellLogFiles().size() > 0 ) + if ( !wellPath->wellLogFiles().empty() ) { options.push_back( caf::PdmOptionItemInfo( wellPath->name(), wellPath ) ); } } - if ( options.size() > 0 ) + if ( !options.empty() ) { options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) ); } @@ -391,7 +391,7 @@ QList RimWellLogFileCurve::calculateValueOptions( const } } - if ( options.size() == 0 ) + if ( options.empty() ) { options.push_back( caf::PdmOptionItemInfo( "None", "None" ) ); } @@ -399,7 +399,7 @@ QList RimWellLogFileCurve::calculateValueOptions( const if ( fieldNeedingOptions == &m_wellLogFile ) { - if ( m_wellPath() && m_wellPath->wellLogFiles().size() > 0 ) + if ( m_wellPath() && !m_wellPath->wellLogFiles().empty() ) { for ( RimWellLogFile* const wellLogFile : m_wellPath->wellLogFiles() ) { diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 3d05bab15b..2ecd224818 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -2571,7 +2571,7 @@ RigEclipseWellLogExtractor* RimWellLogTrack::createSimWellExtractor( RimWellLogP std::vector wellPaths = RiaSimWellBranchTools::simulationWellBranches( simWellName, useBranchDetection ); - if ( wellPaths.size() == 0 ) return nullptr; + if ( wellPaths.empty() ) return nullptr; CVF_ASSERT( branchIndex >= 0 && branchIndex < static_cast( wellPaths.size() ) ); diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp index 299f1530b9..f9f00c1a1c 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp @@ -247,7 +247,7 @@ QList RimWellMeasurementCurve::calculateValueOptions( co QList options; options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions ); - if ( options.size() > 0 ) return options; + if ( !options.empty() ) return options; if ( fieldNeedingOptions == &m_wellPath ) { diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIADataAccess.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIADataAccess.cpp index d198e66796..594fe0cffc 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIADataAccess.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIADataAccess.cpp @@ -69,7 +69,7 @@ int RimWellIADataAccess::elementIndex( cvf::Vec3d position ) std::vector closeElements; m_caseData->femParts()->part( 0 )->findIntersectingElementIndices( bb, &closeElements ); - if ( closeElements.size() == 0 ) return -1; + if ( closeElements.empty() ) return -1; return (int)closeElements[0]; } diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp index 1020d5d75f..cba7d9e25d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp @@ -105,7 +105,7 @@ bool RimWellIASettingsCollection::isEnabled() const //-------------------------------------------------------------------------------------------------- bool RimWellIASettingsCollection::hasSettings() const { - return m_wellIASettings.size() > 0; + return !m_wellIASettings.empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp index 43473d8b9f..b76b3c9de8 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp @@ -459,7 +459,7 @@ const RimWellPathTarget* RimWellPathGeometryDef::firstActiveTarget() const //-------------------------------------------------------------------------------------------------- const RimWellPathTarget* RimWellPathGeometryDef::lastActiveTarget() const { - if ( !m_wellTargets.size() ) return nullptr; + if ( m_wellTargets.empty() ) return nullptr; for ( int tIdx = static_cast( m_wellTargets.size() - 1 ); tIdx >= 0; --tIdx ) { diff --git a/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigActiveCellsResultAccessor.cpp b/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigActiveCellsResultAccessor.cpp index 1532044782..b51642fdf4 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigActiveCellsResultAccessor.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigActiveCellsResultAccessor.cpp @@ -38,7 +38,7 @@ RigActiveCellsResultAccessor::RigActiveCellsResultAccessor( const RigGridBase* //-------------------------------------------------------------------------------------------------- double RigActiveCellsResultAccessor::cellScalar( size_t gridLocalCellIndex ) const { - if ( m_reservoirResultValues == nullptr || m_reservoirResultValues->size() == 0 ) return HUGE_VAL; + if ( m_reservoirResultValues == nullptr || m_reservoirResultValues->empty() ) return HUGE_VAL; size_t reservoirCellIndex = m_grid->reservoirCellIndex( gridLocalCellIndex ); size_t resultValueIndex = m_activeCellInfo->cellResultIndex( reservoirCellIndex ); @@ -65,7 +65,7 @@ double RigActiveCellsResultAccessor::cellFaceScalar( size_t gridLocalCellIndex, //-------------------------------------------------------------------------------------------------- double RigActiveCellsResultAccessor::cellScalarGlobIdx( size_t reservoirCellIndex ) const { - if ( m_reservoirResultValues == nullptr || m_reservoirResultValues->size() == 0 ) return HUGE_VAL; + if ( m_reservoirResultValues == nullptr || m_reservoirResultValues->empty() ) return HUGE_VAL; size_t resultValueIndex = m_activeCellInfo->cellResultIndex( reservoirCellIndex ); if ( resultValueIndex == cvf::UNDEFINED_SIZE_T ) return HUGE_VAL; diff --git a/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigAllGridCellsResultAccessor.cpp b/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigAllGridCellsResultAccessor.cpp index abd6564831..eb654724cb 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigAllGridCellsResultAccessor.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigAllGridCellsResultAccessor.cpp @@ -37,7 +37,7 @@ RigAllGridCellsResultAccessor::RigAllGridCellsResultAccessor( const RigGridBase* //-------------------------------------------------------------------------------------------------- double RigAllGridCellsResultAccessor::cellScalar( size_t gridLocalCellIndex ) const { - if ( m_reservoirResultValues->size() == 0 ) return HUGE_VAL; + if ( m_reservoirResultValues->empty() ) return HUGE_VAL; size_t reservoirCellIndex = m_grid->reservoirCellIndex( gridLocalCellIndex ); CVF_TIGHT_ASSERT( reservoirCellIndex < m_reservoirResultValues->size() ); @@ -58,7 +58,7 @@ double RigAllGridCellsResultAccessor::cellFaceScalar( size_t gridLocalCellIndex, //-------------------------------------------------------------------------------------------------- double RigAllGridCellsResultAccessor::cellScalarGlobIdx( size_t globCellIndex ) const { - if ( m_reservoirResultValues->size() == 0 ) return HUGE_VAL; + if ( m_reservoirResultValues->empty() ) return HUGE_VAL; CVF_TIGHT_ASSERT( globCellIndex < m_reservoirResultValues->size() ); diff --git a/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp b/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp index 15634d80b8..7dd3276597 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp @@ -361,7 +361,7 @@ cvf::ref RigResultAccessorFactory::createNativeFromResultAddr resultValues = &( scalarSetResults[timeStepIndex] ); } - if ( !resultValues || resultValues->size() == 0 ) + if ( !resultValues || resultValues->empty() ) { return new RigHugeValResultAccessor; } diff --git a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigSoilResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigSoilResultCalculator.cpp index d3697cc879..ef7dde6064 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigSoilResultCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultCalculators/RigSoilResultCalculator.cpp @@ -81,7 +81,7 @@ void RigSoilResultCalculator::calculate( const RigEclipseResultAddress& resVarAd if ( scalarIndexSWAT != cvf::UNDEFINED_SIZE_T ) { const std::vector& swatForTimeStep = m_resultsData->cellScalarResults( SWATAddr, timeStepIndex ); - if ( swatForTimeStep.size() > 0 ) + if ( !swatForTimeStep.empty() ) { soilResultValueCount = swatForTimeStep.size(); soilTimeStepCount = m_resultsData->infoForEachResultIndex()[scalarIndexSWAT].timeStepInfos().size(); @@ -91,7 +91,7 @@ void RigSoilResultCalculator::calculate( const RigEclipseResultAddress& resVarAd if ( scalarIndexSGAS != cvf::UNDEFINED_SIZE_T ) { const std::vector& sgasForTimeStep = m_resultsData->cellScalarResults( SGASAddr, timeStepIndex ); - if ( sgasForTimeStep.size() > 0 ) + if ( !sgasForTimeStep.empty() ) { soilResultValueCount = qMax( soilResultValueCount, sgasForTimeStep.size() ); @@ -104,7 +104,7 @@ void RigSoilResultCalculator::calculate( const RigEclipseResultAddress& resVarAd size_t soilResultScalarIndex = m_resultsData->findScalarResultIndexFromAddress( resVarAddr ); m_resultsData->m_cellScalarResults[soilResultScalarIndex].resize( soilTimeStepCount ); - if ( m_resultsData->cellScalarResults( resVarAddr, timeStepIndex ).size() > 0 ) + if ( !m_resultsData->cellScalarResults( resVarAddr, timeStepIndex ).empty() ) { // Data is computed and allocated, nothing more to do return; @@ -119,7 +119,7 @@ void RigSoilResultCalculator::calculate( const RigEclipseResultAddress& resVarAd if ( scalarIndexSWAT != cvf::UNDEFINED_SIZE_T ) { swatForTimeStep = &( m_resultsData->cellScalarResults( SWATAddr, timeStepIndex ) ); - if ( swatForTimeStep->size() == 0 ) + if ( swatForTimeStep->empty() ) { swatForTimeStep = nullptr; } @@ -128,7 +128,7 @@ void RigSoilResultCalculator::calculate( const RigEclipseResultAddress& resVarAd if ( scalarIndexSGAS != cvf::UNDEFINED_SIZE_T ) { sgasForTimeStep = &( m_resultsData->cellScalarResults( SGASAddr, timeStepIndex ) ); - if ( sgasForTimeStep->size() == 0 ) + if ( sgasForTimeStep->empty() ) { sgasForTimeStep = nullptr; } @@ -137,7 +137,7 @@ void RigSoilResultCalculator::calculate( const RigEclipseResultAddress& resVarAd if ( scalarIndexSSOL != cvf::UNDEFINED_SIZE_T ) { ssolForTimeStep = &( m_resultsData->cellScalarResults( SSOLAddr, timeStepIndex ) ); - if ( ssolForTimeStep->size() == 0 ) + if ( ssolForTimeStep->empty() ) { ssolForTimeStep = nullptr; } diff --git a/ApplicationLibCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp index 59704dae54..8530edef79 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp @@ -461,8 +461,8 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection( size_t bran for ( size_t dsBidx : downStreamBranchIndices ) { BranchFlow& downStreamBranchFlow = m_connectionFlowPrBranch[dsBidx]; - if ( dsBidx != branchIdx && downStreamBranchFlow.depthValuesFromTop.size() == 0 ) // Not this branch or - // already calculated + if ( dsBidx != branchIdx && downStreamBranchFlow.depthValuesFromTop.empty() ) // Not this branch or + // already calculated { calculateAccumulatedFlowPrConnection( dsBidx, connNumFromTop ); std::vector accBranchFlowPrTracer = accumulatedDsBranchFlowPrTracer( downStreamBranchFlow ); @@ -561,8 +561,8 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength( size_t branchIdx, do for ( size_t dsBidx : downStreamBranchIndices ) { BranchFlow& downStreamBranchFlow = m_pseudoLengthFlowPrBranch[dsBidx]; - if ( dsBidx != branchIdx && downStreamBranchFlow.depthValuesFromTop.size() == 0 ) // Not this branch or - // already calculated + if ( dsBidx != branchIdx && downStreamBranchFlow.depthValuesFromTop.empty() ) // Not this branch or + // already calculated { calculateFlowPrPseudoLength( dsBidx, pseudoLengthFromTop_upper ); std::vector accBranchFlowPrTracer = accumulatedDsBranchFlowPrTracer( downStreamBranchFlow ); @@ -577,7 +577,7 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength( size_t branchIdx, do // Push back the accumulated result after adding the branch result into the storage - if ( downStreamBranchIndices.size() ) + if ( !downStreamBranchIndices.empty() ) storeFlowOnDepthWTvd( &branchFlow, pseudoLengthFromTop_upper, tvd_upper, accFlowPrTracer, flowPrTracer ); } } @@ -857,7 +857,8 @@ void RigAccWellFlowCalculator::sortTracers() double totalFlow = 0.0; - if ( mainBranchAccFlow.size() ) totalFlow = -fabs( mainBranchAccFlow.back() ); // Based on size in reverse order (biggest to least) + if ( !mainBranchAccFlow.empty() ) + totalFlow = -fabs( mainBranchAccFlow.back() ); // Based on size in reverse order (biggest to least) sortedTracers.insert( { totalFlow, tracerName } ); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.cpp b/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.cpp index 1bad2eca98..3ffae1ccea 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.cpp @@ -51,7 +51,7 @@ size_t RigActiveCellInfo::reservoirCellCount() const //-------------------------------------------------------------------------------------------------- bool RigActiveCellInfo::isActive( size_t reservoirCellIndex ) const { - if ( m_cellIndexToResultIndex.size() == 0 ) + if ( m_cellIndexToResultIndex.empty() ) { return true; } diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp index b55fb20a0e..c4b771c438 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -491,7 +491,7 @@ bool RigCaseCellResultsData::isUsingGlobalActiveIndex( const RigEclipseResultAdd size_t scalarResultIndex = findScalarResultIndexFromAddress( resVarAddr ); CVF_TIGHT_ASSERT( scalarResultIndex < m_cellScalarResults.size() ); - if ( !m_cellScalarResults[scalarResultIndex].size() ) return true; + if ( m_cellScalarResults[scalarResultIndex].empty() ) return true; size_t firstTimeStepResultValueCount = m_cellScalarResults[scalarResultIndex][0].size(); return firstTimeStepResultValueCount != m_ownerMainGrid->globalCellArray().size(); @@ -1355,7 +1355,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu for ( size_t timeStepIdx = 0; timeStepIdx < maxTimeStepCount(); timeStepIdx++ ) { std::vector& values = m_cellScalarResults[scalarResultIndex][timeStepIdx]; - if ( values.size() == 0 ) + if ( values.empty() ) { computeSOILForTimeStep( timeStepIdx ); } @@ -1548,7 +1548,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResultForTimeStep( const Rig m_cellScalarResults[soilScalarResultIndex].resize( maxTimeStepCount() ); std::vector& values = m_cellScalarResults[soilScalarResultIndex][timeStepIndex]; - if ( values.size() == 0 ) + if ( values.empty() ) { computeSOILForTimeStep( timeStepIndex ); } @@ -1582,7 +1582,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResultForTimeStep( const Rig m_cellScalarResults[scalarResultIndex].resize( timeStepCount ); std::vector& values = m_cellScalarResults[scalarResultIndex][timeStepIndex]; - if ( values.size() == 0 ) + if ( values.empty() ) { if ( !m_readerInterface->dynamicResult( resultName, m_porosityModel, timeStepIndex, &values ) ) { @@ -1621,7 +1621,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResultForTimeStep( const Rig std::vector& values = m_cellScalarResults[scalarResultIndex][timeStepIndex]; - if ( values.size() == 0 ) + if ( values.empty() ) { eclReader->sourSimRlResult( resultName, timeStepIndex, &values ); } @@ -1667,7 +1667,7 @@ void RigCaseCellResultsData::testAndComputeSgasForTimeStep( size_t timeStepIndex if ( m_cellScalarResults[scalarIndexSGAS].size() > timeStepIndex ) { std::vector& values = m_cellScalarResults[scalarIndexSGAS][timeStepIndex]; - if ( values.size() > 0 ) return; + if ( !values.empty() ) return; } size_t swatResultValueCount = 0; @@ -1675,7 +1675,7 @@ void RigCaseCellResultsData::testAndComputeSgasForTimeStep( size_t timeStepIndex { std::vector& swatForTimeStep = m_cellScalarResults[scalarIndexSWAT][timeStepIndex]; - if ( swatForTimeStep.size() > 0 ) + if ( !swatForTimeStep.empty() ) { swatResultValueCount = swatForTimeStep.size(); swatTimeStepCount = infoForEachResultIndex()[scalarIndexSWAT].timeStepInfos().size(); @@ -1684,7 +1684,7 @@ void RigCaseCellResultsData::testAndComputeSgasForTimeStep( size_t timeStepIndex m_cellScalarResults[scalarIndexSGAS].resize( swatTimeStepCount ); - if ( m_cellScalarResults[scalarIndexSGAS][timeStepIndex].size() > 0 ) + if ( !m_cellScalarResults[scalarIndexSGAS][timeStepIndex].empty() ) { return; } @@ -1695,7 +1695,7 @@ void RigCaseCellResultsData::testAndComputeSgasForTimeStep( size_t timeStepIndex { swatForTimeStep = &( m_cellScalarResults[scalarIndexSWAT][timeStepIndex] ); - if ( swatForTimeStep->size() == 0 ) + if ( swatForTimeStep->empty() ) { swatForTimeStep = nullptr; } @@ -2809,7 +2809,7 @@ bool RigCaseCellResultsData::isDataPresent( size_t scalarResultIndex ) const for ( size_t tsIdx = 0; tsIdx < data.size(); ++tsIdx ) { - if ( data[tsIdx].size() ) + if ( !data[tsIdx].empty() ) { return true; } diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp index 862ae6180f..9e254cd724 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp @@ -189,7 +189,7 @@ size_t RigEclipseCaseData::gridCount() const void RigEclipseCaseData::computeWellCellsPrGrid() { // If we have computed this already, return - if ( m_wellCellsInGrid.size() ) return; + if ( !m_wellCellsInGrid.empty() ) return; std::vector grids; allGrids( &grids ); @@ -650,7 +650,7 @@ void RigEclipseCaseData::computeActiveCellsGeometryBoundingBox() for ( int acIdx = 0; acIdx < 2; ++acIdx ) { bb.reset(); - if ( m_mainGrid->nodes().size() == 0 ) + if ( m_mainGrid->nodes().empty() ) { bb.add( cvf::Vec3d::ZERO ); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseMultiPropertyStatCalc.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseMultiPropertyStatCalc.cpp index cb0d94fc5b..b34ab1dff2 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseMultiPropertyStatCalc.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseMultiPropertyStatCalc.cpp @@ -113,7 +113,7 @@ void RigEclipseMultiPropertyStatCalc::uniqueValues( size_t timeStepIndex, std::s //-------------------------------------------------------------------------------------------------- size_t RigEclipseMultiPropertyStatCalc::timeStepCount() { - if ( m_nativeStatisticsCalculators.size() > 0 ) + if ( !m_nativeStatisticsCalculators.empty() ) { return m_nativeStatisticsCalculators[0]->timeStepCount(); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigEquil.cpp b/ApplicationLibCode/ReservoirDataModel/RigEquil.cpp index e09ee8abe5..6597982946 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEquil.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEquil.cpp @@ -136,7 +136,7 @@ RigEquil RigEquil::parseString( const QString& keywordData ) line.replace( "\t", " " ); QStringList items = RiaTextStringTools::splitSkipEmptyParts( line ); - if ( items.size() > 0 ) + if ( !items.empty() ) { datumDepth = items.at( 0 ).toDouble(); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagResults.cpp b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagResults.cpp index 1edaf336f0..2d435c5162 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagResults.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagResults.cpp @@ -151,7 +151,7 @@ std::vector* RigFlowDiagResults::findScalarResultFrame( const RigFlowDia if ( resFrames ) { std::vector& frame = resFrames->frameData( timeStepIndex ); - if ( frame.size() ) return ( &frame ); + if ( !frame.empty() ) return ( &frame ); } return nullptr; } diff --git a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp index e26a85d647..a7536f269a 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp @@ -722,7 +722,7 @@ std::vector RigFlowDiagSolverInterface const RelPermCurve::Ident curveIdent = curveIdentNameArr[i].first; const std::string curveName = curveIdentNameArr[i].second; const Opm::FlowDiagnostics::Graph& srcGraph = graphArr[i]; - if ( srcGraph.first.size() > 0 ) + if ( !srcGraph.first.empty() ) { const std::vector& xVals = srcGraph.first; const std::vector& yVals = srcGraph.second; @@ -771,7 +771,7 @@ std::vector RigFlowDiagSolverInterface::ca pvtNum ); for ( Opm::ECLPVT::PVTGraph srcGraph : graphArr ) { - if ( srcGraph.press.size() > 0 ) + if ( !srcGraph.press.empty() ) { retCurveArr.push_back( { PvtCurve::Bo, PvtCurve::OIL, srcGraph.press, srcGraph.value, srcGraph.mixRat } ); } @@ -786,7 +786,7 @@ std::vector RigFlowDiagSolverInterface::ca pvtNum ); for ( Opm::ECLPVT::PVTGraph srcGraph : graphArr ) { - if ( srcGraph.press.size() > 0 ) + if ( !srcGraph.press.empty() ) { retCurveArr.push_back( { PvtCurve::Bg, PvtCurve::GAS, srcGraph.press, srcGraph.value, srcGraph.mixRat } ); } @@ -804,7 +804,7 @@ std::vector RigFlowDiagSolverInterface::ca pvtNum ); for ( Opm::ECLPVT::PVTGraph srcGraph : graphArr ) { - if ( srcGraph.press.size() > 0 ) + if ( !srcGraph.press.empty() ) { retCurveArr.push_back( { PvtCurve::Visc_o, PvtCurve::OIL, srcGraph.press, srcGraph.value, srcGraph.mixRat } ); } @@ -819,7 +819,7 @@ std::vector RigFlowDiagSolverInterface::ca pvtNum ); for ( Opm::ECLPVT::PVTGraph srcGraph : graphArr ) { - if ( srcGraph.press.size() > 0 ) + if ( !srcGraph.press.empty() ) { retCurveArr.push_back( { PvtCurve::Visc_g, PvtCurve::GAS, srcGraph.press, srcGraph.value, srcGraph.mixRat } ); } @@ -867,7 +867,7 @@ bool RigFlowDiagSolverInterface::calculatePvtDynamicPropertiesFvf( int pvtNum, d pvtNum, phasePress, mixRatio ); - if ( valArr.size() > 0 ) + if ( !valArr.empty() ) { *bo = valArr[0]; } @@ -883,7 +883,7 @@ bool RigFlowDiagSolverInterface::calculatePvtDynamicPropertiesFvf( int pvtNum, d pvtNum, phasePress, mixRatio ); - if ( valArr.size() > 0 ) + if ( !valArr.empty() ) { *bg = valArr[0]; } @@ -929,7 +929,7 @@ bool RigFlowDiagSolverInterface::calculatePvtDynamicPropertiesViscosity( int pvt pvtNum, phasePress, mixRatio ); - if ( valArr.size() > 0 ) + if ( !valArr.empty() ) { *mu_o = valArr[0]; } @@ -945,7 +945,7 @@ bool RigFlowDiagSolverInterface::calculatePvtDynamicPropertiesViscosity( int pvt pvtNum, phasePress, mixRatio ); - if ( valArr.size() > 0 ) + if ( !valArr.empty() ) { *mu_g = valArr[0]; } diff --git a/ApplicationLibCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp b/ApplicationLibCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp index 80cbb8a50f..96dd3a4a09 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp @@ -593,7 +593,7 @@ void RigGeoMechWellLogExtractor::wellBoreWallCurveData( const RigFemResultAddres // Load results std::vector vertexStressesFloat = resultCollection->tensors( stressResAddr, m_partId, timeStepIndex, frameIndex ); - if ( !vertexStressesFloat.size() ) return; + if ( vertexStressesFloat.empty() ) return; std::vector vertexStresses; vertexStresses.reserve( vertexStressesFloat.size() ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigHistogramData.cpp b/ApplicationLibCode/ReservoirDataModel/RigHistogramData.cpp index 9917b8503f..838966e412 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigHistogramData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigHistogramData.cpp @@ -55,5 +55,5 @@ bool RigHistogramData::isValid( double parameter ) const //-------------------------------------------------------------------------------------------------- bool RigHistogramData::isHistogramVectorValid() const { - return histogram.size() > 0 && isMinMaxValid(); + return !histogram.empty() && isMinMaxValid(); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp b/ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp index c09303bb51..03b0a96e64 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp @@ -160,7 +160,7 @@ class SingleLasFileMetaData void appendDataToLasFile( NRLib::LasWell* lasFile ) const { - if ( m_logCurveData.size() == 0 ) return; + if ( m_logCurveData.empty() ) return; lasFile->addWellInfo( "WELL", m_wellName.toStdString() ); @@ -185,7 +185,7 @@ class SingleLasFileMetaData lasFile->AddLog( "DEPTH", "", "Depth in Connection number", firstCurveData->depths( RiaDefines::DepthTypeEnum::MEASURED_DEPTH ) ); } - if ( firstCurveData->depths( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH ).size() ) + if ( !firstCurveData->depths( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH ).empty() ) { lasFile->AddLog( "TVDMSL", "M", @@ -245,7 +245,7 @@ class SingleLasFileMetaData private: const RigWellLogCurveData* curveDataForFirstCurve() const { - CVF_ASSERT( m_logCurveData.size() > 0 ); + CVF_ASSERT( !m_logCurveData.empty() ); return m_logCurveData[0].curveData(); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.cpp b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.cpp index df86b4e6fb..b3cfba5026 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.cpp @@ -219,7 +219,7 @@ size_t RigMainGrid::gridCount() const //-------------------------------------------------------------------------------------------------- void RigMainGrid::initAllSubGridsParentGridPointer() { - if ( m_localGrids.size() && m_localGrids[0]->parentGrid() == nullptr ) + if ( !m_localGrids.empty() && m_localGrids[0]->parentGrid() == nullptr ) { initSubGridParentPointer(); size_t i; diff --git a/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp b/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp index e975c0f385..ae361e7e0a 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp @@ -576,11 +576,11 @@ std::vector RigNNCData::availableProperties( NNCResultType resultType ) for ( auto it : m_connectionResults ) { - if ( resultType == NNCResultType::NNC_STATIC && it.second.size() == 1 && it.second[0].size() > 0 && isNative( it.first ) ) + if ( resultType == NNCResultType::NNC_STATIC && it.second.size() == 1 && !it.second[0].empty() && isNative( it.first ) ) { properties.push_back( it.first ); } - else if ( resultType == NNCResultType::NNC_DYNAMIC && it.second.size() > 1 && it.second[0].size() > 0 && isNative( it.first ) ) + else if ( resultType == NNCResultType::NNC_DYNAMIC && it.second.size() > 1 && !it.second[0].empty() && isNative( it.first ) ) { properties.push_back( it.first ); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigNncConnection.cpp b/ApplicationLibCode/ReservoirDataModel/RigNncConnection.cpp index bb0eea1cb8..0529cc990f 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNncConnection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNncConnection.cpp @@ -109,7 +109,7 @@ RigConnection& RigConnection::operator=( const RigConnection& rhs ) //-------------------------------------------------------------------------------------------------- bool RigConnection::hasCommonArea() const { - return m_polygon.size() > 0; + return !m_polygon.empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp index c39cd84824..abbe9383c7 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp @@ -220,7 +220,7 @@ void RigNumberOfFloodedPoreVolumesCalculator::calculate( RigMainGrid* const std::vector* flowrateJ = flowrateJatAllTimeSteps[timeStep - 1]; const std::vector* flowrateK = flowrateKatAllTimeSteps[timeStep - 1]; - if ( flowrateI->size() > 0 && flowrateJ->size() > 0 && flowrateK->size() > 0 ) + if ( !flowrateI->empty() && !flowrateJ->empty() && !flowrateK->empty() ) { distributeNeighbourCellFlow( mainGrid, caseToApply, @@ -234,7 +234,7 @@ void RigNumberOfFloodedPoreVolumesCalculator::calculate( RigMainGrid* const std::vector* flowrateNNC = flowrateNNCatAllTimeSteps[timeStep - 1]; - if ( flowrateNNC && flowrateNNC->size() > 0 ) + if ( flowrateNNC && !flowrateNNC->empty() ) { distributeNNCflow( connections, caseToApply, summedTracersAtAllTimesteps[timeStep - 1], flowrateNNC, totoalFlowrateIntoCell ); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigSimWellData.cpp b/ApplicationLibCode/ReservoirDataModel/RigSimWellData.cpp index 2d51e9ad0b..e9e02ec6a0 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigSimWellData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigSimWellData.cpp @@ -52,7 +52,7 @@ const RigWellResultFrame* RigSimWellData::wellResultFrame( size_t resultTimeStep void RigSimWellData::computeMappingFromResultTimeIndicesToWellTimeIndices( const std::vector& simulationTimeSteps ) { m_resultTimeStepIndexToWellTimeStepIndex.clear(); - if ( m_wellCellsTimeSteps.size() == 0 ) return; + if ( m_wellCellsTimeSteps.empty() ) return; m_resultTimeStepIndexToWellTimeStepIndex.resize( simulationTimeSteps.size(), cvf::UNDEFINED_SIZE_T ); @@ -135,7 +135,7 @@ bool operator==( const RigWellResultPoint& p1, const RigWellResultPoint& p2 ) //-------------------------------------------------------------------------------------------------- void RigSimWellData::computeStaticWellCellPath() const { - if ( m_wellCellsTimeSteps.size() == 0 ) return; + if ( m_wellCellsTimeSteps.empty() ) return; // Mapping of Branch ERT ID to ResultPoint list std::map> staticWellBranches; diff --git a/ApplicationLibCode/ReservoirDataModel/RigTexturedSection.cpp b/ApplicationLibCode/ReservoirDataModel/RigTexturedSection.cpp index 8f02b9d0bc..62a1b93ba3 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigTexturedSection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigTexturedSection.cpp @@ -77,7 +77,7 @@ void RigTexturedSection::setWhatToUpdate( WhatToUpdateEnum updateInfo, int index //-------------------------------------------------------------------------------------------------- bool RigTexturedSection::isValid() const { - if ( m_sectionParts.size() == 0 ) return false; + if ( m_sectionParts.empty() ) return false; bool valid = true; diff --git a/ApplicationLibCode/ReservoirDataModel/RigTofWellDistributionCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigTofWellDistributionCalculator.cpp index fc614e1337..d5012f837a 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigTofWellDistributionCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigTofWellDistributionCalculator.cpp @@ -159,7 +159,7 @@ RigTofWellDistributionCalculator::RigTofWellDistributionCalculator( RimEclipseRe //-------------------------------------------------------------------------------------------------- void RigTofWellDistributionCalculator::groupSmallContributions( double smallContribThreshold ) { - if ( m_tofInIncreasingOrder.size() == 0 ) + if ( m_tofInIncreasingOrder.empty() ) { return; } diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp index f2191ce354..c1c0765ef3 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp @@ -68,7 +68,7 @@ int RigWellPathGeometryTools::lookup( double x, const QPolygonF& values ) //-------------------------------------------------------------------------------------------------- double RigWellPathGeometryTools::value( double x, const QPolygonF& values ) { - if ( values.size() == 0 ) return 0.0; + if ( values.empty() ) return 0.0; const int i = lookup( x, values ); diff --git a/ApplicationLibCode/ReservoirDataModel/cvfGeometryTools.inl b/ApplicationLibCode/ReservoirDataModel/cvfGeometryTools.inl index 09f9fac4a7..4f7f7b90b5 100644 --- a/ApplicationLibCode/ReservoirDataModel/cvfGeometryTools.inl +++ b/ApplicationLibCode/ReservoirDataModel/cvfGeometryTools.inl @@ -555,8 +555,8 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads( std::vector* if intersected cv2 edge has endpoint touching cv1 then add endpoint to polygon. continue to add next endpoint until it does not touch Cv1 */ - if ( !cv1VxTouchCv2[nextCv1Idx] && ( cv1VxTouchCv2[cv1Idx] || ( intersectedCv2EdgeIdxs.size() ) ) ) // Two touches along edge also - // qualifies + if ( !cv1VxTouchCv2[nextCv1Idx] && ( cv1VxTouchCv2[cv1Idx] || ( !intersectedCv2EdgeIdxs.empty() ) ) ) // Two touches along edge also + // qualifies { if ( lastIntersection < intersectedCv2EdgeIdxs.size() ) { diff --git a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsDataCache.cpp b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsDataCache.cpp index 13e9b5c665..506fc60b49 100644 --- a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsDataCache.cpp +++ b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsDataCache.cpp @@ -426,7 +426,7 @@ void RigStatisticsDataCache::computeHistogramStatisticsIfNeeded( size_t timeStep //-------------------------------------------------------------------------------------------------- void RigStatisticsDataCache::computeUniqueValuesIfNeeded() { - if ( m_statsAllTimesteps.m_uniqueValues.size() == 0 ) + if ( m_statsAllTimesteps.m_uniqueValues.empty() ) { std::set setValues; m_statisticsCalculator->uniqueValues( 0, setValues ); // This is a Hack ! Only using first timestep. Ok for @@ -444,7 +444,7 @@ void RigStatisticsDataCache::computeUniqueValuesIfNeeded() //-------------------------------------------------------------------------------------------------- void RigStatisticsDataCache::computeUniqueValuesIfNeeded( size_t timeStepIndex ) { - if ( m_statsPrTs[timeStepIndex].m_uniqueValues.size() == 0 ) + if ( m_statsPrTs[timeStepIndex].m_uniqueValues.empty() ) { std::set setValues; m_statisticsCalculator->uniqueValues( timeStepIndex, setValues ); diff --git a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.cpp b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.cpp index 30aecf58fe..56864d8549 100644 --- a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.cpp +++ b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.cpp @@ -182,7 +182,7 @@ std::vector RigStatisticsMath::calculateNearestRankPercentiles( const st std::sort( sortedValues.begin(), sortedValues.end() ); std::vector percentiles( pValPositions.size(), HUGE_VAL ); - if ( sortedValues.size() ) + if ( !sortedValues.empty() ) { for ( size_t i = 0; i < pValPositions.size(); ++i ) { @@ -226,7 +226,7 @@ std::vector RigStatisticsMath::calculateInterpolatedPercentiles( const s std::sort( sortedValues.begin(), sortedValues.end() ); std::vector percentiles( pValPositions.size(), HUGE_VAL ); - if ( sortedValues.size() ) + if ( !sortedValues.empty() ) { for ( size_t i = 0; i < pValPositions.size(); ++i ) { diff --git a/ApplicationLibCode/SocketInterface/RiaNNCCommands.cpp b/ApplicationLibCode/SocketInterface/RiaNNCCommands.cpp index c173f3e151..aa567a5f91 100644 --- a/ApplicationLibCode/SocketInterface/RiaNNCCommands.cpp +++ b/ApplicationLibCode/SocketInterface/RiaNNCCommands.cpp @@ -402,7 +402,7 @@ class RiaSetNNCProperty : public RiaSocketCommand } } - if ( !m_requestedTimesteps.size() ) + if ( m_requestedTimesteps.empty() ) { server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) + RiaSocketServer::tr( "No time steps specified" ) ); diff --git a/ApplicationLibCode/SocketInterface/RiaPropertyDataCommands.cpp b/ApplicationLibCode/SocketInterface/RiaPropertyDataCommands.cpp index 521b03e41b..cba7bf5280 100644 --- a/ApplicationLibCode/SocketInterface/RiaPropertyDataCommands.cpp +++ b/ApplicationLibCode/SocketInterface/RiaPropertyDataCommands.cpp @@ -491,7 +491,7 @@ class RiaSetActiveCellProperty : public RiaSocketCommand } } - if ( !m_requestedTimesteps.size() ) + if ( m_requestedTimesteps.empty() ) { server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) + RiaSocketServer::tr( "No time steps specified" ).arg( porosityModelName ).arg( propertyName ) ); @@ -643,7 +643,7 @@ class RiaSetActiveCellProperty : public RiaSocketCommand size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T; for ( size_t i = 0; i < scalarResultFrames->size(); i++ ) { - if ( ( *scalarResultFrames )[i].size() > 0 ) + if ( !( *scalarResultFrames )[i].empty() ) { lastIndexWithDataPresent = i; } @@ -843,7 +843,7 @@ class RiaSetGridProperty : public RiaSocketCommand } } - if ( !m_requestedTimesteps.size() ) + if ( m_requestedTimesteps.empty() ) { server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) + RiaSocketServer::tr( "No time steps specified" ).arg( porosityModelName ).arg( propertyName ) ); @@ -1016,7 +1016,7 @@ class RiaSetGridProperty : public RiaSocketCommand size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T; for ( size_t i = 0; i < scalarResultFrames->size(); i++ ) { - if ( ( *scalarResultFrames )[i].size() > 0 ) + if ( !( *scalarResultFrames )[i].empty() ) { lastIndexWithDataPresent = i; } diff --git a/ApplicationLibCode/SocketInterface/RiaSocketServer.cpp b/ApplicationLibCode/SocketInterface/RiaSocketServer.cpp index c77e9e12e8..56d5a76584 100644 --- a/ApplicationLibCode/SocketInterface/RiaSocketServer.cpp +++ b/ApplicationLibCode/SocketInterface/RiaSocketServer.cpp @@ -209,7 +209,7 @@ bool RiaSocketServer::readCommandFromOctave() args.push_back( arg ); } - CVF_ASSERT( args.size() > 0 ); + CVF_ASSERT( !args.empty() ); // Create the actual RiaSocketCommand object that will interpret the socket data diff --git a/ApplicationLibCode/UnitTests/EclipseRftReader-Test.cpp b/ApplicationLibCode/UnitTests/EclipseRftReader-Test.cpp index e81a83bb33..ba5d23dcc0 100644 --- a/ApplicationLibCode/UnitTests/EclipseRftReader-Test.cpp +++ b/ApplicationLibCode/UnitTests/EclipseRftReader-Test.cpp @@ -26,14 +26,14 @@ TEST( DISABLED_RifReaderEclipseRftTest, TestRifEclipseRftAddress ) { std::vector values; reader.values( address, &values ); - EXPECT_TRUE( values.size() > 0 ); + EXPECT_TRUE( !values.empty() ); } - ASSERT_TRUE( addresses.size() > 0 ); + ASSERT_TRUE( !addresses.empty() ); std::vector values; reader.values( *addresses.begin(), &values ); - ASSERT_TRUE( values.size() > 0 ); + ASSERT_TRUE( !values.empty() ); std::cout << "First value: " << values.front() << ", last value: " << values.back() << std::endl; } diff --git a/ApplicationLibCode/UnitTests/RifEclipseUserDataKeywordTools-Test.cpp b/ApplicationLibCode/UnitTests/RifEclipseUserDataKeywordTools-Test.cpp index f6aeafcec9..6347f89d0a 100644 --- a/ApplicationLibCode/UnitTests/RifEclipseUserDataKeywordTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifEclipseUserDataKeywordTools-Test.cpp @@ -154,7 +154,7 @@ TEST( RifEclipseUserDataKeywordToolsTest, CreationOfSummaryAddresses ) EXPECT_EQ( address.category(), RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ); EXPECT_STREQ( quantity.data(), address.quantityName().data() ); - EXPECT_STREQ( columnData[0].data(), address.wellGroupName().data() ); + EXPECT_STREQ( columnData[0].data(), address.groupName().data() ); } // Well diff --git a/ApplicationLibCode/UnitTests/RifSurfaceImporter-Test.cpp b/ApplicationLibCode/UnitTests/RifSurfaceImporter-Test.cpp index 570bbb78aa..259630e40b 100644 --- a/ApplicationLibCode/UnitTests/RifSurfaceImporter-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifSurfaceImporter-Test.cpp @@ -105,8 +105,8 @@ TEST( RifSurfaceImporter, GocadReadNoProperty ) std::vector propNames = gocadData.propertyNames(); std::vector propValues = gocadData.propertyValues( "" ); - EXPECT_TRUE( propNames.size() == 0 ); - EXPECT_TRUE( propValues.size() == 0 ); + EXPECT_TRUE( propNames.empty() ); + EXPECT_TRUE( propValues.empty() ); } TEST( RifSurfaceImporter, GocadReadNonExistingProperty ) @@ -122,7 +122,7 @@ TEST( RifSurfaceImporter, GocadReadNonExistingProperty ) std::vector propValues = gocadData.propertyValues( "NonExistingProperty" ); - EXPECT_TRUE( propValues.size() == 0 ); + EXPECT_TRUE( propValues.empty() ); } TEST( RifSurfaceImporter, ReadWrongFileType ) @@ -221,7 +221,7 @@ TEST( RifSurfaceImporter, ReadTinyOpenWorksXyzFile ) EXPECT_EQ( (size_t)15, vertices.size() ); EXPECT_EQ( (size_t)24, indices.size() ); - if ( indices.size() > 0 ) + if ( !indices.empty() ) { EXPECT_EQ( (size_t)0, indices.front() ); EXPECT_EQ( (size_t)11, indices.back() ); @@ -249,7 +249,7 @@ TEST( RifSurfaceImporter, ReadLargeOpenWorksXyzFile ) EXPECT_EQ( (size_t)60805, vertices.size() ); EXPECT_EQ( (size_t)360792, indices.size() ); - if ( indices.size() > 0 ) + if ( !indices.empty() ) { EXPECT_EQ( (size_t)0, indices.front() ); EXPECT_EQ( (size_t)60802, indices.back() ); diff --git a/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp b/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp index 4519c861f4..f19bbb7e7e 100644 --- a/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp @@ -31,14 +31,14 @@ TEST( RiuSummaryQuantityNameInfoProvider, TestInit ) auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( s ); - EXPECT_TRUE( longName == "" ); + EXPECT_TRUE( longName.empty() ); } { std::string s( "does not exist" ); auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( s ); - EXPECT_TRUE( test == "" ); + EXPECT_TRUE( test.empty() ); } { diff --git a/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp b/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp index ff970acc63..cd55eba222 100644 --- a/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp +++ b/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp @@ -676,9 +676,9 @@ void RiuGroupedBarChartBuilder::addBarChartToPlot( QwtPlot* plot, Qt::Orientatio QwtScaleDiv groupAxisScaleDiv( 0, currentBarPosition ); { - if ( majTickPositions.size() ) groupAxisScaleDiv.setTicks( QwtScaleDiv::MajorTick, majTickPositions ); - if ( midTickPositions.size() ) groupAxisScaleDiv.setTicks( QwtScaleDiv::MediumTick, midTickPositions ); - if ( minTickPositions.size() ) groupAxisScaleDiv.setTicks( QwtScaleDiv::MinorTick, minTickPositions ); + if ( !majTickPositions.empty() ) groupAxisScaleDiv.setTicks( QwtScaleDiv::MajorTick, majTickPositions ); + if ( !midTickPositions.empty() ) groupAxisScaleDiv.setTicks( QwtScaleDiv::MediumTick, midTickPositions ); + if ( !minTickPositions.empty() ) groupAxisScaleDiv.setTicks( QwtScaleDiv::MinorTick, minTickPositions ); if ( barOrientation == Qt::Horizontal ) { @@ -739,17 +739,17 @@ void RiuGroupedBarChartBuilder::addBarChartToPlot( QwtPlot* plot, Qt::Orientatio if ( groupGrid ) { QwtScaleDiv gridDividerScaleDiv( 0, currentBarPosition ); - if ( majDividerPositions.size() ) + if ( !majDividerPositions.empty() ) { gridDividerScaleDiv.setTicks( QwtScaleDiv::MajorTick, majDividerPositions ); } - if ( midDividerPositions.size() ) + if ( !midDividerPositions.empty() ) { gridDividerScaleDiv.setTicks( QwtScaleDiv::MediumTick, midDividerPositions ); } - if ( minDividerPositions.size() ) + if ( !minDividerPositions.empty() ) { gridDividerScaleDiv.setTicks( QwtScaleDiv::MinorTick, minDividerPositions ); } diff --git a/ApplicationLibCode/UserInterface/Riu3dSelectionManager.cpp b/ApplicationLibCode/UserInterface/Riu3dSelectionManager.cpp index 218226231f..c64040799c 100644 --- a/ApplicationLibCode/UserInterface/Riu3dSelectionManager.cpp +++ b/ApplicationLibCode/UserInterface/Riu3dSelectionManager.cpp @@ -136,7 +136,7 @@ bool Riu3dSelectionManager::isEmpty( int role ) const { const std::vector& s = m_selection[role]; - return s.size() == 0; + return s.empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuCellAndNncPickEventHandler.cpp b/ApplicationLibCode/UserInterface/RiuCellAndNncPickEventHandler.cpp index bc73349694..2863191de4 100644 --- a/ApplicationLibCode/UserInterface/RiuCellAndNncPickEventHandler.cpp +++ b/ApplicationLibCode/UserInterface/RiuCellAndNncPickEventHandler.cpp @@ -82,7 +82,7 @@ bool RiuCellAndNncPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eve const cvf::Part* firstNncHitPart = nullptr; uint nncPartTriangleIndex = cvf::UNDEFINED_UINT; - if ( pickItemInfos.size() ) + if ( !pickItemInfos.empty() ) { size_t indexToFirstNoneNncItem = cvf::UNDEFINED_SIZE_T; size_t indexToNncItemNearFirstItem = cvf::UNDEFINED_SIZE_T; diff --git a/ApplicationLibCode/UserInterface/RiuContextMenuLauncher.cpp b/ApplicationLibCode/UserInterface/RiuContextMenuLauncher.cpp index 5a3280c146..3f644d1672 100644 --- a/ApplicationLibCode/UserInterface/RiuContextMenuLauncher.cpp +++ b/ApplicationLibCode/UserInterface/RiuContextMenuLauncher.cpp @@ -47,7 +47,7 @@ bool RiuContextMenuLauncher::eventFilter( QObject* watchedObject, QEvent* event QMenu menu; m_menuBuilder.appendToMenu( &menu ); - if ( menu.actions().size() > 0 ) + if ( !menu.actions().empty() ) { QContextMenuEvent* cme = static_cast( event ); CVF_ASSERT( cme ); diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index adb3f4f266..4a99613920 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -520,7 +520,7 @@ bool RiuDragDrop::handleGridCaseGroupDrop( Qt::DropAction action, caf::PdmObject bool RiuDragDrop::handleMultiPlotDrop( Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimMultiPlot* multiPlot, int insertAtPosition ) { std::vector plots = RiuTypedPdmObjects::typedObjectsFromGroup( draggedObjects ); - if ( plots.size() > 0 ) + if ( !plots.empty() ) { if ( action == Qt::MoveAction ) { @@ -542,7 +542,7 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop( Qt::DropAction action, { std::vector wellLogFileChannels = RiuTypedPdmObjects::typedObjectsFromGroup( draggedObjects ); - if ( wellLogFileChannels.size() > 0 ) + if ( !wellLogFileChannels.empty() ) { if ( action == Qt::CopyAction ) { @@ -552,7 +552,7 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop( Qt::DropAction action, } std::vector wellLogPlotCurves = RiuTypedPdmObjects::typedObjectsFromGroup( draggedObjects ); - if ( wellLogPlotCurves.size() > 0 ) + if ( !wellLogPlotCurves.empty() ) { if ( action == Qt::MoveAction ) { @@ -573,7 +573,7 @@ bool RiuDragDrop::handleWellLogPlotDrop( Qt::DropAction action, int insertAtPosition ) { std::vector wellLogPlotTracks = RiuTypedPdmObjects::typedObjectsFromGroup( draggedObjects ); - if ( wellLogPlotTracks.size() > 0 ) + if ( !wellLogPlotTracks.empty() ) { if ( action == Qt::MoveAction ) { @@ -591,7 +591,7 @@ bool RiuDragDrop::handleWellLogPlotDrop( Qt::DropAction action, bool RiuDragDrop::handleSummaryPlotDrop( Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimSummaryPlot* summaryPlot, int insertAtPosition ) { std::vector summaryCurves = RiuTypedPdmObjects::typedObjectsFromGroup( objectGroup ); - if ( summaryCurves.size() > 0 ) + if ( !summaryCurves.empty() ) { if ( action == Qt::MoveAction ) { @@ -611,7 +611,7 @@ bool RiuDragDrop::handleSummaryCaseCollectionDrop( Qt::DropAction act { std::vector summaryCases = RiuTypedPdmObjects::typedObjectsFromGroup( draggedObjects ); - if ( action != Qt::MoveAction || summaryCases.size() == 0 ) return false; + if ( action != Qt::MoveAction || summaryCases.empty() ) return false; for ( RimSummaryCase* summaryCase : summaryCases ) { @@ -646,7 +646,7 @@ bool RiuDragDrop::handleSummaryCaseMainCollectionDrop( Qt::DropAction { std::vector summaryCases = RiuTypedPdmObjects::typedObjectsFromGroup( draggedObjects ); - if ( action != Qt::MoveAction || summaryCases.size() == 0 ) return false; + if ( action != Qt::MoveAction || summaryCases.empty() ) return false; for ( RimSummaryCase* summaryCase : summaryCases ) { @@ -718,7 +718,7 @@ bool RiuDragDrop::handleSurfaceCollectionDrop( Qt::DropAction action, int row, c { std::vector surfaces = RiuTypedPdmObjects::typedObjectsFromGroup( objectGroup ); - if ( action != Qt::MoveAction || surfaces.size() == 0 ) return false; + if ( action != Qt::MoveAction || surfaces.empty() ) return false; for ( RimSurface* surface : surfaces ) { diff --git a/ApplicationLibCode/UserInterface/RiuFemResultTextBuilder.cpp b/ApplicationLibCode/UserInterface/RiuFemResultTextBuilder.cpp index 519fdfe31a..3d87efc054 100644 --- a/ApplicationLibCode/UserInterface/RiuFemResultTextBuilder.cpp +++ b/ApplicationLibCode/UserInterface/RiuFemResultTextBuilder.cpp @@ -271,7 +271,7 @@ void RiuFemResultTextBuilder::appendTextFromResultColors( RigGeoMechCaseData* { const std::vector& scalarResults = geomData->femPartResults()->resultValues( resultDefinition->resultAddress(), gridIndex, timeStepIndex, frameIndex ); - if ( scalarResults.size() ) + if ( !scalarResults.empty() ) { caf::AppEnum resPosAppEnum = resultDefinition->resultPositionType(); resultInfoText->append( resPosAppEnum.uiText() + ", " ); @@ -398,7 +398,7 @@ QString RiuFemResultTextBuilder::closestNodeResultText( RimGeoMechResultDefiniti const std::vector& scalarResults = geomData->femPartResults()->resultValues( resultColors->resultAddress(), m_gridIndex, m_timeStepIndex, m_frameIndex ); - if ( scalarResults.size() && m_displayCoordView ) + if ( !scalarResults.empty() && m_displayCoordView ) { RigFemPart* femPart = geomData->femParts()->part( m_gridIndex ); RigFemResultPosEnum activeResultPosition = resultColors->resultPositionType(); diff --git a/ApplicationLibCode/UserInterface/RiuFemTimeHistoryResultAccessor.cpp b/ApplicationLibCode/UserInterface/RiuFemTimeHistoryResultAccessor.cpp index aea3124085..8fb96bd661 100644 --- a/ApplicationLibCode/UserInterface/RiuFemTimeHistoryResultAccessor.cpp +++ b/ApplicationLibCode/UserInterface/RiuFemTimeHistoryResultAccessor.cpp @@ -180,7 +180,7 @@ void RiuFemTimeHistoryResultAccessor::computeTimeHistoryData() { const std::vector& scalarResults = m_geoMechCaseData->femPartResults()->resultValues( *m_femResultAddress, static_cast( m_gridIndex ), stepIdx, frameIdx ); - if ( scalarResults.size() ) + if ( !scalarResults.empty() ) { float scalarValue = scalarResults[scalarResultIndex]; diff --git a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp index 4dc900c739..0ce10200fe 100644 --- a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp @@ -358,7 +358,7 @@ void RiuFlowCharacteristicsPlot::contextMenuEvent( QContextMenuEvent* event ) QMenu menu; menuBuilder.appendToMenu( &menu ); - if ( menu.actions().size() > 0 ) + if ( !menu.actions().empty() ) { menu.exec( event->globalPos() ); } diff --git a/ApplicationLibCode/UserInterface/RiuGeoMechXfTensorResultAccessor.cpp b/ApplicationLibCode/UserInterface/RiuGeoMechXfTensorResultAccessor.cpp index f0cc4bf24e..9fadcb921c 100644 --- a/ApplicationLibCode/UserInterface/RiuGeoMechXfTensorResultAccessor.cpp +++ b/ApplicationLibCode/UserInterface/RiuGeoMechXfTensorResultAccessor.cpp @@ -165,7 +165,7 @@ void RiuGeoMechXfTensorResultAccessor::calculateInterpolatedValue( const cvf::Ve const RivIntersectionVertexWeights vertexWeights[3], float returnValues[3] ) { - if ( tens11->size() == 0 ) + if ( tens11->empty() ) { returnValues[0] = returnValues[1] = returnValues[2] = std::numeric_limits::infinity(); return; @@ -216,7 +216,7 @@ void RiuGeoMechXfTensorResultAccessor::calculateInterpolatedValue( const cvf::Ve //-------------------------------------------------------------------------------------------------- float RiuGeoMechXfTensorResultAccessor::calculateElmNodeValue( const std::array& triangle, int globalElmNodeResIndex ) { - if ( tens11->size() == 0 ) return std::numeric_limits::infinity(); + if ( tens11->empty() ) return std::numeric_limits::infinity(); cvf::Mat3f triangleXf = cvf::GeometryTools::computePlaneHorizontalRotationMx( triangle[1] - triangle[0], triangle[2] - triangle[0] ); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index c4ff5b96fb..569d15d07c 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -742,7 +742,7 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu() { QMenu* layoutsMenu = m_windowMenu->addMenu( "Use Window Layout" ); QMenu* deleteLayoutMenu = nullptr; - if ( names.size() > 0 ) deleteLayoutMenu = m_windowMenu->addMenu( "Delete Window Layout" ); + if ( !names.empty() ) deleteLayoutMenu = m_windowMenu->addMenu( "Delete Window Layout" ); for ( auto& defLayout : defaultNames ) { @@ -750,7 +750,7 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu() connect( defLayoutAction, SIGNAL( triggered() ), this, SLOT( setDefaultDockLayout() ) ); } - if ( defaultNames.size() > 0 ) layoutsMenu->addSeparator(); + if ( !defaultNames.empty() ) layoutsMenu->addSeparator(); for ( auto& layout : names ) { diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index ce754fe567..28c54b518a 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -385,7 +385,7 @@ void RiuMultiPlotBook::contextMenuEvent( QContextMenuEvent* event ) menuBuilder.appendToMenu( &menu ); - if ( menu.actions().size() > 0 ) + if ( !menu.actions().empty() ) { menu.exec( event->globalPos() ); } @@ -493,7 +493,7 @@ void RiuMultiPlotBook::performUpdate( RiaDefines::MultiPlotPageUpdateType whatTo if ( !m_plotDefinition || !m_plotDefinition->isValid() || !m_plotDefinition->showWindow() ) return; applyLook(); - if ( ( ( whatToUpdate & RiaDefines::MultiPlotPageUpdateType::PLOT ) == RiaDefines::MultiPlotPageUpdateType::PLOT ) || m_pages.size() == 0 ) + if ( ( ( whatToUpdate & RiaDefines::MultiPlotPageUpdateType::PLOT ) == RiaDefines::MultiPlotPageUpdateType::PLOT ) || m_pages.empty() ) { deleteAllPages(); createPages(); diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 06fe932f40..92a21d47de 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -451,7 +451,7 @@ void RiuMultiPlotPage::contextMenuEvent( QContextMenuEvent* event ) menuBuilder.appendToMenu( &menu ); - if ( menu.actions().size() > 0 ) + if ( !menu.actions().empty() ) { menu.exec( event->globalPos() ); } diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 73fe0e767c..53b177f227 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -992,7 +992,7 @@ void RiuPlotMainWindow::customMenuRequested( const QPoint& pos ) //-------------------------------------------------------------------------------------------------- bool RiuPlotMainWindow::isAnyMdiSubWindowVisible() { - return m_mdiArea->subWindowList().size() > 0; + return !m_mdiArea->subWindowList().empty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPvtPlotPanel.cpp b/ApplicationLibCode/UserInterface/RiuPvtPlotPanel.cpp index 4bb5793cc8..6cc42753f4 100644 --- a/ApplicationLibCode/UserInterface/RiuPvtPlotPanel.cpp +++ b/ApplicationLibCode/UserInterface/RiuPvtPlotPanel.cpp @@ -202,7 +202,7 @@ void RiuPvtPlotWidget::plotCurves( RiaDefines::EclipseUnitSystem for ( size_t i = 0; i < curveArr.size(); i++ ) { const RigFlowDiagSolverInterface::PvtCurve& curve = curveArr[i]; - if ( curve.phase == RigFlowDiagSolverInterface::PvtCurve::OIL && curve.pressureVals.size() > 0 && curve.yVals.size() > 0 ) + if ( curve.phase == RigFlowDiagSolverInterface::PvtCurve::OIL && !curve.pressureVals.empty() && !curve.yVals.empty() ) { xVals.push_back( curve.pressureVals[0] ); yVals.push_back( curve.yVals[0] ); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index 618be610f0..a2f6c543fe 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -197,7 +197,7 @@ void RiuQwtPlotCurve::drawSymbols( QPainter* painter, pointsToDisplay = points; } - if ( pointsToDisplay.size() > 0 ) + if ( !pointsToDisplay.empty() ) { symbol.drawSymbols( painter, pointsToDisplay ); diff --git a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp index 7b20750c41..0b8e5b6c2d 100644 --- a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp +++ b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp @@ -612,7 +612,7 @@ void RiuRelativePermeabilityPlotPanel::addCurveConstSaturationIntersectionMarker //-------------------------------------------------------------------------------------------------- double RiuRelativePermeabilityPlotPanel::interpolatedCurveYValue( const std::vector& xVals, const std::vector& yVals, double x ) { - if ( xVals.size() == 0 ) return HUGE_VAL; + if ( xVals.empty() ) return HUGE_VAL; if ( x < xVals.front() ) return HUGE_VAL; if ( x > xVals.back() ) return HUGE_VAL; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp index e8b04c71ce..503c81f2e7 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp @@ -518,7 +518,7 @@ void RiuSummaryVectorSelectionUi::setDefaultSelection( const std::vector

allSummaryCases(); - if ( allSumCases.size() > 0 ) + if ( !allSumCases.empty() ) { RifEclipseSummaryAddress defaultAddress; @@ -611,7 +611,7 @@ QList // Observed data auto observedDataColl = oilField->observedDataCollection(); - if ( observedDataColl->allObservedSummaryData().size() > 0 ) + if ( !observedDataColl->allObservedSummaryData().empty() ) { options.push_back( caf::PdmOptionItemInfo::createHeader( "Observed Data", true ) ); @@ -1033,7 +1033,7 @@ std::set auto isVectorField = identifierAndField != nullptr && identifierAndField->summaryIdentifier() == SummaryIdentifierType::INPUT_VECTOR_NAME; auto controllingIdentifierAndField = identifierAndField != nullptr ? lookupControllingField( identifierAndField ) : nullptr; - if ( !isVectorField && controllingIdentifierAndField != nullptr && controllingIdentifierAndField->pdmField()->v().size() == 0 ) + if ( !isVectorField && controllingIdentifierAndField != nullptr && controllingIdentifierAndField->pdmField()->v().empty() ) { return addrUnion; } @@ -1208,7 +1208,7 @@ std::set RiuSummaryVectorSelectionUi::buildAddressList std::set addressSet; for ( const auto& category : m_selectedSummaryCategories() ) { - if ( m_identifierFieldsMap.at( category ).size() == 0 || category == SummaryCategory::SUMMARY_INVALID ) continue; + if ( m_identifierFieldsMap.at( category ).empty() || category == SummaryCategory::SUMMARY_INVALID ) continue; const auto& identifierAndFieldList = m_identifierFieldsMap.at( category ); std::vector> selectionStack; @@ -1422,7 +1422,7 @@ void RiuSummaryVectorSelectionUi::appendOptionItemsForSubCategoriesAndVectors( Q if ( address.isErrorResult() ) continue; auto name = address.addressComponentUiText( identifierAndField->summaryIdentifier() ); - if ( name.size() > 0 ) + if ( !name.empty() ) { if ( isVectorField && address.isCalculated() ) { @@ -1443,7 +1443,7 @@ void RiuSummaryVectorSelectionUi::appendOptionItemsForSubCategoriesAndVectors( Q for ( int i = 0; i < itemCount; i++ ) { // Create headers only for vector fields when observed data is selected - bool hasObservedData = itemNames[OBS_DATA].size() > 0; + bool hasObservedData = !itemNames[OBS_DATA].empty(); bool groupItems = isVectorField && hasObservedData; if ( groupItems ) { diff --git a/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.cpp b/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.cpp index 10d07cad4c..bd57e9d412 100644 --- a/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.cpp +++ b/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.cpp @@ -113,7 +113,7 @@ bool RiuTreeViewEventFilter::eventFilter( QObject* obj, QEvent* event ) std::vector uiItems; caf::SelectionManager::instance()->selectedItems( uiItems ); - if ( uiItems.size() > 0 ) + if ( !uiItems.empty() ) { std::vector matches; if ( keyEvent->matches( QKeySequence::Copy ) ) diff --git a/ApplicationLibCode/UserInterface/RiuVfpQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuVfpQwtPlot.cpp index 39f342061f..55a673c22e 100644 --- a/ApplicationLibCode/UserInterface/RiuVfpQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuVfpQwtPlot.cpp @@ -38,7 +38,7 @@ RiuVfpQwtPlot::RiuVfpQwtPlot( RimVfpPlot* plot, QWidget* parent /*= nullptr*/ ) // Remove event filter to disable unwanted highlighting // on left click in plot. - removeEventFilter( this ); + QEventLoop::removeEventFilter( this ); canvas()->removeEventFilter( this ); } @@ -56,7 +56,7 @@ void RiuVfpQwtPlot::contextMenuEvent( QContextMenuEvent* event ) menuBuilder.appendToMenu( &menu ); - if ( menu.actions().size() > 0 ) + if ( !menu.actions().empty() ) { menu.exec( event->globalPos() ); }