mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Change API for PdmObjectHandle and PdmFieldHandle
* Refactor interface to PdmObjectHandle and PdmFieldHandle Return objects instead of passing in structures as parameters * Add nodiscard to several functions * Remove redundant this-> * Rename to ptrReferencedObjectsByType
This commit is contained in:
@@ -231,8 +231,7 @@ void RimElasticProperties::loadDataAndUpdate()
|
||||
{
|
||||
if ( !m_filePath().path().isEmpty() )
|
||||
{
|
||||
RimStimPlanModelTemplate* stimPlanModelTemplate;
|
||||
firstAncestorOrThisOfType( stimPlanModelTemplate );
|
||||
auto stimPlanModelTemplate = firstAncestorOrThisOfType<RimStimPlanModelTemplate>();
|
||||
RicElasticPropertiesImportTools::importElasticPropertiesFromFile( m_filePath().path(), stimPlanModelTemplate );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,8 +148,7 @@ void RimElasticPropertyScaling::updateAutoName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimColorLegend* RimElasticPropertyScaling::getFaciesColorLegend()
|
||||
{
|
||||
RimStimPlanModelTemplate* stimPlanModelTemplate;
|
||||
firstAncestorOrThisOfType( stimPlanModelTemplate );
|
||||
auto stimPlanModelTemplate = firstAncestorOrThisOfType<RimStimPlanModelTemplate>();
|
||||
if ( !stimPlanModelTemplate ) return nullptr;
|
||||
|
||||
RimFaciesProperties* faciesProperties = stimPlanModelTemplate->faciesProperties();
|
||||
|
||||
@@ -197,8 +197,7 @@ void RimFaciesProperties::loadDataAndUpdate()
|
||||
{
|
||||
if ( !m_filePath().path().isEmpty() )
|
||||
{
|
||||
RimStimPlanModelTemplate* stimPlanModelTemplate;
|
||||
firstAncestorOrThisOfType( stimPlanModelTemplate );
|
||||
auto stimPlanModelTemplate = firstAncestorOrThisOfType<RimStimPlanModelTemplate>();
|
||||
RicFaciesPropertiesImportTools::importFaciesPropertiesFromFile( m_filePath().path(), stimPlanModelTemplate );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,8 +156,7 @@ const QString& RimNonNetLayers::facies() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimColorLegend* RimNonNetLayers::getFaciesColorLegend()
|
||||
{
|
||||
RimStimPlanModelTemplate* stimPlanModelTemplate;
|
||||
firstAncestorOrThisOfType( stimPlanModelTemplate );
|
||||
auto stimPlanModelTemplate = firstAncestorOrThisOfType<RimStimPlanModelTemplate>();
|
||||
if ( !stimPlanModelTemplate ) return nullptr;
|
||||
|
||||
RimFaciesProperties* faciesProperties = stimPlanModelTemplate->faciesProperties();
|
||||
|
||||
@@ -56,7 +56,7 @@ RimPressureTable::~RimPressureTable()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPressureTableItem*> RimPressureTable::items() const
|
||||
{
|
||||
std::vector<RimPressureTableItem*> pressureTableItems = m_pressureTableItems.children();
|
||||
std::vector<RimPressureTableItem*> pressureTableItems = m_pressureTableItems.childrenByType();
|
||||
|
||||
// Sort by depth
|
||||
std::sort( pressureTableItems.begin(), pressureTableItems.end(), []( auto const& a, auto const& b ) { return a->depth() < b->depth(); } );
|
||||
|
||||
@@ -926,9 +926,7 @@ RimWellPath* RimStimPlanModel::wellPath() const
|
||||
const caf::PdmObjectHandle* objHandle = dynamic_cast<const caf::PdmObjectHandle*>( this );
|
||||
if ( !objHandle ) return nullptr;
|
||||
|
||||
RimWellPath* wellPath = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType( wellPath );
|
||||
return wellPath;
|
||||
return objHandle->firstAncestorOrThisOfType<RimWellPath>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1301,8 +1299,7 @@ QString RimStimPlanModel::underburdenFacies() const
|
||||
void RimStimPlanModel::updateReferringPlots()
|
||||
{
|
||||
// Update plots referring to this fracture model
|
||||
std::vector<RimStimPlanModelPlot*> referringObjects;
|
||||
objectsWithReferringPtrFieldsOfType( referringObjects );
|
||||
std::vector<RimStimPlanModelPlot*> referringObjects = objectsWithReferringPtrFieldsOfType<RimStimPlanModelPlot>();
|
||||
|
||||
for ( auto modelPlot : referringObjects )
|
||||
{
|
||||
@@ -1551,8 +1548,7 @@ void RimStimPlanModel::stimPlanModelTemplateChanged( const caf::SignalEmitter* e
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStimPlanModel::updateViewsAndPlots()
|
||||
{
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
this->firstAncestorOrThisOfType( eclipseCase );
|
||||
auto eclipseCase = firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews( { eclipseCase } );
|
||||
|
||||
@@ -77,7 +77,7 @@ void RimStimPlanModelCollection::deleteStimPlanModels()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimStimPlanModel*> RimStimPlanModelCollection::allStimPlanModels() const
|
||||
{
|
||||
return m_stimPlanModels.children();
|
||||
return m_stimPlanModels.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -114,8 +114,7 @@ void RimStimPlanModelCollection::defineUiOrdering( QString uiConfigName, caf::Pd
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStimPlanModelCollection::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();
|
||||
|
||||
@@ -98,9 +98,8 @@ RiaDefines::CurveProperty RimStimPlanModelCurve::curveProperty() const
|
||||
void RimStimPlanModelCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
RimWellLogExtractionCurve::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
RimStimPlanModelPlot* stimPlanModelPlot;
|
||||
firstAncestorOrThisOfTypeAsserted( stimPlanModelPlot );
|
||||
|
||||
auto stimPlanModelPlot = firstAncestorOrThisOfTypeAsserted<RimStimPlanModelPlot>();
|
||||
if ( stimPlanModelPlot )
|
||||
{
|
||||
stimPlanModelPlot->loadDataAndUpdate();
|
||||
@@ -154,8 +153,7 @@ void RimStimPlanModelCurve::performDataExtraction( bool* isUsingPseudoLength )
|
||||
bool performDataSmoothing = false;
|
||||
if ( !values.empty() && !measuredDepthValues.empty() && measuredDepthValues.size() == values.size() )
|
||||
{
|
||||
RimWellLogTrack* track = nullptr;
|
||||
firstAncestorOfType( track );
|
||||
auto track = firstAncestorOfType<RimWellLogTrack>();
|
||||
if ( track && track->isLogarithmicScale() )
|
||||
{
|
||||
filterInvalidValuesForLogarithmicScale( values );
|
||||
|
||||
@@ -178,8 +178,7 @@ void RimStimPlanModelPlot::applyDataSource()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogExtractionCurve* RimStimPlanModelPlot::findCurveByProperty( RiaDefines::CurveProperty curveProperty ) const
|
||||
{
|
||||
std::vector<RimStimPlanModelPropertyCurve*> curves;
|
||||
descendantsIncludingThisOfType( curves );
|
||||
std::vector<RimStimPlanModelPropertyCurve*> curves = descendantsIncludingThisOfType<RimStimPlanModelPropertyCurve>();
|
||||
|
||||
for ( RimStimPlanModelPropertyCurve* curve : curves )
|
||||
{
|
||||
|
||||
@@ -76,7 +76,7 @@ void RimStimPlanModelPlotCollection::addStimPlanModelPlot( RimStimPlanModelPlot*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimStimPlanModelPlot*> RimStimPlanModelPlotCollection::stimPlanModelPlots() const
|
||||
{
|
||||
return m_stimPlanModelPlots.children();
|
||||
return m_stimPlanModelPlots.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -485,7 +485,7 @@ void RimStimPlanModelTemplate::initAfterRead()
|
||||
m_faciesProperties->setEclipseCase( eclipseCase );
|
||||
}
|
||||
|
||||
for ( auto& fipConfig : m_faciesInitialPressureConfigs.children() )
|
||||
for ( auto& fipConfig : m_faciesInitialPressureConfigs.childrenByType() )
|
||||
{
|
||||
fipConfig->changed.connect( this, &RimStimPlanModelTemplate::faciesPropertiesChanged );
|
||||
}
|
||||
@@ -811,7 +811,7 @@ RimEclipseCase* RimStimPlanModelTemplate::initialPressureEclipseCase() const
|
||||
std::map<int, double> RimStimPlanModelTemplate::faciesWithInitialPressure() const
|
||||
{
|
||||
std::map<int, double> valueFractionMap;
|
||||
for ( const RimFaciesInitialPressureConfig* c : m_faciesInitialPressureConfigs.children() )
|
||||
for ( const RimFaciesInitialPressureConfig* c : m_faciesInitialPressureConfigs.childrenByType() )
|
||||
{
|
||||
if ( c->isEnabled() ) valueFractionMap[c->faciesValue()] = c->fraction();
|
||||
}
|
||||
|
||||
@@ -127,8 +127,7 @@ int RimStimPlanModelTemplateCollection::nextFractureTemplateId()
|
||||
void RimStimPlanModelTemplateCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
firstAncestorOrThisOfType( proj );
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( proj )
|
||||
{
|
||||
proj->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
|
||||
Reference in New Issue
Block a user