#6491 Fix range iterators which was creating data copies (clang10 warnings).

This commit is contained in:
Kristian Bendiksen 2020-09-14 20:17:20 +02:00
parent ef7517f1cb
commit 69a1901904
13 changed files with 20 additions and 20 deletions

View File

@ -749,7 +749,7 @@ void RifEclipseInputFileTools::saveFaults( QTextStream& stream,
stream << "-- Name I1 I2 J1 J2 K1 K2 Face ( I/J/K )" << endl; stream << "-- Name I1 I2 J1 J2 K1 K2 Face ( I/J/K )" << endl;
const cvf::Collection<RigFault>& faults = mainGrid->faults(); const cvf::Collection<RigFault>& faults = mainGrid->faults();
for ( const auto fault : faults ) for ( const auto& fault : faults )
{ {
if ( fault->name() != RiaDefines::undefinedGridFaultName() && if ( fault->name() != RiaDefines::undefinedGridFaultName() &&
fault->name() != RiaDefines::undefinedGridFaultWithInactiveName() ) fault->name() != RiaDefines::undefinedGridFaultWithInactiveName() )
@ -1281,7 +1281,7 @@ qint64 RifEclipseInputFileTools::findKeyword( const QString& keyword, QFile& fil
bool RifEclipseInputFileTools::isValidDataKeyword( const QString& keyword ) bool RifEclipseInputFileTools::isValidDataKeyword( const QString& keyword )
{ {
const std::vector<QString>& keywordsToSkip = RifEclipseInputFileTools::invalidPropertyDataKeywords(); const std::vector<QString>& keywordsToSkip = RifEclipseInputFileTools::invalidPropertyDataKeywords();
for ( const QString keywordToSkip : keywordsToSkip ) for ( const QString& keywordToSkip : keywordsToSkip )
{ {
if ( keywordToSkip == keyword.toUpper() ) if ( keywordToSkip == keyword.toUpper() )
{ {

View File

@ -77,7 +77,7 @@ std::vector<std::string> RifElementPropertyReader::scalarElementFields() const
{ {
std::vector<std::string> fields; std::vector<std::string> fields;
for ( const std::pair<std::string, RifElementPropertyMetadata>& field : m_fieldsMetaData ) for ( const std::pair<const std::string, RifElementPropertyMetadata>& field : m_fieldsMetaData )
{ {
fields.push_back( field.first ); fields.push_back( field.first );
} }

View File

@ -729,7 +729,7 @@ void RifReaderEclipseSummary::ValuesCache::markAddressForPurge( const RifEclipse
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RifReaderEclipseSummary::ValuesCache::purgeData() void RifReaderEclipseSummary::ValuesCache::purgeData()
{ {
for ( const auto purgeAddr : m_purgeList ) for ( const auto& purgeAddr : m_purgeList )
{ {
m_cachedValues.erase( purgeAddr ); m_cachedValues.erase( purgeAddr );
} }

View File

@ -88,8 +88,8 @@ public:
void load(); void load();
private: private:
typedef std::pair<QString, WellObservationSet> WellObservationPair; typedef std::pair<const QString, WellObservationSet> WellObservationPair;
typedef std::map<QString, WellObservationSet> WellObservationMap; typedef std::map<QString, WellObservationSet> WellObservationMap;
WellObservationMap loadWellDates( QDir& dir, QString* errorMsg ); WellObservationMap loadWellDates( QDir& dir, QString* errorMsg );
static bool readTxtFile( const QString& txtFileName, QString* errorMsg, WellObservationSet* wellObservationSet ); static bool readTxtFile( const QString& txtFileName, QString* errorMsg, WellObservationSet* wellObservationSet );

View File

@ -118,7 +118,7 @@ std::map<QString, cvf::ref<RigWellPathFormations>>
formations[wellNames[i]].push_back( formation ); formations[wellNames[i]].push_back( formation );
} }
for ( const std::pair<QString, std::vector<RigWellPathFormation>>& formation : formations ) for ( const std::pair<const QString, std::vector<RigWellPathFormation>>& formation : formations )
{ {
cvf::ref<RigWellPathFormations> wellPathFormations = cvf::ref<RigWellPathFormations> wellPathFormations =
new RigWellPathFormations( formation.second, filePath, formation.first ); new RigWellPathFormations( formation.second, filePath, formation.first );

View File

@ -1193,14 +1193,14 @@ void RimWellPlotTools::calculateValueOptionsForTimeSteps(
QString dateFormatString; QString dateFormatString;
{ {
std::vector<QDateTime> allTimeSteps; std::vector<QDateTime> allTimeSteps;
for ( const std::pair<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepPair : timestepsToShowWithSources ) for ( const std::pair<const QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepPair : timestepsToShowWithSources )
{ {
allTimeSteps.push_back( timeStepPair.first ); allTimeSteps.push_back( timeStepPair.first );
} }
dateFormatString = RiaQDateTimeTools::createTimeFormatStringFromDates( allTimeSteps ); dateFormatString = RiaQDateTimeTools::createTimeFormatStringFromDates( allTimeSteps );
} }
for ( const std::pair<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepPair : timestepsToShowWithSources ) for ( const std::pair<const QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepPair : timestepsToShowWithSources )
{ {
QString optionText = RiaQDateTimeTools::toStringUsingApplicationLocale( timeStepPair.first, dateFormatString ); QString optionText = RiaQDateTimeTools::toStringUsingApplicationLocale( timeStepPair.first, dateFormatString );

View File

@ -1230,7 +1230,7 @@ QList<caf::PdmOptionItemInfo> RimGeoMechCase::calculateValueOptions( const caf::
std::map<std::string, QString> addressesInFile = std::map<std::string, QString> addressesInFile =
geoMechData()->femPartResults()->addressesInElementPropertyFiles( paths ); geoMechData()->femPartResults()->addressesInElementPropertyFiles( paths );
for ( const std::string elementProperty : elementProperties ) for ( const std::string& elementProperty : elementProperties )
{ {
QString result = QString::fromStdString( elementProperty ); QString result = QString::fromStdString( elementProperty );
QString filename = findFileNameForElementProperty( elementProperty, addressesInFile ); QString filename = findFileNameForElementProperty( elementProperty, addressesInFile );

View File

@ -612,7 +612,7 @@ QList<caf::PdmOptionItemInfo>
std::map<std::string, QString> addressesInFile = std::map<std::string, QString> addressesInFile =
geoMechCase->geoMechData()->femPartResults()->addressesInElementPropertyFiles( paths ); geoMechCase->geoMechData()->femPartResults()->addressesInElementPropertyFiles( paths );
for ( const std::string elementProperty : elementProperties ) for ( const std::string& elementProperty : elementProperties )
{ {
QString result = QString::fromStdString( elementProperty ); QString result = QString::fromStdString( elementProperty );
QString filename = geoMechCase->findFileNameForElementProperty( elementProperty, addressesInFile ); QString filename = geoMechCase->findFileNameForElementProperty( elementProperty, addressesInFile );

View File

@ -1086,7 +1086,7 @@ void RimEnsembleCurveSet::showCurves( bool show )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSet::markCachedDataForPurge() void RimEnsembleCurveSet::markCachedDataForPurge()
{ {
for ( const auto curve : m_curves ) for ( const auto& curve : m_curves )
{ {
curve->markCachedDataForPurge(); curve->markCachedDataForPurge();
} }

View File

@ -217,7 +217,7 @@ void RigWellPathFormations::evaluateFormations( const std::vector<std::pair<RigW
evaluateFormationsForOnePosition( formations, maxLevel, PickPosition::TOP, &tempMakeVectorUniqueOnDepth, depthType ); evaluateFormationsForOnePosition( formations, maxLevel, PickPosition::TOP, &tempMakeVectorUniqueOnDepth, depthType );
evaluateFormationsForOnePosition( formations, maxLevel, PickPosition::BASE, &tempMakeVectorUniqueOnDepth, depthType ); evaluateFormationsForOnePosition( formations, maxLevel, PickPosition::BASE, &tempMakeVectorUniqueOnDepth, depthType );
for ( const std::pair<double, LevelAndName>& uniqueDepth : tempMakeVectorUniqueOnDepth ) for ( const std::pair<const double, LevelAndName>& uniqueDepth : tempMakeVectorUniqueOnDepth )
{ {
depths->push_back( uniqueDepth.first ); depths->push_back( uniqueDepth.first );
names->push_back( uniqueDepth.second.name ); names->push_back( uniqueDepth.second.name );
@ -268,7 +268,7 @@ void RigWellPathFormations::evaluateFluids( const std::vector<RigWellPathFormati
uniqueListMaker[depthTop] = formation.formationName + " Top"; uniqueListMaker[depthTop] = formation.formationName + " Top";
} }
for ( const std::pair<double, QString>& depthAndFormation : uniqueListMaker ) for ( const std::pair<const double, QString>& depthAndFormation : uniqueListMaker )
{ {
depths->push_back( depthAndFormation.first ); depths->push_back( depthAndFormation.first );
names->push_back( depthAndFormation.second ); names->push_back( depthAndFormation.second );
@ -313,7 +313,7 @@ std::vector<RigWellPathFormations::FormationLevel> RigWellPathFormations::format
{ {
std::vector<RigWellPathFormations::FormationLevel> formationLevels; std::vector<RigWellPathFormations::FormationLevel> formationLevels;
for ( const std::pair<RigWellPathFormations::FormationLevel, bool>& formationLevel : m_formationsLevelsPresent ) for ( const std::pair<const RigWellPathFormations::FormationLevel, bool>& formationLevel : m_formationsLevelsPresent )
{ {
formationLevels.push_back( formationLevel.first ); formationLevels.push_back( formationLevel.first );
} }

View File

@ -1321,7 +1321,7 @@ public:
for ( size_t timeStep : requestedTimesteps ) for ( size_t timeStep : requestedTimesteps )
{ {
for ( const std::pair<size_t, size_t> selectedCell : selectedCells ) for ( const std::pair<size_t, size_t>& selectedCell : selectedCells )
{ {
cvf::ref<RigResultAccessor> resultAccessor = cvf::ref<RigResultAccessor> resultAccessor =
RigResultAccessorFactory::createFromResultAddress( rimCase->eclipseCaseData(), RigResultAccessorFactory::createFromResultAddress( rimCase->eclipseCaseData(),

View File

@ -52,7 +52,7 @@ void RiuExpressionContextMenuManager::slotMenuItems( QPoint point )
{ {
QMenu menu; QMenu menu;
for ( const std::pair<QString, std::set<QString>>& subMenuPair : MENU_MAP ) for ( const std::pair<const QString, std::set<QString>>& subMenuPair : MENU_MAP )
{ {
QMenu* subMenu = menu.addMenu( subMenuPair.first ); QMenu* subMenu = menu.addMenu( subMenuPair.first );

View File

@ -345,7 +345,7 @@ void RiuMohrsCirclePlot::addorUpdateEnvelopeCurve( const cvf::Vec3f& principals,
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuMohrsCirclePlot::deleteEnvelopes() void RiuMohrsCirclePlot::deleteEnvelopes()
{ {
for ( const std::pair<const RimGeoMechCase*, QwtPlotCurve*>& envelope : m_envolopePlotItems ) for ( const std::pair<const RimGeoMechCase* const, QwtPlotCurve*>& envelope : m_envolopePlotItems )
{ {
envelope.second->detach(); envelope.second->detach();
delete envelope.second; delete envelope.second;
@ -643,7 +643,7 @@ void RiuMohrsCirclePlot::idealAxesEndPoints( double* xMin, double* xMax, double*
*yMax = -HUGE_VAL; *yMax = -HUGE_VAL;
double maxYEnvelope = -HUGE_VAL; double maxYEnvelope = -HUGE_VAL;
for ( const std::pair<const RimGeoMechCase*, QwtPlotCurve*>& envelope : m_envolopePlotItems ) for ( const std::pair<const RimGeoMechCase* const, QwtPlotCurve*>& envelope : m_envolopePlotItems )
{ {
double tempMax = envelope.second->maxYValue(); double tempMax = envelope.second->maxYValue();
if ( tempMax > maxYEnvelope ) if ( tempMax > maxYEnvelope )
@ -655,7 +655,7 @@ void RiuMohrsCirclePlot::idealAxesEndPoints( double* xMin, double* xMax, double*
*yMax = std::max( maxYEnvelope, 1.2 * largestCircleRadiusInPlot() ); *yMax = std::max( maxYEnvelope, 1.2 * largestCircleRadiusInPlot() );
double minXEvelope = HUGE_VAL; double minXEvelope = HUGE_VAL;
for ( const std::pair<const RimGeoMechCase*, QwtPlotCurve*>& envelope : m_envolopePlotItems ) for ( const std::pair<const RimGeoMechCase* const, QwtPlotCurve*>& envelope : m_envolopePlotItems )
{ {
double tempMin = envelope.second->minXValue(); double tempMin = envelope.second->minXValue();
if ( tempMin < minXEvelope ) if ( tempMin < minXEvelope )