mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Change API for PdmObjectHandle and PdmFieldHandle
* Refactor interface to PdmObjectHandle and PdmFieldHandle Return objects instead of passing in structures as parameters * Add nodiscard to several functions * Remove redundant this-> * Rename to ptrReferencedObjectsByType
This commit is contained in:
@@ -568,8 +568,8 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
|
||||
oilField->fractureDefinitionCollection()->createAndAssignTemplateCopyForNonMatchingUnit();
|
||||
|
||||
{
|
||||
std::vector<RimWellPathFracture*> wellPathFractures;
|
||||
oilField->wellPathCollection->descendantsIncludingThisOfType( wellPathFractures );
|
||||
std::vector<RimWellPathFracture*> wellPathFractures =
|
||||
oilField->wellPathCollection->descendantsIncludingThisOfType<RimWellPathFracture>();
|
||||
|
||||
for ( auto fracture : wellPathFractures )
|
||||
{
|
||||
@@ -627,8 +627,7 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
|
||||
|
||||
if ( m_project->isProjectFileVersionEqualOrOlderThan( "2018.1.0.103" ) )
|
||||
{
|
||||
std::vector<RimStimPlanColors*> stimPlanColors;
|
||||
riv->descendantsIncludingThisOfType( stimPlanColors );
|
||||
std::vector<RimStimPlanColors*> stimPlanColors = riv->descendantsIncludingThisOfType<RimStimPlanColors>();
|
||||
if ( stimPlanColors.size() == 1 )
|
||||
{
|
||||
stimPlanColors[0]->updateConductivityResultName();
|
||||
|
@@ -81,6 +81,7 @@
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimTextAnnotationInView.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
#include "RimWellLogFile.h"
|
||||
@@ -1375,10 +1376,9 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences*
|
||||
|
||||
if ( this->project() )
|
||||
{
|
||||
std::vector<RimViewWindow*> allViewWindows;
|
||||
project()->descendantsIncludingThisOfType( allViewWindows );
|
||||
std::vector<RimViewWindow*> allViewWindows = project()->descendantsIncludingThisOfType<RimViewWindow>();
|
||||
|
||||
RimWellPathCollection* wellPathCollection = this->project()->activeOilField()->wellPathCollection();
|
||||
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
||||
|
||||
bool existingViewsWithDifferentMeshLines = false;
|
||||
bool existingViewsWithCustomColors = false;
|
||||
|
@@ -153,8 +153,7 @@ std::set<RigFemResultAddress> RiaMemoryCleanup::findGeoMechCaseResultsInUse() co
|
||||
auto geoMechCase = dynamic_cast<RimGeoMechCase*>( m_case() );
|
||||
if ( geoMechCase )
|
||||
{
|
||||
std::vector<RimFemResultObserver*> geoMechResults;
|
||||
geoMechCase->descendantsIncludingThisOfType( geoMechResults );
|
||||
std::vector<RimFemResultObserver*> geoMechResults = geoMechCase->descendantsIncludingThisOfType<RimFemResultObserver>();
|
||||
for ( RimFemResultObserver* resultDef : geoMechResults )
|
||||
{
|
||||
auto pdmObj = dynamic_cast<caf::PdmObject*>( resultDef );
|
||||
@@ -181,8 +180,7 @@ std::set<RigEclipseResultAddress> RiaMemoryCleanup::findEclipseResultsInUse() co
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
|
||||
if ( eclipseCase )
|
||||
{
|
||||
std::vector<RimEclipseResultDefinition*> eclipseResultDefs;
|
||||
eclipseCase->descendantsIncludingThisOfType( eclipseResultDefs );
|
||||
auto eclipseResultDefs = eclipseCase->descendantsIncludingThisOfType<RimEclipseResultDefinition>();
|
||||
for ( RimEclipseResultDefinition* resultDef : eclipseResultDefs )
|
||||
{
|
||||
RigEclipseResultAddress resultAddr( resultDef->resultType(), resultDef->resultVariable() );
|
||||
|
@@ -265,8 +265,7 @@ QString RiaEnsembleNameTools::uniqueShortNameForSummaryCase( RimSummaryCase* sum
|
||||
{
|
||||
std::set<QString> allAutoShortNames;
|
||||
|
||||
std::vector<RimSummaryCase*> allCases;
|
||||
RimProject::current()->descendantsOfType( allCases );
|
||||
std::vector<RimSummaryCase*> allCases = RimProject::current()->descendantsOfType<RimSummaryCase>();
|
||||
|
||||
for ( auto sumCase : allCases )
|
||||
{
|
||||
|
@@ -60,8 +60,7 @@ RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateSimWellExtractor( co
|
||||
auto wlPlotCollection = wellLogPlotCollection();
|
||||
if ( !wlPlotCollection ) return nullptr;
|
||||
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
simWell->firstAncestorOrThisOfType( eclipseCase );
|
||||
auto eclipseCase = simWell->firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
if ( !( eclipseCase && eclipseCase->eclipseCaseData() ) )
|
||||
{
|
||||
return nullptr;
|
||||
|
@@ -123,11 +123,10 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList&
|
||||
auto existingSummaryCase = sumCaseColl->findTopLevelSummaryCaseFromFileName( newSumCase->summaryHeaderFilename() );
|
||||
if ( existingSummaryCase )
|
||||
{
|
||||
existingSummaryCase->firstAncestorOrThisOfType( existingCollection );
|
||||
existingCollection = existingSummaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
|
||||
|
||||
// Replace file summary case pointers in Rft Curves
|
||||
std::vector<RimWellLogRftCurve*> rftCurves;
|
||||
existingSummaryCase->objectsWithReferringPtrFieldsOfType( rftCurves );
|
||||
auto rftCurves = existingSummaryCase->objectsWithReferringPtrFieldsOfType<RimWellLogRftCurve>();
|
||||
for ( RimWellLogRftCurve* curve : rftCurves )
|
||||
{
|
||||
if ( curve->summaryCase() == existingSummaryCase )
|
||||
@@ -138,8 +137,7 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList&
|
||||
|
||||
// Replace all occurrences of file sum with ecl sum
|
||||
|
||||
std::vector<RimSummaryCurve*> objects;
|
||||
existingSummaryCase->objectsWithReferringPtrFieldsOfType( objects );
|
||||
auto objects = existingSummaryCase->objectsWithReferringPtrFieldsOfType<RimSummaryCurve>();
|
||||
|
||||
// UI settings of a curve filter is updated based
|
||||
// on the new case association for the curves in the curve filter
|
||||
@@ -158,8 +156,7 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList&
|
||||
summaryCurve->setSummaryCaseY( newSumCase );
|
||||
}
|
||||
|
||||
RimSummaryCurveCollection* parentCollection = nullptr;
|
||||
summaryCurve->firstAncestorOrThisOfType( parentCollection );
|
||||
auto parentCollection = summaryCurve->firstAncestorOrThisOfType<RimSummaryCurveCollection>();
|
||||
if ( parentCollection )
|
||||
{
|
||||
parentCollection->loadDataAndUpdate( true );
|
||||
|
@@ -44,9 +44,8 @@ void RiaOptionItemFactory::appendOptionItemsForEnsembleCurveSets( QList<caf::Pdm
|
||||
{
|
||||
options->push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
|
||||
RimMainPlotCollection* mainPlotColl = RimMainPlotCollection::current();
|
||||
std::vector<RimEnsembleCurveSet*> ensembleCurveSets;
|
||||
mainPlotColl->descendantsOfType( ensembleCurveSets );
|
||||
RimMainPlotCollection* mainPlotColl = RimMainPlotCollection::current();
|
||||
std::vector<RimEnsembleCurveSet*> ensembleCurveSets = mainPlotColl->descendantsOfType<RimEnsembleCurveSet>();
|
||||
for ( auto ensembleCurveSet : ensembleCurveSets )
|
||||
{
|
||||
options->push_back( caf::PdmOptionItemInfo( ensembleCurveSet->name(), ensembleCurveSet ) );
|
||||
|
@@ -127,14 +127,12 @@ RimSummaryPlot* RiaSummaryTools::parentSummaryPlot( caf::PdmObject* object )
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( summaryPlot );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
}
|
||||
|
||||
return summaryPlot;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -142,14 +140,12 @@ RimSummaryPlot* RiaSummaryTools::parentSummaryPlot( caf::PdmObject* object )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryMultiPlotCollection* RiaSummaryTools::parentSummaryPlotCollection( caf::PdmObject* object )
|
||||
{
|
||||
RimSummaryMultiPlotCollection* summaryPlotColl = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( summaryPlotColl );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryMultiPlotCollection>();
|
||||
}
|
||||
|
||||
return summaryPlotColl;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -157,14 +153,12 @@ RimSummaryMultiPlotCollection* RiaSummaryTools::parentSummaryPlotCollection( caf
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryMultiPlot* RiaSummaryTools::parentSummaryMultiPlot( caf::PdmObject* object )
|
||||
{
|
||||
RimSummaryMultiPlot* multiPlot = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( multiPlot );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryMultiPlot>();
|
||||
}
|
||||
|
||||
return multiPlot;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -172,14 +166,12 @@ RimSummaryMultiPlot* RiaSummaryTools::parentSummaryMultiPlot( caf::PdmObject* ob
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCrossPlot* RiaSummaryTools::parentCrossPlot( caf::PdmObject* object )
|
||||
{
|
||||
RimSummaryCrossPlot* crossPlot = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( crossPlot );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryCrossPlot>();
|
||||
}
|
||||
|
||||
return crossPlot;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -187,14 +179,12 @@ RimSummaryCrossPlot* RiaSummaryTools::parentCrossPlot( caf::PdmObject* object )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCrossPlotCollection* RiaSummaryTools::parentCrossPlotCollection( caf::PdmObject* object )
|
||||
{
|
||||
RimSummaryCrossPlotCollection* crossPlotColl = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( crossPlotColl );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryCrossPlotCollection>();
|
||||
}
|
||||
|
||||
return crossPlotColl;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -210,14 +200,12 @@ bool RiaSummaryTools::isSummaryCrossPlot( const RimSummaryPlot* plot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryTable* RiaSummaryTools::parentSummaryTable( caf::PdmObject* object )
|
||||
{
|
||||
RimSummaryTable* summaryTable = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( summaryTable );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryTable>();
|
||||
}
|
||||
|
||||
return summaryTable;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -225,14 +213,12 @@ RimSummaryTable* RiaSummaryTools::parentSummaryTable( caf::PdmObject* object )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryTableCollection* RiaSummaryTools::parentSummaryTableCollection( caf::PdmObject* object )
|
||||
{
|
||||
RimSummaryTableCollection* summaryTableColl = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( summaryTableColl );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryTableCollection>();
|
||||
}
|
||||
|
||||
return summaryTableColl;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user