Add readability-simplify-boolean-expr

* Add readability-simplify-boolean-expr
* Fixes based on review
This commit is contained in:
Magne Sjaastad
2023-06-26 13:12:41 +02:00
committed by GitHub
parent 34d83efaed
commit 59ca0b943c
116 changed files with 179 additions and 635 deletions

View File

@@ -1,5 +1,5 @@
---
Checks: '-*,modernize-use-override,modernize-deprecated-headers,modernize-use-using,bugprone-bool-pointer-implicit-conversion,bugprone-parent-virtual-call,bugprone-redundant-branch-condition,bugprone-suspicious-semicolon,bugprone-suspicious-string-compare,modernize-redundant-void-arg,readability-static-accessed-through-instance'
Checks: '-*,modernize-use-override,modernize-deprecated-headers,modernize-use-using,bugprone-bool-pointer-implicit-conversion,bugprone-parent-virtual-call,bugprone-redundant-branch-condition,bugprone-suspicious-semicolon,bugprone-suspicious-string-compare,modernize-redundant-void-arg,readability-static-accessed-through-instance,readability-simplify-boolean-expr'
WarningsAsErrors: ''
HeaderFilterRegex: 'ApplicationLibCode/*.*$'
FormatStyle: 'file'

View File

@@ -784,12 +784,7 @@ bool RiaApplication::saveProjectAs( const QString& fileName, gsl::not_null<QStri
//--------------------------------------------------------------------------------------------------
bool RiaApplication::hasValidProjectFileExtension( const QString& fileName )
{
if ( fileName.contains( ".rsp", Qt::CaseInsensitive ) || fileName.contains( ".rip", Qt::CaseInsensitive ) )
{
return true;
}
return false;
return fileName.contains( ".rsp", Qt::CaseInsensitive ) || fileName.contains( ".rip", Qt::CaseInsensitive );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -335,12 +335,9 @@ QString RiaDefines::defaultDirectoryLabel( RiaDefines::ImportFileType fileType )
//--------------------------------------------------------------------------------------------------
bool RiaDefines::isInjector( WellProductionType wellProductionType )
{
if ( wellProductionType == RiaDefines::WellProductionType::GAS_INJECTOR ||
wellProductionType == RiaDefines::WellProductionType::OIL_INJECTOR ||
wellProductionType == RiaDefines::WellProductionType::WATER_INJECTOR )
return true;
return false;
return wellProductionType == RiaDefines::WellProductionType::GAS_INJECTOR ||
wellProductionType == RiaDefines::WellProductionType::OIL_INJECTOR ||
wellProductionType == RiaDefines::WellProductionType::WATER_INJECTOR;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -113,10 +113,5 @@ bool RiaEclipseFileNameTools::hasMatchingSuffix( const QString& fileName, Eclips
QString suffix = fi.completeSuffix();
if ( suffix.compare( caf::AppEnum<EclipseFileType>::text( fileType ), Qt::CaseInsensitive ) == 0 )
{
return true;
}
return false;
return suffix.compare( caf::AppEnum<EclipseFileType>::text( fileType ), Qt::CaseInsensitive ) == 0;
}

View File

@@ -146,9 +146,5 @@ bool RiaArgumentParser::parseArguments( cvf::ProgramOptions* progOpt )
// If positional parameter functionality is to be supported, the test for existence of positionalParameters must be
// removed This is based on a pull request by @andlaus https://github.com/OPM/ResInsight/pull/162
if ( !parseOk || !progOpt->positionalParameters().empty() )
{
return false;
}
return true;
return parseOk && progOpt->positionalParameters().empty();
}

View File

@@ -36,12 +36,7 @@
//--------------------------------------------------------------------------------------------------
bool RiaColorTools::isBrightnessAboveThreshold( cvf::Color3f backgroundColor )
{
if ( relativeLuminance( backgroundColor ) > 0.4 )
{
return true;
}
return false;
return relativeLuminance( backgroundColor ) > 0.4;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -163,10 +163,7 @@ std::string RiaStdStringTools::toUpper( const std::string& s )
//--------------------------------------------------------------------------------------------------
bool RiaStdStringTools::endsWith( const std::string& mainStr, const std::string& toMatch )
{
if ( mainStr.size() >= toMatch.size() && mainStr.compare( mainStr.size() - toMatch.size(), toMatch.size(), toMatch ) == 0 )
return true;
else
return false;
return mainStr.size() >= toMatch.size() && mainStr.compare( mainStr.size() - toMatch.size(), toMatch.size(), toMatch ) == 0;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -32,12 +32,7 @@ bool RiaTextStringTools::compare( const QString& expected, const QString& actual
// 2. report line numbers for all changes
// 3. add support for compare with content of a text file on disk
if ( expected.compare( actual ) == 0 )
{
return true;
}
return false;
return expected.compare( actual ) == 0;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -198,12 +198,7 @@ void calculateNewStepsFromJacobi( double dR1_dq1,
//--------------------------------------------------------------------------------------------------
bool isZeroCrossing( double newError, double oldError, double maxError )
{
if ( ( newError < -maxError && maxError < oldError ) || ( newError > maxError && -maxError > oldError ) )
{
return true;
}
return false;
return ( newError < -maxError && maxError < oldError ) || ( newError > maxError && -maxError > oldError );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -38,9 +38,7 @@ bool RicNewPlotDataFilterFeature::isCommandEnabled()
{
RimAnalysisPlot* analysisPlot = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimAnalysisPlot>();
if ( analysisPlot ) return true;
return false;
return analysisPlot != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -36,9 +36,7 @@ CAF_CMD_SOURCE_INIT( RicCopyStandardLegendFeature, "RicCopyStandardLegendFeature
//--------------------------------------------------------------------------------------------------
bool RicCopyStandardLegendFeature::isCommandEnabled()
{
if ( selectedColorLegend() ) return true;
return false;
return selectedColorLegend() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -35,9 +35,7 @@ CAF_CMD_SOURCE_INIT( RicInsertColorLegendFeature, "RicInsertColorLegendFeature"
//--------------------------------------------------------------------------------------------------
bool RicInsertColorLegendFeature::isCommandEnabled()
{
if ( selectedColorLegendCollection() ) return true;
return false;
return selectedColorLegendCollection() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -33,11 +33,7 @@ CAF_CMD_SOURCE_INIT( RicDeleteValveTemplateFeature, "RicDeleteValveTemplateFeatu
//--------------------------------------------------------------------------------------------------
bool RicDeleteValveTemplateFeature::isCommandEnabled()
{
if ( caf::SelectionManager::instance()->selectedItemOfType<RimValveTemplate>() )
{
return true;
}
return false;
return caf::SelectionManager::instance()->selectedItemOfType<RimValveTemplate>() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -125,10 +125,5 @@ void RicExportFishbonesLateralsFeature::setupActionLook( QAction* actionToSetup
//--------------------------------------------------------------------------------------------------
bool RicExportFishbonesLateralsFeature::isCommandEnabled()
{
if ( selectedFishbonesCollection() )
{
return true;
}
return false;
return selectedFishbonesCollection() != nullptr;
}

View File

@@ -76,10 +76,5 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::setupActionLook( QAction* action
//--------------------------------------------------------------------------------------------------
bool RicNewFishbonesSubsAtMeasuredDepthFeature::isCommandEnabled()
{
if ( RiuWellPathSelectionItem::wellPathSelectionItem() )
{
return true;
}
return false;
return RiuWellPathSelectionItem::wellPathSelectionItem() != nullptr;
}

View File

@@ -133,12 +133,7 @@ void RicNewFishbonesSubsFeature::setupActionLook( QAction* actionToSetup )
//--------------------------------------------------------------------------------------------------
bool RicNewFishbonesSubsFeature::isCommandEnabled()
{
if ( selectedFishbonesCollection() )
{
return true;
}
return false;
return selectedFishbonesCollection() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -79,10 +79,5 @@ void RicNewPerforationIntervalAtMeasuredDepthFeature::setupActionLook( QAction*
//--------------------------------------------------------------------------------------------------
bool RicNewPerforationIntervalAtMeasuredDepthFeature::isCommandEnabled()
{
if ( RiuWellPathSelectionItem::wellPathSelectionItem() )
{
return true;
}
return false;
return RiuWellPathSelectionItem::wellPathSelectionItem() != nullptr;
}

View File

@@ -608,7 +608,5 @@ bool RicNewStimPlanModelPlotFeature::useMinMaxTicksOnly( RiaDefines::CurveProper
RiaDefines::CurveProperty::PRESSURE,
RiaDefines::CurveProperty::INITIAL_PRESSURE };
if ( useMajorAndMinorTickmarks.count( property ) ) return false;
return true;
return useMajorAndMinorTickmarks.count( property ) == 0;
}

View File

@@ -91,10 +91,5 @@ void RicNewValveAtMeasuredDepthFeature::setupActionLook( QAction* actionToSetup
bool RicNewValveAtMeasuredDepthFeature::isCommandEnabled()
{
auto wellPathSelectionItem = RiuWellPathSelectionItem::wellPathSelectionItem();
if ( wellPathSelectionItem && dynamic_cast<RimPerforationInterval*>( wellPathSelectionItem->m_wellPathComponent ) )
{
return true;
}
return false;
return wellPathSelectionItem && dynamic_cast<RimPerforationInterval*>( wellPathSelectionItem->m_wellPathComponent );
}

View File

@@ -44,12 +44,7 @@ CAF_CMD_SOURCE_INIT( RicWellPathImportPerforationIntervalsFeature, "RicWellPathI
//--------------------------------------------------------------------------------------------------
bool RicWellPathImportPerforationIntervalsFeature::isCommandEnabled()
{
if ( RicWellPathImportPerforationIntervalsFeature::selectedWellPathCollection() != nullptr )
{
return true;
}
return false;
return RicWellPathImportPerforationIntervalsFeature::selectedWellPathCollection() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -36,12 +36,7 @@ bool RicExportCompletionsForVisibleSimWellsFeature::isCommandEnabled()
{
std::vector<RimSimWellInView*> simWells = visibleSimWells();
if ( simWells.empty() )
{
return false;
}
return true;
return !simWells.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -60,12 +60,7 @@ bool RicExportCompletionsForVisibleWellPathsFeature::isCommandEnabled()
std::vector<RimWellPath*> wellPaths = visibleWellPaths();
if ( wellPaths.empty() )
{
return false;
}
return true;
return !wellPaths.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -206,12 +206,7 @@ bool RicWellPathExportCompletionDataFeature::isCommandEnabled()
{
std::vector<RimWellPath*> wellPaths = selectedWellPaths();
if ( wellPaths.empty() )
{
return false;
}
return true;
return !wellPaths.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -851,7 +851,7 @@ bool RicWellPathExportMswCompletionsImpl::generatePerforationsMswExportInfo( Rim
{
if ( otherValve != valve )
{
bool hasIntersection = !( ( valve->endMD() < otherValve->startMD() ) || ( otherValve->endMD() < valve->startMD() ) );
bool hasIntersection = ( valve->endMD() >= otherValve->startMD() ) && ( otherValve->endMD() >= valve->startMD() );
if ( hasIntersection )
{

View File

@@ -31,12 +31,7 @@
bool RicEclipseWellFeatureImpl::isAnyWellSelected()
{
std::vector<RimSimWellInView*> selection = selectedWells();
if ( selection.size() > 0 )
{
return true;
}
return false;
return selection.size() > 0;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -49,9 +49,7 @@ bool RicEclipseHideFaultFeature::isCommandEnabled()
if ( !view ) return false;
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>( view );
if ( !eclView ) return false;
return true;
return eclView != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -50,9 +50,7 @@ bool RicEclipseShowOnlyFaultFeature::isCommandEnabled()
if ( !view ) return false;
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>( view );
if ( !eclView ) return false;
return true;
return eclView != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -43,12 +43,7 @@ CAF_CMD_SOURCE_INIT( RicExportCarfin, "RicExportCarfin" );
//--------------------------------------------------------------------------------------------------
bool RicExportCarfin::isCommandEnabled()
{
if ( RicExportCarfin::selectedCase() != nullptr )
{
return true;
}
return false;
return RicExportCarfin::selectedCase() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -96,7 +96,7 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells( Rim
CVF_ASSERT( flowDiagSolution );
RimFlowDiagSolution::TracerStatusType tracerStatus = flowDiagSolution->tracerStatusInTimeStep( selectedWell->name(), timeStep );
if ( !( tracerStatus == RimFlowDiagSolution::TracerStatusType::INJECTOR || tracerStatus == RimFlowDiagSolution::TracerStatusType::PRODUCER ) )
if ( tracerStatus != RimFlowDiagSolution::TracerStatusType::INJECTOR && tracerStatus != RimFlowDiagSolution::TracerStatusType::PRODUCER )
{
return;
}

View File

@@ -37,9 +37,7 @@ bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
{
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>( RiaGuiApplication::instance()->activePlotWindow() );
if ( wellAllocationPlot ) return true;
return false;
return wellAllocationPlot != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -39,12 +39,7 @@ bool RicShowTotalAllocationDataFeature::isCommandEnabled()
{
std::set<RimWellAllocationPlot*> wellAllocPlots = RicShowTotalAllocationDataFeature::selectedWellAllocationPlots();
if ( wellAllocPlots.size() > 0 )
{
return true;
}
return false;
return wellAllocPlots.size() > 0;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -65,12 +65,7 @@ bool RicShowWellAllocationPlotFeature::isCommandEnabled()
RimSimWellInView* simWellFromWellPath = eclView->wellCollection()->findWell( wellPathCollection[0]->associatedSimulationWellName() );
if ( simWellFromWellPath )
{
return true;
}
return false;
return simWellFromWellPath != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -139,10 +139,5 @@ bool RicNewSimWellFractureAtPosFeature::isCommandEnabled()
if ( !objHandle ) return false;
RimSimWellInView* eclipseWell = objHandle->firstAncestorOrThisOfType<RimSimWellInView>();
if ( eclipseWell )
{
return true;
}
return false;
return eclipseWell != nullptr;
}

View File

@@ -123,10 +123,5 @@ bool RicNewSimWellFractureFeature::isCommandEnabled()
if ( !objHandle ) return false;
auto simWell = objHandle->firstAncestorOrThisOfType<RimSimWellInView>();
if ( simWell )
{
return true;
}
return false;
return simWell != nullptr;
}

View File

@@ -135,12 +135,7 @@ void RicNewWellPathFractureFeature::setupActionLook( QAction* actionToSetup )
//--------------------------------------------------------------------------------------------------
bool RicNewWellPathFractureFeature::isCommandEnabled()
{
if ( selectedWellPathFractureCollection() )
{
return true;
}
return false;
return selectedWellPathFractureCollection() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -137,12 +137,5 @@ bool RicHoloLensAutoExportToSharingServerFeature::isCommandChecked()
bool RicHoloLensAutoExportToSharingServerFeature::isSessionValid() const
{
RicHoloLensSession* session = RicHoloLensSessionManager::instance()->session();
if ( session && session->isSessionValid() )
{
return true;
}
else
{
return false;
}
return session && session->isSessionValid();
}

View File

@@ -29,7 +29,7 @@ CAF_CMD_SOURCE_INIT( RicHoloLensCreateDummyFiledBackedSessionFeature, "RicHoloLe
//--------------------------------------------------------------------------------------------------
bool RicHoloLensCreateDummyFiledBackedSessionFeature::isCommandEnabled()
{
return RicHoloLensSessionManager::instance()->session() ? false : true;
return RicHoloLensSessionManager::instance()->session() == nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -36,7 +36,7 @@ CAF_CMD_SOURCE_INIT( RicHoloLensCreateSessionFeature, "RicHoloLensCreateSessionF
//--------------------------------------------------------------------------------------------------
bool RicHoloLensCreateSessionFeature::isCommandEnabled()
{
return RicHoloLensSessionManager::instance()->session() ? false : true;
return RicHoloLensSessionManager::instance()->session() == nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -35,14 +35,7 @@ CAF_CMD_SOURCE_INIT( RicHoloLensExportToSharingServerFeature, "RicHoloLensExport
bool RicHoloLensExportToSharingServerFeature::isCommandEnabled()
{
RicHoloLensSession* session = RicHoloLensSessionManager::instance()->session();
if ( session && session->isSessionValid() )
{
return true;
}
else
{
return false;
}
return session && session->isSessionValid();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -34,7 +34,7 @@ CAF_CMD_SOURCE_INIT( RicHoloLensTerminateSessionFeature, "RicHoloLensTerminateSe
//--------------------------------------------------------------------------------------------------
bool RicHoloLensTerminateSessionFeature::isCommandEnabled()
{
return RicHoloLensSessionManager::instance()->session() ? true : false;
return RicHoloLensSessionManager::instance()->session() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -70,14 +70,7 @@ VdeArrayDataPacket::VdeArrayDataPacket()
//--------------------------------------------------------------------------------------------------
bool VdeArrayDataPacket::isValid() const
{
if ( m_elementType != Unknown && m_packetBytes.size() >= VDE_HEADER_SIZE && m_arrayId >= 0 )
{
return true;
}
else
{
return false;
}
return m_elementType != Unknown && m_packetBytes.size() >= VDE_HEADER_SIZE && m_arrayId >= 0;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -91,12 +91,7 @@ bool VdeFileExporter::exportViewContents( const RimGridView& view )
VdePacketDirectory packetDirectory;
extractor.extractViewContents( &modelMetaJsonStr, &allReferencedArrayIds, &packetDirectory );
if ( !exportToFile( modelMetaJsonStr, packetDirectory, allReferencedArrayIds ) )
{
return false;
}
return true;
return exportToFile( modelMetaJsonStr, packetDirectory, allReferencedArrayIds );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -39,9 +39,7 @@ CAF_CMD_SOURCE_INIT( RicAppendIntersectionBoxFeature, "RicAppendIntersectionBoxF
bool RicAppendIntersectionBoxFeature::isCommandEnabled()
{
RimIntersectionCollection* coll = RicAppendIntersectionBoxFeature::intersectionCollection();
if ( coll ) return true;
return false;
return coll != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -42,14 +42,7 @@ bool RicExecuteScriptForCasesFeature::isCommandEnabled()
std::vector<RimCase*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 )
{
return true;
}
else
{
return false;
}
return !selection.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -61,9 +61,7 @@ bool RicPasteEclipseCasesFeature::isCommandEnabled()
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
RimIdenticalGridCaseGroup* gridCaseGroup = RicPasteFeatureImpl::findGridCaseGroup( destinationObject );
if ( gridCaseGroup ) return true;
return false;
return gridCaseGroup != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -60,9 +60,7 @@ bool RicPasteEclipseViewsFeature::isCommandEnabled()
if ( gridCaseGroup ) return false;
RimEclipseCase* eclipseCase = RicPasteFeatureImpl::findEclipseCase( destinationObject );
if ( eclipseCase ) return true;
return false;
return eclipseCase != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -54,9 +54,7 @@ bool RicPasteGeoMechViewsFeature::isCommandEnabled()
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
RimGeoMechCase* geoMechCase = RicPasteFeatureImpl::findGeoMechCase( destinationObject );
if ( geoMechCase ) return true;
return false;
return geoMechCase != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -54,12 +54,7 @@ bool RicPasteIntersectionsFeature::isCommandEnabled()
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
if ( findIntersectionCollection( destinationObject ) )
{
return true;
}
return false;
return findIntersectionCollection( destinationObject ) != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -41,9 +41,7 @@ bool RicAppendSummaryPlotsForSummaryCasesFeature::isCommandEnabled()
auto cases = selectedCases();
auto ensembles = selectedEnsembles();
if ( cases.empty() && ensembles.empty() ) return false;
return true;
return !( cases.empty() && ensembles.empty() );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -48,9 +48,7 @@ bool RicNewSummaryMultiPlotFeature::isCommandEnabled()
std::vector<RimSummaryCase*> selectedIndividualSummaryCases;
std::vector<RimSummaryCaseCollection*> selectedEnsembles;
if ( selectedCases( &selectedIndividualSummaryCases, &selectedEnsembles ) ) return true;
return false;
return selectedCases( &selectedIndividualSummaryCases, &selectedEnsembles );
}
//--------------------------------------------------------------------------------------------------
@@ -124,10 +122,5 @@ bool RicNewSummaryMultiPlotFeature::selectedCases( std::vector<RimSummaryCase*>*
}
// Second try selected summary cases
caf::SelectionManager::instance()->objectsByTypeStrict( selectedIndividualSummaryCases );
if ( !selectedIndividualSummaryCases->empty() )
{
return true;
}
return false;
return !selectedIndividualSummaryCases->empty();
}

View File

@@ -58,9 +58,7 @@ CAF_CMD_SOURCE_INIT( RicSaveMultiPlotTemplateFeature, "RicSaveMultiPlotTemplateF
//--------------------------------------------------------------------------------------------------
bool RicSaveMultiPlotTemplateFeature::isCommandEnabled()
{
if ( selectedSummaryPlot() ) return true;
return false;
return selectedSummaryPlot() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -43,14 +43,7 @@ CAF_CMD_SOURCE_INIT( RicFlyToObjectFeature, "RicFlyToObjectFeature" );
//--------------------------------------------------------------------------------------------------
bool RicFlyToObjectFeature::isCommandEnabled()
{
if ( RicFlyToObjectFeature::boundingBoxForSelectedObjects().isValid() )
{
return true;
}
else
{
return false;
}
return RicFlyToObjectFeature::boundingBoxForSelectedObjects().isValid();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -44,11 +44,7 @@ bool RicHideIntersectionBoxFeature::isCommandEnabled()
if ( !generalSelectionItem ) return false;
RimBoxIntersection* intersectionBox = dynamic_cast<RimBoxIntersection*>( generalSelectionItem->m_object );
if ( intersectionBox )
{
return true;
}
return false;
return intersectionBox != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -44,11 +44,7 @@ bool RicHideIntersectionFeature::isCommandEnabled()
if ( !generalSelectionItem ) return false;
RimExtrudedCurveIntersection* intersection = dynamic_cast<RimExtrudedCurveIntersection*>( generalSelectionItem->m_object );
if ( intersection )
{
return true;
}
return false;
return intersection != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -134,9 +134,7 @@ bool RicWellLogTools::isWellPathOrSimWellSelectedInView()
if ( simWellSelectionItem ) return true;
RiuWellPathSelectionItem* wellPathSelectionItem = dynamic_cast<RiuWellPathSelectionItem*>( selItem );
if ( wellPathSelectionItem ) return true;
return false;
return wellPathSelectionItem != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -67,9 +67,7 @@ RicSummaryPlotEditorDialog* RicEditSummaryCrossPlotFeature::curveCreatorDialog()
//--------------------------------------------------------------------------------------------------
bool RicEditSummaryCrossPlotFeature::isCommandEnabled()
{
if ( selectedSummaryPlot() ) return true;
return false;
return selectedSummaryPlot() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -104,9 +104,7 @@ void RicEditSummaryPlotFeature::editSummaryPlot( RimSummaryPlot* plot )
//--------------------------------------------------------------------------------------------------
bool RicEditSummaryPlotFeature::isCommandEnabled()
{
if ( selectedSummaryPlot() ) return true;
return false;
return selectedSummaryPlot() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -35,9 +35,7 @@ CAF_CMD_SOURCE_INIT( RicNewDerivedSummaryFeature, "RicNewDerivedSummaryFeature"
//--------------------------------------------------------------------------------------------------
bool RicNewDerivedSummaryFeature::isCommandEnabled()
{
if ( mainCollection() ) return true;
return false;
return mainCollection() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -84,9 +84,7 @@ bool RicOpenSummaryPlotEditorFeature::isCommandEnabled()
auto summaryCaseColl = dynamic_cast<RimSummaryCaseCollection*>( selObj );
auto obsColl = dynamic_cast<RimObservedDataCollection*>( selObj );
if ( summaryCase || summaryCaseColl || obsColl ) return true;
return false;
return summaryCase || summaryCaseColl || obsColl;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -89,11 +89,7 @@ bool RicToggleItemsFeatureImpl::isToggleCommandsForSubItems()
{
std::vector<caf::PdmUiItem*> selectedItems;
caf::SelectionManager::instance()->selectedItems( selectedItems );
if ( isToggleCommandsAvailable() && selectedItems.size() == 1 )
{
return true;
}
return false;
return isToggleCommandsAvailable() && selectedItems.size() == 1;
}
//--------------------------------------------------------------------------------------------------
@@ -110,7 +106,7 @@ void RicToggleItemsFeatureImpl::setObjectToggleStateForSelection( SelectionToggl
// contain a field with the target state value. When setting a value to a field with the same value, nothing happens and the UI will
// get an inconsistent state (some curves toggled off are still visible in a plot).
const bool targetState = ( state == TOGGLE_ON ) ? true : false;
const bool targetState = state == TOGGLE_ON;
for ( const auto& field : selectedFields )
{

View File

@@ -74,12 +74,7 @@ public:
}
}
if ( !m_viewsToLink.empty() )
{
return true;
}
return false;
return !m_viewsToLink.empty();
}
void execute() { RicLinkVisibleViewsFeature::linkViews( m_viewsToLink ); }

View File

@@ -36,15 +36,8 @@ public:
bool makeReady()
{
m_activeView = RiaApplication::instance()->activeReservoirView();
if ( m_activeView && m_activeView->viewer() && m_activeView->viewer()->viewerCommands() &&
m_activeView->viewer()->viewerCommands()->isCurrentPickInComparisonView() )
{
return true;
}
else
{
return false;
}
return m_activeView && m_activeView->viewer() && m_activeView->viewer()->viewerCommands() &&
m_activeView->viewer()->viewerCommands()->isCurrentPickInComparisonView();
}
void execute()

View File

@@ -43,12 +43,7 @@ bool RicShowLinkOptionsFeature::isCommandEnabled()
RimViewController* viewController = activeView->viewController();
if ( viewController )
{
return true;
}
return false;
return viewController != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -37,12 +37,7 @@ bool Ric3dWellLogCurveDeleteFeature::isCommandEnabled()
std::vector<Rim3dWellLogCurve*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
if ( objects.size() > 0 )
{
return true;
}
return false;
return !objects.empty();
}
//--------------------------------------------------------------------------------------------------
@@ -53,7 +48,7 @@ void Ric3dWellLogCurveDeleteFeature::onActionTriggered( bool isChecked )
std::vector<Rim3dWellLogCurve*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
if ( objects.size() == 0 ) return;
if ( objects.empty() ) return;
Rim3dWellLogCurve* firstCurve = objects[0];

View File

@@ -35,12 +35,7 @@ bool RicDeletePolylineTargetFeature::isCommandEnabled()
std::vector<RimPolylineTarget*> objects;
caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL );
if ( !objects.empty() )
{
return true;
}
return false;
return !objects.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -22,7 +22,9 @@ CAF_CMD_SOURCE_INIT( RicDeleteWellPathTargetFeature, "RicDeleteWellPathTargetFea
#include "RimModeledWellPath.h"
#include "RimWellPathGeometryDef.h"
#include "RimWellPathTarget.h"
#include "cafSelectionManager.h"
#include <QAction>
//--------------------------------------------------------------------------------------------------
@@ -33,12 +35,7 @@ bool RicDeleteWellPathTargetFeature::isCommandEnabled()
std::vector<RimWellPathTarget*> objects;
caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL );
if ( objects.size() > 0 )
{
return true;
}
return false;
return !objects.empty();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -48,12 +48,7 @@ CAF_CMD_SOURCE_INIT( RicNewWellPathLateralAtDepthFeature, "RicNewWellPathLateral
//--------------------------------------------------------------------------------------------------
bool RicNewWellPathLateralAtDepthFeature::isCommandEnabled()
{
if ( RiuWellPathSelectionItem::wellPathSelectionItem() )
{
return true;
}
return false;
return RiuWellPathSelectionItem::wellPathSelectionItem() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -32,20 +32,11 @@ CAF_CMD_SOURCE_INIT( RicShowWellPlanFeature, "RicShowWellPlanFeature" );
//--------------------------------------------------------------------------------------------------
///
///
/// RicShowPlotDataFeature
///
///
//--------------------------------------------------------------------------------------------------
bool RicShowWellPlanFeature::isCommandEnabled()
{
auto selectedWellPaths = caf::selectedObjectsByType<RimModeledWellPath*>();
if ( selectedWellPaths.size() > 0 )
{
return true;
}
return false;
return !selectedWellPaths.empty();
}
//--------------------------------------------------------------------------------------------------
@@ -56,8 +47,7 @@ void RicShowWellPlanFeature::onActionTriggered( bool isChecked )
this->disableModelChangeContribution();
std::vector<RimModeledWellPath*> selectedWellPaths = caf::selectedObjectsByType<RimModeledWellPath*>();
if ( selectedWellPaths.size() == 0 )
if ( selectedWellPaths.empty() )
{
return;
}

View File

@@ -121,7 +121,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorNormalized::calculate( int p
for ( int elmIdx = 0; elmIdx < femPart->elementCount(); ++elmIdx )
{
RigElementType elmType = femPart->elementType( elmIdx );
if ( !( elmType == HEX8 || elmType == HEX8P ) ) continue;
if ( elmType != HEX8 && elmType != HEX8P ) continue;
bool porRegion = false;
for ( int elmLocalNodeIdx = 0; elmLocalNodeIdx < 8; ++elmLocalNodeIdx )

View File

@@ -133,7 +133,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorStressGradients::calculate(
const int* cornerIndices = femPart->connectivities( elmIdx );
RigElementType elmType = femPart->elementType( elmIdx );
if ( !( elmType == HEX8P || elmType == HEX8 ) ) continue;
if ( elmType != HEX8P && elmType != HEX8 ) continue;
// Find the corner coordinates for element
std::array<cvf::Vec3d, 8> hexCorners;

View File

@@ -122,7 +122,7 @@ RigFemPartResultsCollection::RigFemPartResultsCollection( RifGeoMechReaderInterf
{
auto stepNameComplete = stepName;
if ( !( RiaRegressionTestRunner::instance()->isRunningRegressionTests() && m_readerInterface->frameTimes( stepIdx ).size() == 1 ) )
if ( !RiaRegressionTestRunner::instance()->isRunningRegressionTests() || m_readerInterface->frameTimes( stepIdx ).size() != 1 )
{
// Do not add postfix for time steps with a single frame to ensure identical generated snapshot
// name used by regression tests

View File

@@ -139,13 +139,8 @@ public:
bool operator==( const RigFemResultAddress& other ) const
{
if ( resultPosType != other.resultPosType || fieldName != other.fieldName || componentName != other.componentName ||
timeLapseBaseStepIdx != other.timeLapseBaseStepIdx || normalizedByHydrostaticPressure != other.normalizedByHydrostaticPressure )
{
return false;
}
return true;
return resultPosType == other.resultPosType && fieldName == other.fieldName && componentName == other.componentName &&
timeLapseBaseStepIdx == other.timeLapseBaseStepIdx && normalizedByHydrostaticPressure == other.normalizedByHydrostaticPressure;
}
private:

View File

@@ -94,11 +94,7 @@ bool RigGeoMechCaseData::open( std::string* errorMessage )
m_readerInterface = new RifOdbReader;
#endif
if ( m_readerInterface.notNull() && m_readerInterface->openFile( m_geoMechCaseFileName, errorMessage ) )
{
return true;
}
return false;
return m_readerInterface.notNull() && m_readerInterface->openFile( m_geoMechCaseFileName, errorMessage );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -81,7 +81,7 @@ ref<DrawableGeo> RivFemPartGeometryGenerator::generateSurface( const std::vector
//--------------------------------------------------------------------------------------------------
ref<DrawableGeo> RivFemPartGeometryGenerator::createMeshDrawable()
{
if ( !( m_quadVertices.notNull() && m_quadVertices->size() != 0 ) ) return nullptr;
if ( !m_quadVertices.notNull() || m_quadVertices->size() == 0 ) return nullptr;
ref<DrawableGeo> geo = new DrawableGeo;
geo->setVertexArray( m_quadVertices.p() );
@@ -100,7 +100,7 @@ ref<DrawableGeo> RivFemPartGeometryGenerator::createMeshDrawable()
//--------------------------------------------------------------------------------------------------
ref<DrawableGeo> RivFemPartGeometryGenerator::createOutlineMeshDrawable( double creaseAngle )
{
if ( !( m_quadVertices.notNull() && m_quadVertices->size() != 0 ) ) return nullptr;
if ( !m_quadVertices.notNull() || m_quadVertices->size() == 0 ) return nullptr;
cvf::OutlineEdgeExtractor ee( creaseAngle, *m_quadVertices );
@@ -289,7 +289,7 @@ cvf::ref<cvf::DrawableGeo> RivFemPartGeometryGenerator::createMeshDrawableFromSi
quadVertices->assign( vertices );
}
if ( !( quadVertices.notNull() && quadVertices->size() != 0 ) ) return nullptr;
if ( !quadVertices.notNull() || quadVertices->size() == 0 ) return nullptr;
ref<DrawableGeo> geo = new DrawableGeo;
geo->setVertexArray( quadVertices.p() );

View File

@@ -458,8 +458,8 @@ void RimPlotDataFilterItem::updateMaxMinAndDefaultValues( bool forceDefault )
&m_upperLimit );
}
if ( forceDefault || !( m_min >= m_lowerLimit && m_min <= m_upperLimit ) ) m_min = m_lowerLimit;
if ( forceDefault || !( m_max >= m_lowerLimit && m_max <= m_upperLimit ) ) m_max = m_upperLimit;
if ( forceDefault || m_min < m_lowerLimit || m_min > m_upperLimit ) m_min = m_lowerLimit;
if ( forceDefault || m_max < m_lowerLimit || m_max > m_upperLimit ) m_max = m_upperLimit;
m_min.uiCapability()->setUiName( QString( "Min (%1)" ).arg( m_lowerLimit ) );
m_max.uiCapability()->setUiName( QString( "Max (%1)" ).arg( m_upperLimit ) );

View File

@@ -59,9 +59,7 @@ bool RimCellFilterInterval::isIncluded( size_t val ) const
size_t tmp = val - m_minIncludeVal;
if ( m_valid && ( tmp % m_step == 0 ) ) return true;
return false;
return m_valid && ( tmp % m_step == 0 );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -134,12 +134,7 @@ void RimEclipsePropertyFilter::rangeValues( double* lower, double* upper ) const
//--------------------------------------------------------------------------------------------------
bool RimEclipsePropertyFilter::isCategorySelectionActive() const
{
if ( m_resultDefinition->hasCategoryResult() && m_useCategorySelection )
{
return true;
}
return false;
return m_resultDefinition->hasCategoryResult() && m_useCategorySelection;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -213,12 +213,7 @@ void RimGeoMechPropertyFilter::updateActiveState()
//--------------------------------------------------------------------------------------------------
bool RimGeoMechPropertyFilter::isActiveAndHasResult()
{
if ( this->isActive() && this->resultDefinition->hasResult() )
{
return true;
}
return false;
return this->isActive() && this->resultDefinition->hasResult();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -603,12 +603,7 @@ std::vector<double>
//--------------------------------------------------------------------------------------------------
bool RimStimPlanFractureTemplate::hasConductivity() const
{
if ( m_stimPlanFractureDefinitionData.notNull() && !m_stimPlanFractureDefinitionData->conductivityResultNames().isEmpty() )
{
return true;
}
return false;
return m_stimPlanFractureDefinitionData.notNull() && !m_stimPlanFractureDefinitionData->conductivityResultNames().isEmpty();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -268,12 +268,7 @@ void RimWellFlowRateCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedF
bool RimWellFlowRateCurve::isUsingConnectionNumberDepthType() const
{
auto wellLogPlot = firstAncestorOrThisOfType<RimWellLogPlot>();
if ( wellLogPlot && wellLogPlot->depthType() == RiaDefines::DepthTypeEnum::CONNECTION_NUMBER )
{
return true;
}
return false;
return wellLogPlot && wellLogPlot->depthType() == RiaDefines::DepthTypeEnum::CONNECTION_NUMBER;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -531,7 +531,7 @@ std::vector<double> RimGeoMechContourMapProjection::gridCellValues( RigFemResult
for ( size_t globalCellIdx = 0; globalCellIdx < static_cast<size_t>( m_femPart->elementCount() ); ++globalCellIdx )
{
RigElementType elmType = m_femPart->elementType( globalCellIdx );
if ( !( elmType == HEX8 || elmType == HEX8P ) ) continue;
if ( elmType != HEX8 && elmType != HEX8P ) continue;
if ( resAddr.resultPosType == RIG_ELEMENT )
{

View File

@@ -1104,15 +1104,11 @@ bool RimGridCrossPlotDataSet::groupingByCategoryResult() const
//--------------------------------------------------------------------------------------------------
bool RimGridCrossPlotDataSet::groupingEnabled() const
{
if ( m_grouping != NO_GROUPING )
{
if ( m_grouping == GROUP_BY_RESULT && !m_groupingProperty->eclipseResultAddress().isValid() )
{
return false;
}
return true;
}
return false;
if ( m_grouping == NO_GROUPING ) return false;
if ( m_grouping == GROUP_BY_RESULT && !m_groupingProperty->eclipseResultAddress().isValid() ) return false;
return true;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -207,14 +207,7 @@ RimTernaryLegendConfig* RimIntersectionResultDefinition::ternaryLegendConfig() c
//--------------------------------------------------------------------------------------------------
bool RimIntersectionResultDefinition::isEclipseResultDefinition()
{
if ( dynamic_cast<RimEclipseCase*>( m_case() ) )
{
return true;
}
else
{
return false;
}
return dynamic_cast<RimEclipseCase*>( m_case() ) != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -1125,12 +1125,7 @@ void Rim3dView::addMeasurementToModel( cvf::ModelBasicList* measureModel )
bool Rim3dView::isMasterView() const
{
RimViewLinker* viewLinker = this->assosiatedViewLinker();
if ( viewLinker && this == viewLinker->masterView() )
{
return true;
}
return false;
return viewLinker && this == viewLinker->masterView();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -635,12 +635,8 @@ bool RimContourMapProjection::geometryNeedsUpdating() const
//--------------------------------------------------------------------------------------------------
bool RimContourMapProjection::resultRangeIsValid() const
{
if ( m_minResultAllTimeSteps == std::numeric_limits<double>::infinity() ||
m_maxResultAllTimeSteps == -std::numeric_limits<double>::infinity() )
{
return false;
}
return true;
return m_minResultAllTimeSteps != std::numeric_limits<double>::infinity() &&
m_maxResultAllTimeSteps != -std::numeric_limits<double>::infinity();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -1137,14 +1137,7 @@ bool RimEclipseResultDefinition::hasStaticResult() const
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
RigEclipseResultAddress gridScalarResultIndex = this->eclipseResultAddress();
if ( hasResult() && gridCellResults->timeStepCount( gridScalarResultIndex ) == 1 )
{
return true;
}
else
{
return false;
}
return hasResult() && gridCellResults->timeStepCount( gridScalarResultIndex ) == 1;
}
//--------------------------------------------------------------------------------------------------
@@ -1465,13 +1458,8 @@ bool RimEclipseResultDefinition::hasCategoryResult() const
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isFlowDiagOrInjectionFlooding() const
{
if ( this->m_resultType() == RiaDefines::ResultCatType::FLOW_DIAGNOSTICS ||
this->m_resultType() == RiaDefines::ResultCatType::INJECTION_FLOODING )
{
return true;
}
return false;
return this->m_resultType() == RiaDefines::ResultCatType::FLOW_DIAGNOSTICS ||
this->m_resultType() == RiaDefines::ResultCatType::INJECTION_FLOODING;
}
//--------------------------------------------------------------------------------------------------
@@ -1903,10 +1891,5 @@ bool RimEclipseResultDefinition::addPerCellFaceOptionsForVariableUiField() const
RimEclipsePropertyFilter* propFilter = firstAncestorOrThisOfType<RimEclipsePropertyFilter>();
RimCellEdgeColors* cellEdge = firstAncestorOrThisOfType<RimCellEdgeColors>();
if ( propFilter || curve || cellEdge )
{
return false;
}
return true;
return !( propFilter || curve || cellEdge );
}

View File

@@ -672,27 +672,27 @@ void RimEclipseStatisticsCase::updateSelectionListVisibilities()
isLocked ); // ||
// !caseGroup()->mainCase()->reservoirData()->results(RiaDefines::FRACTURE_MODEL)->resultCount()
m_selectedDynamicProperties.uiCapability()->setUiHidden( isLocked || !( m_porosityModel() == RiaDefines::PorosityModelType::MATRIX_MODEL &&
m_resultType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE ) );
m_selectedStaticProperties.uiCapability()->setUiHidden( isLocked || !( m_porosityModel() == RiaDefines::PorosityModelType::MATRIX_MODEL &&
m_resultType() == RiaDefines::ResultCatType::STATIC_NATIVE ) );
m_selectedGeneratedProperties.uiCapability()->setUiHidden( isLocked || !( m_porosityModel() == RiaDefines::PorosityModelType::MATRIX_MODEL &&
m_resultType() == RiaDefines::ResultCatType::GENERATED ) );
m_selectedInputProperties.uiCapability()->setUiHidden( isLocked || !( m_porosityModel() == RiaDefines::PorosityModelType::MATRIX_MODEL &&
m_resultType() == RiaDefines::ResultCatType::INPUT_PROPERTY ) );
m_selectedDynamicProperties.uiCapability()->setUiHidden( isLocked || m_porosityModel() != RiaDefines::PorosityModelType::MATRIX_MODEL ||
m_resultType() != RiaDefines::ResultCatType::DYNAMIC_NATIVE );
m_selectedStaticProperties.uiCapability()->setUiHidden( isLocked || m_porosityModel() != RiaDefines::PorosityModelType::MATRIX_MODEL ||
m_resultType() != RiaDefines::ResultCatType::STATIC_NATIVE );
m_selectedGeneratedProperties.uiCapability()->setUiHidden( isLocked || m_porosityModel() != RiaDefines::PorosityModelType::MATRIX_MODEL ||
m_resultType() != RiaDefines::ResultCatType::GENERATED );
m_selectedInputProperties.uiCapability()->setUiHidden( isLocked || m_porosityModel() != RiaDefines::PorosityModelType::MATRIX_MODEL ||
m_resultType() != RiaDefines::ResultCatType::INPUT_PROPERTY );
m_selectedFractureDynamicProperties.uiCapability()->setUiHidden( isLocked ||
!( m_porosityModel() == RiaDefines::PorosityModelType::FRACTURE_MODEL &&
m_resultType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE ) );
m_porosityModel() != RiaDefines::PorosityModelType::FRACTURE_MODEL ||
m_resultType() != RiaDefines::ResultCatType::DYNAMIC_NATIVE );
m_selectedFractureStaticProperties.uiCapability()->setUiHidden( isLocked ||
!( m_porosityModel() == RiaDefines::PorosityModelType::FRACTURE_MODEL &&
m_resultType() == RiaDefines::ResultCatType::STATIC_NATIVE ) );
m_selectedFractureGeneratedProperties.uiCapability()->setUiHidden(
isLocked ||
!( m_porosityModel() == RiaDefines::PorosityModelType::FRACTURE_MODEL && m_resultType() == RiaDefines::ResultCatType::GENERATED ) );
m_porosityModel() != RiaDefines::PorosityModelType::FRACTURE_MODEL ||
m_resultType() != RiaDefines::ResultCatType::STATIC_NATIVE );
m_selectedFractureGeneratedProperties.uiCapability()->setUiHidden( isLocked ||
m_porosityModel() != RiaDefines::PorosityModelType::FRACTURE_MODEL ||
m_resultType() != RiaDefines::ResultCatType::GENERATED );
m_selectedFractureInputProperties.uiCapability()->setUiHidden( isLocked ||
!( m_porosityModel() == RiaDefines::PorosityModelType::FRACTURE_MODEL &&
m_resultType() == RiaDefines::ResultCatType::INPUT_PROPERTY ) );
m_porosityModel() != RiaDefines::PorosityModelType::FRACTURE_MODEL ||
m_resultType() != RiaDefines::ResultCatType::INPUT_PROPERTY );
}
//--------------------------------------------------------------------------------------------------
@@ -713,15 +713,8 @@ void RimEclipseStatisticsCase::updatePercentileUiVisibility()
//--------------------------------------------------------------------------------------------------
bool RimEclipseStatisticsCase::hasComputedStatistics() const
{
if ( eclipseCaseData() && ( eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->existingResults().size() ||
eclipseCaseData()->results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->existingResults().size() ) )
{
return true;
}
else
{
return false;
}
return eclipseCaseData() && ( !eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->existingResults().empty() ||
!eclipseCaseData()->results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->existingResults().empty() );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -577,10 +577,7 @@ void RimPlotCurve::checkAndApplyDefaultFillColor()
//--------------------------------------------------------------------------------------------------
bool RimPlotCurve::isCrossPlotCurve() const
{
auto crossPlot = firstAncestorOrThisOfType<RimSummaryCrossPlot>();
if ( crossPlot ) return true;
return false;
return firstAncestorOrThisOfType<RimSummaryCrossPlot>() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -697,7 +697,7 @@ void RimRegularLegendConfig::defineEditorAttribute( const caf::PdmFieldHandle* f
//--------------------------------------------------------------------------------------------------
void RimRegularLegendConfig::updateFieldVisibility()
{
bool showRangeItems = m_mappingMode == MappingType::CATEGORY_INTEGER ? false : true;
bool showRangeItems = m_mappingMode != MappingType::CATEGORY_INTEGER;
m_numLevels.uiCapability()->setUiHidden( !showRangeItems );
m_precision.uiCapability()->setUiHidden( !showRangeItems );

View File

@@ -266,14 +266,7 @@ void RimSimWellInViewCollection::setShowWellCellsState( bool enable )
//--------------------------------------------------------------------------------------------------
bool RimSimWellInViewCollection::showWellCells()
{
if ( m_showWellCells().isFalse() )
{
return false;
}
else
{
return true;
}
return !m_showWellCells().isFalse();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -1133,10 +1133,5 @@ bool RimViewController::askUserToRestoreOriginalCellFilterCollection( const QStr
msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No );
int ret = msgBox.exec();
if ( ret == QMessageBox::Yes )
{
return false;
}
return true;
return ret != QMessageBox::Yes;
}

View File

@@ -176,10 +176,5 @@ bool RimViewManipulator::isBoundingBoxesOverlappingOrClose( const cvf::BoundingB
}
double centerDist = ( sourceBB.center() - destBB.center() ).length();
if ( centerDist < largestExtent * 5 )
{
return true;
}
return false;
return centerDist < largestExtent * 5;
}

View File

@@ -185,12 +185,7 @@ void RimViewWindow::revokeMdiWindowStatus()
//--------------------------------------------------------------------------------------------------
bool RimViewWindow::isMdiWindow() const
{
if ( m_windowController() )
{
return true;
}
return false;
return m_windowController() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -378,11 +378,7 @@ void RimWbsParameters::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
//--------------------------------------------------------------------------------------------------
bool RimWbsParameters::hasLasFileWithChannel( const QString& channel ) const
{
if ( m_wellPath && !RimWellLogFile::findMdAndChannelValuesForWellPath( m_wellPath, channel ).empty() )
{
return true;
}
return false;
return m_wellPath && !RimWellLogFile::findMdAndChannelValuesForWellPath( m_wellPath, channel ).empty();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -651,8 +651,8 @@ void RimEnsembleCurveFilter::updateMaxMinAndDefaultValues( bool forceDefault )
if ( RiaCurveDataTools::isValidValue( eParam.minValue, false ) ) m_lowerLimit = eParam.minValue;
if ( RiaCurveDataTools::isValidValue( eParam.maxValue, false ) ) m_upperLimit = eParam.maxValue;
if ( forceDefault || !( m_minValue >= m_lowerLimit && m_minValue <= m_upperLimit ) ) m_minValue = m_lowerLimit;
if ( forceDefault || !( m_maxValue >= m_lowerLimit && m_maxValue <= m_upperLimit ) ) m_maxValue = m_upperLimit;
if ( forceDefault || m_minValue < m_lowerLimit || m_minValue > m_upperLimit ) m_minValue = m_lowerLimit;
if ( forceDefault || m_maxValue < m_lowerLimit || m_maxValue > m_upperLimit ) m_maxValue = m_upperLimit;
m_minValue.uiCapability()->setUiName( QString( "Min (%1)" ).arg( m_lowerLimit ) );
m_maxValue.uiCapability()->setUiName( QString( "Max (%1)" ).arg( m_upperLimit ) );
@@ -675,8 +675,8 @@ void RimEnsembleCurveFilter::updateMaxMinAndDefaultValues( bool forceDefault )
m_lowerLimit = minObjValue;
m_upperLimit = maxObjValue;
if ( forceDefault || !( m_minValue >= m_lowerLimit && m_minValue <= m_upperLimit ) ) m_minValue = m_lowerLimit;
if ( forceDefault || !( m_maxValue >= m_lowerLimit && m_maxValue <= m_upperLimit ) ) m_maxValue = m_upperLimit;
if ( forceDefault || m_minValue < m_lowerLimit || m_minValue > m_upperLimit ) m_minValue = m_lowerLimit;
if ( forceDefault || m_maxValue < m_lowerLimit || m_maxValue > m_upperLimit ) m_maxValue = m_upperLimit;
m_minValue.uiCapability()->setUiName( QString( "Min (%1)" ).arg( m_lowerLimit ) );
m_maxValue.uiCapability()->setUiName( QString( "Max (%1)" ).arg( m_upperLimit ) );
@@ -691,8 +691,8 @@ void RimEnsembleCurveFilter::updateMaxMinAndDefaultValues( bool forceDefault )
m_lowerLimit = minMaxValues.first;
m_upperLimit = minMaxValues.second;
if ( forceDefault || !( m_minValue >= m_lowerLimit && m_minValue <= m_upperLimit ) ) m_minValue = m_lowerLimit;
if ( forceDefault || !( m_maxValue >= m_lowerLimit && m_maxValue <= m_upperLimit ) ) m_maxValue = m_upperLimit;
if ( forceDefault || m_minValue < m_lowerLimit || m_minValue > m_upperLimit ) m_minValue = m_lowerLimit;
if ( forceDefault || m_maxValue < m_lowerLimit || m_maxValue > m_upperLimit ) m_maxValue = m_upperLimit;
m_minValue.uiCapability()->setUiName( QString( "Min (%1)" ).arg( m_lowerLimit ) );
m_maxValue.uiCapability()->setUiName( QString( "Max (%1)" ).arg( m_upperLimit ) );

View File

@@ -57,9 +57,7 @@ bool RimMultiSummaryPlotNameHelper::isPlotDisplayingSingleVectorName() const
if ( nameHelper->isPlotDisplayingSingleVectorName() ) plotCountWithSingleQuantity++;
}
if ( plotCountWithSingleQuantity == 1 ) return true;
return false;
return plotCountWithSingleQuantity == 1;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -423,13 +423,8 @@ bool RimSummaryAddressCollection::isEnsemble() const
//--------------------------------------------------------------------------------------------------
bool RimSummaryAddressCollection::isFolder() const
{
if ( contentType() == CollectionContentType::WELL_FOLDER || contentType() == CollectionContentType::GROUP_FOLDER ||
contentType() == CollectionContentType::REGION_FOLDER )
{
return true;
}
return false;
return contentType() == CollectionContentType::WELL_FOLDER || contentType() == CollectionContentType::GROUP_FOLDER ||
contentType() == CollectionContentType::REGION_FOLDER;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -56,12 +56,7 @@ void caf::AppEnum<RimSummaryCurveAppearanceCalculator::CurveAppearanceType>::set
//--------------------------------------------------------------------------------------------------
bool isExcplicitHandled( char secondChar )
{
if ( secondChar == 'W' || secondChar == 'O' || secondChar == 'G' || secondChar == 'V' )
{
return true;
}
return false;
return secondChar == 'W' || secondChar == 'O' || secondChar == 'G' || secondChar == 'V';
}
//--------------------------------------------------------------------------------------------------

View File

@@ -187,7 +187,5 @@ bool RimFileSurface::loadDataFromFile()
m_vertices = surface.first;
m_tringleIndices = surface.second;
if ( m_vertices.empty() || m_tringleIndices.empty() ) return false;
return true;
return !( m_vertices.empty() || m_tringleIndices.empty() );
}

View File

@@ -445,7 +445,7 @@ void RimWellLogCurveCommonDataSource::analyseCurvesAndTracks( const std::vector<
}
if ( m_uniqueBranchDetection.size() == 1u )
{
setBranchDetectionToApply( *m_uniqueBranchDetection.begin() == true ? caf::Tristate::State::True : caf::Tristate::State::False );
setBranchDetectionToApply( *m_uniqueBranchDetection.begin() ? caf::Tristate::State::True : caf::Tristate::State::False );
}
if ( m_uniqueWellNames.size() == 1u )
{
@@ -460,7 +460,7 @@ void RimWellLogCurveCommonDataSource::analyseCurvesAndTracks( const std::vector<
if ( m_uniqueWbsSmoothing.size() == 1u )
{
setWbsSmoothingToApply( *m_uniqueWbsSmoothing.begin() == true ? caf::Tristate::State::True : caf::Tristate::State::False );
setWbsSmoothingToApply( *m_uniqueWbsSmoothing.begin() ? caf::Tristate::State::True : caf::Tristate::State::False );
}
if ( m_uniqueWbsSmoothingThreshold.size() == 1u )

Some files were not shown because too many files have changed in this diff Show More