Fixes by clang-tidy

This commit is contained in:
magnesj
2024-09-02 15:26:44 +02:00
committed by Magne Sjaastad
parent 4a2e730ee0
commit fc2106edb0
33 changed files with 115 additions and 85 deletions
@@ -259,7 +259,7 @@ void addToPathTree( PathNode* node, QStringList pathComponents, const QString& f
} }
} }
node->children.push_back( std::unique_ptr<PathNode>( new PathNode( pathComponent, node ) ) ); node->children.push_back( std::make_unique<PathNode>( pathComponent, node ) );
addToPathTree( node->children.back().get(), pathComponents, fileName ); addToPathTree( node->children.back().get(), pathComponents, fileName );
} }
else else
@@ -335,7 +335,7 @@ std::map<QString, QStringList> RiaFilePathTools::keyPathComponentsForEachFilePat
allComponents[fileName] = pathComponentsForFile; allComponents[fileName] = pathComponentsForFile;
} }
auto topNode = std::unique_ptr<PathNode>( new PathNode( "", nullptr ) ); auto topNode = std::make_unique<PathNode>( "", nullptr );
for ( auto keyComponentsPair : allComponents ) for ( auto keyComponentsPair : allComponents )
{ {
@@ -168,7 +168,7 @@ QFilePtr RicExportSelectedWellPathsFeature::openFileForExport( const QString& fo
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QTextStreamPtr RicExportSelectedWellPathsFeature::createOutputFileStream( QFile& file ) QTextStreamPtr RicExportSelectedWellPathsFeature::createOutputFileStream( QFile& file )
{ {
auto stream = QTextStreamPtr( new QTextStream( &file ) ); auto stream = std::make_shared<QTextStream>( &file );
stream->setRealNumberNotation( QTextStream::FixedNotation ); stream->setRealNumberNotation( QTextStream::FixedNotation );
stream->setRealNumberPrecision( 2 ); stream->setRealNumberPrecision( 2 );
return stream; return stream;
@@ -18,6 +18,8 @@
#include "RicGridCalculatorDialog.h" #include "RicGridCalculatorDialog.h"
#include <memory>
#include "RicCalculatorWidgetCreator.h" #include "RicCalculatorWidgetCreator.h"
#include "RicGridCalculatorUi.h" #include "RicGridCalculatorUi.h"
@@ -75,7 +77,7 @@ QWidget* RicGridCalculatorDialog::getCalculatorWidget()
{ {
if ( !m_calcEditor ) if ( !m_calcEditor )
{ {
m_calcEditor = std::unique_ptr<RicCalculatorWidgetCreator>( new RicCalculatorWidgetCreator( std::make_unique<RicGridCalculatorUi>() ) ); m_calcEditor = std::make_unique<RicCalculatorWidgetCreator>( std::make_unique<RicGridCalculatorUi>() );
} }
return m_calcEditor->getOrCreateWidget( this ); return m_calcEditor->getOrCreateWidget( this );
@@ -18,6 +18,8 @@
#include "RicSummaryCurveCalculatorDialog.h" #include "RicSummaryCurveCalculatorDialog.h"
#include <memory>
#include "RicCalculatorWidgetCreator.h" #include "RicCalculatorWidgetCreator.h"
#include "RicSummaryCurveCalculatorUi.h" #include "RicSummaryCurveCalculatorUi.h"
@@ -75,8 +77,7 @@ QWidget* RicSummaryCurveCalculatorDialog::getCalculatorWidget()
{ {
if ( !m_summaryCalcEditor ) if ( !m_summaryCalcEditor )
{ {
m_summaryCalcEditor = m_summaryCalcEditor = std::make_unique<RicCalculatorWidgetCreator>( std::make_unique<RicSummaryCurveCalculatorUi>() );
std::unique_ptr<RicCalculatorWidgetCreator>( new RicCalculatorWidgetCreator( std::make_unique<RicSummaryCurveCalculatorUi>() ) );
} }
return m_summaryCalcEditor->getOrCreateWidget( this ); return m_summaryCalcEditor->getOrCreateWidget( this );
@@ -38,6 +38,7 @@
#include <QFrame> #include <QFrame>
#include <QSplitter> #include <QSplitter>
#include <QTreeView> #include <QTreeView>
#include <memory>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -46,7 +47,7 @@ RicSummaryPlotEditorWidgetCreator::RicSummaryPlotEditorWidgetCreator( QWidget* p
{ {
m_parentWidget = parent; m_parentWidget = parent;
m_summaryCurveCreator.reset( new RicSummaryPlotEditorUi() ); m_summaryCurveCreator = std::make_unique<RicSummaryPlotEditorUi>();
setPdmObject( m_summaryCurveCreator.get() ); setPdmObject( m_summaryCurveCreator.get() );
} }
@@ -27,13 +27,14 @@
#include <QStringList> #include <QStringList>
#include <functional> #include <functional>
#include <memory>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RifCaseRealizationReader::RifCaseRealizationReader( const QString& fileName ) RifCaseRealizationReader::RifCaseRealizationReader( const QString& fileName )
{ {
m_parameters = std::shared_ptr<RigCaseRealizationParameters>( new RigCaseRealizationParameters() ); m_parameters = std::make_shared<RigCaseRealizationParameters>();
m_fileName = fileName; m_fileName = fileName;
} }
@@ -31,6 +31,7 @@
#include <QDateTime> #include <QDateTime>
#include <QFile> #include <QFile>
#include <QTextStream> #include <QTextStream>
#include <memory>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -56,7 +57,7 @@ bool RifColumnBasedUserData::parse( const QString& data, QString* errorText )
m_mapFromAddressToTimeStepIndex.clear(); m_mapFromAddressToTimeStepIndex.clear();
m_mapFromAddressToResultIndex.clear(); m_mapFromAddressToResultIndex.clear();
m_parser = std::unique_ptr<RifColumnBasedUserDataParser>( new RifColumnBasedUserDataParser( data, errorText ) ); m_parser = std::make_unique<RifColumnBasedUserDataParser>( data, errorText );
if ( !m_parser ) if ( !m_parser )
{ {
RiaLogging::error( QString( "Failed to parse file" ) ); RiaLogging::error( QString( "Failed to parse file" ) );
@@ -31,6 +31,7 @@
#include <QDateTime> #include <QDateTime>
#include <QFile> #include <QFile>
#include <QTextStream> #include <QTextStream>
#include <memory>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -54,7 +55,7 @@ bool RifCsvUserData::parse( const QString& fileName, const RifAsciiDataParseOpti
m_allResultAddresses.clear(); m_allResultAddresses.clear();
m_mapFromAddressToResultIndex.clear(); m_mapFromAddressToResultIndex.clear();
m_parser = std::unique_ptr<RifCsvUserDataFileParser>( new RifCsvUserDataFileParser( fileName, errorText ) ); m_parser = std::make_unique<RifCsvUserDataFileParser>( fileName, errorText );
if ( !m_parser->parse( parseOptions ) ) if ( !m_parser->parse( parseOptions ) )
{ {
RiaLogging::error( QString( "Failed to parse file" ) ); RiaLogging::error( QString( "Failed to parse file" ) );
@@ -31,6 +31,7 @@
#include <QFile> #include <QFile>
#include <QStringList> #include <QStringList>
#include <QTextStream> #include <QTextStream>
#include <memory>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -54,7 +55,7 @@ bool RifKeywordVectorUserData::parse( const QString& data, const QString& custom
m_allResultAddresses.clear(); m_allResultAddresses.clear();
m_timeSteps.clear(); m_timeSteps.clear();
m_parser = std::unique_ptr<RifKeywordVectorParser>( new RifKeywordVectorParser( data ) ); m_parser = std::make_unique<RifKeywordVectorParser>( data );
if ( !m_parser ) if ( !m_parser )
{ {
RiaLogging::error( QString( "Failed to parse file" ) ); RiaLogging::error( QString( "Failed to parse file" ) );
@@ -34,6 +34,7 @@
#include <QDateTime> #include <QDateTime>
#include <QFile> #include <QFile>
#include <QTextStream> #include <QTextStream>
#include <memory>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -68,7 +69,7 @@ bool RifRevealCsvSectionSummaryReader::parse( const QString&
parseOptions.timeSeriesColumnName = "Date"; parseOptions.timeSeriesColumnName = "Date";
parseOptions.defaultCategory = defaultCategory; parseOptions.defaultCategory = defaultCategory;
m_parser = std::unique_ptr<RifCsvUserDataPastedTextParser>( new RifCsvUserDataPastedTextParser( text, errorText ) ); m_parser = std::make_unique<RifCsvUserDataPastedTextParser>( text, errorText );
std::map<QString, std::pair<QString, double>> unitMapping = { { "Sm3", { "SM3", 1.0 } }, std::map<QString, std::pair<QString, double>> unitMapping = { { "Sm3", { "SM3", 1.0 } },
{ "Sm3/day", { "SM3/DAY", 1.0 } }, { "Sm3/day", { "SM3/DAY", 1.0 } },
{ "Sm3/day/bar", { "SM3/DAY/BAR", 1.0 } }, { "Sm3/day/bar", { "SM3/DAY/BAR", 1.0 } },
@@ -33,6 +33,7 @@
#include <QDateTime> #include <QDateTime>
#include <QFile> #include <QFile>
#include <QTextStream> #include <QTextStream>
#include <memory>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -76,7 +77,7 @@ std::pair<bool, QString> RifStimPlanCsvSummaryReader::parse( const QString& file
parseOptions.timeSeriesColumnName = "Time"; parseOptions.timeSeriesColumnName = "Time";
parseOptions.startDateTime = startDateTime; parseOptions.startDateTime = startDateTime;
m_parser = std::unique_ptr<RifCsvUserDataPastedTextParser>( new RifCsvUserDataPastedTextParser( fileContents, errorText ) ); m_parser = std::make_unique<RifCsvUserDataPastedTextParser>( fileContents, errorText );
if ( !m_parser->parse( parseOptions ) ) if ( !m_parser->parse( parseOptions ) )
{ {
@@ -40,6 +40,7 @@
#include <chrono> #include <chrono>
#include <cmath> #include <cmath>
#include <cstdlib> #include <cstdlib>
#include <memory>
#include <random> #include <random>
CAF_PDM_SOURCE_INIT( RimFishbones, "FishbonesMultipleSubs" ); CAF_PDM_SOURCE_INIT( RimFishbones, "FishbonesMultipleSubs" );
@@ -126,7 +127,7 @@ RimFishbones::RimFishbones()
m_pipeProperties = new RimFishbonesPipeProperties; m_pipeProperties = new RimFishbonesPipeProperties;
m_rigFishbonesGeometry = std::unique_ptr<RigFisbonesGeometry>( new RigFisbonesGeometry( this ) ); m_rigFishbonesGeometry = std::make_unique<RigFisbonesGeometry>( this );
setDeletable( true ); setDeletable( true );
} }
@@ -18,6 +18,8 @@
#include "RimWellAllocationPlot.h" #include "RimWellAllocationPlot.h"
#include <memory>
#include "RiaNumericalTools.h" #include "RiaNumericalTools.h"
#include "RiaPlotDefines.h" #include "RiaPlotDefines.h"
#include "RiaPreferences.h" #include "RiaPreferences.h"
@@ -332,18 +334,18 @@ void RimWellAllocationPlot::updateFromWell()
RigEclCellIndexCalculator cellIdxCalc( m_case->eclipseCaseData()->mainGrid(), RigEclCellIndexCalculator cellIdxCalc( m_case->eclipseCaseData()->mainGrid(),
m_case->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ), m_case->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ),
nullptr ); nullptr );
wfCalculator.reset( new RigAccWellFlowCalculator( pipeBranchesCLCoords, wfCalculator = std::make_unique<RigAccWellFlowCalculator>( pipeBranchesCLCoords,
pipeBranchesCellIds, pipeBranchesCellIds,
tracerFractionCellValues, tracerFractionCellValues,
cellIdxCalc, cellIdxCalc,
smallContributionThreshold, smallContributionThreshold,
isProducer ) ); isProducer );
} }
else else
{ {
if ( !pipeBranchesCLCoords.empty() ) if ( !pipeBranchesCLCoords.empty() )
{ {
wfCalculator.reset( new RigAccWellFlowCalculator( pipeBranchesCLCoords, pipeBranchesCellIds, smallContributionThreshold ) ); wfCalculator = std::make_unique<RigAccWellFlowCalculator>( pipeBranchesCLCoords, pipeBranchesCellIds, smallContributionThreshold );
} }
} }
@@ -67,6 +67,7 @@
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <memory>
#include <tuple> #include <tuple>
CAF_PDM_SOURCE_INIT( RimWellPltPlot, "WellPltPlot" ); CAF_PDM_SOURCE_INIT( RimWellPltPlot, "WellPltPlot" );
@@ -507,11 +508,11 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
if ( sourceDef.sourceType() == RifDataSourceForRftPlt::SourceType::RFT_SIM_WELL_DATA ) 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 ) 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; RiaDefines::EclipseUnitSystem unitSet = RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
@@ -66,6 +66,7 @@
#include "caf.h" #include "caf.h"
#include <QLocale> #include <QLocale>
#include <memory>
CAF_PDM_SOURCE_INIT( Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig" ); CAF_PDM_SOURCE_INIT( Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -98,7 +99,7 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
RimHistogramCalculator::StatisticsCellRangeType::VISIBLE_CELLS; RimHistogramCalculator::StatisticsCellRangeType::VISIBLE_CELLS;
CAF_PDM_InitField( &m_statisticsCellRange, "StatisticsCellRange", defaultCellRange, "Statistics Cell Range" ); 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 ) if ( !m_gridStatisticsDialog )
{ {
m_gridStatisticsDialog.reset( new RicGridStatisticsDialog( nullptr ) ); m_gridStatisticsDialog = std::make_unique<RicGridStatisticsDialog>( nullptr );
} }
CVF_ASSERT( m_gridStatisticsDialog ); CVF_ASSERT( m_gridStatisticsDialog );
return m_gridStatisticsDialog.get(); return m_gridStatisticsDialog.get();
@@ -18,6 +18,8 @@
#include "RimGridTimeHistoryCurve.h" #include "RimGridTimeHistoryCurve.h"
#include <memory>
#include "RigCaseCellResultsData.h" #include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h" #include "RigEclipseCaseData.h"
#include "RigFemResultAddress.h" #include "RigFemResultAddress.h"
@@ -714,24 +716,22 @@ std::unique_ptr<RiuFemTimeHistoryResultAccessor> RimGridTimeHistoryCurve::femTim
intersectionTriangle[1] = cvf::Vec3f( geoMechTopItem->m_intersectionTriangle_1() ); intersectionTriangle[1] = cvf::Vec3f( geoMechTopItem->m_intersectionTriangle_1() );
intersectionTriangle[2] = cvf::Vec3f( geoMechTopItem->m_intersectionTriangle_2() ); intersectionTriangle[2] = cvf::Vec3f( geoMechTopItem->m_intersectionTriangle_2() );
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>( timeHistResultAccessor = std::make_unique<RiuFemTimeHistoryResultAccessor>( geoMechTopItem->geoMechCase()->geoMechData(),
new RiuFemTimeHistoryResultAccessor( geoMechTopItem->geoMechCase()->geoMechData(), m_geoMechResultDefinition()->resultAddress(),
m_geoMechResultDefinition()->resultAddress(), geoMechTopItem->m_gridIndex,
geoMechTopItem->m_gridIndex, static_cast<int>( geoMechTopItem->m_cellIndex ),
static_cast<int>( geoMechTopItem->m_cellIndex ), geoMechTopItem->m_elementFace,
geoMechTopItem->m_elementFace, geoMechTopItem->m_localIntersectionPoint,
geoMechTopItem->m_localIntersectionPoint, intersectionTriangle );
intersectionTriangle ) );
} }
else else
{ {
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>( timeHistResultAccessor = std::make_unique<RiuFemTimeHistoryResultAccessor>( geoMechTopItem->geoMechCase()->geoMechData(),
new RiuFemTimeHistoryResultAccessor( geoMechTopItem->geoMechCase()->geoMechData(), m_geoMechResultDefinition()->resultAddress(),
m_geoMechResultDefinition()->resultAddress(), geoMechTopItem->m_gridIndex,
geoMechTopItem->m_gridIndex, static_cast<int>( geoMechTopItem->m_cellIndex ),
static_cast<int>( geoMechTopItem->m_cellIndex ), geoMechTopItem->m_elementFace,
geoMechTopItem->m_elementFace, geoMechTopItem->m_localIntersectionPoint );
geoMechTopItem->m_localIntersectionPoint ) );
} }
} }
@@ -129,6 +129,7 @@
#include <QMenu> #include <QMenu>
#include <algorithm> #include <algorithm>
#include <memory>
CAF_PDM_SOURCE_INIT( RimProject, "ResInsightProject" ); CAF_PDM_SOURCE_INIT( RimProject, "ResInsightProject" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -1545,7 +1546,7 @@ QString RimProject::updatedFilePathFromPathId( QString filePath, RiaVariableMapp
if ( pathListMapper == nullptr ) if ( pathListMapper == nullptr )
{ {
internalMapper.reset( new RiaVariableMapper( m_globalPathList ) ); internalMapper = std::make_unique<RiaVariableMapper>( m_globalPathList );
pathListMapper = internalMapper.get(); pathListMapper = internalMapper.get();
} }
@@ -35,6 +35,7 @@
#include "cafPdmUiTextEditor.h" #include "cafPdmUiTextEditor.h"
#include <algorithm> #include <algorithm>
#include <memory>
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimUserDefinedCalculation, "RimUserDefinedCalculation" ); CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimUserDefinedCalculation, "RimUserDefinedCalculation" );
@@ -77,7 +78,7 @@ RimUserDefinedCalculation::RimUserDefinedCalculation()
CAF_PDM_InitField( &m_id, "Id", -1, "Id" ); CAF_PDM_InitField( &m_id, "Id", -1, "Id" );
m_id.uiCapability()->setUiHidden( true ); m_id.uiCapability()->setUiHidden( true );
m_exprContextMenuMgr = std::unique_ptr<RiuExpressionContextMenuManager>( new RiuExpressionContextMenuManager() ); m_exprContextMenuMgr = std::make_unique<RiuExpressionContextMenuManager>();
m_isDirty = false; m_isDirty = false;
} }
@@ -78,6 +78,7 @@
#include <cmath> #include <cmath>
#include <limits> #include <limits>
#include <memory>
CAF_PDM_SOURCE_INIT( RimStimPlanModel, "StimPlanModel" ); CAF_PDM_SOURCE_INIT( RimStimPlanModel, "StimPlanModel" );
@@ -240,7 +241,7 @@ RimStimPlanModel::RimStimPlanModel()
CAF_PDM_InitScriptableFieldNoDefault( &m_perforationInterval, "PerforationInterval", "Perforation Interval" ); 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 ); m_calculator->setStimPlanModel( this );
setDeletable( true ); setDeletable( true );
@@ -33,6 +33,7 @@
#include <QDateTime> #include <QDateTime>
#include <algorithm> #include <algorithm>
#include <memory>
namespace caf namespace caf
{ {
@@ -297,7 +298,7 @@ void RimDerivedSummaryCase::createSummaryReaderInterface()
summaryCase1Reader2 = m_summaryCase2->summaryReader(); summaryCase1Reader2 = m_summaryCase2->summaryReader();
} }
m_reader.reset( new RifDerivedEnsembleReader( this, summaryCase1Reader1, summaryCase1Reader2 ) ); m_reader = std::make_unique<RifDerivedEnsembleReader>( this, summaryCase1Reader1, summaryCase1Reader2 );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -79,6 +79,7 @@
#include "cafTitledOverlayFrame.h" #include "cafTitledOverlayFrame.h"
#include <algorithm> #include <algorithm>
#include <memory>
#include <utility> #include <utility>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -254,8 +255,8 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
m_summaryAddressNameTools = new RimSummaryCurveAutoName; m_summaryAddressNameTools = new RimSummaryCurveAutoName;
m_ensembleStatCaseY.reset( new RimEnsembleStatisticsCase() ); m_ensembleStatCaseY = std::make_unique<RimEnsembleStatisticsCase>();
m_ensembleStatCaseXY.reset( new RimEnsembleCrossPlotStatisticsCase() ); m_ensembleStatCaseXY = std::make_unique<RimEnsembleCrossPlotStatisticsCase>();
m_disableStatisticCurves = false; m_disableStatisticCurves = false;
m_isCurveSetFiltered = false; m_isCurveSetFiltered = false;
@@ -1636,7 +1637,7 @@ RiaSummaryCurveDefinitionAnalyser* RimEnsembleCurveSet::getOrCreateSelectedCurve
{ {
if ( !m_analyserOfSelectedCurveDefs ) if ( !m_analyserOfSelectedCurveDefs )
{ {
m_analyserOfSelectedCurveDefs = std::unique_ptr<RiaSummaryCurveDefinitionAnalyser>( new RiaSummaryCurveDefinitionAnalyser ); m_analyserOfSelectedCurveDefs = std::make_unique<RiaSummaryCurveDefinitionAnalyser>();
} }
m_analyserOfSelectedCurveDefs->setCurveDefinitions( curveDefinitions() ); m_analyserOfSelectedCurveDefs->setCurveDefinitions( curveDefinitions() );
return m_analyserOfSelectedCurveDefs.get(); return m_analyserOfSelectedCurveDefs.get();
@@ -50,6 +50,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
#include <memory>
CAF_PDM_SOURCE_INIT( RimSummaryCaseMainCollection, "SummaryCaseCollection" ); CAF_PDM_SOURCE_INIT( RimSummaryCaseMainCollection, "SummaryCaseCollection" );
@@ -78,7 +79,7 @@ void addCaseRealizationParametersIfFound( RimSummaryCase& sumCase, const QString
} }
else else
{ {
parameters = std::shared_ptr<RigCaseRealizationParameters>( new RigCaseRealizationParameters() ); parameters = std::make_shared<RigCaseRealizationParameters>();
} }
if ( dynamic_cast<RimSummaryCaseSumo*>( &sumCase ) == nullptr ) if ( dynamic_cast<RimSummaryCaseSumo*>( &sumCase ) == nullptr )
@@ -548,7 +549,7 @@ std::vector<RimSummaryCase*>
if ( showProgress ) 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 ) for ( const RifSummaryCaseFileResultInfo& fileInfo : summaryHeaderFileInfos )
@@ -30,6 +30,7 @@
#include "cafPdmObjectScriptingCapability.h" #include "cafPdmObjectScriptingCapability.h"
#include <QFileInfo> #include <QFileInfo>
#include <memory>
CAF_PDM_SOURCE_INIT( RimFileSurface, "Surface", "FileSurface" ); CAF_PDM_SOURCE_INIT( RimFileSurface, "Surface", "FileSurface" );
@@ -170,7 +171,7 @@ bool RimFileSurface::loadDataFromFile()
} }
else if ( filePath.endsWith( "ts", Qt::CaseInsensitive ) ) else if ( filePath.endsWith( "ts", Qt::CaseInsensitive ) )
{ {
m_gocadData.reset( new RigGocadData ); m_gocadData = std::make_unique<RigGocadData>();
RifSurfaceImporter::readGocadFile( filePath, m_gocadData.get() ); RifSurfaceImporter::readGocadFile( filePath, m_gocadData.get() );
@@ -68,6 +68,7 @@
#include "qwt_symbol.h" #include "qwt_symbol.h"
#include <algorithm> #include <algorithm>
#include <memory>
#include <vector> #include <vector>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -143,7 +144,7 @@ RimEnsembleWellLogCurveSet::RimEnsembleWellLogCurveSet()
m_qwtPlotCurveForLegendText = new QwtPlotCurve; m_qwtPlotCurveForLegendText = new QwtPlotCurve;
m_qwtPlotCurveForLegendText->setLegendAttribute( QwtPlotCurve::LegendShowSymbol, true ); m_qwtPlotCurveForLegendText->setLegendAttribute( QwtPlotCurve::LegendShowSymbol, true );
m_ensembleWellLogStatistics.reset( new RimEnsembleWellLogStatistics ); m_ensembleWellLogStatistics = std::make_unique<RimEnsembleWellLogStatistics>();
m_disableStatisticCurves = false; m_disableStatisticCurves = false;
m_isCurveSetFiltered = false; m_isCurveSetFiltered = false;
@@ -102,6 +102,7 @@
#include <QWheelEvent> #include <QWheelEvent>
#include <algorithm> #include <algorithm>
#include <memory>
#include <set> #include <set>
#define RI_LOGPLOTTRACK_MINX_DEFAULT -10.0 #define RI_LOGPLOTTRACK_MINX_DEFAULT -10.0
@@ -2842,7 +2843,7 @@ void RimWellLogTrack::updateRegionAnnotationsOnPlot()
if ( m_annotationTool == nullptr ) 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 ) if ( m_regionAnnotationType == RiaDefines::RegionAnnotationType::FORMATION_ANNOTATIONS )
@@ -3280,8 +3281,7 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
if ( wellPathAttributeSource()->wellPathGeometry() && ( m_showWellPathAttributes || m_showWellPathCompletions ) ) if ( wellPathAttributeSource()->wellPathGeometry() && ( m_showWellPathAttributes || m_showWellPathCompletions ) )
{ {
m_wellPathAttributePlotObjects.push_back( m_wellPathAttributePlotObjects.push_back( std::make_unique<RiuWellPathComponentPlotItem>( wellPathAttributeSource() ) );
std::unique_ptr<RiuWellPathComponentPlotItem>( new RiuWellPathComponentPlotItem( wellPathAttributeSource() ) ) );
} }
if ( m_showWellPathAttributes ) if ( m_showWellPathAttributes )
@@ -110,7 +110,8 @@ RigEclipseCrossPlotResult RigEclipseCrossPlotDataExtractor::extract( RigEclipseC
if ( catValuesForAllSteps ) if ( catValuesForAllSteps )
{ {
int catIndex = timeStep >= (int)catValuesForAllSteps->size() ? 0 : timeStep; int catIndex = timeStep >= (int)catValuesForAllSteps->size() ? 0 : timeStep;
catAccessor.reset( new RigActiveCellsResultAccessor( mainGrid, &( catValuesForAllSteps->at( catIndex ) ), activeCellInfo ) ); catAccessor =
std::make_unique<RigActiveCellsResultAccessor>( mainGrid, &( catValuesForAllSteps->at( catIndex ) ), activeCellInfo );
} }
for ( size_t globalCellIdx = 0; globalCellIdx < activeCellInfo->reservoirCellCount(); ++globalCellIdx ) for ( size_t globalCellIdx = 0; globalCellIdx < activeCellInfo->reservoirCellCount(); ++globalCellIdx )
@@ -18,6 +18,8 @@
#include "RigFlowDiagSolverInterface.h" #include "RigFlowDiagSolverInterface.h"
#include <memory>
#include "RiaLogging.h" #include "RiaLogging.h"
#include "RifEclipseOutputFileTools.h" #include "RifEclipseOutputFileTools.h"
@@ -122,12 +124,12 @@ public:
try try
{ {
m_eclGraph.reset( new Opm::ECLGraph( Opm::ECLGraph::load( mainGrid, initData ) ) ); m_eclGraph = std::make_unique<Opm::ECLGraph>( Opm::ECLGraph::load( mainGrid, initData ) );
m_hasUnifiedRestartFile = false; m_hasUnifiedRestartFile = false;
m_poreVolume = m_eclGraph->poreVolume(); m_poreVolume = m_eclGraph->poreVolume();
m_eclSaturationFunc.reset( new Opm::ECLSaturationFunc( *m_eclGraph, initData ) ); m_eclSaturationFunc = std::make_unique<Opm::ECLSaturationFunc>( *m_eclGraph, initData );
} }
catch ( ... ) catch ( ... )
{ {
@@ -137,7 +139,7 @@ public:
try try
{ {
m_eclPvtCurveCollection.reset( new Opm::ECLPVT::ECLPvtCurveCollection( *m_eclGraph, initData ) ); m_eclPvtCurveCollection = std::make_unique<Opm::ECLPVT::ECLPvtCurveCollection>( *m_eclGraph, initData );
} }
catch ( ... ) catch ( ... )
{ {
@@ -256,7 +258,7 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate( size_t
// Create the Toolbox. // Create the Toolbox.
m_opmFlowDiagStaticData->m_fldToolbox.reset( new Opm::FlowDiagnostics::Toolbox{ connGraph } ); m_opmFlowDiagStaticData->m_fldToolbox = std::make_unique<Opm::FlowDiagnostics::Toolbox>( connGraph );
// Look for unified restart file // Look for unified restart file
QStringList m_filesWithSameBaseName; QStringList m_filesWithSameBaseName;
@@ -267,8 +269,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate( size_t
QString firstRestartFileName = RifEclipseOutputFileTools::firstFileNameOfType( m_filesWithSameBaseName, ECL_UNIFIED_RESTART_FILE ); QString firstRestartFileName = RifEclipseOutputFileTools::firstFileNameOfType( m_filesWithSameBaseName, ECL_UNIFIED_RESTART_FILE );
if ( !firstRestartFileName.isEmpty() ) if ( !firstRestartFileName.isEmpty() )
{ {
m_opmFlowDiagStaticData->m_unifiedRestartData.reset( m_opmFlowDiagStaticData->m_unifiedRestartData =
new Opm::ECLRestartData( Opm::ECLRestartData( firstRestartFileName.toStdString() ) ) ); std::make_unique<Opm::ECLRestartData>( Opm::ECLRestartData( firstRestartFileName.toStdString() ) );
m_opmFlowDiagStaticData->m_hasUnifiedRestartFile = true; m_opmFlowDiagStaticData->m_hasUnifiedRestartFile = true;
} }
else else
@@ -400,8 +402,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate( size_t
injectorCellSets.push_back( CellSet( CellSetID( tracerName ), tIt.second ) ); injectorCellSets.push_back( CellSet( CellSetID( tracerName ), tIt.second ) );
} }
injectorSolution.reset( injectorSolution =
new Toolbox::Forward( m_opmFlowDiagStaticData->m_fldToolbox->computeInjectionDiagnostics( injectorCellSets ) ) ); std::make_unique<Toolbox::Forward>( m_opmFlowDiagStaticData->m_fldToolbox->computeInjectionDiagnostics( injectorCellSets ) );
for ( const CellSetID& tracerId : injectorSolution->fd.startPoints() ) for ( const CellSetID& tracerId : injectorSolution->fd.startPoints() )
{ {
@@ -434,8 +436,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate( size_t
prodjCellSets.push_back( CellSet( CellSetID( tracerName ), tIt.second ) ); prodjCellSets.push_back( CellSet( CellSetID( tracerName ), tIt.second ) );
} }
producerSolution.reset( producerSolution =
new Toolbox::Reverse( m_opmFlowDiagStaticData->m_fldToolbox->computeProductionDiagnostics( prodjCellSets ) ) ); std::make_unique<Toolbox::Reverse>( m_opmFlowDiagStaticData->m_fldToolbox->computeProductionDiagnostics( prodjCellSets ) );
for ( const CellSetID& tracerId : producerSolution->fd.startPoints() ) for ( const CellSetID& tracerId : producerSolution->fd.startPoints() )
{ {
@@ -58,6 +58,7 @@
#include <QMenu> #include <QMenu>
#include <QResizeEvent> #include <QResizeEvent>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <memory>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -83,7 +84,7 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimGridCrossPlot* plot, QWidget* paren
SIGNAL( plotItemSelected( std::shared_ptr<RiuPlotItem>, bool, int ) ), SIGNAL( plotItemSelected( std::shared_ptr<RiuPlotItem>, bool, int ) ),
SLOT( onPlotItemSelected( std::shared_ptr<RiuPlotItem>, bool, int ) ) ); SLOT( onPlotItemSelected( std::shared_ptr<RiuPlotItem>, bool, int ) ) );
m_annotationTool = std::unique_ptr<RiuPlotAnnotationTool>( new RiuPlotAnnotationTool() ); m_annotationTool = std::make_unique<RiuPlotAnnotationTool>();
m_selectedPointMarker = new QwtPlotMarker; m_selectedPointMarker = new QwtPlotMarker;
// QwtPlotMarker takes ownership of the symbol, it is deleted in destructor of QwtPlotMarker // QwtPlotMarker takes ownership of the symbol, it is deleted in destructor of QwtPlotMarker
@@ -58,6 +58,7 @@
#include <cafDisplayCoordTransform.h> #include <cafDisplayCoordTransform.h>
#include <cassert> #include <cassert>
#include <memory>
//================================================================================================== //==================================================================================================
// //
@@ -206,24 +207,22 @@ void RiuSelectionChangedHandler::addResultCurveFromSelectionItem( const RiuGeoMe
if ( geomSelectionItem->m_hasIntersectionTriangle ) if ( geomSelectionItem->m_hasIntersectionTriangle )
{ {
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>( timeHistResultAccessor = std::make_unique<RiuFemTimeHistoryResultAccessor>( geomResDef->geoMechCase()->geoMechData(),
new RiuFemTimeHistoryResultAccessor( geomResDef->geoMechCase()->geoMechData(), geomResDef->resultAddress(),
geomResDef->resultAddress(), geomSelectionItem->m_gridIndex,
geomSelectionItem->m_gridIndex, static_cast<int>( geomSelectionItem->m_cellIndex ),
static_cast<int>( geomSelectionItem->m_cellIndex ), geomSelectionItem->m_elementFace,
geomSelectionItem->m_elementFace, intersectionPointInDomain,
intersectionPointInDomain, geomSelectionItem->m_intersectionTriangle );
geomSelectionItem->m_intersectionTriangle ) );
} }
else else
{ {
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>( timeHistResultAccessor = std::make_unique<RiuFemTimeHistoryResultAccessor>( geomResDef->geoMechCase()->geoMechData(),
new RiuFemTimeHistoryResultAccessor( geomResDef->geoMechCase()->geoMechData(), geomResDef->resultAddress(),
geomResDef->resultAddress(), geomSelectionItem->m_gridIndex,
geomSelectionItem->m_gridIndex, static_cast<int>( geomSelectionItem->m_cellIndex ),
static_cast<int>( geomSelectionItem->m_cellIndex ), geomSelectionItem->m_elementFace,
geomSelectionItem->m_elementFace, intersectionPointInDomain );
intersectionPointInDomain ) );
} }
QString curveName; QString curveName;
@@ -67,6 +67,7 @@
#include <QWheelEvent> #include <QWheelEvent>
#include <limits> #include <limits>
#include <memory>
static RimEnsembleCurveInfoTextProvider ensembleCurveInfoTextProvider; static RimEnsembleCurveInfoTextProvider ensembleCurveInfoTextProvider;
@@ -105,7 +106,7 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*=
// Do not set internal legends visible, as this will cause a performance hit. // Do not set internal legends visible, as this will cause a performance hit.
m_plotWidget->clearLegend(); m_plotWidget->clearLegend();
m_annotationTool = std::unique_ptr<RiuPlotAnnotationTool>( new RiuPlotAnnotationTool() ); m_annotationTool = std::make_unique<RiuPlotAnnotationTool>();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -30,6 +30,7 @@
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QLabel> #include <QLabel>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <memory>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -37,7 +38,7 @@
RiuSummaryVectorSelectionDialog::RiuSummaryVectorSelectionDialog( QWidget* parent ) RiuSummaryVectorSelectionDialog::RiuSummaryVectorSelectionDialog( QWidget* parent )
: QDialog( parent, RiuTools::defaultDialogFlags() ) : QDialog( parent, RiuTools::defaultDialogFlags() )
{ {
m_addrSelWidget = std::unique_ptr<RiuSummaryVectorSelectionWidgetCreator>( new RiuSummaryVectorSelectionWidgetCreator() ); m_addrSelWidget = std::make_unique<RiuSummaryVectorSelectionWidgetCreator>();
QWidget* addrWidget = m_addrSelWidget->getOrCreateWidget( this ); QWidget* addrWidget = m_addrSelWidget->getOrCreateWidget( this );
QVBoxLayout* mainLayout = new QVBoxLayout( this ); QVBoxLayout* mainLayout = new QVBoxLayout( this );
@@ -29,13 +29,14 @@
#include <QBoxLayout> #include <QBoxLayout>
#include <QFrame> #include <QFrame>
#include <QSplitter> #include <QSplitter>
#include <memory>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuSummaryVectorSelectionWidgetCreator::RiuSummaryVectorSelectionWidgetCreator() RiuSummaryVectorSelectionWidgetCreator::RiuSummaryVectorSelectionWidgetCreator()
{ {
m_summaryAddressSelection = std::unique_ptr<RiuSummaryVectorSelectionUi>( new RiuSummaryVectorSelectionUi() ); m_summaryAddressSelection = std::make_unique<RiuSummaryVectorSelectionUi>();
setPdmObject( m_summaryAddressSelection.get() ); setPdmObject( m_summaryAddressSelection.get() );
} }
@@ -66,6 +66,7 @@
#include <algorithm> #include <algorithm>
#include <QLabel> #include <QLabel>
#include <memory>
using cvf::ManipulatorTrackball; using cvf::ManipulatorTrackball;
@@ -1321,7 +1322,7 @@ void RiuViewer::showScaleLegend( bool show )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuViewer::setHoverCursor( const QCursor& cursor ) void RiuViewer::setHoverCursor( const QCursor& cursor )
{ {
s_hoverCursor.reset( new QCursor( cursor ) ); s_hoverCursor = std::make_unique<QCursor>( cursor );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------