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

@@ -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 );
}
else
@@ -335,7 +335,7 @@ std::map<QString, QStringList> RiaFilePathTools::keyPathComponentsForEachFilePat
allComponents[fileName] = pathComponentsForFile;
}
auto topNode = std::unique_ptr<PathNode>( new PathNode( "", nullptr ) );
auto topNode = std::make_unique<PathNode>( "", nullptr );
for ( auto keyComponentsPair : allComponents )
{

View File

@@ -168,7 +168,7 @@ QFilePtr RicExportSelectedWellPathsFeature::openFileForExport( const QString& fo
//--------------------------------------------------------------------------------------------------
QTextStreamPtr RicExportSelectedWellPathsFeature::createOutputFileStream( QFile& file )
{
auto stream = QTextStreamPtr( new QTextStream( &file ) );
auto stream = std::make_shared<QTextStream>( &file );
stream->setRealNumberNotation( QTextStream::FixedNotation );
stream->setRealNumberPrecision( 2 );
return stream;

View File

@@ -18,6 +18,8 @@
#include "RicGridCalculatorDialog.h"
#include <memory>
#include "RicCalculatorWidgetCreator.h"
#include "RicGridCalculatorUi.h"
@@ -75,7 +77,7 @@ QWidget* RicGridCalculatorDialog::getCalculatorWidget()
{
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 );

View File

@@ -18,6 +18,8 @@
#include "RicSummaryCurveCalculatorDialog.h"
#include <memory>
#include "RicCalculatorWidgetCreator.h"
#include "RicSummaryCurveCalculatorUi.h"
@@ -75,8 +77,7 @@ QWidget* RicSummaryCurveCalculatorDialog::getCalculatorWidget()
{
if ( !m_summaryCalcEditor )
{
m_summaryCalcEditor =
std::unique_ptr<RicCalculatorWidgetCreator>( new RicCalculatorWidgetCreator( std::make_unique<RicSummaryCurveCalculatorUi>() ) );
m_summaryCalcEditor = std::make_unique<RicCalculatorWidgetCreator>( std::make_unique<RicSummaryCurveCalculatorUi>() );
}
return m_summaryCalcEditor->getOrCreateWidget( this );

View File

@@ -38,6 +38,7 @@
#include <QFrame>
#include <QSplitter>
#include <QTreeView>
#include <memory>
//--------------------------------------------------------------------------------------------------
///
@@ -46,7 +47,7 @@ RicSummaryPlotEditorWidgetCreator::RicSummaryPlotEditorWidgetCreator( QWidget* p
{
m_parentWidget = parent;
m_summaryCurveCreator.reset( new RicSummaryPlotEditorUi() );
m_summaryCurveCreator = std::make_unique<RicSummaryPlotEditorUi>();
setPdmObject( m_summaryCurveCreator.get() );
}

View File

@@ -27,13 +27,14 @@
#include <QStringList>
#include <functional>
#include <memory>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifCaseRealizationReader::RifCaseRealizationReader( const QString& fileName )
{
m_parameters = std::shared_ptr<RigCaseRealizationParameters>( new RigCaseRealizationParameters() );
m_parameters = std::make_shared<RigCaseRealizationParameters>();
m_fileName = fileName;
}

View File

@@ -31,6 +31,7 @@
#include <QDateTime>
#include <QFile>
#include <QTextStream>
#include <memory>
//--------------------------------------------------------------------------------------------------
///
@@ -56,7 +57,7 @@ bool RifColumnBasedUserData::parse( const QString& data, QString* errorText )
m_mapFromAddressToTimeStepIndex.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 )
{
RiaLogging::error( QString( "Failed to parse file" ) );

View File

@@ -31,6 +31,7 @@
#include <QDateTime>
#include <QFile>
#include <QTextStream>
#include <memory>
//--------------------------------------------------------------------------------------------------
///
@@ -54,7 +55,7 @@ bool RifCsvUserData::parse( const QString& fileName, const RifAsciiDataParseOpti
m_allResultAddresses.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 ) )
{
RiaLogging::error( QString( "Failed to parse file" ) );

View File

@@ -31,6 +31,7 @@
#include <QFile>
#include <QStringList>
#include <QTextStream>
#include <memory>
//--------------------------------------------------------------------------------------------------
///
@@ -54,7 +55,7 @@ bool RifKeywordVectorUserData::parse( const QString& data, const QString& custom
m_allResultAddresses.clear();
m_timeSteps.clear();
m_parser = std::unique_ptr<RifKeywordVectorParser>( new RifKeywordVectorParser( data ) );
m_parser = std::make_unique<RifKeywordVectorParser>( data );
if ( !m_parser )
{
RiaLogging::error( QString( "Failed to parse file" ) );

View File

@@ -34,6 +34,7 @@
#include <QDateTime>
#include <QFile>
#include <QTextStream>
#include <memory>
//--------------------------------------------------------------------------------------------------
///
@@ -68,7 +69,7 @@ bool RifRevealCsvSectionSummaryReader::parse( const QString&
parseOptions.timeSeriesColumnName = "Date";
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 } },
{ "Sm3/day", { "SM3/DAY", 1.0 } },
{ "Sm3/day/bar", { "SM3/DAY/BAR", 1.0 } },

View File

@@ -33,6 +33,7 @@
#include <QDateTime>
#include <QFile>
#include <QTextStream>
#include <memory>
//--------------------------------------------------------------------------------------------------
///
@@ -76,7 +77,7 @@ std::pair<bool, QString> RifStimPlanCsvSummaryReader::parse( const QString& file
parseOptions.timeSeriesColumnName = "Time";
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 ) )
{

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 )

View File

@@ -110,7 +110,8 @@ RigEclipseCrossPlotResult RigEclipseCrossPlotDataExtractor::extract( RigEclipseC
if ( catValuesForAllSteps )
{
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 )

View File

@@ -18,6 +18,8 @@
#include "RigFlowDiagSolverInterface.h"
#include <memory>
#include "RiaLogging.h"
#include "RifEclipseOutputFileTools.h"
@@ -122,12 +124,12 @@ public:
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_poreVolume = m_eclGraph->poreVolume();
m_eclSaturationFunc.reset( new Opm::ECLSaturationFunc( *m_eclGraph, initData ) );
m_eclSaturationFunc = std::make_unique<Opm::ECLSaturationFunc>( *m_eclGraph, initData );
}
catch ( ... )
{
@@ -137,7 +139,7 @@ public:
try
{
m_eclPvtCurveCollection.reset( new Opm::ECLPVT::ECLPvtCurveCollection( *m_eclGraph, initData ) );
m_eclPvtCurveCollection = std::make_unique<Opm::ECLPVT::ECLPvtCurveCollection>( *m_eclGraph, initData );
}
catch ( ... )
{
@@ -256,7 +258,7 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate( size_t
// 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
QStringList m_filesWithSameBaseName;
@@ -267,8 +269,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate( size_t
QString firstRestartFileName = RifEclipseOutputFileTools::firstFileNameOfType( m_filesWithSameBaseName, ECL_UNIFIED_RESTART_FILE );
if ( !firstRestartFileName.isEmpty() )
{
m_opmFlowDiagStaticData->m_unifiedRestartData.reset(
new Opm::ECLRestartData( Opm::ECLRestartData( firstRestartFileName.toStdString() ) ) );
m_opmFlowDiagStaticData->m_unifiedRestartData =
std::make_unique<Opm::ECLRestartData>( Opm::ECLRestartData( firstRestartFileName.toStdString() ) );
m_opmFlowDiagStaticData->m_hasUnifiedRestartFile = true;
}
else
@@ -400,8 +402,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate( size_t
injectorCellSets.push_back( CellSet( CellSetID( tracerName ), tIt.second ) );
}
injectorSolution.reset(
new Toolbox::Forward( m_opmFlowDiagStaticData->m_fldToolbox->computeInjectionDiagnostics( injectorCellSets ) ) );
injectorSolution =
std::make_unique<Toolbox::Forward>( m_opmFlowDiagStaticData->m_fldToolbox->computeInjectionDiagnostics( injectorCellSets ) );
for ( const CellSetID& tracerId : injectorSolution->fd.startPoints() )
{
@@ -434,8 +436,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate( size_t
prodjCellSets.push_back( CellSet( CellSetID( tracerName ), tIt.second ) );
}
producerSolution.reset(
new Toolbox::Reverse( m_opmFlowDiagStaticData->m_fldToolbox->computeProductionDiagnostics( prodjCellSets ) ) );
producerSolution =
std::make_unique<Toolbox::Reverse>( m_opmFlowDiagStaticData->m_fldToolbox->computeProductionDiagnostics( prodjCellSets ) );
for ( const CellSetID& tracerId : producerSolution->fd.startPoints() )
{

View File

@@ -58,6 +58,7 @@
#include <QMenu>
#include <QResizeEvent>
#include <QVBoxLayout>
#include <memory>
//--------------------------------------------------------------------------------------------------
///
@@ -83,7 +84,7 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimGridCrossPlot* plot, QWidget* paren
SIGNAL( plotItemSelected( 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;
// QwtPlotMarker takes ownership of the symbol, it is deleted in destructor of QwtPlotMarker

View File

@@ -58,6 +58,7 @@
#include <cafDisplayCoordTransform.h>
#include <cassert>
#include <memory>
//==================================================================================================
//
@@ -206,24 +207,22 @@ void RiuSelectionChangedHandler::addResultCurveFromSelectionItem( const RiuGeoMe
if ( geomSelectionItem->m_hasIntersectionTriangle )
{
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>(
new RiuFemTimeHistoryResultAccessor( geomResDef->geoMechCase()->geoMechData(),
geomResDef->resultAddress(),
geomSelectionItem->m_gridIndex,
static_cast<int>( geomSelectionItem->m_cellIndex ),
geomSelectionItem->m_elementFace,
intersectionPointInDomain,
geomSelectionItem->m_intersectionTriangle ) );
timeHistResultAccessor = std::make_unique<RiuFemTimeHistoryResultAccessor>( geomResDef->geoMechCase()->geoMechData(),
geomResDef->resultAddress(),
geomSelectionItem->m_gridIndex,
static_cast<int>( geomSelectionItem->m_cellIndex ),
geomSelectionItem->m_elementFace,
intersectionPointInDomain,
geomSelectionItem->m_intersectionTriangle );
}
else
{
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>(
new RiuFemTimeHistoryResultAccessor( geomResDef->geoMechCase()->geoMechData(),
geomResDef->resultAddress(),
geomSelectionItem->m_gridIndex,
static_cast<int>( geomSelectionItem->m_cellIndex ),
geomSelectionItem->m_elementFace,
intersectionPointInDomain ) );
timeHistResultAccessor = std::make_unique<RiuFemTimeHistoryResultAccessor>( geomResDef->geoMechCase()->geoMechData(),
geomResDef->resultAddress(),
geomSelectionItem->m_gridIndex,
static_cast<int>( geomSelectionItem->m_cellIndex ),
geomSelectionItem->m_elementFace,
intersectionPointInDomain );
}
QString curveName;

View File

@@ -67,6 +67,7 @@
#include <QWheelEvent>
#include <limits>
#include <memory>
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.
m_plotWidget->clearLegend();
m_annotationTool = std::unique_ptr<RiuPlotAnnotationTool>( new RiuPlotAnnotationTool() );
m_annotationTool = std::make_unique<RiuPlotAnnotationTool>();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -30,6 +30,7 @@
#include <QDialogButtonBox>
#include <QLabel>
#include <QVBoxLayout>
#include <memory>
//--------------------------------------------------------------------------------------------------
///
@@ -37,7 +38,7 @@
RiuSummaryVectorSelectionDialog::RiuSummaryVectorSelectionDialog( QWidget* parent )
: QDialog( parent, RiuTools::defaultDialogFlags() )
{
m_addrSelWidget = std::unique_ptr<RiuSummaryVectorSelectionWidgetCreator>( new RiuSummaryVectorSelectionWidgetCreator() );
m_addrSelWidget = std::make_unique<RiuSummaryVectorSelectionWidgetCreator>();
QWidget* addrWidget = m_addrSelWidget->getOrCreateWidget( this );
QVBoxLayout* mainLayout = new QVBoxLayout( this );

View File

@@ -29,13 +29,14 @@
#include <QBoxLayout>
#include <QFrame>
#include <QSplitter>
#include <memory>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuSummaryVectorSelectionWidgetCreator::RiuSummaryVectorSelectionWidgetCreator()
{
m_summaryAddressSelection = std::unique_ptr<RiuSummaryVectorSelectionUi>( new RiuSummaryVectorSelectionUi() );
m_summaryAddressSelection = std::make_unique<RiuSummaryVectorSelectionUi>();
setPdmObject( m_summaryAddressSelection.get() );
}

View File

@@ -66,6 +66,7 @@
#include <algorithm>
#include <QLabel>
#include <memory>
using cvf::ManipulatorTrackball;
@@ -1321,7 +1322,7 @@ void RiuViewer::showScaleLegend( bool show )
//--------------------------------------------------------------------------------------------------
void RiuViewer::setHoverCursor( const QCursor& cursor )
{
s_hoverCursor.reset( new QCursor( cursor ) );
s_hoverCursor = std::make_unique<QCursor>( cursor );
}
//--------------------------------------------------------------------------------------------------