Fixes by clang-tidy

This commit is contained in:
magnesj
2024-09-02 11:35:00 +00:00
committed by Magne Sjaastad
parent 4a2e730ee0
commit fc2106edb0
33 changed files with 115 additions and 85 deletions

View File

@@ -40,6 +40,7 @@
#include <chrono>
#include <cmath>
#include <cstdlib>
#include <memory>
#include <random>
CAF_PDM_SOURCE_INIT( RimFishbones, "FishbonesMultipleSubs" );
@@ -126,7 +127,7 @@ RimFishbones::RimFishbones()
m_pipeProperties = new RimFishbonesPipeProperties;
m_rigFishbonesGeometry = std::unique_ptr<RigFisbonesGeometry>( new RigFisbonesGeometry( this ) );
m_rigFishbonesGeometry = std::make_unique<RigFisbonesGeometry>( this );
setDeletable( true );
}

View File

@@ -18,6 +18,8 @@
#include "RimWellAllocationPlot.h"
#include <memory>
#include "RiaNumericalTools.h"
#include "RiaPlotDefines.h"
#include "RiaPreferences.h"
@@ -332,18 +334,18 @@ void RimWellAllocationPlot::updateFromWell()
RigEclCellIndexCalculator cellIdxCalc( m_case->eclipseCaseData()->mainGrid(),
m_case->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ),
nullptr );
wfCalculator.reset( new RigAccWellFlowCalculator( pipeBranchesCLCoords,
pipeBranchesCellIds,
tracerFractionCellValues,
cellIdxCalc,
smallContributionThreshold,
isProducer ) );
wfCalculator = std::make_unique<RigAccWellFlowCalculator>( pipeBranchesCLCoords,
pipeBranchesCellIds,
tracerFractionCellValues,
cellIdxCalc,
smallContributionThreshold,
isProducer );
}
else
{
if ( !pipeBranchesCLCoords.empty() )
{
wfCalculator.reset( new RigAccWellFlowCalculator( pipeBranchesCLCoords, pipeBranchesCellIds, smallContributionThreshold ) );
wfCalculator = std::make_unique<RigAccWellFlowCalculator>( pipeBranchesCLCoords, pipeBranchesCellIds, smallContributionThreshold );
}
}

View File

@@ -67,6 +67,7 @@
#include <algorithm>
#include <iterator>
#include <memory>
#include <tuple>
CAF_PDM_SOURCE_INIT( RimWellPltPlot, "WellPltPlot" );
@@ -507,11 +508,11 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
if ( sourceDef.sourceType() == RifDataSourceForRftPlt::SourceType::RFT_SIM_WELL_DATA )
{
resultPointCalc.reset( new RigRftResultPointCalculator( m_wellPathName, rimEclipseResultCase, timeStep ) );
resultPointCalc = std::make_unique<RigRftResultPointCalculator>( m_wellPathName, rimEclipseResultCase, timeStep );
}
else if ( sourceDef.sourceType() == RifDataSourceForRftPlt::SourceType::GRID_MODEL_CELL_DATA )
{
resultPointCalc.reset( new RigSimWellResultPointCalculator( m_wellPathName, rimEclipseResultCase, timeStep ) );
resultPointCalc = std::make_unique<RigSimWellResultPointCalculator>( m_wellPathName, rimEclipseResultCase, timeStep );
}
RiaDefines::EclipseUnitSystem unitSet = RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;

View File

@@ -66,6 +66,7 @@
#include "caf.h"
#include <QLocale>
#include <memory>
CAF_PDM_SOURCE_INIT( Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig" );
//--------------------------------------------------------------------------------------------------
@@ -98,7 +99,7 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
RimHistogramCalculator::StatisticsCellRangeType::VISIBLE_CELLS;
CAF_PDM_InitField( &m_statisticsCellRange, "StatisticsCellRange", defaultCellRange, "Statistics Cell Range" );
m_histogramCalculator.reset( new RimHistogramCalculator );
m_histogramCalculator = std::make_unique<RimHistogramCalculator>();
}
//--------------------------------------------------------------------------------------------------
@@ -240,7 +241,7 @@ RicGridStatisticsDialog* Rim3dOverlayInfoConfig::getOrCreateGridStatisticsDialog
{
if ( !m_gridStatisticsDialog )
{
m_gridStatisticsDialog.reset( new RicGridStatisticsDialog( nullptr ) );
m_gridStatisticsDialog = std::make_unique<RicGridStatisticsDialog>( nullptr );
}
CVF_ASSERT( m_gridStatisticsDialog );
return m_gridStatisticsDialog.get();

View File

@@ -18,6 +18,8 @@
#include "RimGridTimeHistoryCurve.h"
#include <memory>
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigFemResultAddress.h"
@@ -714,24 +716,22 @@ std::unique_ptr<RiuFemTimeHistoryResultAccessor> RimGridTimeHistoryCurve::femTim
intersectionTriangle[1] = cvf::Vec3f( geoMechTopItem->m_intersectionTriangle_1() );
intersectionTriangle[2] = cvf::Vec3f( geoMechTopItem->m_intersectionTriangle_2() );
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>(
new RiuFemTimeHistoryResultAccessor( geoMechTopItem->geoMechCase()->geoMechData(),
m_geoMechResultDefinition()->resultAddress(),
geoMechTopItem->m_gridIndex,
static_cast<int>( geoMechTopItem->m_cellIndex ),
geoMechTopItem->m_elementFace,
geoMechTopItem->m_localIntersectionPoint,
intersectionTriangle ) );
timeHistResultAccessor = std::make_unique<RiuFemTimeHistoryResultAccessor>( geoMechTopItem->geoMechCase()->geoMechData(),
m_geoMechResultDefinition()->resultAddress(),
geoMechTopItem->m_gridIndex,
static_cast<int>( geoMechTopItem->m_cellIndex ),
geoMechTopItem->m_elementFace,
geoMechTopItem->m_localIntersectionPoint,
intersectionTriangle );
}
else
{
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>(
new RiuFemTimeHistoryResultAccessor( geoMechTopItem->geoMechCase()->geoMechData(),
m_geoMechResultDefinition()->resultAddress(),
geoMechTopItem->m_gridIndex,
static_cast<int>( geoMechTopItem->m_cellIndex ),
geoMechTopItem->m_elementFace,
geoMechTopItem->m_localIntersectionPoint ) );
timeHistResultAccessor = std::make_unique<RiuFemTimeHistoryResultAccessor>( geoMechTopItem->geoMechCase()->geoMechData(),
m_geoMechResultDefinition()->resultAddress(),
geoMechTopItem->m_gridIndex,
static_cast<int>( geoMechTopItem->m_cellIndex ),
geoMechTopItem->m_elementFace,
geoMechTopItem->m_localIntersectionPoint );
}
}

View File

@@ -129,6 +129,7 @@
#include <QMenu>
#include <algorithm>
#include <memory>
CAF_PDM_SOURCE_INIT( RimProject, "ResInsightProject" );
//--------------------------------------------------------------------------------------------------
@@ -1545,7 +1546,7 @@ QString RimProject::updatedFilePathFromPathId( QString filePath, RiaVariableMapp
if ( pathListMapper == nullptr )
{
internalMapper.reset( new RiaVariableMapper( m_globalPathList ) );
internalMapper = std::make_unique<RiaVariableMapper>( m_globalPathList );
pathListMapper = internalMapper.get();
}

View File

@@ -35,6 +35,7 @@
#include "cafPdmUiTextEditor.h"
#include <algorithm>
#include <memory>
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimUserDefinedCalculation, "RimUserDefinedCalculation" );
@@ -77,7 +78,7 @@ RimUserDefinedCalculation::RimUserDefinedCalculation()
CAF_PDM_InitField( &m_id, "Id", -1, "Id" );
m_id.uiCapability()->setUiHidden( true );
m_exprContextMenuMgr = std::unique_ptr<RiuExpressionContextMenuManager>( new RiuExpressionContextMenuManager() );
m_exprContextMenuMgr = std::make_unique<RiuExpressionContextMenuManager>();
m_isDirty = false;
}

View File

@@ -78,6 +78,7 @@
#include <cmath>
#include <limits>
#include <memory>
CAF_PDM_SOURCE_INIT( RimStimPlanModel, "StimPlanModel" );
@@ -240,7 +241,7 @@ RimStimPlanModel::RimStimPlanModel()
CAF_PDM_InitScriptableFieldNoDefault( &m_perforationInterval, "PerforationInterval", "Perforation Interval" );
m_calculator = std::shared_ptr<RimStimPlanModelCalculator>( new RimStimPlanModelCalculator );
m_calculator = std::make_shared<RimStimPlanModelCalculator>();
m_calculator->setStimPlanModel( this );
setDeletable( true );

View File

@@ -33,6 +33,7 @@
#include <QDateTime>
#include <algorithm>
#include <memory>
namespace caf
{
@@ -297,7 +298,7 @@ void RimDerivedSummaryCase::createSummaryReaderInterface()
summaryCase1Reader2 = m_summaryCase2->summaryReader();
}
m_reader.reset( new RifDerivedEnsembleReader( this, summaryCase1Reader1, summaryCase1Reader2 ) );
m_reader = std::make_unique<RifDerivedEnsembleReader>( this, summaryCase1Reader1, summaryCase1Reader2 );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -79,6 +79,7 @@
#include "cafTitledOverlayFrame.h"
#include <algorithm>
#include <memory>
#include <utility>
//--------------------------------------------------------------------------------------------------
@@ -254,8 +255,8 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
m_summaryAddressNameTools = new RimSummaryCurveAutoName;
m_ensembleStatCaseY.reset( new RimEnsembleStatisticsCase() );
m_ensembleStatCaseXY.reset( new RimEnsembleCrossPlotStatisticsCase() );
m_ensembleStatCaseY = std::make_unique<RimEnsembleStatisticsCase>();
m_ensembleStatCaseXY = std::make_unique<RimEnsembleCrossPlotStatisticsCase>();
m_disableStatisticCurves = false;
m_isCurveSetFiltered = false;
@@ -1636,7 +1637,7 @@ RiaSummaryCurveDefinitionAnalyser* RimEnsembleCurveSet::getOrCreateSelectedCurve
{
if ( !m_analyserOfSelectedCurveDefs )
{
m_analyserOfSelectedCurveDefs = std::unique_ptr<RiaSummaryCurveDefinitionAnalyser>( new RiaSummaryCurveDefinitionAnalyser );
m_analyserOfSelectedCurveDefs = std::make_unique<RiaSummaryCurveDefinitionAnalyser>();
}
m_analyserOfSelectedCurveDefs->setCurveDefinitions( curveDefinitions() );
return m_analyserOfSelectedCurveDefs.get();

View File

@@ -50,6 +50,7 @@
#include <QCoreApplication>
#include <QDir>
#include <memory>
CAF_PDM_SOURCE_INIT( RimSummaryCaseMainCollection, "SummaryCaseCollection" );
@@ -78,7 +79,7 @@ void addCaseRealizationParametersIfFound( RimSummaryCase& sumCase, const QString
}
else
{
parameters = std::shared_ptr<RigCaseRealizationParameters>( new RigCaseRealizationParameters() );
parameters = std::make_shared<RigCaseRealizationParameters>();
}
if ( dynamic_cast<RimSummaryCaseSumo*>( &sumCase ) == nullptr )
@@ -548,7 +549,7 @@ std::vector<RimSummaryCase*>
if ( showProgress )
{
progress.reset( new caf::ProgressInfo( summaryHeaderFileInfos.size(), "Creating summary cases" ) );
progress = std::make_unique<caf::ProgressInfo>( summaryHeaderFileInfos.size(), "Creating summary cases" );
}
for ( const RifSummaryCaseFileResultInfo& fileInfo : summaryHeaderFileInfos )

View File

@@ -30,6 +30,7 @@
#include "cafPdmObjectScriptingCapability.h"
#include <QFileInfo>
#include <memory>
CAF_PDM_SOURCE_INIT( RimFileSurface, "Surface", "FileSurface" );
@@ -170,7 +171,7 @@ bool RimFileSurface::loadDataFromFile()
}
else if ( filePath.endsWith( "ts", Qt::CaseInsensitive ) )
{
m_gocadData.reset( new RigGocadData );
m_gocadData = std::make_unique<RigGocadData>();
RifSurfaceImporter::readGocadFile( filePath, m_gocadData.get() );

View File

@@ -68,6 +68,7 @@
#include "qwt_symbol.h"
#include <algorithm>
#include <memory>
#include <vector>
//--------------------------------------------------------------------------------------------------
@@ -143,7 +144,7 @@ RimEnsembleWellLogCurveSet::RimEnsembleWellLogCurveSet()
m_qwtPlotCurveForLegendText = new QwtPlotCurve;
m_qwtPlotCurveForLegendText->setLegendAttribute( QwtPlotCurve::LegendShowSymbol, true );
m_ensembleWellLogStatistics.reset( new RimEnsembleWellLogStatistics );
m_ensembleWellLogStatistics = std::make_unique<RimEnsembleWellLogStatistics>();
m_disableStatisticCurves = false;
m_isCurveSetFiltered = false;

View File

@@ -102,6 +102,7 @@
#include <QWheelEvent>
#include <algorithm>
#include <memory>
#include <set>
#define RI_LOGPLOTTRACK_MINX_DEFAULT -10.0
@@ -2842,7 +2843,7 @@ void RimWellLogTrack::updateRegionAnnotationsOnPlot()
if ( m_annotationTool == nullptr )
{
m_annotationTool = std::unique_ptr<RiuPlotAnnotationTool>( new RiuPlotAnnotationTool() );
m_annotationTool = std::make_unique<RiuPlotAnnotationTool>();
}
if ( m_regionAnnotationType == RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS )
@@ -3280,8 +3281,7 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
if ( wellPathAttributeSource()->wellPathGeometry() && ( m_showWellPathAttributes || m_showWellPathCompletions ) )
{
m_wellPathAttributePlotObjects.push_back(
std::unique_ptr<RiuWellPathComponentPlotItem>( new RiuWellPathComponentPlotItem( wellPathAttributeSource() ) ) );
m_wellPathAttributePlotObjects.push_back( std::make_unique<RiuWellPathComponentPlotItem>( wellPathAttributeSource() ) );
}
if ( m_showWellPathAttributes )