diff --git a/Framework/Algorithms/src/DiffractionFocussing2.cpp b/Framework/Algorithms/src/DiffractionFocussing2.cpp index 05e80f1350200b3dfebb46d9cca26a43c8b087d5..30739942885ad98dc5c264552aa14ded38c3db98 100644 --- a/Framework/Algorithms/src/DiffractionFocussing2.cpp +++ b/Framework/Algorithms/src/DiffractionFocussing2.cpp @@ -368,7 +368,7 @@ void DiffractionFocussing2::execEvent() { const vector<size_t> &indices = this->m_wsIndices[group]; totalHistProcess += static_cast<int>(indices.size()); - for (unsigned long indice : indices) { + for (auto indice : indices) { size_required[iGroup] += m_eventW->getEventList(indice).getNumberEvents(); } prog->report(1, "Pre-counting"); @@ -454,7 +454,7 @@ void DiffractionFocussing2::execEvent() { PARALLEL_START_INTERUPT_REGION const int group = this->m_validGroups[iGroup]; const std::vector<size_t> &indices = this->m_wsIndices[group]; - for (unsigned long wi : indices) { + for (auto wi : indices) { // In workspace index iGroup, put what was in the OLD workspace index wi out->getOrAddEventList(iGroup) += m_eventW->getEventList(wi); diff --git a/Framework/Algorithms/src/MaskBins.cpp b/Framework/Algorithms/src/MaskBins.cpp index c1f3bc54fd6e3bfc69771cad53b322a0890c86a8..f2257a087fc4e7af2e67c415e4dc20dcaae2669b 100644 --- a/Framework/Algorithms/src/MaskBins.cpp +++ b/Framework/Algorithms/src/MaskBins.cpp @@ -204,9 +204,9 @@ void MaskBins::execEvent() { if (this->spectra_list.size() > 0) { // Specific spectra were specified PARALLEL_FOR1(outputWS) - for (int i : this->spectra_list) { + for (int i = 0; i < static_cast<int>(this->spectra_list.size()); ++i) { PARALLEL_START_INTERUPT_REGION - outputWS->getEventList(i).maskTof(m_startX, m_endX); + outputWS->getEventList(this->spectra_list[i]).maskTof(m_startX, m_endX); progress.report(); PARALLEL_END_INTERUPT_REGION } diff --git a/Framework/Algorithms/src/MedianDetectorTest.cpp b/Framework/Algorithms/src/MedianDetectorTest.cpp index ccf8339d2bdd10b118ab69010568e704ffb9ef8c..4503df4f954027d01797d05df0c5f2db7cd73cda 100644 --- a/Framework/Algorithms/src/MedianDetectorTest.cpp +++ b/Framework/Algorithms/src/MedianDetectorTest.cpp @@ -246,25 +246,25 @@ int MedianDetectorTest::maskOutliers( } for (size_t i = 0; i < indexmap.size(); ++i) { - std::vector<size_t> hists = indexmap.at(i); + std::vector<size_t> hists = indexmap[i]; double median = medianvec.at(i); PARALLEL_FOR1(countsWS) - for (unsigned long hist : hists) { - const double value = countsWS->readY(hist)[0]; + for (int j = 0; j < static_cast<int>(hists.size()); ++j) { + const double value = countsWS->readY(hists[j])[0]; if ((value == 0.) && checkForMask) { const std::set<detid_t> &detids = - countsWS->getSpectrum(hist)->getDetectorIDs(); + countsWS->getSpectrum(hists[j])->getDetectorIDs(); if (instrument->isDetectorMasked(detids)) { numFailed -= 1; // it was already masked } } if ((value < out_lo * median) && (value > 0.0)) { - countsWS->maskWorkspaceIndex(hist); + countsWS->maskWorkspaceIndex(hists[j]); PARALLEL_ATOMIC ++numFailed; } else if (value > out_hi * median) { - countsWS->maskWorkspaceIndex(hist); + countsWS->maskWorkspaceIndex(hists[j]); PARALLEL_ATOMIC ++numFailed; } diff --git a/Framework/Algorithms/src/Stitch1D.cpp b/Framework/Algorithms/src/Stitch1D.cpp index aa26f4c41751e5b1bf5aa4c1935459c2e60e70db..326507f660fcf402185a506b50ae29f4ce0470c4 100644 --- a/Framework/Algorithms/src/Stitch1D.cpp +++ b/Framework/Algorithms/src/Stitch1D.cpp @@ -638,19 +638,19 @@ void Stitch1D::reinsertSpecialValues(MatrixWorkspace_sptr ws) { // Copy over the data MantidVec &sourceY = ws->dataY(i); - for (unsigned long j : m_nanYIndexes[i]) { + for (auto j : m_nanYIndexes[i]) { sourceY[j] = std::numeric_limits<double>::quiet_NaN(); } - for (unsigned long j : m_infYIndexes[i]) { + for (auto j : m_infYIndexes[i]) { sourceY[j] = std::numeric_limits<double>::infinity(); } - for (unsigned long j : m_nanEIndexes[i]) { + for (auto j : m_nanEIndexes[i]) { sourceY[j] = std::numeric_limits<double>::quiet_NaN(); } - for (unsigned long j : m_infEIndexes[i]) { + for (auto j : m_infEIndexes[i]) { sourceY[j] = std::numeric_limits<double>::infinity(); } diff --git a/Framework/Crystal/src/Cluster.cpp b/Framework/Crystal/src/Cluster.cpp index 0666dab699030448eae5a4d809fe76961926f2fd..aafeb2e32d1e1b31af47864ac46b9db8212b1531 100644 --- a/Framework/Crystal/src/Cluster.cpp +++ b/Framework/Crystal/src/Cluster.cpp @@ -59,7 +59,7 @@ void Cluster::addIndex(const size_t &index) { m_indexes.push_back(index); } */ void Cluster::writeTo(Mantid::API::IMDHistoWorkspace_sptr ws) const { const size_t label = this->getLabel(); - for (unsigned long m_indexe : m_indexes) { + for (auto m_indexe : m_indexes) { ws->setSignalAt(m_indexe, static_cast<Mantid::signal_t>(label)); ws->setErrorSquaredAt(m_indexe, 0); } @@ -75,7 +75,7 @@ Cluster::integrate(Mantid::API::IMDHistoWorkspace_const_sptr ws) const { double errorIntSQ = 0; double sigInt = 0; // Integrate accross indexes owned by this workspace. - for (unsigned long m_indexe : m_indexes) { + for (auto m_indexe : m_indexes) { sigInt += ws->getSignalAt(m_indexe); double errorSQ = ws->getErrorAt(m_indexe); errorSQ *= errorSQ; diff --git a/Framework/Crystal/src/ConnectedComponentLabeling.cpp b/Framework/Crystal/src/ConnectedComponentLabeling.cpp index 33799a633769a904172cb3d95e4a13fd206c56cc..3ef5a6cc359cf7440928d79d8fbca91ee65fb430 100644 --- a/Framework/Crystal/src/ConnectedComponentLabeling.cpp +++ b/Framework/Crystal/src/ConnectedComponentLabeling.cpp @@ -134,7 +134,7 @@ size_t doConnectedComponentLabeling(IMDIterator *iterator, nonEmptyNeighbourIndexes.reserve(maxNeighbours); SetIds neighbourIds; // Discover non-empty neighbours - for (unsigned long neighIndex : neighbourIndexes) { + for (auto neighIndex : neighbourIndexes) { if (!iterator->isWithinBounds(neighIndex)) { /* Record labels which appear to belong to the same cluster, but cannot be combined in this @@ -180,7 +180,7 @@ size_t doConnectedComponentLabeling(IMDIterator *iterator, DisjointElement &parentElement = neighbourElements[candidateSourceParentIndex]; // Union remainder parents with the chosen parent - for (unsigned long neighIndex : nonEmptyNeighbourIndexes) { + for (auto neighIndex : nonEmptyNeighbourIndexes) { if (neighIndex != candidateSourceParentIndex) { neighbourElements[neighIndex].unionWith(&parentElement); } diff --git a/Framework/Crystal/src/FindClusterFaces.cpp b/Framework/Crystal/src/FindClusterFaces.cpp index 5ac372173d5805411d06e91ce32c0978778ee211..3ea8f765609a8517e1d8182742ec047fca38971d 100644 --- a/Framework/Crystal/src/FindClusterFaces.cpp +++ b/Framework/Crystal/src/FindClusterFaces.cpp @@ -120,7 +120,7 @@ void findFacesAtIndex(const size_t linearIndex, IMDIterator *mdIterator, indexes); const auto neighbours = mdIterator->findNeighbourIndexesFaceTouching(); - for (unsigned long neighbourLinearIndex : neighbours) { + for (auto neighbourLinearIndex : neighbours) { const int neighbourId = static_cast<int>(clusterImage->getSignalAt(neighbourLinearIndex)); diff --git a/Framework/Crystal/src/SaveIsawPeaks.cpp b/Framework/Crystal/src/SaveIsawPeaks.cpp index f75e9d2937c50e0a2ccd844e4f40b36d531f3c40..f22c62517ef75d67e7c43a684f4aba195de73bbe 100644 --- a/Framework/Crystal/src/SaveIsawPeaks.cpp +++ b/Framework/Crystal/src/SaveIsawPeaks.cpp @@ -298,7 +298,7 @@ void SaveIsawPeaks::exec() { out << header << std::endl; // Go through each peak at this run / bank - for (unsigned long wi : ids) { + for (auto wi : ids) { Peak &p = peaks[wi]; // Sequence (run) number diff --git a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp index 4048851063e9552c13d1dd34fa58914a9b0a8098..ce10880e9a0c21a91270b34725883c1641c5cbe4 100644 --- a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp +++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp @@ -1215,7 +1215,7 @@ void FitPowderDiffPeaks::fitPeaksWithGoodStartingValues() { } else { // Fit overlapped peaks vector<BackToBackExponential_sptr> peaksgroup; - for (unsigned long ipk : indexpeakgroup) { + for (auto ipk : indexpeakgroup) { BackToBackExponential_sptr temppeak = m_vecPeakFunctions[ipk].second.second; peaksgroup.push_back(temppeak); diff --git a/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp b/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp index eb9a1e13cbb3366ae0a82afd0b900b8a98d341ba..e42ae776c6b9b51d4ab82628a586013b6075dedc 100644 --- a/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp +++ b/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp @@ -309,7 +309,7 @@ void ComptonScatteringCountRate::cacheComptonProfile( const size_t paramsOffset) { m_profiles.push_back(profile.get()); auto fixedParams = profile->intensityParameterIndices(); - for (unsigned long fixedParam : fixedParams) { + for (auto fixedParam : fixedParams) { const size_t indexOfFixed = paramsOffset + fixedParam; this->fix(indexOfFixed); m_fixedParamIndices.push_back(indexOfFixed); diff --git a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp index 9ec0ae393dc7979f731c0f0f0b91b6cbf077abb8..6caf090ceef304e934e4d8321a96212b68f5d102 100644 --- a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp +++ b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp @@ -1426,10 +1426,10 @@ void FilterEventsByLogValuePreNexus::unmaskVetoEventIndexes() { size_t numerror = 0; PRAGMA_OMP(parallel for schedule(dynamic, 1) ) - for (unsigned long long &i : m_vecEventIndex) { + for (int i = 0; i < static_cast<int>(m_vecEventIndex.size()); ++i) { PARALLEL_START_INTERUPT_REGION - uint64_t eventindex = i; + uint64_t eventindex = m_vecEventIndex[i]; if (eventindex > static_cast<uint64_t>(m_numEvents)) { uint64_t realeventindex = eventindex & VETOFLAG; i = realeventindex; diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp index 52ea8c348e5e986d1abf5b0e2d8d8cd39ce0760f..ec52b317dd62cba78a798dfb3ea4a61b5b2cccc6 100644 --- a/Framework/DataHandling/src/GroupDetectors2.cpp +++ b/Framework/DataHandling/src/GroupDetectors2.cpp @@ -957,7 +957,7 @@ size_t GroupDetectors2::formGroups(API::MatrixWorkspace_const_sptr inputWS, size_t nonMaskedSpectra(0); beh->dataX(outIndex)[0] = 0.0; beh->dataE(outIndex)[0] = 0.0; - for (unsigned long originalWI : it->second) { + for (auto originalWI : it->second) { // detectors to add to firstSpecNum const ISpectrum *fromSpectrum = inputWS->getSpectrum(originalWI); @@ -1062,7 +1062,7 @@ GroupDetectors2::formGroupsEvent(DataObjects::EventWorkspace_const_sptr inputWS, size_t nonMaskedSpectra(0); beh->dataX(outIndex)[0] = 0.0; beh->dataE(outIndex)[0] = 0.0; - for (unsigned long originalWI : it->second) { + for (auto originalWI : it->second) { const EventList &fromEL = inputWS->getEventList(originalWI); // Add the event lists with the operator outEL += fromEL; diff --git a/Framework/DataHandling/src/LoadVulcanCalFile.cpp b/Framework/DataHandling/src/LoadVulcanCalFile.cpp index 7f38f3e18359f6cd7301cfdcc049d102bb2ba63f..852a2a458117fe71424386070e23844aee3ceed7 100644 --- a/Framework/DataHandling/src/LoadVulcanCalFile.cpp +++ b/Framework/DataHandling/src/LoadVulcanCalFile.cpp @@ -420,7 +420,7 @@ void LoadVulcanCalFile::processOffsets( static const size_t arr[] = {21, 22, 23, 26, 27, 28}; vector<size_t> vec_banks(arr, arr + sizeof(arr) / sizeof(arr[0])); - for (unsigned long bankindex : vec_banks) { + for (auto bankindex : vec_banks) { for (size_t j = 0; j < NUMBERDETECTORPERMODULE; ++j) { detid_t detindex = static_cast<detid_t>(bankindex * NUMBERRESERVEDPERMODULE + j); diff --git a/Framework/MDAlgorithms/src/FindPeaksMD.cpp b/Framework/MDAlgorithms/src/FindPeaksMD.cpp index d592acf12b06fdceaa31ed535c09d4c0048ea2f1..59355a573a786054ae1a8ba92292597fdc7bd3c9 100644 --- a/Framework/MDAlgorithms/src/FindPeaksMD.cpp +++ b/Framework/MDAlgorithms/src/FindPeaksMD.cpp @@ -515,7 +515,7 @@ void FindPeaksMD::findPeaksHisto( // Compare to all boxes already picked. bool badBox = false; - for (unsigned long &peakBoxe : peakBoxes) { + for (auto &peakBoxe : peakBoxes) { VMD otherCenter = ws->getCenter(peakBoxe); // Distance between this box and a box we already put in. @@ -549,7 +549,7 @@ void FindPeaksMD::findPeaksHisto( } } // --- Convert the "boxes" to peaks ---- - for (unsigned long index : peakBoxes) { + for (auto index : peakBoxes) { // The center of the box = Q in the lab frame VMD boxCenter = ws->getCenter(index); diff --git a/Framework/MDAlgorithms/src/ReplicateMD.cpp b/Framework/MDAlgorithms/src/ReplicateMD.cpp index e83ee390befb9d8464791a33ecb90329591840ea..340f280f2be73d7d0c4505096f3067d8e57d3802 100644 --- a/Framework/MDAlgorithms/src/ReplicateMD.cpp +++ b/Framework/MDAlgorithms/src/ReplicateMD.cpp @@ -329,11 +329,11 @@ void ReplicateMD::exec() { auto iterators = outputWS->createIterators(nThreads, NULL); PARALLEL_FOR_NO_WSP_CHECK() - for (auto &iterator : iterators) { + for (int it = 0; it < int(iterators.size()); ++it) { PARALLEL_START_INTERUPT_REGION auto outIt = std::unique_ptr<MDHistoWorkspaceIterator>( - dynamic_cast<MDHistoWorkspaceIterator *>(iterator)); + dynamic_cast<MDHistoWorkspaceIterator *>(iterators[it])); // Iterate over the output workspace do { diff --git a/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp b/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp index 6b35162dfebbaf5c417e20b9fdedfb3de9d84b2c..b8643d77a1a0bcee2f39e9a4e554a77eda5d046a 100644 --- a/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp +++ b/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp @@ -1080,7 +1080,7 @@ SlicingAlgorithm::extractMDFrameForNonAxisAligned( const auto &referenceMDFrame = m_inWS->getDimension(indicesWithProjection[0])->getMDFrame(); - for (unsigned long &it : indicesWithProjection) { + for (auto &it : indicesWithProjection) { const auto &toCheckMDFrame = m_inWS->getDimension(it)->getMDFrame(); if (!referenceMDFrame.isSameType(toCheckMDFrame)) { g_log.warning() << "Slicing Algorithm: New basis vector tries to " diff --git a/Framework/MDAlgorithms/src/SmoothMD.cpp b/Framework/MDAlgorithms/src/SmoothMD.cpp index 24e570e7d81d6435fd62dbc95f5f0f8688aefb32..c34969adac864e8f4359b3801fd89f3ede858189 100644 --- a/Framework/MDAlgorithms/src/SmoothMD.cpp +++ b/Framework/MDAlgorithms/src/SmoothMD.cpp @@ -129,11 +129,11 @@ SmoothMD::hatSmooth(IMDHistoWorkspace_const_sptr toSmooth, auto iterators = toSmooth->createIterators(nThreads, NULL); PARALLEL_FOR_NO_WSP_CHECK() - for (auto &it : iterators) { + for (int it = 0; it < int(iterators.size()); ++it) { PARALLEL_START_INTERUPT_REGION boost::scoped_ptr<MDHistoWorkspaceIterator> iterator( - dynamic_cast<MDHistoWorkspaceIterator *>(it)); + dynamic_cast<MDHistoWorkspaceIterator *>(iterators[it])); if (!iterator) { throw std::logic_error( diff --git a/Framework/MDAlgorithms/src/TransformMD.cpp b/Framework/MDAlgorithms/src/TransformMD.cpp index e92f0eaea6a825adeefa751a99e6ac7cacfbd686..75d5a5383a7894bb5fe7bed070b23de415b024db 100644 --- a/Framework/MDAlgorithms/src/TransformMD.cpp +++ b/Framework/MDAlgorithms/src/TransformMD.cpp @@ -81,9 +81,9 @@ void TransformMD::doTransform( API::IMDNode::sortObjByID(boxes); PARALLEL_FOR_IF(!ws->isFileBacked()) - for (auto &boxe : boxes) { + for (int i = 0; i < static_cast<int>(boxes.size()); i++) { PARALLEL_START_INTERUPT_REGION - MDBoxBase<MDE, nd> *box = dynamic_cast<MDBoxBase<MDE, nd> *>(boxe); + MDBoxBase<MDE, nd> *box = dynamic_cast<MDBoxBase<MDE, nd> *>(boxes[i]); if (box) { box->transformDimensions(m_scaling, m_offset); } diff --git a/Framework/MDAlgorithms/src/TransposeMD.cpp b/Framework/MDAlgorithms/src/TransposeMD.cpp index 598fb2c31cfe34bb17debeaea64b2bfd2ad471be..0a2f355fdd10dbdf517d93e1d9fe24227b500bed 100644 --- a/Framework/MDAlgorithms/src/TransposeMD.cpp +++ b/Framework/MDAlgorithms/src/TransposeMD.cpp @@ -138,10 +138,10 @@ void TransposeMD::exec() { auto iterators = inWS->createIterators(nThreads, NULL); PARALLEL_FOR_NO_WSP_CHECK() - for (auto &iterator : iterators) { + for (int it = 0; it < int(iterators.size()); ++it) { PARALLEL_START_INTERUPT_REGION - auto inIterator = std::unique_ptr<IMDIterator>(iterator); + auto inIterator = std::unique_ptr<IMDIterator>(iterators[it]); do { auto center = inIterator->getCenter(); const coord_t *incoords = center.getBareArray(); diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp index 02a0419f7e10dfdffb90fee11f0a10ef75e07194..cc7d068fa8d09991f48c65d737f0ae004fd2ee1d 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp @@ -134,7 +134,8 @@ void PoldiResidualCorrelationCore::correctCountData() const { double ratio = sumOfResiduals / numberOfCells; PARALLEL_FOR_NO_WSP_CHECK() - for (int element : m_detectorElements) { + for (int i = 0; i < static_cast<int>(m_detectorElements.size()); ++i) { + int element = m_detectorElements[i]; for (int j = 0; j < m_timeBinCount; ++j) { addToCountData(element, j, -ratio); }