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:
Magne Sjaastad
2023-05-12 21:41:34 +02:00
committed by GitHub
parent 37e29a0f68
commit 0c90f67dcc
510 changed files with 1651 additions and 3111 deletions

View File

@@ -123,7 +123,7 @@ void RimAnalysisPlotCollection::updateSummaryNameHasChanged()
//--------------------------------------------------------------------------------------------------
std::vector<RimAnalysisPlot*> RimAnalysisPlotCollection::plots() const
{
return m_analysisPlots.children();
return m_analysisPlots.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -164,8 +164,7 @@ void RimAnalysisPlotCollection::applyFirstSummaryCaseCollectionAndFieldAddresses
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlotCollection::applyAllSummaryCasesAndFieldAddressesToPlot( RimAnalysisPlot* plot, const std::string& quantityName /*= "" */ )
{
std::vector<RimSummaryCase*> allSummaryCases;
RimProject::current()->descendantsOfType( allSummaryCases );
std::vector<RimSummaryCase*> allSummaryCases = RimProject::current()->descendantsOfType<RimSummaryCase>();
if ( !allSummaryCases.empty() )
{
@@ -223,8 +222,7 @@ void RimAnalysisPlotCollection::applySummaryCaseCollectionAndFieldAddressToPlot(
//--------------------------------------------------------------------------------------------------
RimSummaryCaseCollection* RimAnalysisPlotCollection::firstEnsemble() const
{
std::vector<RimSummaryCaseCollection*> allSummaryCaseCollections;
RimProject::current()->descendantsOfType( allSummaryCaseCollections );
std::vector<RimSummaryCaseCollection*> allSummaryCaseCollections = RimProject::current()->descendantsOfType<RimSummaryCaseCollection>();
for ( auto summaryCaseCollection : allSummaryCaseCollections )
{
if ( summaryCaseCollection->isEnsemble() ) return summaryCaseCollection;
@@ -237,8 +235,7 @@ RimSummaryCaseCollection* RimAnalysisPlotCollection::firstEnsemble() const
//--------------------------------------------------------------------------------------------------
RimSummaryCaseCollection* RimAnalysisPlotCollection::firstSummaryCaseCollection() const
{
std::vector<RimSummaryCaseCollection*> allSummaryCaseCollections;
RimProject::current()->descendantsOfType( allSummaryCaseCollections );
std::vector<RimSummaryCaseCollection*> allSummaryCaseCollections = RimProject::current()->descendantsOfType<RimSummaryCaseCollection>();
if ( !allSummaryCaseCollections.empty() ) return allSummaryCaseCollections.front();

View File

@@ -67,7 +67,7 @@ void RimPlotDataFilterCollection::removeFilter( RimPlotDataFilterItem* filter )
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotDataFilterItem*> RimPlotDataFilterCollection::filters() const
{
return m_filters.children();
return m_filters.childrenByType();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -270,8 +270,7 @@ void RimPlotDataFilterItem::fieldChangedByUi( const caf::PdmFieldHandle* changed
QList<caf::PdmOptionItemInfo> RimPlotDataFilterItem::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
{
QList<caf::PdmOptionItemInfo> options;
RimAnalysisPlot* parentPlot;
this->firstAncestorOrThisOfTypeAsserted( parentPlot );
auto parentPlot = firstAncestorOrThisOfTypeAsserted<RimAnalysisPlot>();
if ( fieldNeedingOptions == &m_filterQuantityUiField )
{
@@ -417,8 +416,7 @@ void RimPlotDataFilterItem::defineEditorAttribute( const caf::PdmFieldHandle* fi
//--------------------------------------------------------------------------------------------------
void RimPlotDataFilterItem::updateMaxMinAndDefaultValues( bool forceDefault )
{
RimAnalysisPlot* parentPlot;
this->firstAncestorOrThisOfTypeAsserted( parentPlot );
auto parentPlot = firstAncestorOrThisOfTypeAsserted<RimAnalysisPlot>();
if ( m_filterTarget == ENSEMBLE_CASE )
{
@@ -471,7 +469,6 @@ void RimPlotDataFilterItem::updateMaxMinAndDefaultValues( bool forceDefault )
//--------------------------------------------------------------------------------------------------
RigEnsembleParameter RimPlotDataFilterItem::selectedEnsembleParameter() const
{
RimAnalysisPlot* parentPlot;
this->firstAncestorOrThisOfTypeAsserted( parentPlot );
auto parentPlot = firstAncestorOrThisOfTypeAsserted<RimAnalysisPlot>();
return parentPlot->ensembleParameter( m_filterEnsembleParameter );
}

View File

@@ -132,18 +132,16 @@ void RimAnnotationCollectionBase::scheduleRedrawOfRelevantViews()
//--------------------------------------------------------------------------------------------------
std::vector<RimGridView*> RimAnnotationCollectionBase::gridViewsContainingAnnotations() const
{
RimProject* project = RimProject::current();
if ( !project ) return {};
std::vector<RimGridView*> views;
RimProject* project = nullptr;
this->firstAncestorOrThisOfType( project );
if ( !project ) return views;
std::vector<RimGridView*> visibleGridViews;
project->allVisibleGridViews( visibleGridViews );
for ( auto& gridView : visibleGridViews )
{
/*if (gridView->annotationCollection()->annotationsCount() > 0)*/ views.push_back( gridView );
views.push_back( gridView );
}
return views;
}

View File

@@ -72,8 +72,7 @@ bool RimAnnotationGroupCollection::isActive() const
//--------------------------------------------------------------------------------------------------
bool RimAnnotationGroupCollection::isVisible() const
{
RimAnnotationCollectionBase* coll;
firstAncestorOrThisOfType( coll );
auto coll = firstAncestorOrThisOfType<RimAnnotationCollectionBase>();
bool visible = true;
if ( coll ) visible = coll->isActive();
@@ -102,7 +101,7 @@ void RimAnnotationGroupCollection::removeAnnotation( caf::PdmObject* annotation
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmObject*> RimAnnotationGroupCollection::annotations() const
{
return m_annotations.children();
return m_annotations.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -114,8 +113,7 @@ void RimAnnotationGroupCollection::fieldChangedByUi( const caf::PdmFieldHandle*
{
updateUiIconFromToggleField();
RimAnnotationCollectionBase* coll;
firstAncestorOrThisOfType( coll );
auto coll = firstAncestorOrThisOfType<RimAnnotationCollectionBase>();
if ( coll ) coll->scheduleRedrawOfRelevantViews();
}
}

View File

@@ -284,9 +284,7 @@ void RimAnnotationInViewCollection::defineEditorAttribute( const caf::PdmFieldHa
if ( attr )
{
RimCase* rimCase;
firstAncestorOrThisOfType( rimCase );
auto rimCase = firstAncestorOrThisOfType<RimCase>();
if ( rimCase )
{
auto bb = rimCase->allCellsBoundingBox();

View File

@@ -137,8 +137,7 @@ void RimAnnotationLineAppearance::defineUiOrdering( QString uiConfigName, caf::P
//--------------------------------------------------------------------------------------------------
void RimAnnotationLineAppearance::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
{
RimAnnotationCollection* annColl = nullptr;
this->firstAncestorOrThisOfType( annColl );
auto annColl = firstAncestorOrThisOfType<RimAnnotationCollection>();
if ( annColl ) annColl->scheduleRedrawOfRelevantViews();
objectChanged.send();

View File

@@ -109,9 +109,7 @@ void RimAnnotationTextAppearance::defineUiOrdering( QString uiConfigName, caf::P
//--------------------------------------------------------------------------------------------------
void RimAnnotationTextAppearance::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
{
RimAnnotationCollectionBase* annColl = nullptr;
this->firstAncestorOrThisOfTypeAsserted( annColl );
auto annColl = firstAncestorOrThisOfTypeAsserted<RimAnnotationCollectionBase>();
if ( annColl )
{
annColl->scheduleRedrawOfRelevantViews();

View File

@@ -114,7 +114,6 @@ void RimPolylineTarget::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
//--------------------------------------------------------------------------------------------------
void RimPolylineTarget::triggerVisualizationUpdate() const
{
RimPolylinePickerInterface* ppInterface;
firstAncestorOrThisOfTypeAsserted( ppInterface );
auto ppInterface = firstAncestorOrThisOfTypeAsserted<RimPolylinePickerInterface>();
if ( ppInterface ) ppInterface->updateVisualization();
}

View File

@@ -73,8 +73,7 @@ bool RimPolylinesAnnotation::isActive()
//--------------------------------------------------------------------------------------------------
bool RimPolylinesAnnotation::isVisible()
{
RimAnnotationCollectionBase* coll;
firstAncestorOrThisOfType( coll );
auto coll = firstAncestorOrThisOfType<RimAnnotationCollectionBase>();
return coll && coll->isActive() && m_isActive;
}

View File

@@ -74,8 +74,7 @@ RimPolylinesAnnotation* RimPolylinesAnnotationInView::sourceAnnotation() const
//--------------------------------------------------------------------------------------------------
bool RimPolylinesAnnotationInView::isVisible() const
{
RimAnnotationGroupCollection* coll;
firstAncestorOrThisOfType( coll );
auto coll = firstAncestorOrThisOfType<RimAnnotationGroupCollection>();
bool visible = true;
if ( coll ) visible = coll->isVisible();
@@ -85,8 +84,7 @@ bool RimPolylinesAnnotationInView::isVisible() const
if ( visible )
{
RimAnnotationGroupCollection* globalColl;
m_sourceAnnotation->firstAncestorOrThisOfType( globalColl );
auto globalColl = m_sourceAnnotation->firstAncestorOrThisOfType<RimAnnotationGroupCollection>();
if ( globalColl ) visible = globalColl->isVisible();
}
}
@@ -101,9 +99,7 @@ void RimPolylinesAnnotationInView::fieldChangedByUi( const caf::PdmFieldHandle*
{
if ( changedField == &m_isActive )
{
RimAnnotationCollectionBase* coll;
firstAncestorOrThisOfType( coll );
auto coll = firstAncestorOrThisOfType<RimAnnotationCollectionBase>();
if ( coll ) coll->scheduleRedrawOfRelevantViews();
}
}
@@ -132,8 +128,7 @@ cvf::ref<RigPolyLinesData> RimPolylinesAnnotationInView::polyLinesData() const
retval->setVisibility( false, false );
}
RimAnnotationInViewCollection* coll;
firstAncestorOrThisOfType( coll );
auto coll = firstAncestorOrThisOfType<RimAnnotationInViewCollection>();
if ( coll )
{
retval->setZPlaneLock( coll->snapAnnotations(), coll->annotationPlaneZ() );

View File

@@ -219,8 +219,7 @@ void RimPolylinesFromFileAnnotation::fieldChangedByUi( const caf::PdmFieldHandle
appearance()->setSphereFieldsHidden( !m_showSpheres() );
}
RimAnnotationCollection* annColl = nullptr;
this->firstAncestorOrThisOfTypeAsserted( annColl );
auto annColl = firstAncestorOrThisOfTypeAsserted<RimAnnotationCollection>();
annColl->scheduleRedrawOfRelevantViews();
}

View File

@@ -74,8 +74,7 @@ bool RimReachCircleAnnotation::isActive()
//--------------------------------------------------------------------------------------------------
bool RimReachCircleAnnotation::isVisible()
{
RimAnnotationCollectionBase* coll;
firstAncestorOrThisOfType( coll );
auto coll = firstAncestorOrThisOfType<RimAnnotationCollectionBase>();
return coll && coll->isActive() && m_isActive;
}
@@ -152,8 +151,7 @@ void RimReachCircleAnnotation::fieldChangedByUi( const caf::PdmFieldHandle* chan
{
this->updateConnectedEditors();
}
RimAnnotationCollection* annColl = nullptr;
this->firstAncestorOrThisOfTypeAsserted( annColl );
auto annColl = firstAncestorOrThisOfTypeAsserted<RimAnnotationCollection>();
annColl->scheduleRedrawOfRelevantViews();
}

View File

@@ -79,8 +79,7 @@ RimReachCircleAnnotation* RimReachCircleAnnotationInView::sourceAnnotation() con
//--------------------------------------------------------------------------------------------------
bool RimReachCircleAnnotationInView::isVisible() const
{
RimAnnotationGroupCollection* coll;
firstAncestorOrThisOfType( coll );
auto coll = firstAncestorOrThisOfType<RimAnnotationGroupCollection>();
bool visible = true;
if ( coll ) visible = coll->isVisible();
@@ -90,8 +89,7 @@ bool RimReachCircleAnnotationInView::isVisible() const
if ( visible )
{
RimAnnotationGroupCollection* globalColl;
m_sourceAnnotation->firstAncestorOrThisOfType( globalColl );
auto globalColl = m_sourceAnnotation->firstAncestorOrThisOfType<RimAnnotationGroupCollection>();
if ( globalColl ) visible = globalColl->isVisible();
}
}
@@ -106,8 +104,7 @@ void RimReachCircleAnnotationInView::fieldChangedByUi( const caf::PdmFieldHandle
{
if ( changedField == &m_isActive )
{
RimAnnotationCollectionBase* coll;
firstAncestorOrThisOfType( coll );
auto coll = firstAncestorOrThisOfType<RimAnnotationCollectionBase>();
if ( coll ) coll->scheduleRedrawOfRelevantViews();
}

View File

@@ -184,9 +184,7 @@ void RimTextAnnotation::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
this->updateConnectedEditors();
}
RimAnnotationCollectionBase* annColl = nullptr;
this->firstAncestorOrThisOfTypeAsserted( annColl );
auto annColl = firstAncestorOrThisOfTypeAsserted<RimAnnotationCollectionBase>();
if ( annColl ) annColl->scheduleRedrawOfRelevantViews();
}
@@ -211,8 +209,7 @@ bool RimTextAnnotation::isActive()
//--------------------------------------------------------------------------------------------------
bool RimTextAnnotation::isVisible() const
{
RimAnnotationGroupCollection* coll;
firstAncestorOrThisOfType( coll );
auto coll = firstAncestorOrThisOfType<RimAnnotationGroupCollection>();
bool visible = true;
if ( coll ) visible = coll->isVisible();

View File

@@ -79,8 +79,7 @@ RimTextAnnotation* RimTextAnnotationInView::sourceAnnotation() const
//--------------------------------------------------------------------------------------------------
bool RimTextAnnotationInView::isVisible() const
{
RimAnnotationGroupCollection* coll;
firstAncestorOrThisOfType( coll );
auto coll = firstAncestorOrThisOfType<RimAnnotationGroupCollection>();
bool visible = true;
if ( coll ) visible = coll->isVisible();
@@ -90,8 +89,7 @@ bool RimTextAnnotationInView::isVisible() const
if ( visible )
{
RimAnnotationGroupCollection* globalColl;
m_sourceAnnotation->firstAncestorOrThisOfType( globalColl );
auto globalColl = m_sourceAnnotation->firstAncestorOrThisOfType<RimAnnotationGroupCollection>();
if ( globalColl ) visible = globalColl->isVisible();
}
}
@@ -106,8 +104,7 @@ void RimTextAnnotationInView::fieldChangedByUi( const caf::PdmFieldHandle* chang
{
if ( changedField == &m_isActive )
{
RimAnnotationCollectionBase* coll;
firstAncestorOrThisOfType( coll );
auto coll = firstAncestorOrThisOfType<RimAnnotationCollectionBase>();
if ( coll ) coll->scheduleRedrawOfRelevantViews();
}

View File

@@ -95,7 +95,7 @@ cvf::ref<RigPolyLinesData> RimUserDefinedPolylinesAnnotation::polyLinesData()
//--------------------------------------------------------------------------------------------------
std::vector<RimPolylineTarget*> RimUserDefinedPolylinesAnnotation::activeTargets() const
{
return m_targets.children();
return m_targets.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -191,8 +191,7 @@ void RimUserDefinedPolylinesAnnotation::updateEditorsAndVisualization()
//--------------------------------------------------------------------------------------------------
void RimUserDefinedPolylinesAnnotation::updateVisualization()
{
RimAnnotationCollection* annColl = nullptr;
this->firstAncestorOrThisOfTypeAsserted( annColl );
auto annColl = firstAncestorOrThisOfTypeAsserted<RimAnnotationCollection>();
if ( annColl ) annColl->scheduleRedrawOfRelevantViews();
}

View File

@@ -213,8 +213,7 @@ void RimCellFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
bool readOnlyState = isFilterControlled();
std::vector<caf::PdmFieldHandle*> objFields;
this->fields( objFields );
std::vector<caf::PdmFieldHandle*> objFields = fields();
for ( auto& objField : objFields )
{
objField->uiCapability()->setUiReadOnly( readOnlyState );
@@ -235,8 +234,7 @@ QString RimCellFilter::modeString() const
//--------------------------------------------------------------------------------------------------
const cvf::StructGridInterface* RimCellFilter::selectedGrid() const
{
RimCase* rimCase = nullptr;
this->firstAncestorOrThisOfTypeAsserted( rimCase );
auto rimCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
int clampedIndex = gridIndex();
if ( clampedIndex >= RigReservoirGridTools::gridCount( rimCase ) )
@@ -256,8 +254,7 @@ QList<caf::PdmOptionItemInfo> RimCellFilter::calculateValueOptions( const caf::P
if ( &m_gridIndex == fieldNeedingOptions )
{
RimCase* rimCase = nullptr;
this->firstAncestorOrThisOfTypeAsserted( rimCase );
auto rimCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
for ( int gIdx = 0; gIdx < RigReservoirGridTools::gridCount( rimCase ); ++gIdx )
{
@@ -284,8 +281,7 @@ QList<caf::PdmOptionItemInfo> RimCellFilter::calculateValueOptions( const caf::P
//--------------------------------------------------------------------------------------------------
bool RimCellFilter::isFilterControlled() const
{
Rim3dView* rimView = nullptr;
firstAncestorOrThisOfTypeAsserted( rimView );
auto rimView = firstAncestorOrThisOfTypeAsserted<Rim3dView>();
bool isFilterControlled = false;
if ( rimView && rimView->viewController() && rimView->viewController()->isCellFiltersControlled() )

View File

@@ -104,7 +104,7 @@ void RimCellFilterCollection::setCase( RimCase* theCase )
//--------------------------------------------------------------------------------------------------
std::vector<RimCellFilter*> RimCellFilterCollection::filters() const
{
return m_cellFilters.children();
return m_cellFilters.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -157,8 +157,7 @@ void RimCellFilterCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTr
{
PdmObject::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfType( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
RimViewController* viewController = rimView->viewController();
if ( viewController && ( viewController->isPropertyFilterOveridden() || viewController->isVisibleCellsOveridden() ) )
{
@@ -179,8 +178,7 @@ void RimCellFilterCollection::updateIconState()
{
bool activeIcon = true;
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfType( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
RimViewController* viewController = rimView->viewController();
bool isControlled = viewController && ( viewController->isCellFiltersControlled() || viewController->isVisibleCellsOveridden() );
@@ -340,8 +338,7 @@ void RimCellFilterCollection::connectToFilterUpdates( RimCellFilter* filter )
//--------------------------------------------------------------------------------------------------
void RimCellFilterCollection::onFilterUpdated( const SignalEmitter* emitter )
{
Rim3dView* view = nullptr;
firstAncestorOrThisOfType( view );
auto view = firstAncestorOrThisOfType<Rim3dView>();
if ( !view ) return;
if ( view->isMasterView() )

View File

@@ -175,12 +175,9 @@ void RimCellRangeFilter::setDefaultValues( int sliceDirection, int defaultSlice
if ( !grid ) return;
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfTypeAsserted( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
auto actCellInfo = RigReservoirGridTools::activeCellInfo( rimView );
RimCase* rimCase = nullptr;
this->firstAncestorOrThisOfTypeAsserted( rimCase );
auto rimCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
const cvf::StructGridInterface* mainGrid = RigReservoirGridTools::mainGrid( rimCase );
@@ -277,12 +274,10 @@ void RimCellRangeFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder
const cvf::StructGridInterface* grid = selectedGrid();
RimCase* rimCase = nullptr;
this->firstAncestorOrThisOfTypeAsserted( rimCase );
auto rimCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
const cvf::StructGridInterface* mainGrid = RigReservoirGridTools::mainGrid( rimCase );
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfTypeAsserted( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
auto actCellInfo = RigReservoirGridTools::activeCellInfo( rimView );
if ( grid == mainGrid && actCellInfo )

View File

@@ -162,10 +162,7 @@ void RimEclipsePropertyFilter::fieldChangedByUi( const caf::PdmFieldHandle* chan
//--------------------------------------------------------------------------------------------------
RimEclipsePropertyFilterCollection* RimEclipsePropertyFilter::parentContainer()
{
RimEclipsePropertyFilterCollection* propFilterColl = nullptr;
this->firstAncestorOrThisOfTypeAsserted( propFilterColl );
return propFilterColl;
return firstAncestorOrThisOfTypeAsserted<RimEclipsePropertyFilterCollection>();
}
//--------------------------------------------------------------------------------------------------
@@ -241,8 +238,7 @@ void RimEclipsePropertyFilter::updateReadOnlyStateOfAllFields()
{
bool readOnlyState = isPropertyFilterControlled();
std::vector<caf::PdmFieldHandle*> objFields;
this->fields( objFields );
std::vector<caf::PdmFieldHandle*> objFields = fields();
// Include fields declared in Rimm_resultDefinition
objFields.push_back( &( m_resultDefinition->m_resultTypeUiField ) );
@@ -277,8 +273,7 @@ void RimEclipsePropertyFilter::updateRangeLabel()
//--------------------------------------------------------------------------------------------------
bool RimEclipsePropertyFilter::isPropertyFilterControlled()
{
Rim3dView* rimView = nullptr;
firstAncestorOrThisOfTypeAsserted( rimView );
auto rimView = firstAncestorOrThisOfTypeAsserted<Rim3dView>();
bool isPropertyFilterControlled = false;
@@ -353,8 +348,7 @@ void RimEclipsePropertyFilter::defineObjectEditorAttribute( QString uiConfigName
{
if ( !m_isDuplicatedFromLinkedView ) return;
Rim3dView* rimView = nullptr;
firstAncestorOrThisOfTypeAsserted( rimView );
auto rimView = firstAncestorOrThisOfTypeAsserted<Rim3dView>();
RimViewController* vc = rimView->viewController();
if ( vc && vc->isPropertyFilterDuplicationActive() )
@@ -385,8 +379,7 @@ void RimEclipsePropertyFilter::computeResultValueRange()
if ( m_resultDefinition->isFlowDiagOrInjectionFlooding() )
{
Rim3dView* view;
this->firstAncestorOrThisOfType( view );
auto view = firstAncestorOrThisOfType<Rim3dView>();
int timeStep = 0;
if ( view ) timeStep = view->currentTimeStep();
@@ -490,8 +483,7 @@ void RimEclipsePropertyFilter::updateFromCurrentTimeStep()
clearCategories();
Rim3dView* view = nullptr;
this->firstAncestorOrThisOfTypeAsserted( view );
auto view = firstAncestorOrThisOfTypeAsserted<Rim3dView>();
int timeStep = view->currentTimeStep();
RigFlowDiagResultAddress resAddr = m_resultDefinition->flowDiagResAddress();

View File

@@ -57,10 +57,7 @@ RimEclipsePropertyFilterCollection::~RimEclipsePropertyFilterCollection()
//--------------------------------------------------------------------------------------------------
RimEclipseView* RimEclipsePropertyFilterCollection::reservoirView()
{
RimEclipseView* eclipseView = nullptr;
firstAncestorOrThisOfType( eclipseView );
return eclipseView;
return firstAncestorOrThisOfType<RimEclipseView>();
}
//--------------------------------------------------------------------------------------------------
@@ -79,7 +76,7 @@ void RimEclipsePropertyFilterCollection::setIsDuplicatedFromLinkedView()
//--------------------------------------------------------------------------------------------------
std::vector<RimEclipsePropertyFilter*> RimEclipsePropertyFilterCollection::propertyFilters() const
{
return m_propertyFilters.children();
return m_propertyFilters.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -169,8 +166,7 @@ void RimEclipsePropertyFilterCollection::updateIconState()
{
bool activeIcon = true;
RimEclipseView* view = nullptr;
this->firstAncestorOrThisOfType( view );
auto view = firstAncestorOrThisOfType<RimEclipseView>();
if ( view )
{
RimViewController* viewController = view->viewController();

View File

@@ -167,8 +167,7 @@ void RimGeoMechPropertyFilter::updateReadOnlyStateOfAllFields()
{
bool readOnlyState = isPropertyFilterControlled();
std::vector<caf::PdmFieldHandle*> objFields;
this->fields( objFields );
std::vector<caf::PdmFieldHandle*> objFields = fields();
// Include fields declared in RimResultDefinition
objFields.push_back( &( resultDefinition->m_resultPositionTypeUiField ) );
@@ -188,9 +187,7 @@ bool RimGeoMechPropertyFilter::isPropertyFilterControlled()
{
bool isPropertyFilterControlled = false;
Rim3dView* rimView = nullptr;
firstAncestorOrThisOfType( rimView );
CVF_ASSERT( rimView );
auto rimView = firstAncestorOrThisOfTypeAsserted<Rim3dView>();
if ( rimView )
{
RimViewController* vc = rimView->viewController();

View File

@@ -53,10 +53,7 @@ RimGeoMechPropertyFilterCollection::~RimGeoMechPropertyFilterCollection()
//--------------------------------------------------------------------------------------------------
RimGeoMechView* RimGeoMechPropertyFilterCollection::reservoirView()
{
RimGeoMechView* geoMechView = nullptr;
firstAncestorOrThisOfType( geoMechView );
return geoMechView;
return firstAncestorOrThisOfType<RimGeoMechView>();
}
//--------------------------------------------------------------------------------------------------
@@ -138,8 +135,7 @@ void RimGeoMechPropertyFilterCollection::updateIconState()
{
bool activeIcon = true;
RimGeoMechView* view = nullptr;
this->firstAncestorOrThisOfType( view );
RimGeoMechView* view = reservoirView();
if ( view )
{
RimViewController* viewController = view->viewController();

View File

@@ -257,7 +257,7 @@ QString RimPolygonFilter::fullName() const
//--------------------------------------------------------------------------------------------------
std::vector<RimPolylineTarget*> RimPolygonFilter::activeTargets() const
{
return m_targets.children();
return m_targets.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -412,8 +412,7 @@ void RimPolygonFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
bool readOnlyState = isFilterControlled();
std::vector<caf::PdmFieldHandle*> objFields;
this->fields( objFields );
std::vector<caf::PdmFieldHandle*> objFields = this->fields();
for ( auto& objField : objFields )
{
objField->uiCapability()->setUiReadOnly( readOnlyState );

View File

@@ -46,9 +46,7 @@ RimPropertyFilterCollection::~RimPropertyFilterCollection()
//--------------------------------------------------------------------------------------------------
void RimPropertyFilterCollection::updateDisplayModelNotifyManagedViews( RimPropertyFilter* changedFilter ) const
{
Rim3dView* view = nullptr;
this->firstAncestorOrThisOfType( view );
CVF_ASSERT( view );
auto view = firstAncestorOrThisOfTypeAsserted<Rim3dView>();
if ( !view ) return;
if ( view->isMasterView() )
@@ -109,8 +107,7 @@ void RimPropertyFilterCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering&
{
PdmObject::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfType( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
RimViewController* viewController = rimView->viewController();
if ( viewController && ( viewController->isPropertyFilterOveridden() || viewController->isVisibleCellsOveridden() ) )
{

View File

@@ -134,14 +134,13 @@ std::vector<Rim3dWellLogCurve*> Rim3dWellLogCurveCollection::vectorOf3dWellLogCu
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurveCollection::redrawAffectedViewsAndEditors()
{
RimProject* proj = nullptr;
this->firstAncestorOrThisOfType( proj );
RimProject* proj = RimProject::current();
if ( proj )
{
proj->scheduleCreateDisplayModelAndRedrawAllViews();
}
RimWellPath* path = nullptr;
this->firstAncestorOrThisOfType( path );
auto path = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( path )
{
path->updateConnectedEditors();
@@ -183,8 +182,7 @@ Rim3dWellLogCurve* Rim3dWellLogCurveCollection::checkForCurveIntersection( const
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurveCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
{
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
RimProject* proj = RimProject::current();
proj->scheduleCreateDisplayModelAndRedrawAllViews();
}

View File

@@ -385,8 +385,7 @@ void RimEllipseFractureTemplate::onLoadDataAndUpdateGeometryHasChanged()
{
loadDataAndUpdate();
RimEclipseCase* eclipseCase = nullptr;
this->firstAncestorOrThisOfType( eclipseCase );
auto eclipseCase = firstAncestorOrThisOfType<RimEclipseCase>();
if ( eclipseCase )
{
RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews( { eclipseCase } );

View File

@@ -278,8 +278,7 @@ void RimEnsembleFractureStatistics::fieldChangedByUi( const caf::PdmFieldHandle*
// Update views
if ( !updatedTemplates.empty() )
{
RimFractureTemplateCollection* templateCollection = nullptr;
updatedTemplates.front()->firstAncestorOrThisOfTypeAsserted( templateCollection );
auto templateCollection = updatedTemplates.front()->firstAncestorOrThisOfTypeAsserted<RimFractureTemplateCollection>();
templateCollection->updateConnectedEditors();
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
@@ -291,8 +290,7 @@ void RimEnsembleFractureStatistics::fieldChangedByUi( const caf::PdmFieldHandle*
#ifdef USE_QTCHARTS
// Update referring plots
std::vector<caf::PdmObjectHandle*> referringObjects;
this->objectsWithReferringPtrFields( referringObjects );
std::vector<caf::PdmObjectHandle*> referringObjects = this->objectsWithReferringPtrFields();
for ( caf::PdmObjectHandle* obj : referringObjects )
{
auto plot = dynamic_cast<RimEnsembleFractureStatisticsPlot*>( obj );

View File

@@ -46,7 +46,7 @@ void RimEnsembleFractureStatisticsCollection::addFractureGroupStatistics( RimEns
//--------------------------------------------------------------------------------------------------
void RimEnsembleFractureStatisticsCollection::loadAndUpdateData()
{
for ( auto f : m_fractureGroupStatistics.children() )
for ( auto f : m_fractureGroupStatistics.childrenByType() )
{
f->loadAndUpdateData();
}

View File

@@ -216,8 +216,7 @@ double RimFishbones::buildAngle() const
//--------------------------------------------------------------------------------------------------
double RimFishbones::tubingDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( unitSystem == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
@@ -284,8 +283,7 @@ double RimFishbones::skinFactor() const
//--------------------------------------------------------------------------------------------------
double RimFishbones::openHoleRoughnessFactor( RiaDefines::EclipseUnitSystem unitSystem ) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_FIELD && unitSystem == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
{
return RiaEclipseUnitTools::feetToMeter( m_lateralOpenHoleRoghnessFactor() );
@@ -302,8 +300,7 @@ double RimFishbones::openHoleRoughnessFactor( RiaDefines::EclipseUnitSystem unit
//--------------------------------------------------------------------------------------------------
double RimFishbones::icdOrificeDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
return RimWellPathValve::convertOrificeDiameter( m_icdOrificeDiameter(), wellPath->unitSystem(), unitSystem );
}
@@ -358,12 +355,10 @@ void RimFishbones::geometryUpdated()
computeRotationAngles();
computeSubLateralIndices();
RimFishbonesCollection* collection;
this->firstAncestorOrThisOfTypeAsserted( collection );
auto collection = firstAncestorOrThisOfTypeAsserted<RimFishbonesCollection>();
collection->recalculateStartMD();
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
RimProject* proj = RimProject::current();
proj->reloadCompletionTypeResultsInAllViews();
}
@@ -413,8 +408,7 @@ void RimFishbones::recomputeLateralLocations()
//--------------------------------------------------------------------------------------------------
void RimFishbones::setUnitSystemSpecificDefaults()
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
@@ -556,8 +550,7 @@ void RimFishbones::computeRangesAndLocations()
void RimFishbones::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
@@ -671,8 +664,7 @@ cvf::BoundingBox RimFishbones::boundingBoxInDomainCoords() const
//--------------------------------------------------------------------------------------------------
bool RimFishbones::isEnabled() const
{
RimFishbonesCollection* collection;
this->firstAncestorOrThisOfTypeAsserted( collection );
auto collection = firstAncestorOrThisOfTypeAsserted<RimFishbonesCollection>();
return collection->isChecked() && isActive();
}

View File

@@ -64,8 +64,7 @@ void RimFishbonesCollection::fieldChangedByUi( const caf::PdmFieldHandle* change
manuallyModifiedStartMD = true;
}
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
RimProject* proj = RimProject::current();
if ( changedField == &m_isChecked )
{
proj->reloadCompletionTypeResultsInAllViews();
@@ -82,8 +81,7 @@ void RimFishbonesCollection::fieldChangedByUi( const caf::PdmFieldHandle* change
void RimFishbonesCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
@@ -153,7 +151,7 @@ std::vector<RimFishbones*> RimFishbonesCollection::activeFishbonesSubs() const
//--------------------------------------------------------------------------------------------------
std::vector<RimFishbones*> RimFishbonesCollection::allFishbonesSubs() const
{
return m_fishbones.children();
return m_fishbones.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -161,8 +159,7 @@ std::vector<RimFishbones*> RimFishbonesCollection::allFishbonesSubs() const
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimFishbonesCollection::nextFishbonesColor() const
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
cvf::Color3ub wellPathColor( wellPath->wellPathColor() );
QColor qWellPathColor = QColor( wellPathColor.r(), wellPathColor.g(), wellPathColor.b() );
@@ -226,7 +223,7 @@ double RimFishbonesCollection::endMD() const
double endMD = m_startMD;
if ( !m_fishbones.empty() )
{
auto lastFishbone = m_fishbones.children().back();
auto lastFishbone = m_fishbones.childrenByType().back();
CVF_ASSERT( lastFishbone );
endMD = lastFishbone->endMD();
}
@@ -238,8 +235,7 @@ double RimFishbonesCollection::endMD() const
//--------------------------------------------------------------------------------------------------
double RimFishbonesCollection::mainBoreDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_FIELD && unitSystem == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
{
return RiaEclipseUnitTools::feetToMeter( m_mainBoreDiameter() );
@@ -256,8 +252,7 @@ double RimFishbonesCollection::mainBoreDiameter( RiaDefines::EclipseUnitSystem u
//--------------------------------------------------------------------------------------------------
void RimFishbonesCollection::setUnitSystemSpecificDefaults()
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )

View File

@@ -49,8 +49,7 @@ RimFishbonesPipeProperties::~RimFishbonesPipeProperties()
//--------------------------------------------------------------------------------------------------
double RimFishbonesPipeProperties::holeDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( unitSystem == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
@@ -82,8 +81,7 @@ double RimFishbonesPipeProperties::holeDiameter( RiaDefines::EclipseUnitSystem u
//--------------------------------------------------------------------------------------------------
void RimFishbonesPipeProperties::setUnitSystemSpecificDefaults()
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
@@ -102,19 +100,16 @@ void RimFishbonesPipeProperties::setUnitSystemSpecificDefaults()
//--------------------------------------------------------------------------------------------------
void RimFishbonesPipeProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
if ( wellPath )
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
{
m_lateralHoleDiameter.uiCapability()->setUiName( "Hole Diameter [mm]" );
}
else if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
{
m_lateralHoleDiameter.uiCapability()->setUiName( "Hole Diameter [in]" );
}
m_lateralHoleDiameter.uiCapability()->setUiName( "Hole Diameter [mm]" );
}
else if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
{
m_lateralHoleDiameter.uiCapability()->setUiName( "Hole Diameter [in]" );
}
}

View File

@@ -79,9 +79,7 @@ void setDefaultFractureColorResult()
{
for ( Rim3dView* const view : eclCase->views() )
{
std::vector<RimStimPlanColors*> fractureColors;
view->descendantsIncludingThisOfType( fractureColors );
std::vector<RimStimPlanColors*> fractureColors = view->descendantsIncludingThisOfType<RimStimPlanColors>();
for ( RimStimPlanColors* const stimPlanColors : fractureColors )
{
stimPlanColors->setDefaultResultName();
@@ -286,8 +284,7 @@ void RimFracture::fieldChangedByUi( const caf::PdmFieldHandle* changedField, con
{
clearCachedNonDarcyProperties();
RimEclipseCase* eclipseCase = nullptr;
this->firstAncestorOrThisOfType( eclipseCase );
auto eclipseCase = firstAncestorOrThisOfType<RimEclipseCase>();
if ( eclipseCase )
{
RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews( { eclipseCase } );

View File

@@ -179,8 +179,7 @@ void RimFractureContainment::defineUiOrdering( QString uiConfigName, caf::PdmUiO
void RimFractureContainment::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
{
{
RimProject* proj;
this->firstAncestorOrThisOfType( proj );
RimProject* proj = RimProject::current();
if ( proj )
{
proj->reloadCompletionTypeResultsInAllViews();
@@ -189,8 +188,7 @@ void RimFractureContainment::fieldChangedByUi( const caf::PdmFieldHandle* change
if ( changedField == &m_useContainment || changedField == &m_truncateAtFaults )
{
RimFractureTemplate* fractureTemplate = nullptr;
this->firstAncestorOrThisOfType( fractureTemplate );
auto fractureTemplate = firstAncestorOrThisOfType<RimFractureTemplate>();
if ( fractureTemplate )
{
fractureTemplate->updateConnectedEditors();

View File

@@ -877,10 +877,7 @@ void RimFractureTemplate::loadDataAndUpdateGeometryHasChanged()
//--------------------------------------------------------------------------------------------------
std::vector<RimFracture*> RimFractureTemplate::fracturesUsingThisTemplate() const
{
std::vector<RimFracture*> fractures;
this->objectsWithReferringPtrFieldsOfType( fractures );
return fractures;
return this->objectsWithReferringPtrFieldsOfType<RimFracture>();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -215,9 +215,7 @@ void RimFractureTemplateCollection::createAndAssignTemplateCopyForNonMatchingUni
{
RimFractureTemplate* templateWithMatchingUnit = nullptr;
std::vector<RimFracture*> referringObjects;
fractureTemplate->objectsWithReferringPtrFieldsOfType( referringObjects );
std::vector<RimFracture*> referringObjects = fractureTemplate->objectsWithReferringPtrFieldsOfType<RimFracture>();
for ( auto fracture : referringObjects )
{
if ( fracture && fracture->fractureUnit() != fractureTemplate->fractureTemplateUnit() )
@@ -313,8 +311,7 @@ int RimFractureTemplateCollection::nextFractureTemplateId()
void RimFractureTemplateCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects )
{
RimProject* proj = nullptr;
firstAncestorOrThisOfType( proj );
RimProject* proj = RimProject::current();
if ( proj )
{
proj->scheduleCreateDisplayModelAndRedrawAllViews();

View File

@@ -230,9 +230,7 @@ WellFractureIntersectionData RimMeshFractureTemplate::wellFractureIntersectionDa
const RigFractureGrid* fractureGrid = fractureInstance->fractureGrid();
if ( orientationType() == ALONG_WELL_PATH )
{
RimWellPath* rimWellPath = nullptr;
fractureInstance->firstAncestorOrThisOfType( rimWellPath );
auto rimWellPath = fractureInstance->firstAncestorOrThisOfType<RimWellPath>();
if ( rimWellPath && rimWellPath->wellPathGeometry() )
{
double totalLength = 0.0;

View File

@@ -136,8 +136,7 @@ double RimMswCompletionParameters::manualReferenceMD() const
//--------------------------------------------------------------------------------------------------
double RimMswCompletionParameters::linerDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
double diameter = m_linerDiameter();
if ( !wellPath->isTopLevelWellPath() && !m_customValuesForLateral )
@@ -176,8 +175,7 @@ double RimMswCompletionParameters::defaultLinerDiameter( RiaDefines::EclipseUnit
//--------------------------------------------------------------------------------------------------
double RimMswCompletionParameters::roughnessFactor( RiaDefines::EclipseUnitSystem unitSystem ) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
double rFactor = m_roughnessFactor();
if ( !wellPath->isTopLevelWellPath() && !m_customValuesForLateral )
@@ -307,8 +305,7 @@ void RimMswCompletionParameters::fieldChangedByUi( const caf::PdmFieldHandle* ch
//--------------------------------------------------------------------------------------------------
void RimMswCompletionParameters::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
@@ -366,8 +363,7 @@ void RimMswCompletionParameters::initAfterRead()
//--------------------------------------------------------------------------------------------------
void RimMswCompletionParameters::setUnitSystemSpecificDefaults()
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( wellPath )
{
m_linerDiameter = defaultLinerDiameter( wellPath->unitSystem() );

View File

@@ -152,8 +152,7 @@ void RimMultipleValveLocations::computeRangesAndLocations()
{
std::vector<double> validMeasuredDepths;
{
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
double firstWellPathMD = wellPath->startMD();
double lastWellPathMD = wellPath->endMD();
@@ -228,8 +227,7 @@ void RimMultipleValveLocations::applyOffset( double offset )
void RimMultipleValveLocations::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
@@ -329,8 +327,7 @@ void RimMultipleValveLocations::fieldChangedByUi( const caf::PdmFieldHandle* cha
{
double minimumDistanceMeter = minimumSpacingMeters();
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
{
double minimumDistanceFeet = RiaEclipseUnitTools::meterToFeet( minimumDistanceMeter );
@@ -349,9 +346,8 @@ void RimMultipleValveLocations::fieldChangedByUi( const caf::PdmFieldHandle* cha
computeRangesAndLocations();
}
RimWellPathComponentInterface* parentCompletion = nullptr;
this->firstAncestorOrThisOfType( parentCompletion );
caf::PdmObject* pdmParent = dynamic_cast<caf::PdmObject*>( parentCompletion );
auto parentCompletion = firstAncestorOrThisOfType<RimWellPathComponentInterface>();
caf::PdmObject* pdmParent = dynamic_cast<caf::PdmObject*>( parentCompletion );
if ( recomputeLocations || changedField == &m_locationOfValves )
{
@@ -405,9 +401,7 @@ double RimMultipleValveLocations::minimumSpacingMeters() const
//--------------------------------------------------------------------------------------------------
double RimMultipleValveLocations::perforationStartMD() const
{
const RimPerforationInterval* perfInterval = nullptr;
this->firstAncestorOrThisOfType( perfInterval );
const RimPerforationInterval* perfInterval = firstAncestorOrThisOfType<RimPerforationInterval>();
if ( perfInterval )
{
return perfInterval->startMD();
@@ -420,16 +414,13 @@ double RimMultipleValveLocations::perforationStartMD() const
//--------------------------------------------------------------------------------------------------
double RimMultipleValveLocations::perforationEndMD() const
{
const RimPerforationInterval* perfInterval = nullptr;
this->firstAncestorOrThisOfType( perfInterval );
const RimPerforationInterval* perfInterval = firstAncestorOrThisOfType<RimPerforationInterval>();
if ( perfInterval )
{
return perfInterval->endMD();
}
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
return wellPath->endMD();
}

View File

@@ -88,8 +88,7 @@ void RimPerforationCollection::appendPerforation( RimPerforationInterval* perfor
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
if ( activeView )
{
RimEclipseCase* eclipseCase = nullptr;
activeView->firstAncestorOrThisOfType( eclipseCase );
auto eclipseCase = activeView->firstAncestorOrThisOfType<RimEclipseCase>();
if ( eclipseCase )
{
auto dates = eclipseCase->timeStepDates();
@@ -117,8 +116,7 @@ void RimPerforationCollection::appendPerforation( RimPerforationInterval* perfor
updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem( perforation );
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
RimProject* proj = RimProject::current();
proj->reloadCompletionTypeResultsInAllViews();
}
@@ -184,8 +182,7 @@ void RimPerforationCollection::defineUiOrdering( QString uiConfigName, caf::PdmU
//--------------------------------------------------------------------------------------------------
void RimPerforationCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
{
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
RimProject* proj = RimProject::current();
if ( changedField == &m_isChecked )
{
proj->reloadCompletionTypeResultsInAllViews();

View File

@@ -136,8 +136,7 @@ void RimPerforationInterval::setSkinFactor( double skinFactor )
//--------------------------------------------------------------------------------------------------
double RimPerforationInterval::diameter( RiaDefines::EclipseUnitSystem unitSystem ) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( unitSystem == RiaDefines::EclipseUnitSystem::UNITS_METRIC && wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
{
return RiaEclipseUnitTools::feetToMeter( m_diameter() );
@@ -177,8 +176,7 @@ cvf::BoundingBox RimPerforationInterval::boundingBoxInDomainCoords() const
{
cvf::BoundingBox bb;
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
RigWellPath* rigWellPath = wellPath->wellPathGeometry();
if ( rigWellPath )
@@ -195,8 +193,7 @@ cvf::BoundingBox RimPerforationInterval::boundingBoxInDomainCoords() const
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::setUnitSystemSpecificDefaults()
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
@@ -236,9 +233,7 @@ std::vector<RimWellPathValve*> RimPerforationInterval::valves() const
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::updateAllReferringTracks()
{
std::vector<RimWellLogTrack*> wellLogTracks;
this->objectsWithReferringPtrFieldsOfType( wellLogTracks );
std::vector<RimWellLogTrack*> wellLogTracks = objectsWithReferringPtrFieldsOfType<RimWellLogTrack>();
for ( RimWellLogTrack* track : wellLogTracks )
{
track->loadDataAndUpdate();
@@ -251,8 +246,7 @@ void RimPerforationInterval::updateAllReferringTracks()
//--------------------------------------------------------------------------------------------------
bool RimPerforationInterval::isEnabled() const
{
RimPerforationCollection* perforationCollection;
this->firstAncestorOrThisOfTypeAsserted( perforationCollection );
auto perforationCollection = firstAncestorOrThisOfTypeAsserted<RimPerforationCollection>();
return perforationCollection->isChecked() && isChecked();
}
@@ -328,8 +322,7 @@ void RimPerforationInterval::fieldChangedByUi( const caf::PdmFieldHandle* change
this->updateAllReferringTracks();
RimProject* proj = nullptr;
this->firstAncestorOrThisOfTypeAsserted( proj );
RimProject* proj = RimProject::current();
proj->reloadCompletionTypeResultsInAllViews();
}
@@ -347,8 +340,7 @@ void RimPerforationInterval::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTre
void RimPerforationInterval::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
@@ -401,8 +393,7 @@ void RimPerforationInterval::defineEditorAttribute( const caf::PdmFieldHandle* f
if ( myAttr )
{
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( !wellPath ) return;
myAttr->m_minimum = wellPath->uniqueStartMD();

View File

@@ -186,8 +186,7 @@ void RimSimWellFracture::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
updateAzimuthBasedOnWellAzimuthAngle();
}
RimProject* proj;
this->firstAncestorOrThisOfType( proj );
RimProject* proj = RimProject::current();
if ( proj ) proj->reloadCompletionTypeResultsInAllViews();
}
}
@@ -215,8 +214,7 @@ void RimSimWellFracture::updateFracturePositionFromLocation()
this->setAnchorPosition( interpolated );
RimProject* proj;
this->firstAncestorOrThisOfType( proj );
RimProject* proj = RimProject::current();
if ( proj ) proj->scheduleCreateDisplayModelAndRedrawAllViews();
}
}
@@ -314,9 +312,7 @@ QList<caf::PdmOptionItemInfo> RimSimWellFracture::calculateValueOptions( const c
//--------------------------------------------------------------------------------------------------
RigMainGrid* RimSimWellFracture::ownerCaseMainGrid() const
{
RimEclipseView* ownerEclView;
this->firstAncestorOrThisOfType( ownerEclView );
auto ownerEclView = firstAncestorOrThisOfType<RimEclipseView>();
if ( ownerEclView )
return ownerEclView->mainGrid();
else
@@ -341,10 +337,7 @@ void RimSimWellFracture::computeSimWellBranchCenterLines()
{
m_branchCenterLines.clear();
RimSimWellInView* rimWell = nullptr;
this->firstAncestorOrThisOfType( rimWell );
CVF_ASSERT( rimWell );
auto rimWell = firstAncestorOrThisOfTypeAsserted<RimSimWellInView>();
const auto simWellBranches = RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline( rimWell );
for ( const auto& [coords, wellCells] : simWellBranches )
{

View File

@@ -773,8 +773,7 @@ RimThermalFractureTemplate::FilterCakePressureDrop RimThermalFractureTemplate::f
//--------------------------------------------------------------------------------------------------
bool RimThermalFractureTemplate::placeFractureUsingTemplateData( RimFracture* fracture )
{
RimWellPath* wellPath = nullptr;
fracture->firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = fracture->firstAncestorOrThisOfTypeAsserted<RimWellPath>();
auto wellPathGeometry = wellPath->wellPathGeometry();
if ( !wellPathGeometry ) return false;
@@ -788,7 +787,7 @@ bool RimThermalFractureTemplate::placeFractureUsingTemplateData( RimFracture* fr
double md = wellPathGeometry->closestMeasuredDepth( centerPosition );
RiaLogging::info(
QString( "Placing thermal fracture. Posotion: [%1 %2 %3]" ).arg( centerPosition.x() ).arg( centerPosition.y() ).arg( centerPosition.z() ) );
QString( "Placing thermal fracture. Position: [%1 %2 %3]" ).arg( centerPosition.x() ).arg( centerPosition.y() ).arg( centerPosition.z() ) );
RiaLogging::info( QString( "Computed MD: %1" ).arg( md ) );
RimWellPathFracture* wellPathFracture = dynamic_cast<RimWellPathFracture*>( fracture );

View File

@@ -238,8 +238,7 @@ void RimValveTemplate::fieldChangedByUi( const caf::PdmFieldHandle* changedField
}
if ( changedField == &m_type )
{
std::vector<caf::PdmFieldHandle*> referringFields;
this->referringPtrFields( referringFields );
std::vector<caf::PdmFieldHandle*> referringFields = referringPtrFields();
for ( caf::PdmFieldHandle* field : referringFields )
{
RimWellPathValve* valve = dynamic_cast<RimWellPathValve*>( field->ownerObject() );

View File

@@ -81,8 +81,7 @@ RimWellPathAicdParameters::RimWellPathAicdParameters()
QString( "1*" ),
"Viscosity Exponent of Gas Fraction" );
std::vector<caf::PdmFieldHandle*> allFields;
this->fields( allFields );
std::vector<caf::PdmFieldHandle*> allFields = fields();
for ( caf::PdmFieldHandle* field : allFields )
{
caf::PdmField<QString>* stringField = dynamic_cast<caf::PdmField<QString>*>( field );
@@ -226,9 +225,8 @@ void RimWellPathAicdParameters::setUnitLabels()
//--------------------------------------------------------------------------------------------------
bool RimWellPathAicdParameters::isMetric() const
{
bool metric = false;
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
bool metric = false;
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )

View File

@@ -275,8 +275,7 @@ RimMswCompletionParameters* RimWellPathCompletionSettings::mswCompletionParamete
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( wellPath->isTopLevelWellPath() )
{

View File

@@ -136,9 +136,7 @@ RimStimPlanModelCollection* RimWellPathCompletions::stimPlanModelCollection() co
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPathValve*> RimWellPathCompletions::valves() const
{
std::vector<RimWellPathValve*> allValves;
this->descendantsIncludingThisOfType( allValves );
return allValves;
return descendantsIncludingThisOfType<RimWellPathValve>();
}
//--------------------------------------------------------------------------------------------------
@@ -287,10 +285,9 @@ void RimWellPathCompletions::initAfterRead()
{
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2020.10.1.2" ) )
{
std::vector<RimWellPath*> wellPathHierarchy;
this->allAncestorsOrThisOfType( wellPathHierarchy );
RimWellPath* topLevelWellPath = wellPathHierarchy.back();
auto settings = topLevelWellPath->completionSettings();
std::vector<RimWellPath*> wellPathHierarchy = allAncestorsOrThisOfType<RimWellPath>();
RimWellPath* topLevelWellPath = wellPathHierarchy.back();
auto settings = topLevelWellPath->completionSettings();
applyToSettings( settings );
};

View File

@@ -115,8 +115,7 @@ void RimWellPathFracture::updateAzimuthBasedOnWellAzimuthAngle()
//--------------------------------------------------------------------------------------------------
double RimWellPathFracture::wellAzimuthAtFracturePosition() const
{
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( !wellPath ) return cvf::UNDEFINED_DOUBLE;
double wellPathAzimuth = 0.0;
@@ -137,8 +136,7 @@ double RimWellPathFracture::wellAzimuthAtFracturePosition() const
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimWellPathFracture::computeFractureDirectionNormal() const
{
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( !wellPath ) return cvf::Vec3d::UNDEFINED;
RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
@@ -184,8 +182,7 @@ std::vector<cvf::Vec3d> RimWellPathFracture::perforationLengthCenterLineCoords()
{
std::vector<cvf::Vec3d> wellPathCoords;
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath && wellPath->wellPathGeometry() )
{
double startMd = m_measuredDepth - perforationLength() / 2.0;
@@ -206,11 +203,8 @@ bool RimWellPathFracture::compareByWellPathNameAndMD( const RimWellPathFracture*
{
CVF_TIGHT_ASSERT( lhs && rhs );
RimWellPath* lhsWellPath = nullptr;
lhs->firstAncestorOrThisOfType( lhsWellPath );
RimWellPath* rhsWellPath = nullptr;
rhs->firstAncestorOrThisOfType( rhsWellPath );
RimWellPath* lhsWellPath = lhs->firstAncestorOrThisOfType<RimWellPath>();
RimWellPath* rhsWellPath = rhs->firstAncestorOrThisOfType<RimWellPath>();
if ( lhsWellPath && rhsWellPath )
{
@@ -228,8 +222,7 @@ bool RimWellPathFracture::compareByWellPathNameAndMD( const RimWellPathFracture*
//--------------------------------------------------------------------------------------------------
bool RimWellPathFracture::isEnabled() const
{
RimWellPathFractureCollection* fractureCollection = nullptr;
this->firstAncestorOrThisOfTypeAsserted( fractureCollection );
auto fractureCollection = firstAncestorOrThisOfTypeAsserted<RimWellPathFractureCollection>();
return fractureCollection->isChecked() && isChecked();
}
@@ -244,8 +237,7 @@ void RimWellPathFracture::updatePositionFromMeasuredDepth()
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( this );
if ( !objHandle ) return;
RimWellPath* wellPath = nullptr;
objHandle->firstAncestorOrThisOfType( wellPath );
auto wellPath = objHandle->firstAncestorOrThisOfType<RimWellPath>();
if ( !wellPath ) return;
RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
@@ -325,8 +317,7 @@ void RimWellPathFracture::defineEditorAttribute( const caf::PdmFieldHandle* fiel
if ( myAttr )
{
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( !wellPath ) return;
myAttr->m_minimum = wellPath->uniqueStartMD();

View File

@@ -85,7 +85,7 @@ void RimWellPathFractureCollection::deleteFractures()
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPathFracture*> RimWellPathFractureCollection::allFractures() const
{
return m_fractures.children();
return m_fractures.childrenByType();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -80,10 +80,9 @@ void RimWellPathValve::perforationIntervalUpdated()
{
if ( componentType() == RiaDefines::WellPathComponentType::ICV )
{
const RimPerforationInterval* perfInterval = nullptr;
this->firstAncestorOrThisOfType( perfInterval );
double startMD = perfInterval->startMD();
double endMD = perfInterval->endMD();
const RimPerforationInterval* perfInterval = firstAncestorOrThisOfType<RimPerforationInterval>();
double startMD = perfInterval->startMD();
double endMD = perfInterval->endMD();
m_measuredDepth = std::clamp( m_measuredDepth(), std::min( startMD, endMD ), std::max( startMD, endMD ) );
}
else if ( componentType() == RiaDefines::WellPathComponentType::ICD || componentType() == RiaDefines::WellPathComponentType::AICD )
@@ -112,8 +111,7 @@ void RimWellPathValve::multipleValveGeometryUpdated()
m_measuredDepth = m_multipleValveLocations->valveLocations().front();
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
RimProject* proj = RimProject::current();
proj->reloadCompletionTypeResultsInAllViews();
}
@@ -263,8 +261,7 @@ double RimWellPathValve::convertOrificeDiameter( double o
//--------------------------------------------------------------------------------------------------
std::vector<std::pair<double, double>> RimWellPathValve::valveSegments() const
{
RimPerforationInterval* perforationInterval = nullptr;
this->firstAncestorOrThisOfType( perforationInterval );
auto perforationInterval = firstAncestorOrThisOfType<RimPerforationInterval>();
std::vector<std::pair<double, double>> segments;
if ( componentType() == RiaDefines::WellPathComponentType::ICV )
@@ -315,8 +312,7 @@ void RimWellPathValve::setComponentTypeFilter( const std::set<RiaDefines::WellPa
//--------------------------------------------------------------------------------------------------
bool RimWellPathValve::isEnabled() const
{
RimPerforationInterval* perforationInterval = nullptr;
this->firstAncestorOrThisOfType( perforationInterval );
auto perforationInterval = firstAncestorOrThisOfType<RimPerforationInterval>();
return perforationInterval->isEnabled() && isChecked();
}
@@ -447,12 +443,10 @@ void RimWellPathValve::templateUpdated()
{
applyValveLabelAndIcon();
RimPerforationInterval* perfInterval;
this->firstAncestorOrThisOfTypeAsserted( perfInterval );
perfInterval->updateAllReferringTracks();
auto perforationInterval = firstAncestorOrThisOfType<RimPerforationInterval>();
perforationInterval->updateAllReferringTracks();
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
RimProject* proj = RimProject::current();
proj->reloadCompletionTypeResultsInAllViews();
}
@@ -463,8 +457,7 @@ QList<caf::PdmOptionItemInfo> RimWellPathValve::calculateValueOptions( const caf
{
QList<caf::PdmOptionItemInfo> options;
RimProject* project = nullptr;
this->firstAncestorOrThisOfTypeAsserted( project );
RimProject* project = RimProject::current();
std::vector<RimValveTemplate*> allTemplates = project->allValveTemplates();
for ( RimValveTemplate* valveTemplate : allTemplates )
@@ -500,15 +493,13 @@ void RimWellPathValve::fieldChangedByUi( const caf::PdmFieldHandle* changedField
Riu3DMainWindowTools::selectAsCurrentItem( m_valveTemplate() );
}
RimPerforationInterval* perfInterval;
this->firstAncestorOrThisOfType( perfInterval );
auto perfInterval = firstAncestorOrThisOfType<RimPerforationInterval>();
if ( perfInterval )
{
perfInterval->updateAllReferringTracks();
}
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
RimProject* proj = RimProject::current();
proj->reloadCompletionTypeResultsInAllViews();
}
@@ -535,8 +526,7 @@ void RimWellPathValve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
{
if ( componentType() == RiaDefines::WellPathComponentType::ICV )
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
@@ -580,9 +570,7 @@ void RimWellPathValve::defineEditorAttribute( const caf::PdmFieldHandle* field,
{
double minimumValue = 0.0, maximumValue = 0.0;
RimPerforationInterval* perforationInterval = nullptr;
this->firstAncestorOrThisOfType( perforationInterval );
auto perforationInterval = firstAncestorOrThisOfType<RimPerforationInterval>();
if ( perforationInterval )
{
minimumValue = perforationInterval->startMD();
@@ -590,8 +578,7 @@ void RimWellPathValve::defineEditorAttribute( const caf::PdmFieldHandle* field,
}
else
{
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
minimumValue = wellPath->startMD();
maximumValue = wellPath->endMD();

View File

@@ -316,8 +316,7 @@ QList<caf::PdmOptionItemInfo> RimAbstractCorrelationPlot::calculateValueOptions(
if ( ensemble )
{
std::vector<RimEnsembleCurveSet*> referringObjects;
ensemble->objectsWithReferringPtrFieldsOfType( referringObjects );
std::vector<RimEnsembleCurveSet*> referringObjects = ensemble->objectsWithReferringPtrFieldsOfType<RimEnsembleCurveSet>();
for ( auto object : referringObjects )
{

View File

@@ -198,7 +198,7 @@ void RimCorrelationPlotCollection::removePlot( RimAbstractCorrelationPlot* plot
//--------------------------------------------------------------------------------------------------
std::vector<RimAbstractCorrelationPlot*> RimCorrelationPlotCollection::plots() const
{
return m_correlationPlots.children();
return m_correlationPlots.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -214,7 +214,7 @@ size_t RimCorrelationPlotCollection::plotCount() const
//--------------------------------------------------------------------------------------------------
std::vector<RimCorrelationReportPlot*> RimCorrelationPlotCollection::reports() const
{
return m_correlationReports.children();
return m_correlationReports.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -232,8 +232,7 @@ void RimCorrelationPlotCollection::deleteAllPlots()
void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot,
const std::vector<QString>& quantityNames /*= {} */ )
{
std::vector<RimSummaryCaseCollection*> ensembles;
RimProject::current()->descendantsIncludingThisOfType( ensembles );
std::vector<RimSummaryCaseCollection*> ensembles = RimProject::current()->descendantsIncludingThisOfType<RimSummaryCaseCollection>();
if ( !ensembles.empty() )
{
std::set<RifEclipseSummaryAddress> allAddresses = ensembles.front()->ensembleSummaryAddresses();
@@ -297,8 +296,7 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToReport( Rim
const std::vector<QString>& matrixQuantityNames,
const QString& tornadoAndCrossPlotQuantityName )
{
std::vector<RimSummaryCaseCollection*> ensembles;
RimProject::current()->descendantsIncludingThisOfType( ensembles );
std::vector<RimSummaryCaseCollection*> ensembles = RimProject::current()->descendantsIncludingThisOfType<RimSummaryCaseCollection>();
if ( !ensembles.empty() )
{
std::set<RifEclipseSummaryAddress> allAddresses = ensembles.front()->ensembleSummaryAddresses();

View File

@@ -69,10 +69,7 @@ void RimFaultInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
if ( &faultColor == changedField || &showFault == changedField )
{
RimEclipseView* reservoirView = nullptr;
this->firstAncestorOrThisOfType( reservoirView );
auto reservoirView = firstAncestorOrThisOfType<RimEclipseView>();
if ( reservoirView )
{
reservoirView->scheduleCreateDisplayModelAndRedraw();

View File

@@ -309,8 +309,7 @@ void RimFaultInViewCollection::defineUiOrdering( QString uiConfigName, caf::PdmU
//--------------------------------------------------------------------------------------------------
void RimFaultInViewCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
{
RimEclipseView* eclipseView = nullptr;
this->firstAncestorOfType( eclipseView );
auto eclipseView = firstAncestorOfType<RimEclipseView>();
if ( eclipseView )
{
auto uiTree = eclipseView->faultResultSettings()->uiTreeOrdering();
@@ -330,10 +329,7 @@ void RimFaultInViewCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiT
//--------------------------------------------------------------------------------------------------
RimEclipseView* RimFaultInViewCollection::parentView() const
{
RimEclipseView* view = nullptr;
this->firstAncestorOrThisOfTypeAsserted( view );
return view;
return firstAncestorOrThisOfTypeAsserted<RimEclipseView>();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -145,9 +145,8 @@ void RimFlowCharacteristicsPlot::setFromFlowSolution( RimFlowDiagSolution* flowS
}
else
{
RimEclipseResultCase* eclCase;
flowSolution->firstAncestorOrThisOfType( eclCase );
m_case = eclCase;
auto eclCase = flowSolution->firstAncestorOrThisOfType<RimEclipseResultCase>();
m_case = eclCase;
if ( !eclCase->reservoirViews.empty() )
{
m_cellFilterView = eclCase->reservoirViews()[0];

View File

@@ -99,9 +99,7 @@ RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
{
size_t timeStepCount;
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType( eclCase );
auto eclCase = firstAncestorOrThisOfType<RimEclipseResultCase>();
if ( !eclCase || !eclCase->eclipseCaseData() )
{
return nullptr;
@@ -129,8 +127,7 @@ const RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults() const
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimFlowDiagSolution::tracerNames() const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType( eclCase );
auto eclCase = firstAncestorOrThisOfType<RimEclipseResultCase>();
std::vector<QString> tracerNameSet;
@@ -169,8 +166,7 @@ std::map<std::string, std::vector<int>> RimFlowDiagSolution::allProducerTracerAc
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int>> RimFlowDiagSolution::allTracerActiveCellIndices( size_t timeStepIndex, bool useInjectors ) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType( eclCase );
auto eclCase = firstAncestorOrThisOfType<RimEclipseResultCase>();
std::map<std::string, std::vector<int>> tracersWithCells;
@@ -233,8 +229,7 @@ std::map<std::string, std::vector<int>> RimFlowDiagSolution::allTracerActiveCell
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall( const QString& tracerName ) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfTypeAsserted( eclCase );
auto eclCase = firstAncestorOrThisOfTypeAsserted<RimEclipseResultCase>();
TracerStatusType tracerStatus = TracerStatusType::UNDEFINED;
if ( eclCase && eclCase->eclipseCaseData() )
@@ -287,9 +282,7 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeStep( const QString& tracerName, size_t timeStepIndex ) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfTypeAsserted( eclCase );
auto eclCase = firstAncestorOrThisOfTypeAsserted<RimEclipseResultCase>();
if ( eclCase && eclCase->eclipseCaseData() )
{
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
@@ -337,9 +330,7 @@ cvf::Color3f RimFlowDiagSolution::tracerColor( const QString& tracerName ) const
if ( wellName == RIG_RESERVOIR_TRACER_NAME ) return cvf::Color3f::LIGHT_GRAY;
if ( wellName == RIG_TINY_TRACER_GROUP_NAME ) return cvf::Color3f::DARK_GRAY;
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType( eclCase );
auto eclCase = firstAncestorOrThisOfType<RimEclipseResultCase>();
if ( eclCase )
{
return eclCase->defaultWellColor( wellName );

View File

@@ -107,8 +107,7 @@ void RimTofAccumulatedPhaseFractionsPlot::reloadFromWell()
//--------------------------------------------------------------------------------------------------
RimEclipseResultCase* RimTofAccumulatedPhaseFractionsPlot::resultCase()
{
RimWellAllocationPlot* allocationPlot;
firstAncestorOrThisOfTypeAsserted( allocationPlot );
auto allocationPlot = firstAncestorOrThisOfTypeAsserted<RimWellAllocationPlot>();
return allocationPlot->rimCase();
}
@@ -118,8 +117,7 @@ RimEclipseResultCase* RimTofAccumulatedPhaseFractionsPlot::resultCase()
//--------------------------------------------------------------------------------------------------
QString RimTofAccumulatedPhaseFractionsPlot::tracerName()
{
RimWellAllocationPlot* allocationPlot;
firstAncestorOrThisOfTypeAsserted( allocationPlot );
auto allocationPlot = firstAncestorOrThisOfTypeAsserted<RimWellAllocationPlot>();
return allocationPlot->wellName();
}
@@ -129,8 +127,7 @@ QString RimTofAccumulatedPhaseFractionsPlot::tracerName()
//--------------------------------------------------------------------------------------------------
size_t RimTofAccumulatedPhaseFractionsPlot::timeStep()
{
RimWellAllocationPlot* allocationPlot;
firstAncestorOrThisOfTypeAsserted( allocationPlot );
auto allocationPlot = firstAncestorOrThisOfTypeAsserted<RimWellAllocationPlot>();
return static_cast<size_t>( allocationPlot->timeStep() );
}

View File

@@ -152,10 +152,8 @@ void RimWellAllocationOverTimePlot::setDescription( const QString& description )
//--------------------------------------------------------------------------------------------------
void RimWellAllocationOverTimePlot::setFromSimulationWell( RimSimWellInView* simWell )
{
RimEclipseView* eclView;
simWell->firstAncestorOrThisOfType( eclView );
RimEclipseResultCase* eclCase;
simWell->firstAncestorOrThisOfType( eclCase );
auto eclView = simWell->firstAncestorOrThisOfType<RimEclipseView>();
auto eclCase = simWell->firstAncestorOrThisOfType<RimEclipseResultCase>();
m_case = eclCase;
m_wellName = simWell->simWellData()->m_wellName;

View File

@@ -168,10 +168,8 @@ void RimWellAllocationPlot::setFromSimulationWell( RimSimWellInView* simWell )
{
m_showWindow = true;
RimEclipseView* eclView;
simWell->firstAncestorOrThisOfType( eclView );
RimEclipseResultCase* eclCase;
simWell->firstAncestorOrThisOfType( eclCase );
auto eclView = simWell->firstAncestorOrThisOfType<RimEclipseView>();
auto eclCase = simWell->firstAncestorOrThisOfType<RimEclipseResultCase>();
m_case = eclCase;
m_wellName = simWell->simWellData()->m_wellName;
@@ -210,9 +208,7 @@ void RimWellAllocationPlot::updateFromWell()
// Delete existing tracks
{
std::vector<RimWellLogTrack*> tracks;
accumulatedWellFlowPlot()->descendantsIncludingThisOfType( tracks );
std::vector<RimWellLogTrack*> tracks = accumulatedWellFlowPlot()->descendantsIncludingThisOfType<RimWellLogTrack>();
for ( RimWellLogTrack* t : tracks )
{
for ( auto c : t->curves() )

View File

@@ -52,8 +52,7 @@ void RimWellAllocationPlotLegend::fieldChangedByUi( const caf::PdmFieldHandle* c
{
if ( changedField == &m_showLegend )
{
RimWellAllocationPlot* walp;
firstAncestorOrThisOfType( walp );
auto walp = firstAncestorOrThisOfType<RimWellAllocationPlot>();
if ( walp ) walp->showPlotLegend( m_showLegend() );
}

View File

@@ -202,10 +202,8 @@ void RimWellConnectivityTable::setFromSimulationWell( RimSimWellInView* simWell
{
if ( !simWell ) return;
RimEclipseView* eclView;
simWell->firstAncestorOrThisOfType( eclView );
RimEclipseResultCase* eclCase;
simWell->firstAncestorOrThisOfType( eclCase );
auto eclView = simWell->firstAncestorOrThisOfType<RimEclipseView>();
auto eclCase = simWell->firstAncestorOrThisOfType<RimEclipseResultCase>();
m_cellFilterView = eclView;
m_case = eclCase;
@@ -665,7 +663,7 @@ QList<caf::PdmOptionItemInfo> RimWellConnectivityTable::calculateValueOptions( c
else if ( fieldNeedingOptions == &m_cellFilterView && m_case() )
{
options.push_back( caf::PdmOptionItemInfo( "Disabled", nullptr ) );
for ( RimEclipseView* view : m_case()->reservoirViews.children() )
for ( RimEclipseView* view : m_case()->reservoirViews.childrenByType() )
{
CVF_ASSERT( view && "Really always should have a valid view pointer in ReservoirViews" );
options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) );

View File

@@ -370,7 +370,7 @@ void RimWellDistributionPlotCollection::updatePlots()
//--------------------------------------------------------------------------------------------------
void RimWellDistributionPlotCollection::cleanupBeforeClose()
{
auto plotVector = m_plots.children();
auto plotVector = m_plots.childrenByType();
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
{
plotVector[tIdx]->detachAllCurves();

View File

@@ -165,8 +165,7 @@ void RimWellFlowRateCurve::onLoadDataAndUpdate( bool updateParentPlot )
if ( updateParentPlot )
{
RimWellLogTrack* track = nullptr;
this->firstAncestorOrThisOfTypeAsserted( track );
auto track = firstAncestorOrThisOfTypeAsserted<RimWellLogTrack>();
track->updateStackedCurveData();
updateZoomInParentPlot();
@@ -184,8 +183,7 @@ void RimWellFlowRateCurve::updateCurveAppearance()
bool isLastCurveInGroup = false;
{
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfTypeAsserted( wellLogTrack );
auto wellLogTrack = firstAncestorOrThisOfTypeAsserted<RimWellLogTrack>();
std::map<int, std::vector<RimWellLogCurve*>> stackedCurveGroups = wellLogTrack->visibleStackedCurves();
const std::vector<RimWellLogCurve*>& curveGroup = stackedCurveGroups[this->m_groupId];
@@ -269,8 +267,7 @@ void RimWellFlowRateCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedF
//--------------------------------------------------------------------------------------------------
bool RimWellFlowRateCurve::isUsingConnectionNumberDepthType() const
{
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType( wellLogPlot );
auto wellLogPlot = firstAncestorOrThisOfType<RimWellLogPlot>();
if ( wellLogPlot && wellLogPlot->depthType() == RiaDefines::DepthTypeEnum::CONNECTION_NUMBER )
{
return true;
@@ -284,10 +281,7 @@ bool RimWellFlowRateCurve::isUsingConnectionNumberDepthType() const
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const
{
RimWellAllocationPlot* wap = nullptr;
this->firstAncestorOrThisOfType( wap );
return wap;
return firstAncestorOrThisOfType<RimWellAllocationPlot>();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -627,9 +627,7 @@ RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve( const RimWellLogCu
}
else if ( rftSummaryCase != nullptr )
{
RimSummaryCaseCollection* parentEnsemble = nullptr;
rftSummaryCase->firstAncestorOrThisOfType( parentEnsemble );
RimSummaryCaseCollection* parentEnsemble = rftSummaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
return RiaRftPltCurveDefinition( RifDataSourceForRftPlt( rftSummaryCase, parentEnsemble ), wellName, timeStep );
}
else if ( rftEnsemble != nullptr )

View File

@@ -184,8 +184,7 @@ void RimWellRftEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* ch
{
if ( changedField == &m_ensembleColorMode || changedField == &m_ensembleParameter )
{
RimWellRftPlot* rftPlot = nullptr;
this->firstAncestorOrThisOfTypeAsserted( rftPlot );
RimWellRftPlot* rftPlot = firstAncestorOrThisOfTypeAsserted<RimWellRftPlot>();
rftPlot->syncCurvesFromUiSelection();
rftPlot->updateConnectedEditors();
}

View File

@@ -121,11 +121,6 @@ RimWellRftPlot::RimWellRftPlot()
m_selectedTimeSteps.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
m_selectedTimeSteps.uiCapability()->setAutoAddingOptionFromValue( false );
CAF_PDM_InitFieldNoDefault( &m_wellPathCollection, "WellPathCollection", "Well Path Collection" );
m_wellPathCollection.uiCapability()->setUiHidden( true );
m_wellPathCollection.xmlCapability()->disableIO();
m_wellPathCollection = RimProject::current()->activeOilField()->wellPathCollection();
CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSets, "EnsembleCurveSets", "Ensemble Curve Sets" );
// TODO: may want to support TRUE_VERTICAL_DEPTH_RKB in the future
@@ -848,9 +843,8 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptionsForSources()
{
if ( summaryCase->rftReader() && summaryCase->rftReader()->wellNames().contains( m_wellPathNameOrSimWellName ) )
{
RimSummaryCaseCollection* parentEnsemble = nullptr;
summaryCase->firstAncestorOrThisOfType( parentEnsemble );
auto addr = RifDataSourceForRftPlt( summaryCase, parentEnsemble );
auto parentEnsemble = summaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
auto addr = RifDataSourceForRftPlt( summaryCase, parentEnsemble );
auto item = caf::PdmOptionItemInfo( summaryCase->displayCaseName(), QVariant::fromValue( addr ) );
item.setLevel( 1 );

View File

@@ -153,8 +153,6 @@ private:
caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources;
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
caf::PdmPtrField<RimWellPathCollection*> m_wellPathCollection;
caf::PdmChildArrayField<RimWellRftEnsembleCurveSet*> m_ensembleCurveSets;
std::map<RimWellRftEnsembleCurveSet*, QPointer<RiuDraggableOverlayFrame>> m_ensembleLegendFrames;

View File

@@ -398,8 +398,7 @@ std::vector<Rim3dView*> RimGeoMechCase::allSpecialViews() const
//--------------------------------------------------------------------------------------------------
void RimGeoMechCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
{
std::vector<PdmObjectHandle*> children;
geoMechViews.children( &children );
std::vector<PdmObjectHandle*> children = geoMechViews.children();
for ( auto child : children )
uiTreeOrdering.add( child );

View File

@@ -51,10 +51,7 @@ RimGeoMechCellColors::~RimGeoMechCellColors()
//--------------------------------------------------------------------------------------------------
void RimGeoMechCellColors::updateIconState()
{
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfType( rimView );
CVF_ASSERT( rimView );
auto rimView = firstAncestorOrThisOfTypeAsserted<Rim3dView>();
if ( rimView )
{
RimViewController* viewController = rimView->viewController();

View File

@@ -568,9 +568,7 @@ std::vector<double> RimGeoMechContourMapProjection::gridCellValues( RigFemResult
//--------------------------------------------------------------------------------------------------
RimGeoMechCase* RimGeoMechContourMapProjection::geoMechCase() const
{
RimGeoMechCase* geoMechCase = nullptr;
firstAncestorOrThisOfType( geoMechCase );
return geoMechCase;
return firstAncestorOrThisOfType<RimGeoMechCase>();
}
//--------------------------------------------------------------------------------------------------
@@ -578,9 +576,7 @@ RimGeoMechCase* RimGeoMechContourMapProjection::geoMechCase() const
//--------------------------------------------------------------------------------------------------
RimGeoMechContourMapView* RimGeoMechContourMapProjection::view() const
{
RimGeoMechContourMapView* view = nullptr;
firstAncestorOrThisOfTypeAsserted( view );
return view;
return firstAncestorOrThisOfTypeAsserted<RimGeoMechContourMapView>();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -104,8 +104,7 @@ QString RimGeoMechContourMapView::createAutoName() const
QStringList generatedAutoTags;
RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfTypeAsserted( ownerCase );
auto ownerCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
if ( nameConfig()->addCaseName() )
{

View File

@@ -28,7 +28,7 @@ RimGeoMechContourMapViewCollection::~RimGeoMechContourMapViewCollection()
//--------------------------------------------------------------------------------------------------
std::vector<RimGeoMechContourMapView*> RimGeoMechContourMapViewCollection::views()
{
return m_contourMapViews.children();
return m_contourMapViews.childrenByType();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -52,7 +52,7 @@ RimGeoMechModels::~RimGeoMechModels()
//--------------------------------------------------------------------------------------------------
std::vector<RimGeoMechCase*> RimGeoMechModels::cases() const
{
return m_cases.children();
return m_cases.childrenByType();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -72,8 +72,7 @@ void RimGeoMechPart::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
if ( changedField == objectToggleField() )
{
RimGeoMechView* ownerView;
firstAncestorOrThisOfType( ownerView );
auto ownerView = firstAncestorOrThisOfType<RimGeoMechView>();
if ( ownerView ) ownerView->scheduleCreateDisplayModelAndRedraw();
}
}

View File

@@ -88,7 +88,7 @@ void RimGeoMechPartCollection::syncWithCase( RimGeoMechCase* geoCase )
//--------------------------------------------------------------------------------------------------
std::vector<RimGeoMechPart*> RimGeoMechPartCollection::parts() const
{
return m_parts.children();
return m_parts.childrenByType();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -351,13 +351,10 @@ void RimGeoMechResultDefinition::fieldChangedByUi( const caf::PdmFieldHandle* ch
}
// Get the possible property filter owner
RimGeoMechPropertyFilter* propFilter = dynamic_cast<RimGeoMechPropertyFilter*>( this->parentField()->ownerObject() );
RimGridView* view = nullptr;
this->firstAncestorOrThisOfType( view );
RimPlotCurve* curve = nullptr;
this->firstAncestorOrThisOfType( curve );
Rim3dWellLogCurve* rim3dWellLogCurve = nullptr;
this->firstAncestorOrThisOfType( rim3dWellLogCurve );
auto propFilter = dynamic_cast<RimGeoMechPropertyFilter*>( this->parentField()->ownerObject() );
auto view = firstAncestorOrThisOfType<RimGridView>();
auto curve = firstAncestorOrThisOfType<RimPlotCurve>();
auto rim3dWellLogCurve = firstAncestorOrThisOfType<Rim3dWellLogCurve>();
if ( &m_resultVariableUiField == changedField || &m_compactionRefLayerUiField == changedField ||
&m_timeLapseBaseTimestep == changedField || &m_normalizeByHydrostaticPressure == changedField ||

View File

@@ -229,8 +229,7 @@ QString RimGeoMechView::createAutoName() const
QStringList generatedAutoTags;
RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfTypeAsserted( ownerCase );
RimCase* ownerCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
if ( nameConfig()->addCaseName() )
{

View File

@@ -71,9 +71,7 @@ void RimPlotCellFilterCollection::setCase( RimCase* gridCase )
RimEclipseResultCase* eclipseResultCase = dynamic_cast<RimEclipseResultCase*>( gridCase );
if ( eclipseResultCase )
{
std::vector<RimEclipseResultDefinition*> resultDefinitions;
this->descendantsIncludingThisOfType( resultDefinitions );
auto resultDefinitions = descendantsIncludingThisOfType<RimEclipseResultDefinition>();
for ( auto r : resultDefinitions )
{
r->setEclipseCase( eclipseResultCase );

View File

@@ -143,7 +143,7 @@ void RimGridCrossPlot::addDataSet( RimGridCrossPlotDataSet* dataSet )
//--------------------------------------------------------------------------------------------------
std::vector<RimGridCrossPlotDataSet*> RimGridCrossPlot::dataSets() const
{
return m_crossPlotDataSets.children();
return m_crossPlotDataSets.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -1041,8 +1041,7 @@ void RimGridCrossPlot::cleanupBeforeClose()
//--------------------------------------------------------------------------------------------------
bool RimGridCrossPlot::isDeletable() const
{
RimMultiPlot* plotWindow = nullptr;
firstAncestorOrThisOfType( plotWindow );
auto plotWindow = firstAncestorOrThisOfType<RimMultiPlot>();
return plotWindow == nullptr;
}

View File

@@ -45,7 +45,7 @@ RimGridCrossPlotCollection::~RimGridCrossPlotCollection()
//--------------------------------------------------------------------------------------------------
std::vector<RimGridCrossPlot*> RimGridCrossPlotCollection::plots() const
{
return m_gridCrossPlots.children();
return m_gridCrossPlots.childrenByType();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -93,9 +93,8 @@ void RimGridCrossPlotCurve::determineLegendIcon()
{
if ( !m_plotCurve ) return;
RimGridCrossPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted( plot );
int fontSize = plot->legendFontSize();
auto plot = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
int fontSize = plot->legendFontSize();
m_plotCurve->setLegendIconSize( QSize( fontSize, fontSize ) );
}
@@ -124,8 +123,7 @@ void RimGridCrossPlotCurve::determineSymbol()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurve::updateZoomInParentPlot()
{
RimGridCrossPlot* plot;
this->firstAncestorOrThisOfTypeAsserted( plot );
auto plot = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
plot->calculateZoomRangeAndUpdateQwt();
}

View File

@@ -191,8 +191,7 @@ void RimGridCrossPlotDataSet::setCellFilterView( RimGridView* cellFilterView )
m_yAxisProperty->setResultVariable( "DEPTH" );
m_timeStep = eclipseView->currentTimeStep();
RimGridCrossPlot* parentPlot = nullptr;
firstAncestorOrThisOfType( parentPlot );
auto parentPlot = firstAncestorOrThisOfType<RimGridCrossPlot>();
if ( parentPlot )
{
parentPlot->setYAxisInverted( true );
@@ -271,8 +270,7 @@ QString RimGridCrossPlotDataSet::infoText() const
//--------------------------------------------------------------------------------------------------
int RimGridCrossPlotDataSet::indexInPlot() const
{
RimGridCrossPlot* parent;
this->firstAncestorOrThisOfTypeAsserted( parent );
auto parent = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
return parent->indexOfDataSet( this );
}
@@ -385,7 +383,7 @@ RimRegularLegendConfig* RimGridCrossPlotDataSet::legendConfig() const
//--------------------------------------------------------------------------------------------------
std::vector<RimGridCrossPlotCurve*> RimGridCrossPlotDataSet::curves() const
{
return m_crossPlotCurves.children();
return m_crossPlotCurves.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -940,8 +938,7 @@ void RimGridCrossPlotDataSet::childFieldChangedByUi( const caf::PdmFieldHandle*
{
if ( m_yAxisProperty->resultVariable() == "DEPTH" )
{
RimGridCrossPlot* plot;
this->firstAncestorOrThisOfTypeAsserted( plot );
auto plot = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
plot->setYAxisInverted( true );
triggerPlotNameUpdateAndReplot();
}
@@ -979,7 +976,7 @@ QList<caf::PdmOptionItemInfo> RimGridCrossPlotDataSet::calculateValueOptions( co
if ( eclipseCase )
{
options.push_back( caf::PdmOptionItemInfo( "Disabled", nullptr ) );
for ( RimEclipseView* view : eclipseCase->reservoirViews.children() )
for ( RimEclipseView* view : eclipseCase->reservoirViews.childrenByType() )
{
CVF_ASSERT( view && "Really always should have a valid view pointer in ReservoirViews" );
options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) );
@@ -1017,8 +1014,7 @@ void RimGridCrossPlotDataSet::updateLegendRange()
legendConfig()->setTitle( groupParameter() );
legendConfig()->disableAllTimeStepsRange( !hasMultipleTimeSteps() );
RimGridCrossPlot* parent;
this->firstAncestorOrThisOfTypeAsserted( parent );
auto parent = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
if ( parent->plotWidget() )
{
if ( groupingEnabled() && m_case() && isChecked() && legendConfig()->showLegend() )
@@ -1194,8 +1190,7 @@ void RimGridCrossPlotDataSet::exportFormattedData( RifTextDataTableFormatter& fo
//--------------------------------------------------------------------------------------------------
bool RimGridCrossPlotDataSet::isXAxisLogarithmic() const
{
RimGridCrossPlot* parent = nullptr;
firstAncestorOrThisOfTypeAsserted( parent );
auto parent = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
return parent->isXAxisLogarithmic();
}
@@ -1204,8 +1199,7 @@ bool RimGridCrossPlotDataSet::isXAxisLogarithmic() const
//--------------------------------------------------------------------------------------------------
bool RimGridCrossPlotDataSet::isYAxisLogarithmic() const
{
RimGridCrossPlot* parent = nullptr;
firstAncestorOrThisOfTypeAsserted( parent );
auto parent = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
return parent->isYAxisLogarithmic();
}
@@ -1260,8 +1254,7 @@ void RimGridCrossPlotDataSet::setCustomColor( const cvf::Color3f color )
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotDataSet::triggerPlotNameUpdateAndReplot()
{
RimGridCrossPlot* parent;
this->firstAncestorOrThisOfType( parent );
auto parent = firstAncestorOrThisOfType<RimGridCrossPlot>();
if ( parent )
{
parent->updateCurveNamesAndPlotTitle();

View File

@@ -193,11 +193,8 @@ void RimSaturationPressurePlot::fixPointersAfterCopy( RimSaturationPressurePlot*
{
CAF_ASSERT( source && copy );
std::vector<RimPlotCellPropertyFilter*> sourceFilters;
source->descendantsIncludingThisOfType( sourceFilters );
std::vector<RimPlotCellPropertyFilter*> copyFilters;
copy->descendantsIncludingThisOfType( copyFilters );
auto sourceFilters = source->descendantsIncludingThisOfType<RimPlotCellPropertyFilter>();
auto copyFilters = copy->descendantsIncludingThisOfType<RimPlotCellPropertyFilter>();
if ( !sourceFilters.empty() && ( sourceFilters.size() == copyFilters.size() ) )
{

View File

@@ -109,7 +109,7 @@ std::vector<RimSaturationPressurePlot*>
//--------------------------------------------------------------------------------------------------
std::vector<RimSaturationPressurePlot*> RimSaturationPressurePlotCollection::plots() const
{
return m_saturationPressurePlots.children();
return m_saturationPressurePlots.childrenByType();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -336,8 +336,7 @@ void RimBoxIntersection::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
{
m_boxManipulator = new RicBoxManipulatorEventHandler( viewer() );
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfType( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
for ( Rim3dView* mainView : rimView->viewsUsingThisAsComparisonView() )
{
m_boxManipulator->registerInAdditionalViewer( mainView->viewer() );
@@ -367,9 +366,7 @@ void RimBoxIntersection::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
{
if ( m_boxManipulator )
{
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfType( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
if ( rimView )
{
cvf::ref<caf::DisplayCoordTransform> transForm = rimView->displayCoordTransform();
@@ -393,8 +390,7 @@ void RimBoxIntersection::updateBoxManipulatorGeometry()
{
if ( m_boxManipulator.isNull() ) return;
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfType( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
if ( !rimView ) return;
cvf::ref<caf::DisplayCoordTransform> transForm = rimView->displayCoordTransform();
@@ -522,8 +518,7 @@ void RimBoxIntersection::initAfterRead()
//--------------------------------------------------------------------------------------------------
void RimBoxIntersection::slotScheduleRedraw()
{
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfType( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
if ( rimView )
{
rimView->scheduleCreateDisplayModelAndRedraw();
@@ -535,9 +530,7 @@ void RimBoxIntersection::slotScheduleRedraw()
//--------------------------------------------------------------------------------------------------
void RimBoxIntersection::slotUpdateGeometry( const cvf::Vec3d& origin, const cvf::Vec3d& size )
{
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfType( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
if ( rimView )
{
cvf::ref<caf::DisplayCoordTransform> transForm = rimView->displayCoordTransform();
@@ -663,23 +656,8 @@ void RimBoxIntersection::switchSingelPlaneState()
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RimBoxIntersection::currentCellBoundingBox()
{
RimCase* rimCase = nullptr;
this->firstAncestorOrThisOfType( rimCase );
auto rimCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
CVF_ASSERT( rimCase );
/*
RimEclipseView* eclView = nullptr;
this->firstAncestorOrThisOfType(eclView);
bool useAllCells = true;
if (eclView)
{
useAllCells = eclView->showInactiveCells();
}
if(false)//useAllCells) // For now, only use the active CellsBBox.
return rimCase->allCellsBoundingBox();
else */
return rimCase->activeCellsBoundingBox();
}
@@ -688,11 +666,8 @@ cvf::BoundingBox RimBoxIntersection::currentCellBoundingBox()
//--------------------------------------------------------------------------------------------------
RiuViewer* RimBoxIntersection::viewer()
{
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfType( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
if ( rimView ) return rimView->viewer();
RiuViewer* riuViewer = nullptr;
if ( rimView ) riuViewer = rimView->viewer();
return riuViewer;
return nullptr;
}

View File

@@ -708,8 +708,7 @@ std::vector<std::vector<cvf::Vec3d>> RimExtrudedCurveIntersection::polyLines( cv
if ( m_wellPath() && wellPath()->wellPathGeometry() )
{
lines.push_back( wellPath()->wellPathGeometry()->wellPathPoints() );
RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfType( ownerCase );
auto ownerCase = firstAncestorOrThisOfType<RimCase>();
if ( ownerCase && ownerCase->activeCellsBoundingBox().isValid() )
{
size_t dummy;
@@ -1041,8 +1040,7 @@ void RimExtrudedCurveIntersection::appendPointToPolyLine( const cvf::Vec3d& poin
//--------------------------------------------------------------------------------------------------
Rim2dIntersectionView* RimExtrudedCurveIntersection::correspondingIntersectionView() const
{
std::vector<Rim2dIntersectionView*> objects;
this->objectsWithReferringPtrFieldsOfType( objects );
std::vector<Rim2dIntersectionView*> objects = objectsWithReferringPtrFieldsOfType<Rim2dIntersectionView>();
for ( auto isectView : objects )
{
if ( isectView )
@@ -1237,8 +1235,7 @@ void RimExtrudedCurveIntersection::rebuildGeometryAndScheduleCreateDisplayModel(
{
m_crossSectionPartMgr = nullptr;
Rim3dView* rimView = nullptr;
this->firstAncestorOrThisOfType( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
if ( rimView )
{
rimView->scheduleCreateDisplayModelAndRedraw();
@@ -1314,7 +1311,5 @@ void RimExtrudedCurveIntersection::setPointsFromXYD( const std::vector<cvf::Vec3
//--------------------------------------------------------------------------------------------------
RimEclipseView* RimExtrudedCurveIntersection::eclipseView() const
{
RimEclipseView* eclipseView = nullptr;
firstAncestorOrThisOfType( eclipseView );
return eclipseView;
return firstAncestorOrThisOfType<RimEclipseView>();
}

View File

@@ -128,8 +128,7 @@ QList<caf::PdmOptionItemInfo> RimIntersection::calculateValueOptions( const caf:
//--------------------------------------------------------------------------------------------------
RimIntersectionResultsDefinitionCollection* RimIntersection::findSeparateResultsCollection()
{
RimGridView* view;
this->firstAncestorOrThisOfTypeAsserted( view );
auto view = firstAncestorOrThisOfTypeAsserted<RimGridView>();
return view->separateIntersectionResultsCollection();
}
@@ -187,8 +186,7 @@ void RimIntersection::updateDefaultSeparateDataSource()
//--------------------------------------------------------------------------------------------------
cvf::ref<RivIntersectionHexGridInterface> RimIntersection::createHexGridInterface()
{
RimGeoMechView* geoView;
this->firstAncestorOrThisOfType( geoView );
auto geoView = firstAncestorOrThisOfType<RimGeoMechView>();
RimIntersectionResultDefinition* resDef = activeSeparateResultDefinition();
if ( resDef && resDef->activeCase() )
@@ -214,8 +212,7 @@ cvf::ref<RivIntersectionHexGridInterface> RimIntersection::createHexGridInterfac
}
}
RimEclipseView* eclipseView;
this->firstAncestorOrThisOfType( eclipseView );
auto eclipseView = firstAncestorOrThisOfType<RimEclipseView>();
if ( eclipseView && eclipseView->mainGrid() )
{
RigMainGrid* grid = eclipseView->mainGrid();

View File

@@ -96,8 +96,7 @@ caf::PdmFieldHandle* RimIntersectionCollection::objectToggleField()
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= "" */ )
{
RimGridView* gridView = nullptr;
this->firstAncestorOfType( gridView );
auto gridView = firstAncestorOfType<RimGridView>();
if ( gridView )
{
auto uiTree = gridView->separateIntersectionResultsCollection()->uiTreeOrdering();
@@ -251,7 +250,7 @@ void RimIntersectionCollection::rebuildGeometry()
//--------------------------------------------------------------------------------------------------
std::vector<RimExtrudedCurveIntersection*> RimIntersectionCollection::intersections() const
{
return m_intersections.children();
return m_intersections.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -259,7 +258,7 @@ std::vector<RimExtrudedCurveIntersection*> RimIntersectionCollection::intersecti
//--------------------------------------------------------------------------------------------------
std::vector<RimBoxIntersection*> RimIntersectionCollection::intersectionBoxes() const
{
return m_intersectionBoxes.children();
return m_intersectionBoxes.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -306,8 +305,7 @@ void RimIntersectionCollection::appendIntersectionNoUpdate( RimExtrudedCurveInte
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::syncronize2dIntersectionViews()
{
RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfTypeAsserted( ownerCase );
auto ownerCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
ownerCase->intersectionViewCollection()->syncFromExistingIntersections( true );
}
@@ -508,9 +506,7 @@ void RimIntersectionCollection::defineEditorAttribute( const caf::PdmFieldHandle
//--------------------------------------------------------------------------------------------------
RimEclipseView* RimIntersectionCollection::eclipseView() const
{
RimEclipseView* eclipseView = nullptr;
firstAncestorOrThisOfType( eclipseView );
return eclipseView;
return firstAncestorOrThisOfType<RimEclipseView>();
}
//--------------------------------------------------------------------------------------------------
@@ -518,8 +514,7 @@ RimEclipseView* RimIntersectionCollection::eclipseView() const
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::rebuild3dView() const
{
Rim3dView* rimView = nullptr;
firstAncestorOrThisOfType( rimView );
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
if ( rimView )
{
rimView->scheduleCreateDisplayModelAndRedraw();

View File

@@ -104,8 +104,7 @@ void RimIntersectionResultDefinition::assignCaseIfMissing() const
{
if ( !m_case )
{
RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfType( ownerCase );
auto ownerCase = firstAncestorOrThisOfType<RimCase>();
const_cast<RimIntersectionResultDefinition*>( this )->setActiveCase( ownerCase );
}
}
@@ -331,14 +330,12 @@ void RimIntersectionResultDefinition::fieldChangedByUi( const caf::PdmFieldHandl
this->updateConnectedEditors();
RimIntersectionResultsDefinitionCollection* interResDefColl = nullptr;
this->firstAncestorOrThisOfType( interResDefColl );
bool isInAction = isActive() && interResDefColl && interResDefColl->isActive();
auto interResDefColl = firstAncestorOrThisOfType<RimIntersectionResultsDefinitionCollection>();
bool isInAction = isActive() && interResDefColl && interResDefColl->isActive();
if ( changedField == &m_isActive || ( changedField == &m_timeStep && isInAction ) )
{
std::vector<PdmObject*> referringObjects;
this->objectsWithReferringPtrFieldsOfType( referringObjects );
std::vector<PdmObject*> referringObjects = objectsWithReferringPtrFieldsOfType<PdmObject>();
for ( auto* obj : referringObjects )
{
obj->updateConnectedEditors();
@@ -349,8 +346,7 @@ void RimIntersectionResultDefinition::fieldChangedByUi( const caf::PdmFieldHandl
if ( reDraw )
{
RimGridView* gridView = nullptr;
this->firstAncestorOrThisOfType( gridView );
auto gridView = firstAncestorOrThisOfType<RimGridView>();
if ( gridView ) gridView->scheduleCreateDisplayModelAndRedraw();
update2dIntersectionViews();
@@ -367,9 +363,7 @@ void RimIntersectionResultDefinition::update2dIntersectionViews()
// Update 2D Intersection views
updateCaseInResultDefinitions();
std::vector<RimExtrudedCurveIntersection*> intersections;
this->objectsWithReferringPtrFieldsOfType( intersections );
auto intersections = objectsWithReferringPtrFieldsOfType<RimExtrudedCurveIntersection>();
for ( auto intersection : intersections )
{
if ( intersection && intersection->correspondingIntersectionView() )
@@ -494,8 +488,7 @@ void RimIntersectionResultDefinition::updateCaseInResultDefinitions()
//--------------------------------------------------------------------------------------------------
bool RimIntersectionResultDefinition::isInAction() const
{
RimIntersectionResultsDefinitionCollection* interResDefColl = nullptr;
this->firstAncestorOrThisOfType( interResDefColl );
auto interResDefColl = firstAncestorOrThisOfType<RimIntersectionResultsDefinitionCollection>();
return isActive() && interResDefColl && interResDefColl->isActive();
}

View File

@@ -61,7 +61,7 @@ bool RimIntersectionResultsDefinitionCollection::isActive() const
//--------------------------------------------------------------------------------------------------
std::vector<RimIntersectionResultDefinition*> RimIntersectionResultsDefinitionCollection::intersectionResultsDefinitions() const
{
return m_intersectionResultsDefs.children();
return m_intersectionResultsDefs.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -73,8 +73,7 @@ void RimIntersectionResultsDefinitionCollection::appendIntersectionResultDefinit
if ( interResDef->activeCase() == nullptr )
{
RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfType( ownerCase );
auto ownerCase = firstAncestorOrThisOfType<RimCase>();
interResDef->setActiveCase( ownerCase );
}
}
@@ -96,8 +95,7 @@ void RimIntersectionResultsDefinitionCollection::fieldChangedByUi( const caf::Pd
{
this->updateUiIconFromToggleField();
RimGridView* gridView = nullptr;
this->firstAncestorOrThisOfType( gridView );
auto gridView = firstAncestorOrThisOfType<RimGridView>();
if ( gridView ) gridView->scheduleCreateDisplayModelAndRedraw();
if ( intersectionResultsDefinitions().size() > 0 ) intersectionResultsDefinitions()[0]->update2dIntersectionViews();
}
@@ -116,8 +114,7 @@ void RimIntersectionResultsDefinitionCollection::initAfterRead()
void RimIntersectionResultsDefinitionCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects )
{
RimGridView* gridView = nullptr;
this->firstAncestorOrThisOfType( gridView );
auto gridView = firstAncestorOrThisOfType<RimGridView>();
if ( gridView )
{
gridView->scheduleCreateDisplayModelAndRedraw();

View File

@@ -278,7 +278,7 @@ std::vector<RimGenericParameter*> RimParameterGroup::parameters() const
{
std::vector<RimGenericParameter*> retParams;
for ( const auto& p : m_parameters.children() )
for ( const auto& p : m_parameters.childrenByType() )
{
if ( isListParameter( p->name() ) ) continue;
retParams.push_back( p );
@@ -286,7 +286,7 @@ std::vector<RimGenericParameter*> RimParameterGroup::parameters() const
for ( const auto& list : m_lists )
{
retParams.push_back( list->getAsListParameter( m_parameters.children() ) );
retParams.push_back( list->getAsListParameter( m_parameters.childrenByType() ) );
}
return retParams;
@@ -322,7 +322,7 @@ void RimParameterGroup::setParameterValue( QString name, QString value )
//--------------------------------------------------------------------------------------------------
RimGenericParameter* RimParameterGroup::parameter( QString name ) const
{
for ( auto& p : m_parameters.children() )
for ( auto& p : m_parameters.childrenByType() )
{
if ( p->name() == name )
{

View File

@@ -85,7 +85,7 @@ void RimPlotTemplateFolderItem::updateIconState() const
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotTemplateFileItem*> RimPlotTemplateFolderItem::fileItems() const
{
return m_fileNames.children();
return m_fileNames.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -93,7 +93,7 @@ std::vector<RimPlotTemplateFileItem*> RimPlotTemplateFolderItem::fileItems() con
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotTemplateFolderItem*> RimPlotTemplateFolderItem::subFolders() const
{
return m_subFolders.children();
return m_subFolders.childrenByType();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -178,7 +178,7 @@ RimCase* Rim2dIntersectionView::ownerCase() const
if ( !rimCase )
{
this->firstAncestorOrThisOfTypeAsserted( rimCase );
rimCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
}
return rimCase;
@@ -198,8 +198,7 @@ bool Rim2dIntersectionView::isTimeStepDependentDataVisible() const
}
else
{
RimGridView* gridView = nullptr;
m_intersection->firstAncestorOrThisOfTypeAsserted( gridView );
RimGridView* gridView = m_intersection->firstAncestorOrThisOfTypeAsserted<RimGridView>();
return gridView->isTimeStepDependentDataVisibleInThisOrComparisonView();
}
}
@@ -221,10 +220,8 @@ void Rim2dIntersectionView::update3dInfo()
RimEclipseResultDefinition* eclResDef = nullptr;
{
RimEclipseView* originEclView = nullptr;
m_intersection->firstAncestorOrThisOfType( originEclView );
RimGeoMechView* originGeoView = nullptr;
m_intersection->firstAncestorOrThisOfType( originGeoView );
RimEclipseView* originEclView = m_intersection->firstAncestorOrThisOfType<RimEclipseView>();
RimGeoMechView* originGeoView = m_intersection->firstAncestorOrThisOfType<RimGeoMechView>();
if ( originEclView )
{
@@ -350,8 +347,7 @@ void Rim2dIntersectionView::updateName()
{
if ( m_intersection )
{
Rim3dView* parentView = nullptr;
m_intersection->firstAncestorOrThisOfTypeAsserted( parentView );
Rim3dView* parentView = m_intersection->firstAncestorOrThisOfTypeAsserted<Rim3dView>();
this->setName( parentView->name() + ": " + m_intersection->name() );
}
}
@@ -453,15 +449,13 @@ bool Rim2dIntersectionView::hasResults()
}
}
RimEclipseView* eclView = nullptr;
m_intersection->firstAncestorOrThisOfType( eclView );
RimEclipseView* eclView = m_intersection->firstAncestorOrThisOfType<RimEclipseView>();
if ( eclView )
{
return ( eclView->cellResult()->hasResult() || eclView->cellResult()->isTernarySaturationSelected() );
}
RimGeoMechView* geoView = nullptr;
m_intersection->firstAncestorOrThisOfType( geoView );
RimGeoMechView* geoView = m_intersection->firstAncestorOrThisOfType<RimGeoMechView>();
if ( geoView )
{
return geoView->cellResult()->hasResult();
@@ -556,21 +550,14 @@ void Rim2dIntersectionView::onCreateDisplayModel()
if ( m_intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_SIMULATION_WELL && m_intersection->simulationWell() )
{
RimEclipseView* eclipseView = nullptr;
m_intersection->firstAncestorOrThisOfType( eclipseView );
// if ( eclipseView ) Do we need this ?
{
m_flatSimWellPipePartMgr = new RivSimWellPipesPartMgr( m_intersection->simulationWell() );
m_flatWellHeadPartMgr = new RivWellHeadPartMgr( m_intersection->simulationWell() );
}
m_flatSimWellPipePartMgr = new RivSimWellPipesPartMgr( m_intersection->simulationWell() );
m_flatWellHeadPartMgr = new RivWellHeadPartMgr( m_intersection->simulationWell() );
}
m_flatWellpathPartMgr = nullptr;
if ( m_intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_WELL_PATH && m_intersection->wellPath() )
{
Rim3dView* settingsView = nullptr;
m_intersection->firstAncestorOrThisOfType( settingsView );
Rim3dView* settingsView = m_intersection->firstAncestorOrThisOfType<Rim3dView>();
if ( settingsView )
{
m_flatWellpathPartMgr = new RivWellPathPartMgr( m_intersection->wellPath(), settingsView );
@@ -690,10 +677,8 @@ void Rim2dIntersectionView::onUpdateLegends()
RimTernaryLegendConfig* ternaryLegendConfig = nullptr;
{
RimEclipseView* originEclView = nullptr;
m_intersection->firstAncestorOrThisOfType( originEclView );
RimGeoMechView* originGeoView = nullptr;
m_intersection->firstAncestorOrThisOfType( originGeoView );
RimEclipseView* originEclView = m_intersection->firstAncestorOrThisOfType<RimEclipseView>();
RimGeoMechView* originGeoView = m_intersection->firstAncestorOrThisOfType<RimGeoMechView>();
if ( originEclView )
{

View File

@@ -47,7 +47,7 @@ Rim2dIntersectionViewCollection::~Rim2dIntersectionViewCollection()
//--------------------------------------------------------------------------------------------------
std::vector<Rim2dIntersectionView*> Rim2dIntersectionViewCollection::views()
{
return m_intersectionViews.children();
return m_intersectionViews.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -55,11 +55,10 @@ std::vector<Rim2dIntersectionView*> Rim2dIntersectionViewCollection::views()
//--------------------------------------------------------------------------------------------------
void Rim2dIntersectionViewCollection::syncFromExistingIntersections( bool doUpdate )
{
RimCase* parentCase = nullptr;
this->firstAncestorOrThisOfTypeAsserted( parentCase );
auto parentCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
std::vector<RimExtrudedCurveIntersection*> allOrderedIntersectionsInCase;
parentCase->descendantsIncludingThisOfType( allOrderedIntersectionsInCase );
std::vector<RimExtrudedCurveIntersection*> allOrderedIntersectionsInCase =
parentCase->descendantsIncludingThisOfType<RimExtrudedCurveIntersection>();
// Delete views without a valid intersection
@@ -95,8 +94,7 @@ void Rim2dIntersectionViewCollection::syncFromExistingIntersections( bool doUpda
{
Rim2dIntersectionView* newView = new Rim2dIntersectionView();
Rim3dView* view = nullptr;
intersection->firstAncestorOrThisOfType( view );
auto view = intersection->firstAncestorOrThisOfType<Rim3dView>();
if ( view )
{
newView->setCurrentTimeStep( view->currentTimeStep() );
@@ -113,8 +111,7 @@ void Rim2dIntersectionViewCollection::syncFromExistingIntersections( bool doUpda
if ( doUpdate ) this->updateConnectedEditors();
RimCase* rimCase = nullptr;
firstAncestorOrThisOfType( rimCase );
auto rimCase = firstAncestorOrThisOfType<RimCase>();
if ( rimCase ) rimCase->updateConnectedEditors();
}

View File

@@ -916,8 +916,7 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo( RimGeoMechView* geoMechView )
//--------------------------------------------------------------------------------------------------
void Rim3dOverlayInfoConfig::update3DInfoIn2dViews() const
{
RimCase* rimCase;
firstAncestorOrThisOfType( rimCase );
RimCase* rimCase = firstAncestorOrThisOfType<RimCase>();
if ( rimCase )
{
for ( Rim2dIntersectionView* view : rimCase->intersectionViewCollection()->views() )

View File

@@ -462,8 +462,7 @@ RimViewLinker* Rim3dView::assosiatedViewLinker() const
//--------------------------------------------------------------------------------------------------
RimViewController* Rim3dView::viewController() const
{
std::vector<RimViewController*> objects;
this->objectsWithReferringPtrFieldsOfType( objects );
std::vector<RimViewController*> objects = objectsWithReferringPtrFieldsOfType<RimViewController>();
for ( auto v : objects )
{
@@ -561,9 +560,7 @@ void Rim3dView::scheduleCreateDisplayModelAndRedraw()
std::set<Rim3dView*> Rim3dView::viewsUsingThisAsComparisonView()
{
std::set<Rim3dView*> containingViews;
std::vector<caf::PdmFieldHandle*> fieldsReferringToMe;
this->referringPtrFields( fieldsReferringToMe );
std::vector<caf::PdmFieldHandle*> fieldsReferringToMe = referringPtrFields();
for ( caf::PdmFieldHandle* field : fieldsReferringToMe )
{
if ( field->keyword() == m_comparisonView.keyword() )
@@ -815,8 +812,7 @@ bool Rim3dView::hasVisibleTimeStepDependent3dWellLogCurves() const
{
if ( wellPathCollection() )
{
std::vector<Rim3dWellLogCurve*> wellLogCurves;
wellPathCollection()->descendantsIncludingThisOfType( wellLogCurves );
std::vector<Rim3dWellLogCurve*> wellLogCurves = wellPathCollection()->descendantsIncludingThisOfType<Rim3dWellLogCurve>();
for ( const Rim3dWellLogCurve* curve : wellLogCurves )
{
if ( curve->showInView( this ) && curve->isShowingTimeDependentResult() )
@@ -996,8 +992,7 @@ void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const
{
if ( changedField == &m_fontSize )
{
std::vector<caf::FontHolderInterface*> fontHolderChildren;
descendantsOfType( fontHolderChildren );
auto fontHolderChildren = descendantsOfType<caf::FontHolderInterface>();
for ( auto fontHolder : fontHolderChildren )
{
fontHolder->updateFonts();
@@ -1072,8 +1067,7 @@ void Rim3dView::addAnnotationsToModel( cvf::ModelBasicList* annotationsModel )
{
if ( !this->ownerCase() ) return;
std::vector<RimAnnotationInViewCollection*> annotationCollections;
descendantsIncludingThisOfType( annotationCollections );
auto annotationCollections = descendantsIncludingThisOfType<RimAnnotationInViewCollection>();
if ( annotationCollections.empty() || !annotationCollections.front()->isActive() )
{
@@ -1497,8 +1491,7 @@ QList<caf::PdmOptionItemInfo> Rim3dView::calculateValueOptions( const caf::PdmFi
if ( fieldNeedingOptions == &m_comparisonView )
{
RimProject* proj;
this->firstAncestorOrThisOfType( proj );
RimProject* proj = RimProject::current();
if ( proj )
{
std::vector<Rim3dView*> views;
@@ -1751,8 +1744,7 @@ void Rim3dView::restoreComparisonView()
//--------------------------------------------------------------------------------------------------
RimViewLinker* Rim3dView::viewLinkerIfMasterView() const
{
std::vector<RimViewLinker*> objects;
this->objectsWithReferringPtrFieldsOfType( objects );
std::vector<RimViewLinker*> objects = objectsWithReferringPtrFieldsOfType<RimViewLinker>();
for ( auto viewLinker : objects )
{

View File

@@ -192,8 +192,7 @@ void RimAdvancedSnapshotExportDefinition::fieldChangedByUi( const caf::PdmFieldH
{
actCellInfo = RigReservoirGridTools::activeCellInfo( view() );
RimCase* rimCase = nullptr;
view()->firstAncestorOrThisOfTypeAsserted( rimCase );
auto rimCase = view()->firstAncestorOrThisOfTypeAsserted<RimCase>();
mainGrid = RigReservoirGridTools::mainGrid( rimCase );
}

View File

@@ -356,8 +356,7 @@ QString RimCase::uniqueShortNameCase( RimCase* rimCase, int shortNameLengthLimit
{
std::set<QString> allAutoShortNames;
std::vector<RimCase*> allCases;
RimProject::current()->descendantsOfType( allCases );
std::vector<RimCase*> allCases = RimProject::current()->descendantsOfType<RimCase>();
for ( RimCase* rCase : allCases )
{

View File

@@ -104,7 +104,7 @@ void RimColorLegend::appendColorLegendItem( RimColorLegendItem* colorLegendItem
//--------------------------------------------------------------------------------------------------
std::vector<RimColorLegendItem*> RimColorLegend::colorLegendItems() const
{
return m_colorLegendItems.children();
return m_colorLegendItems.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -183,15 +183,13 @@ void RimColorLegend::onColorLegendItemHasChanged()
{
this->updateConnectedEditors();
std::vector<caf::PdmObjectHandle*> referringObjects;
this->objectsWithReferringPtrFields( referringObjects );
std::vector<caf::PdmObjectHandle*> referringObjects = objectsWithReferringPtrFields();
for ( auto o : referringObjects )
{
o->uiCapability()->updateConnectedEditors();
Rim3dView* view = nullptr;
o->firstAncestorOrThisOfType( view );
auto view = o->firstAncestorOrThisOfType<Rim3dView>();
if ( view )
{
view->resetLegends();

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