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:
parent
6220ff160c
commit
b1d9d17ddb
@ -1677,11 +1677,8 @@ void RicWellPathExportMswCompletionsImpl::writeMainBoreWelsegsSegment( std::shar
|
|||||||
prevOutTVD = previousSegment->outputTVD();
|
prevOutTVD = previousSegment->outputTVD();
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto mdPair : subSegments )
|
for ( const auto& [subStartMD, subEndMD] : subSegments )
|
||||||
{
|
{
|
||||||
double subStartMD = mdPair.first;
|
|
||||||
double subEndMD = mdPair.second;
|
|
||||||
|
|
||||||
auto startPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subStartMD );
|
auto startPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subStartMD );
|
||||||
auto endPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subEndMD );
|
auto endPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subEndMD );
|
||||||
|
|
||||||
@ -1749,13 +1746,10 @@ void RicWellPathExportMswCompletionsImpl::writeValveWelsegsSegment( std::shared_
|
|||||||
|
|
||||||
std::vector<std::pair<double, double>> splitSegments = createSubSegmentMDPairs( startMD, endMD, maxSegmentLength );
|
std::vector<std::pair<double, double>> splitSegments = createSubSegmentMDPairs( startMD, endMD, maxSegmentLength );
|
||||||
|
|
||||||
for ( auto mdPair : splitSegments )
|
for ( const auto& [subStartMD, subEndMD] : splitSegments )
|
||||||
{
|
{
|
||||||
int subSegmentNumber = ( *segmentNumber )++;
|
int subSegmentNumber = ( *segmentNumber )++;
|
||||||
|
|
||||||
double subStartMD = mdPair.first;
|
|
||||||
double subEndMD = mdPair.second;
|
|
||||||
|
|
||||||
auto startPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subStartMD );
|
auto startPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subStartMD );
|
||||||
auto endPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subEndMD );
|
auto endPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subEndMD );
|
||||||
|
|
||||||
@ -1815,13 +1809,10 @@ void RicWellPathExportMswCompletionsImpl::writeCompletionWelsegsSegment( std::sh
|
|||||||
|
|
||||||
std::vector<std::pair<double, double>> splitSegments = createSubSegmentMDPairs( startMD, endMD, maxSegmentLength );
|
std::vector<std::pair<double, double>> splitSegments = createSubSegmentMDPairs( startMD, endMD, maxSegmentLength );
|
||||||
|
|
||||||
for ( auto mdPair : splitSegments )
|
for ( const auto& [subStartMD, subEndMD] : splitSegments )
|
||||||
{
|
{
|
||||||
int subSegmentNumber = ( *segmentNumber )++;
|
int subSegmentNumber = ( *segmentNumber )++;
|
||||||
|
|
||||||
double subStartMD = mdPair.first;
|
|
||||||
double subEndMD = mdPair.second;
|
|
||||||
|
|
||||||
auto startPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subStartMD );
|
auto startPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subStartMD );
|
||||||
auto endPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subEndMD );
|
auto endPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subEndMD );
|
||||||
|
|
||||||
|
@ -176,9 +176,9 @@ void RicCreateMultipleFracturesFeature::onActionTriggered( bool isChecked )
|
|||||||
{
|
{
|
||||||
firstSourceCase = proj->eclipseCases().front();
|
firstSourceCase = proj->eclipseCases().front();
|
||||||
|
|
||||||
auto ijkRange = ijkRangeForGrid( firstSourceCase );
|
auto [top, base] = ijkRangeForGrid( firstSourceCase );
|
||||||
int topK = static_cast<int>( ijkRange.first.z() );
|
int topK = static_cast<int>( top.z() );
|
||||||
int baseK = static_cast<int>( ijkRange.second.z() );
|
int baseK = static_cast<int>( base.z() );
|
||||||
|
|
||||||
double minimumDistanceFromTip = 100.0;
|
double minimumDistanceFromTip = 100.0;
|
||||||
int maxFractureCount = 100;
|
int maxFractureCount = 100;
|
||||||
|
@ -62,12 +62,7 @@ RicExportContourMapToTextFeature::RicExportContourMapToTextFeature()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicExportContourMapToTextFeature::isCommandEnabled()
|
bool RicExportContourMapToTextFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
RimEclipseContourMapView* existingEclipseContourMap = nullptr;
|
auto [existingEclipseContourMap, existingGeoMechContourMap] = findContourMapView();
|
||||||
RimGeoMechContourMapView* existingGeoMechContourMap = nullptr;
|
|
||||||
|
|
||||||
auto sourceViews = findContourMapView();
|
|
||||||
existingEclipseContourMap = sourceViews.first;
|
|
||||||
existingGeoMechContourMap = sourceViews.second;
|
|
||||||
|
|
||||||
return existingEclipseContourMap || existingGeoMechContourMap;
|
return existingEclipseContourMap || existingGeoMechContourMap;
|
||||||
}
|
}
|
||||||
|
@ -460,12 +460,12 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult( i
|
|||||||
std::map<std::string, std::vector<float>> elementProperties =
|
std::map<std::string, std::vector<float>> elementProperties =
|
||||||
m_elementPropertyReader->readAllElementPropertiesInFileContainingField( resVarAddr.fieldName );
|
m_elementPropertyReader->readAllElementPropertiesInFileContainingField( resVarAddr.fieldName );
|
||||||
|
|
||||||
for ( std::pair<std::string, std::vector<float>> elem : elementProperties )
|
for ( auto [addrString, values] : elementProperties )
|
||||||
{
|
{
|
||||||
RigFemResultAddress addressForElement( RIG_ELEMENT, elem.first, "" );
|
RigFemResultAddress addressForElement( RIG_ELEMENT, addrString, "" );
|
||||||
RigFemScalarResultFrames* currentFrames = m_femPartResults[partIndex]->createScalarResult( addressForElement );
|
RigFemScalarResultFrames* currentFrames = m_femPartResults[partIndex]->createScalarResult( addressForElement );
|
||||||
currentFrames->enableAsSingleFrameResult();
|
currentFrames->enableAsSingleFrameResult();
|
||||||
currentFrames->frameData( 0 ).swap( elem.second );
|
currentFrames->frameData( 0 ).swap( values );
|
||||||
}
|
}
|
||||||
|
|
||||||
frames = m_femPartResults[partIndex]->findScalarResult( resVarAddr );
|
frames = m_femPartResults[partIndex]->findScalarResult( resVarAddr );
|
||||||
|
@ -1127,9 +1127,9 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
|||||||
|
|
||||||
if ( filter->filterOperation() == RimPlotDataFilterItem::RANGE )
|
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 );
|
casesToKeep.insert( sumCase );
|
||||||
}
|
}
|
||||||
|
@ -304,10 +304,7 @@ cvf::ref<Riv3dWellLogCurveGeometryGenerator> Rim3dWellLogCurve::geometryGenerato
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void Rim3dWellLogCurve::resetMinMaxValues()
|
void Rim3dWellLogCurve::resetMinMaxValues()
|
||||||
{
|
{
|
||||||
std::pair<double, double> valueRange = findCurveValueRange();
|
std::tie( m_minCurveDataValue, m_maxCurveDataValue ) = findCurveValueRange();
|
||||||
|
|
||||||
m_minCurveDataValue = valueRange.first;
|
|
||||||
m_maxCurveDataValue = valueRange.second;
|
|
||||||
|
|
||||||
m_minCurveUIValue = m_minCurveDataValue;
|
m_minCurveUIValue = m_minCurveDataValue;
|
||||||
m_maxCurveUIValue = m_maxCurveDataValue;
|
m_maxCurveUIValue = m_maxCurveDataValue;
|
||||||
|
@ -466,13 +466,12 @@ double RimContourMapProjection::calculateValueInMapCell( uint i, uint j, const s
|
|||||||
case RESULTS_MEAN_VALUE:
|
case RESULTS_MEAN_VALUE:
|
||||||
{
|
{
|
||||||
RiaWeightedMeanCalculator<double> calculator;
|
RiaWeightedMeanCalculator<double> calculator;
|
||||||
for ( auto cellIdxAndWeight : matchingCells )
|
for ( auto [cellIdx, weight] : matchingCells )
|
||||||
{
|
{
|
||||||
size_t cellIdx = cellIdxAndWeight.first;
|
|
||||||
double cellValue = gridCellValues[cellIdx];
|
double cellValue = gridCellValues[cellIdx];
|
||||||
if ( cellValue != std::numeric_limits<double>::infinity() )
|
if ( cellValue != std::numeric_limits<double>::infinity() )
|
||||||
{
|
{
|
||||||
calculator.addValueAndWeight( cellValue, cellIdxAndWeight.second );
|
calculator.addValueAndWeight( cellValue, weight );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( calculator.validAggregatedWeight() )
|
if ( calculator.validAggregatedWeight() )
|
||||||
@ -484,9 +483,8 @@ double RimContourMapProjection::calculateValueInMapCell( uint i, uint j, const s
|
|||||||
case RESULTS_GEOM_VALUE:
|
case RESULTS_GEOM_VALUE:
|
||||||
{
|
{
|
||||||
RiaWeightedGeometricMeanCalculator calculator;
|
RiaWeightedGeometricMeanCalculator calculator;
|
||||||
for ( auto cellIdxAndWeight : matchingCells )
|
for ( auto [cellIdx, weight] : matchingCells )
|
||||||
{
|
{
|
||||||
size_t cellIdx = cellIdxAndWeight.first;
|
|
||||||
double cellValue = gridCellValues[cellIdx];
|
double cellValue = gridCellValues[cellIdx];
|
||||||
if ( cellValue < 1.0e-8 )
|
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() )
|
if ( cellValue != std::numeric_limits<double>::infinity() )
|
||||||
{
|
{
|
||||||
calculator.addValueAndWeight( cellValue, cellIdxAndWeight.second );
|
calculator.addValueAndWeight( cellValue, weight );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( calculator.validAggregatedWeight() )
|
if ( calculator.validAggregatedWeight() )
|
||||||
|
@ -125,9 +125,9 @@ void RimEclipseContourMapProjection::updateLegend()
|
|||||||
double minVal = minValue( m_aggregatedResults );
|
double minVal = minValue( m_aggregatedResults );
|
||||||
double maxVal = maxValue( 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 ||
|
if ( m_resultAggregation() == RESULTS_OIL_COLUMN || m_resultAggregation() == RESULTS_GAS_COLUMN ||
|
||||||
m_resultAggregation() == RESULTS_HC_COLUMN )
|
m_resultAggregation() == RESULTS_HC_COLUMN )
|
||||||
|
@ -142,12 +142,11 @@ QList<caf::PdmOptionItemInfo>
|
|||||||
if ( curveSet )
|
if ( curveSet )
|
||||||
{
|
{
|
||||||
auto params = curveSet->correlationSortedEnsembleParameters();
|
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(
|
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 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user