mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Simplify some code with C++17
This commit is contained in:
@@ -1127,9 +1127,9 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
|
||||
if ( filter->filterOperation() == RimPlotDataFilterItem::RANGE )
|
||||
{
|
||||
std::pair<double, double> minMax = filter->filterRangeMinMax();
|
||||
auto [min, max] = filter->filterRangeMinMax();
|
||||
|
||||
if ( minMax.first <= value && value <= minMax.second )
|
||||
if ( min <= value && value <= max )
|
||||
{
|
||||
casesToKeep.insert( sumCase );
|
||||
}
|
||||
|
||||
@@ -304,10 +304,7 @@ cvf::ref<Riv3dWellLogCurveGeometryGenerator> Rim3dWellLogCurve::geometryGenerato
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dWellLogCurve::resetMinMaxValues()
|
||||
{
|
||||
std::pair<double, double> valueRange = findCurveValueRange();
|
||||
|
||||
m_minCurveDataValue = valueRange.first;
|
||||
m_maxCurveDataValue = valueRange.second;
|
||||
std::tie( m_minCurveDataValue, m_maxCurveDataValue ) = findCurveValueRange();
|
||||
|
||||
m_minCurveUIValue = m_minCurveDataValue;
|
||||
m_maxCurveUIValue = m_maxCurveDataValue;
|
||||
|
||||
@@ -466,13 +466,12 @@ double RimContourMapProjection::calculateValueInMapCell( uint i, uint j, const s
|
||||
case RESULTS_MEAN_VALUE:
|
||||
{
|
||||
RiaWeightedMeanCalculator<double> calculator;
|
||||
for ( auto cellIdxAndWeight : matchingCells )
|
||||
for ( auto [cellIdx, weight] : matchingCells )
|
||||
{
|
||||
size_t cellIdx = cellIdxAndWeight.first;
|
||||
double cellValue = gridCellValues[cellIdx];
|
||||
if ( cellValue != std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
calculator.addValueAndWeight( cellValue, cellIdxAndWeight.second );
|
||||
calculator.addValueAndWeight( cellValue, weight );
|
||||
}
|
||||
}
|
||||
if ( calculator.validAggregatedWeight() )
|
||||
@@ -484,9 +483,8 @@ double RimContourMapProjection::calculateValueInMapCell( uint i, uint j, const s
|
||||
case RESULTS_GEOM_VALUE:
|
||||
{
|
||||
RiaWeightedGeometricMeanCalculator calculator;
|
||||
for ( auto cellIdxAndWeight : matchingCells )
|
||||
for ( auto [cellIdx, weight] : matchingCells )
|
||||
{
|
||||
size_t cellIdx = cellIdxAndWeight.first;
|
||||
double cellValue = gridCellValues[cellIdx];
|
||||
if ( cellValue < 1.0e-8 )
|
||||
{
|
||||
@@ -494,7 +492,7 @@ double RimContourMapProjection::calculateValueInMapCell( uint i, uint j, const s
|
||||
}
|
||||
if ( cellValue != std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
calculator.addValueAndWeight( cellValue, cellIdxAndWeight.second );
|
||||
calculator.addValueAndWeight( cellValue, weight );
|
||||
}
|
||||
}
|
||||
if ( calculator.validAggregatedWeight() )
|
||||
|
||||
@@ -125,9 +125,9 @@ void RimEclipseContourMapProjection::updateLegend()
|
||||
double minVal = minValue( m_aggregatedResults );
|
||||
double maxVal = maxValue( m_aggregatedResults );
|
||||
|
||||
std::pair<double, double> minmaxValAllTimeSteps = minmaxValuesAllTimeSteps();
|
||||
auto [minValAllTimeSteps, maxValAllTimeSteps] = minmaxValuesAllTimeSteps();
|
||||
|
||||
legendConfig()->setAutomaticRanges( minmaxValAllTimeSteps.first, minmaxValAllTimeSteps.second, minVal, maxVal );
|
||||
legendConfig()->setAutomaticRanges( minValAllTimeSteps, maxValAllTimeSteps, minVal, maxVal );
|
||||
|
||||
if ( m_resultAggregation() == RESULTS_OIL_COLUMN || m_resultAggregation() == RESULTS_GAS_COLUMN ||
|
||||
m_resultAggregation() == RESULTS_HC_COLUMN )
|
||||
|
||||
@@ -142,12 +142,11 @@ QList<caf::PdmOptionItemInfo>
|
||||
if ( curveSet )
|
||||
{
|
||||
auto params = curveSet->correlationSortedEnsembleParameters();
|
||||
for ( const auto& paramCorrPair : params )
|
||||
for ( const auto& [param, corr] : params )
|
||||
{
|
||||
QString name = paramCorrPair.first.name;
|
||||
double corr = paramCorrPair.second;
|
||||
options.push_back(
|
||||
caf::PdmOptionItemInfo( QString( "%1 (Avg. correlation: %2)" ).arg( name ).arg( corr ), name ) );
|
||||
caf::PdmOptionItemInfo( QString( "%1 (Avg. correlation: %2)" ).arg( param.name ).arg( corr ),
|
||||
param.name ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user