Commit 04511409 authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Refs #14988. Naming fixes.

parent ea68446f
......@@ -71,9 +71,9 @@ void Expression::add_operators(const std::vector<std::string> &ops) {
char j = 0;
tokenizer tkz(m_operators->binary[i], " ",
tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM);
for (const auto &it : tkz) {
m_operators->precedence[it] = i + 1;
m_operators->op_number[it] = j++;
for (const auto &index : tkz) {
m_operators->precedence[index] = i + 1;
m_operators->op_number[index] = j++;
}
}
......
......@@ -478,9 +478,10 @@ FileFinderImpl::findRun(const std::string &hintstr,
tolower);
if (!archiveOpt.empty() && archiveOpt != "off" &&
!facility.archiveSearch().empty()) {
for (const auto &it : facility.archiveSearch()) {
g_log.debug() << "get archive search for the facility..." << it << "\n";
archs.push_back(ArchiveSearchFactory::Instance().create(it));
for (const auto &facilityname : facility.archiveSearch()) {
g_log.debug() << "get archive search for the facility..."
<< facilityname << "\n";
archs.push_back(ArchiveSearchFactory::Instance().create(facilityname));
}
}
}
......
......@@ -176,8 +176,8 @@ std::string ParameterTie::asString(const IFunction *fun) const {
* @return True if any of the parameters is used as a variable in the mu::Parser
*/
bool ParameterTie::findParametersOf(const IFunction *fun) const {
for (const auto &it : m_varMap) {
if (it.second.getFunction() == fun) {
for (const auto &varPair : m_varMap) {
if (varPair.second.getFunction() == fun) {
return true;
}
}
......
......@@ -131,8 +131,8 @@ void ConvertEmptyToTof::exec() {
std::map<int, int> eppMap =
findElasticPeakPositions(spectraIndices, channelIndices);
for (auto &it : eppMap) {
g_log.debug() << "Spectra idx =" << it.first << ", epp=" << it.second
for (auto &epp : eppMap) {
g_log.debug() << "Spectra idx =" << epp.first << ", epp=" << epp.second
<< std::endl;
}
......@@ -168,10 +168,10 @@ void ConvertEmptyToTof::validateSpectraIndices(std::vector<int> &v) {
for (unsigned int i = 0; i < nHist; ++i)
v[i] = i;
} else {
for (int &it : v) {
if (it < 0 || static_cast<size_t>(it) >= nHist) {
for (int index : v) {
if (index < 0 || static_cast<size_t>(index) >= nHist) {
throw std::runtime_error("Spectra index out of limits: " +
boost::lexical_cast<std::string>(it));
boost::lexical_cast<std::string>(index));
}
}
}
......@@ -193,10 +193,10 @@ void ConvertEmptyToTof::validateChannelIndices(std::vector<int> &v) {
for (unsigned int i = 0; i < blockSize; ++i)
v[i] = i;
} else {
for (int &it : v) {
if (it < 0 || static_cast<size_t>(it) >= blockSize) {
for (int &index : v) {
if (index < 0 || static_cast<size_t>(index) >= blockSize) {
throw std::runtime_error("Channel index out of limits: " +
boost::lexical_cast<std::string>(it));
boost::lexical_cast<std::string>(index));
}
}
}
......@@ -398,9 +398,9 @@ ConvertEmptyToTof::findAverageEppAndEpTof(const std::map<int, int> &eppMap) {
std::vector<int> eppList;
double firstL2 = getL2(m_inputWS, eppMap.begin()->first);
for (const auto &it : eppMap) {
for (const auto &epp : eppMap) {
double l2 = getL2(m_inputWS, it.first);
double l2 = getL2(m_inputWS, epp.first);
if (!areEqual(l2, firstL2, 0.0001)) {
g_log.error() << "firstL2=" << firstL2 << " , "
<< "l2=" << l2 << std::endl;
......@@ -413,9 +413,9 @@ ConvertEmptyToTof::findAverageEppAndEpTof(const std::map<int, int> &eppMap) {
epTofList.push_back(
(calculateTOF(l1, wavelength) + calculateTOF(l2, wavelength)) *
1e6); // microsecs
eppList.push_back(it.first);
eppList.push_back(epp.first);
g_log.debug() << "WS index = " << it.first << ", l1 = " << l1
g_log.debug() << "WS index = " << epp.first << ", l1 = " << l1
<< ", l2 = " << l2
<< ", TOF(l1+l2) = " << *(epTofList.end() - 1) << std::endl;
}
......
......@@ -164,8 +164,8 @@ void CorelliCrossCorrelate::exec() {
int offset_int = getProperty("TimingOffset");
const int64_t offset = static_cast<int64_t>(offset_int);
for (auto &i : tdc)
i += offset;
for (auto &timing : tdc)
timing += offset;
// Determine period from chopper frequency.
auto motorSpeed = dynamic_cast<TimeSeriesProperty<double> *>(
......
......@@ -221,9 +221,9 @@ void CreateCalFileByNames::saveGroupingFile(const std::string &filename,
}
} else //
{
for (const auto &it : instrcalib)
writeCalEntry(outfile, it.first, (it.second).first, 0.0, 1,
(it.second).second);
for (const auto &value : instrcalib)
writeCalEntry(outfile, value.first, (value.second).first, 0.0, 1,
(value.second).second);
}
// Closing
......
......@@ -223,9 +223,9 @@ void CreateDummyCalFile::saveGroupingFile(const std::string &filename,
}
} else //
{
for (const auto &it : instrcalib)
writeCalEntry(outfile, it.first, (it.second).first, 0.0, 1,
(it.second).second);
for (const auto &value : instrcalib)
writeCalEntry(outfile, value.first, (value.second).first, 0.0, 1,
(value.second).second);
}
// Closing
......
......@@ -245,8 +245,8 @@ void DiffractionFocussing2::exec() {
m_matrixInputW->maskedBins(i);
// Now iterate over the list, adjusting the weights for the affected
// bins
for (const auto &it : mask) {
const double currentX = Xin[it.first];
for (const auto &bin : mask) {
const double currentX = Xin[bin.first];
// Add an intermediate bin with full weight if masked bins aren't
// consecutive
if (weight_bins.back() != currentX) {
......@@ -255,8 +255,8 @@ void DiffractionFocussing2::exec() {
}
// The weight for this masked bin is 1 - the degree to which this bin
// is masked
weights.push_back(1.0 - it.second);
weight_bins.push_back(Xin[it.first + 1]);
weights.push_back(1.0 - bin.second);
weight_bins.push_back(Xin[bin.first + 1]);
}
// Add on a final bin with full weight if masking doesn't go up to the
// end
......
......@@ -282,8 +282,8 @@ void GetAllEi::exec() {
boost::lexical_cast<std::string>(guess_ei.size()) +
" fell within both monitor's recording energy range\n";
g_log.debug() << " Guess Energies are:\n";
for (double &i : guess_ei) {
g_log.debug() << boost::str(boost::format(" %8.2f; ") % i);
for (double ei : guess_ei) {
g_log.debug() << boost::str(boost::format(" %8.2f; ") % ei);
}
g_log.debug() << std::endl;
......
......@@ -64,15 +64,15 @@ void MergeRuns::exec() {
// This will hold the inputs, with the groups separated off
std::vector<std::string> inputs;
for (const auto &i : inputs_orig) {
for (const auto &input : inputs_orig) {
WorkspaceGroup_sptr wsgroup =
AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>(i);
AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>(input);
if (wsgroup) { // Workspace group
std::vector<std::string> group = wsgroup->getNames();
inputs.insert(inputs.end(), group.begin(), group.end());
} else {
// Single workspace
inputs.push_back(i);
inputs.push_back(input);
}
}
......@@ -282,9 +282,9 @@ void MergeRuns::execEvent() {
boost::shared_ptr<AdditionTable> table = m_tables[workspaceNum - 1];
// Add all the event lists together as the table says to do
for (auto &it : *table) {
int64_t inWI = it.first;
int64_t outWI = it.second;
for (auto &WI : *table) {
int64_t inWI = WI.first;
int64_t outWI = WI.second;
if (outWI >= 0) {
outWS->getEventList(outWI) += addee->getEventList(inWI);
} else {
......
......@@ -387,29 +387,29 @@ void PlotAsymmetryByLogValue::populateOutputWorkspace(
auto tAxis = new TextAxis(nplots);
if (nplots == 1) {
size_t i = 0;
for (auto &it : m_logValue) {
outWS->dataX(0)[i] = it.second;
outWS->dataY(0)[i] = m_redY[it.first];
outWS->dataE(0)[i] = m_redE[it.first];
for (auto &value : m_logValue) {
outWS->dataX(0)[i] = value.second;
outWS->dataY(0)[i] = m_redY[value.first];
outWS->dataE(0)[i] = m_redE[value.first];
i++;
}
tAxis->setLabel(0, "Asymmetry");
} else {
size_t i = 0;
for (auto &it : m_logValue) {
outWS->dataX(0)[i] = it.second;
outWS->dataY(0)[i] = m_diffY[it.first];
outWS->dataE(0)[i] = m_diffE[it.first];
outWS->dataX(1)[i] = it.second;
outWS->dataY(1)[i] = m_redY[it.first];
outWS->dataE(1)[i] = m_redE[it.first];
outWS->dataX(2)[i] = it.second;
outWS->dataY(2)[i] = m_greenY[it.first];
outWS->dataE(2)[i] = m_greenE[it.first];
outWS->dataX(3)[i] = it.second;
outWS->dataY(3)[i] = m_sumY[it.first];
outWS->dataE(3)[i] = m_sumE[it.first];
for (auto &value : m_logValue) {
outWS->dataX(0)[i] = value.second;
outWS->dataY(0)[i] = m_diffY[value.first];
outWS->dataE(0)[i] = m_diffE[value.first];
outWS->dataX(1)[i] = value.second;
outWS->dataY(1)[i] = m_redY[value.first];
outWS->dataE(1)[i] = m_redE[value.first];
outWS->dataX(2)[i] = value.second;
outWS->dataY(2)[i] = m_greenY[value.first];
outWS->dataE(2)[i] = m_greenE[value.first];
outWS->dataX(3)[i] = value.second;
outWS->dataY(3)[i] = m_sumY[value.first];
outWS->dataE(3)[i] = m_sumE[value.first];
i++;
}
tAxis->setLabel(0, "Red-Green");
......@@ -431,20 +431,20 @@ void PlotAsymmetryByLogValue::saveResultsToADS(MatrixWorkspace_sptr &outWS,
if (nplots == 2) {
size_t i = 0;
for (auto &it : m_logValue) {
size_t run = it.first;
for (auto &value : m_logValue) {
size_t run = value.first;
outWS->dataX(0)[i] = static_cast<double>(run); // run number
outWS->dataY(0)[i] = it.second; // log value
outWS->dataY(0)[i] = value.second; // log value
outWS->dataY(1)[i] = m_redY[run]; // redY
outWS->dataE(1)[i] = m_redE[run]; // redE
i++;
}
} else {
size_t i = 0;
for (auto &it : m_logValue) {
size_t run = it.first;
for (auto &value : m_logValue) {
size_t run = value.first;
outWS->dataX(0)[i] = static_cast<double>(run); // run number
outWS->dataY(0)[i] = it.second; // log value
outWS->dataY(0)[i] = value.second; // log value
outWS->dataY(1)[i] = m_diffY[run]; // diffY
outWS->dataE(1)[i] = m_diffE[run]; // diffE
outWS->dataY(2)[i] = m_redY[run]; // redY
......
......@@ -225,11 +225,11 @@ void ReadGroupsFromFile::readXMLGroupingFile(const std::string &filename) {
Poco::StringTokenizer data(ids, ",", Poco::StringTokenizer::TOK_TRIM);
if (data.begin() != data.end()) {
for (const auto &it : data) {
for (const auto &value : data) {
// cast the string to an int
int detID;
try {
detID = boost::lexical_cast<int>(it);
detID = boost::lexical_cast<int>(value);
} catch (boost::bad_lexical_cast &) {
throw Mantid::Kernel::Exception::FileError(
"Could cast string to integer in input XML file", filename);
......
......@@ -153,8 +153,8 @@ void ResetNegatives::pushMinimum(MatrixWorkspace_const_sptr minWS,
if (minValue <= 0) {
minValue *= -1.;
MantidVec &y = wksp->dataY(i);
for (double &it : y) {
it = fixZero(it + minValue);
for (double &value : y) {
value = fixZero(value + minValue);
}
}
prog.report();
......@@ -168,12 +168,13 @@ void ResetNegatives::pushMinimum(MatrixWorkspace_const_sptr minWS,
* them to the supplied value.
*
* @param minWS A workspace of minimum values for each spectra.
* @param value Reset negative values in the spectra to this number.
* @param spectrumNegativeValues Reset negative values in the spectra to this
* number.
* @param wksp The workspace to modify.
* @param prog The progress.
*/
void ResetNegatives::changeNegatives(MatrixWorkspace_const_sptr minWS,
const double value,
const double spectrumNegativeValues,
MatrixWorkspace_sptr wksp,
Progress &prog) {
int64_t nHist = wksp->getNumberHistograms();
......@@ -184,11 +185,11 @@ void ResetNegatives::changeNegatives(MatrixWorkspace_const_sptr minWS,
0.) // quick check to see if there is a reason to bother
{
MantidVec &y = wksp->dataY(i);
for (double &it : y) {
if (it < 0.) {
it = value;
for (double &value : y) {
if (value < 0.) {
value = spectrumNegativeValues;
} else
it = fixZero(it);
value = fixZero(value);
}
}
prog.report();
......
......@@ -108,8 +108,8 @@ void SetInstrumentParameter::exec() {
}
} else {
if (cmptList.size() > 0) {
for (auto &it : cmptList) {
addParameter(paramMap, it.get(), paramName, paramType, paramValue);
for (auto &cmpt : cmptList) {
addParameter(paramMap, cmpt.get(), paramName, paramType, paramValue);
}
} else {
g_log.warning("Could not find the component requested.");
......
......@@ -399,11 +399,11 @@ void SmoothNeighbours::findNeighboursUbiqutious() {
std::vector<weightedNeighbour> neighbours;
// Convert from spectrum numbers to workspace indices
for (auto &it : neighbSpectra) {
specid_t spec = it.first;
for (auto &specDistance : neighbSpectra) {
specid_t spec = specDistance.first;
// Use the weighting strategy to calculate the weight.
double weight = WeightedSum->weightAt(it.second);
double weight = WeightedSum->weightAt(specDistance.second);
if (weight > 0) {
// Find the corresponding workspace index
......
......@@ -229,8 +229,8 @@ void SumEventsByLogValue::createTableOutput(
// Calculate the time covered by this log value and add it to the table
double duration = 0.0;
for (auto &it : filter) {
duration += it.duration();
for (auto &time : filter) {
duration += time.duration();
}
timeCol->cell<double>(row) = duration;
......
......@@ -58,8 +58,8 @@ void UpdateScriptRepository::exec() {
std::stringstream info;
info << "Information about ScriptRepository:\n"
<< " A more recent version of the following files was installed:\n";
for (auto &i : f_list) {
info << " * " << i << "\n";
for (auto &file : f_list) {
info << " * " << file << "\n";
}
info << "Please check these files before using them. "
<< "Note: These files were configured for AutoUpdate.";
......
......@@ -344,9 +344,10 @@ ClusterMap ConnectedComponentLabeling::calculateDisjointTree(
// equivalent clusters. Must be done in sequence.
// Combine cluster maps processed by each thread.
ClusterRegister clusterRegister;
for (auto &it : parallelClusterMapVec) {
for (auto itt = it.begin(); itt != it.end(); ++itt) {
clusterRegister.add(itt->first, itt->second);
for (auto &parallelClusterMap : parallelClusterMapVec) {
for (auto it = parallelClusterMap.begin(); it != parallelClusterMap.end();
++it) {
clusterRegister.add(it->first, it->second);
}
}
......
......@@ -96,8 +96,8 @@ Kernel::Matrix<double> SelectCellWithForm::DetermineErrors(
}
if (!latErrorsValid) {
for (double &i : sigabc)
i = 0;
for (double &sig : sigabc)
sig = 0;
return UB;
} else
......
......@@ -520,8 +520,8 @@ PlotPeakByLogValue::makeNames() const {
typedef Poco::StringTokenizer tokenizer;
tokenizer names(inputList, ";",
tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM);
for (const auto &it : names) {
tokenizer params(it, ",", tokenizer::TOK_TRIM);
for (const auto &name : names) {
tokenizer params(name, ",", tokenizer::TOK_TRIM);
std::string name = params[0];
int wi = default_wi;
int spec = default_spec;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment