Minor code adjustments

This commit is contained in:
Magne Sjaastad 2019-12-19 11:55:34 +01:00
parent 4ccbd274b8
commit 4d3113255e
6 changed files with 48 additions and 46 deletions

View File

@ -398,7 +398,7 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellD
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
const std::vector<double>& tofValuesDays = calculator.sortedUniqueTOFValues();
const std::vector<double>& tofValuesDays = calculator.sortedUniqueTofValues();
if ( tofValuesDays.size() == 0 )
{
// cvf::Trace::show("No TOF values!");
@ -422,7 +422,7 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellD
for ( size_t i = 0; i < numWells; i++ )
{
QString wellName = calculator.contributingWellName( i );
const QString& wellName = calculator.contributingWellName( i );
const std::vector<double>& volArr = calculator.accumulatedVolumeForContributingWell( i );
cvf::Color3f cvfClr = flowDiagSolution.tracerColor( wellName );

View File

@ -47,35 +47,35 @@ public:
void setPlotOptions( bool groupSmallContributions, double smallContributionsRelativeThreshold );
// RimPlot implementations
virtual RiuQwtPlotWidget* viewer() override;
virtual void setAutoScaleXEnabled( bool enabled ) override;
virtual void setAutoScaleYEnabled( bool enabled ) override;
virtual void updateAxes() override;
virtual void updateLegend() override;
virtual void updateZoomInQwt() override;
virtual void updateZoomFromQwt() override;
virtual QString asciiDataForPlotExport() const override;
virtual void reattachAllCurves() override;
virtual void detachAllCurves() override;
virtual caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
virtual void onAxisSelected( int axis, bool toggle ) override;
RiuQwtPlotWidget* viewer() override;
void setAutoScaleXEnabled( bool enabled ) override;
void setAutoScaleYEnabled( bool enabled ) override;
void updateAxes() override;
void updateLegend() override;
void updateZoomInQwt() override;
void updateZoomFromQwt() override;
QString asciiDataForPlotExport() const override;
void reattachAllCurves() override;
void detachAllCurves() override;
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
void onAxisSelected( int axis, bool toggle ) override;
// RimPlotWindow implementations
virtual QString description() const override;
QString description() const override;
// RimViewWindow implementations
virtual QWidget* viewWidget() override;
virtual QImage snapshotWindowContent() override;
virtual void zoomAll() override;
QWidget* viewWidget() override;
QImage snapshotWindowContent() override;
void zoomAll() override;
private:
// RimPlot implementations
virtual void doRemoveFromCollection() override;
void doRemoveFromCollection() override;
// RimViewWindow implementations
virtual QWidget* createViewWidget( QWidget* mainWindowParent ) override;
virtual void deleteViewWidget() override;
virtual void onLoadDataAndUpdate() override;
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override;
void onLoadDataAndUpdate() override;
private:
void fixupDependentFieldsAfterCaseChange();
@ -83,12 +83,13 @@ private:
const RimFlowDiagSolution& flowDiagSolution,
RiuQwtPlotWidget* plotWidget );
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
private:
caf::PdmPtrField<RimEclipseResultCase*> m_case;

View File

@ -49,18 +49,18 @@ public:
private:
// RimPlotWindow overrides
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
virtual void onLoadDataAndUpdate() override;
void onLoadDataAndUpdate() override;
private:
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fixupDependentFieldsAfterCaseChange();
void applyPlotParametersToContainedPlots();
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fixupDependentFieldsAfterCaseChange();
void applyPlotParametersToContainedPlots();
private:
caf::PdmPtrField<RimEclipseResultCase*> m_case;

View File

@ -132,7 +132,7 @@ void RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFract
double fractionPorvPhaseSumSoil = 0.0;
double fractionPorvPhaseSumSgas = 0.0;
for ( auto element : tofAndIndexMap )
for ( const auto& element : tofAndIndexMap )
{
double tofValue = element.first;
for ( int index : element.second )
@ -160,4 +160,4 @@ void RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFract
accumulatedPhaseFractionSoil.push_back( fractionPorvPhaseSumSoil / fractionPorvSum );
accumulatedPhaseFractionSgas.push_back( fractionPorvPhaseSumSgas / fractionPorvSum );
}
}
}

View File

@ -91,7 +91,8 @@ RigTofWellDistributionCalculator::RigTofWellDistributionCalculator( RimEclipseRe
const RigFlowDiagResultAddress resultAddrFraction( "Fraction",
RigFlowDiagResultAddress::PhaseSelection::PHASE_ALL,
targetWellname.toStdString() );
const std::vector<double>* tofData = flowDiagResults->resultValues( resultAddrTof, timeStepIndex );
const std::vector<double>* tofData = flowDiagResults->resultValues( resultAddrTof, timeStepIndex );
const std::vector<double>* targetWellFractionData = flowDiagResults->resultValues( resultAddrFraction, timeStepIndex );
if ( !tofData || !targetWellFractionData )
{
@ -103,8 +104,8 @@ RigTofWellDistributionCalculator::RigTofWellDistributionCalculator( RimEclipseRe
const std::vector<QString> candidateContributingWellNames = findCandidateContributingWellNames( *flowDiagSolution,
targetWellname,
timeStepIndex );
const size_t numContribWells = candidateContributingWellNames.size();
const size_t numContribWells = candidateContributingWellNames.size();
for ( size_t iContribWell = 0; iContribWell < numContribWells; iContribWell++ )
{
const QString contribWellName = candidateContributingWellNames[iContribWell];
@ -124,7 +125,7 @@ RigTofWellDistributionCalculator::RigTofWellDistributionCalculator( RimEclipseRe
ContribWellEntry contribWellEntry;
contribWellEntry.name = contribWellName;
for ( auto mapElement : tofToCellIndicesMap )
for ( const auto& mapElement : tofToCellIndicesMap )
{
const double tofValue = mapElement.first;
const std::vector<size_t>& cellIndicesArr = mapElement.second;
@ -152,7 +153,7 @@ RigTofWellDistributionCalculator::RigTofWellDistributionCalculator( RimEclipseRe
}
}
for ( auto mapElement : tofToCellIndicesMap )
for ( const auto& mapElement : tofToCellIndicesMap )
{
const double tofValue = mapElement.first;
m_tofInIncreasingOrder.push_back( tofValue );
@ -262,7 +263,7 @@ std::vector<QString>
: RimFlowDiagSolution::INJECTOR;
const std::vector<QString> allWellNames = flowDiagSolution.tracerNames();
for ( QString name : allWellNames )
for ( const QString& name : allWellNames )
{
const RimFlowDiagSolution::TracerStatusType status = flowDiagSolution.tracerStatusInTimeStep( name,
timeStepIndex );
@ -285,7 +286,7 @@ std::vector<QString>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>& RigTofWellDistributionCalculator::sortedUniqueTOFValues() const
const std::vector<double>& RigTofWellDistributionCalculator::sortedUniqueTofValues() const
{
return m_tofInIncreasingOrder;
}

View File

@ -45,7 +45,7 @@ public:
void groupSmallContributions( double smallContribThreshold );
const std::vector<double>& sortedUniqueTOFValues() const;
const std::vector<double>& sortedUniqueTofValues() const;
size_t contributingWellCount() const;
const QString& contributingWellName( size_t contribWellIndex ) const;