Commit 1951aa2f authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Refs #14764. Reviewed changes through Framework/Algorithms/src/CreateWorkspace.cpp

parent 1473c74e
......@@ -202,15 +202,11 @@ void Algorithm::progress(double p, const std::string &msg, double estimatedTime,
//---------------------------------------------------------------------------------------------
/// Function to return all of the categories that contain this algorithm
const std::vector<std::string> Algorithm::categories() const {
std::vector<std::string> res;
Poco::StringTokenizer tokenizer(category(), categorySeparator(),
Poco::StringTokenizer::TOK_TRIM |
Poco::StringTokenizer::TOK_IGNORE_EMPTY);
auto h = tokenizer.begin();
for (; h != tokenizer.end(); ++h) {
res.push_back(*h);
}
std::vector<std::string> res(tokenizer.begin(), tokenizer.end());
const DeprecatedAlgorithm *depo =
dynamic_cast<const DeprecatedAlgorithm *>(this);
......
......@@ -394,11 +394,8 @@ void AlgorithmFactoryImpl::fillHiddenCategories(
Poco::StringTokenizer tokenizer(categoryString, ";",
Poco::StringTokenizer::TOK_TRIM |
Poco::StringTokenizer::TOK_IGNORE_EMPTY);
auto h = tokenizer.begin();
for (; h != tokenizer.end(); ++h) {
categorySet->insert(*h);
}
std::copy(tokenizer.begin(), tokenizer.end(),
std::inserter(*categorySet, categorySet->end()));
}
/** Extract the name of an algorithm
......
......@@ -273,11 +273,9 @@ void AlgorithmHistory::saveNexus(::NeXus::File *file, int &algCount) const {
file->writeData("data", algData.str());
// child algorithms
auto histIter = m_childHistories.begin();
for (; histIter != m_childHistories.end(); ++histIter) {
(*histIter)->saveNexus(file, algCount);
for (auto &history : m_childHistories) {
history->saveNexus(file, algCount);
}
file->closeGroup();
}
......
......@@ -282,9 +282,8 @@ void AlgorithmProxy::dropWorkspaceReferences() {
void AlgorithmProxy::addObservers() {
if (!m_alg)
return;
auto o =
m_externalObservers.rbegin();
for (; o != m_externalObservers.rend(); ++o)
for (auto o = m_externalObservers.rbegin(); o != m_externalObservers.rend();
++o)
m_alg->addObserver(**o);
m_externalObservers.clear();
}
......@@ -310,15 +309,11 @@ std::string AlgorithmProxy::toString() const {
/// Function to return all of the categories that contain this algorithm
const std::vector<std::string> AlgorithmProxy::categories() const {
std::vector<std::string> res;
Poco::StringTokenizer tokenizer(category(), categorySeparator(),
Poco::StringTokenizer::TOK_TRIM |
Poco::StringTokenizer::TOK_IGNORE_EMPTY);
auto h = tokenizer.begin();
for (; h != tokenizer.end(); ++h) {
res.push_back(*h);
}
std::vector<std::string> res(tokenizer.begin(), tokenizer.end());
const DeprecatedAlgorithm *depo =
dynamic_cast<const DeprecatedAlgorithm *>(this);
......
......@@ -33,10 +33,8 @@ CompositeDomainMD::CompositeDomainMD(IMDWorkspace_const_sptr ws,
* Destructor.
*/
CompositeDomainMD::~CompositeDomainMD() {
auto it = m_domains.begin();
for (; it != m_domains.end(); ++it) {
delete *it;
}
for (auto domain : m_domains)
delete domain;
}
/// Return i-th domain reset to its start.
......
......@@ -521,9 +521,8 @@ void Expression::renameAll(const std::string &oldName,
if (!isFunct() && name() == oldName) {
rename(newName);
} else {
auto e = m_terms.begin();
for (; e != m_terms.end(); ++e) {
e->renameAll(oldName, newName);
for (auto &term : m_terms) {
term.renameAll(oldName, newName);
}
}
}
......
......@@ -126,8 +126,7 @@ std::string FileFinderImpl::getFullPath(const std::string &filename,
const std::vector<std::string> &searchPaths =
Kernel::ConfigService::Instance().getDataSearchDirs();
auto it = searchPaths.begin();
for (; it != searchPaths.end(); ++it) {
for (auto it = searchPaths.begin(); it != searchPaths.end(); ++it) {
// On windows globbing is note working properly with network drives
// for example a network drive containing a $
// For this reason, and since windows is case insensitive anyway
......@@ -479,9 +478,8 @@ FileFinderImpl::findRun(const std::string &hintstr,
tolower);
if (!archiveOpt.empty() && archiveOpt != "off" &&
!facility.archiveSearch().empty()) {
auto it =
facility.archiveSearch().begin();
for (; it != facility.archiveSearch().end(); ++it) {
for (auto it = facility.archiveSearch().begin();
it != facility.archiveSearch().end(); ++it) {
g_log.debug() << "get archive search for the facility..." << *it
<< "\n";
archs.push_back(ArchiveSearchFactory::Instance().create(*it));
......@@ -751,8 +749,7 @@ FileFinderImpl::getPath(const std::vector<IArchiveSearch_sptr> &archs,
}
for (auto ext = extensions.begin(); ext != extensions.end(); ++ext) {
auto it = filenames.begin();
for (; it != filenames.end(); ++it) {
for (auto it = filenames.begin(); it != filenames.end(); ++it) {
path = getFullPath(*it + *ext);
try {
if (!path.empty() && Poco::File(path).exists()) {
......
......@@ -10,10 +10,8 @@ HistoryView::HistoryView(const WorkspaceHistory &wsHist)
: m_wsHist(wsHist), m_historyItems() {
// add all of the top level algorithms to the view by default
const auto algorithms = wsHist.getAlgorithmHistories();
auto iter = algorithms.begin();
for (; iter != algorithms.end(); ++iter) {
HistoryItem item(*iter);
m_historyItems.push_back(item);
for (auto iter = algorithms.begin(); iter != algorithms.end(); ++iter) {
m_historyItems.emplace_back(*iter);
}
}
......
......@@ -253,17 +253,10 @@ void IFunction::setHandler(FunctionHandler *handler) {
/// Function to return all of the categories that contain this function
const std::vector<std::string> IFunction::categories() const {
std::vector<std::string> res;
Poco::StringTokenizer tokenizer(category(), categorySeparator(),
Poco::StringTokenizer::TOK_TRIM |
Poco::StringTokenizer::TOK_IGNORE_EMPTY);
auto h = tokenizer.begin();
for (; h != tokenizer.end(); ++h) {
res.push_back(*h);
}
return res;
return std::vector<std::string>(tokenizer.begin(), tokenizer.end());
}
/**
......
......@@ -395,9 +395,7 @@ void LogManager::loadNexus(::NeXus::File *file, const std::string &group,
std::map<std::string, std::string> entries;
file->getEntries(entries);
auto it = entries.begin();
auto it_end = entries.end();
for (; it != it_end; ++it) {
for (auto it = entries.begin(); it != entries.end(); ++it) {
// Get the name/class pair
const std::pair<std::string, std::string> &name_class = *it;
// NXLog types are the main one.
......
......@@ -625,14 +625,11 @@ void MatrixWorkspace::getIndicesFromDetectorIDs(
void MatrixWorkspace::getSpectraFromDetectorIDs(
const std::vector<detid_t> &detIdList,
std::vector<specid_t> &spectraList) const {
auto it_start = detIdList.begin();
auto it_end = detIdList.end();
spectraList.clear();
// Try every detector in the list
std::vector<detid_t>::const_iterator it;
for (it = it_start; it != it_end; ++it) {
for (auto it = detIdList.cbegin(); it != detIdList.cend(); ++it) {
bool foundDet = false;
specid_t foundSpecNum = 0;
......
......@@ -76,16 +76,14 @@ MultiPeriodGroupWorker::findMultiPeriodGroups(
WorkspaceNameType workspaces =
sourceAlg->getProperty(this->m_workspacePropertyName);
auto it = workspaces.begin();
// Inspect all the input workspaces in the ArrayProperty input.
while (it != workspaces.end()) {
for (auto it = workspaces.begin(); it != workspaces.end(); ++it) {
Workspace_sptr ws = AnalysisDataService::Instance().retrieve(*it);
if (!ws) {
throw Kernel::Exception::NotFoundError("Workspace", *it);
}
tryAddInputWorkspaceToInputGroups(ws, vecWorkspaceGroups);
++it;
}
} else {
typedef std::vector<boost::shared_ptr<Workspace>> WorkspaceVector;
......@@ -93,10 +91,8 @@ MultiPeriodGroupWorker::findMultiPeriodGroups(
WorkspaceVector outWorkspaces;
sourceAlg->findWorkspaceProperties(inWorkspaces, outWorkspaces);
UNUSED_ARG(outWorkspaces);
auto it = inWorkspaces.begin();
while (it != inWorkspaces.end()) {
for (auto it = inWorkspaces.begin(); it != inWorkspaces.end(); ++it) {
tryAddInputWorkspaceToInputGroups(*it, vecWorkspaceGroups);
++it;
}
}
......
......@@ -154,9 +154,7 @@ std::vector<std::string> MultipleFileProperty::flattenFileNames(
const std::vector<std::vector<std::string>> &fileNames) {
std::vector<std::string> flattenedFileNames;
auto it = fileNames.begin();
for (; it != fileNames.end(); ++it) {
for (auto it = fileNames.begin(); it != fileNames.end(); ++it) {
flattenedFileNames.insert(flattenedFileNames.end(), it->begin(), it->end());
}
......
......@@ -152,9 +152,7 @@ std::string ParameterTie::asString(const IFunction *fun) const {
int iTemp = boost::lexical_cast<int>(res[1]);
int i = 0;
for (auto it =
m_varMap.begin();
it != m_varMap.end(); ++it) {
for (auto it = m_varMap.cbegin(); it != m_varMap.cend(); ++it) {
if (i == iTemp) {
res_expression +=
fun->parameterName(fun->getParameterIndex(it->second));
......@@ -178,9 +176,7 @@ 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 (auto it =
m_varMap.begin();
it != m_varMap.end(); ++it) {
for (auto it = m_varMap.cbegin(); it != m_varMap.cend(); ++it) {
if (it->second.getFunction() == fun) {
return true;
}
......
......@@ -398,9 +398,7 @@ void Run::loadNexus(::NeXus::File *file, const std::string &group,
std::map<std::string, std::string> entries;
file->getEntries(entries);
auto it = entries.begin();
auto it_end = entries.end();
for (; it != it_end; ++it) {
for (auto it = entries.begin(); it != entries.end(); ++it) {
// Get the name/class pair
const std::pair<std::string, std::string> &name_class = *it;
if (name_class.second == "NXpositioner") {
......@@ -508,9 +506,7 @@ void Run::mergeMergables(Mantid::Kernel::PropertyManager &sum,
// get pointers to all the properties on the right-handside and prepare to
// loop through them
const std::vector<Property *> inc = toAdd.getProperties();
auto end = inc.end();
for (auto it = inc.begin(); it != end;
++it) {
for (auto it = inc.cbegin(); it != inc.cend(); ++it) {
const std::string rhs_name = (*it)->name();
try {
// now get pointers to the same properties on the left-handside
......
......@@ -330,9 +330,9 @@ bool WorkspaceGroup::isMultiperiod() const {
g_log.debug("Not a multiperiod-group with < 1 nested workspace.");
return false;
}
auto iterator = m_workspaces.begin();
// Loop through all inner workspaces, checking each one in turn.
while (iterator != m_workspaces.end()) {
for (auto iterator = m_workspaces.begin(); iterator != m_workspaces.end();
++iterator) {
if (MatrixWorkspace_sptr ws =
boost::dynamic_pointer_cast<MatrixWorkspace>(*iterator)) {
try {
......@@ -353,7 +353,6 @@ bool WorkspaceGroup::isMultiperiod() const {
"Matrix Workspaces.");
return false;
}
++iterator;
}
return true;
}
......
......@@ -180,8 +180,8 @@ void WorkspaceHistory::saveNexus(::NeXus::File *file) const {
// Algorithm History
int algCount = 0;
auto histIter = m_algorithms.begin();
for (; histIter != m_algorithms.end(); ++histIter) {
for (auto histIter = m_algorithms.begin(); histIter != m_algorithms.end();
++histIter) {
(*histIter)->saveNexus(file, algCount);
}
......
......@@ -135,8 +135,8 @@ void AbsorptionCorrection::exec() {
// If sample not at origin, shift cached positions.
const V3D samplePos = m_inputWS->getInstrument()->getSample()->getPos();
if (samplePos != V3D(0, 0, 0)) {
auto it = m_elementPositions.begin();
for (; it != m_elementPositions.end(); ++it) {
for (auto it = m_elementPositions.begin(); it != m_elementPositions.end();
++it) {
(*it) += samplePos;
}
}
......
......@@ -91,12 +91,10 @@ void AverageLogData::exec() {
pctime.push_back(EMPTY_DBL() * 1.1); // larger than stime
pcvalue.push_back(0.0);
auto istime = stime.begin(),
isvalue = svalue.begin(),
ipctime = pctime.begin(),
ipcvalue = pcvalue.begin();
auto isvalue = svalue.begin(), ipctime = pctime.begin(),
ipcvalue = pcvalue.begin();
for (; istime < (--stime.end()); ++istime) {
for (auto istime = stime.begin(); istime < (--stime.end()); ++istime) {
// ignore all proton pulses before the lowest time for the log
while ((*ipctime) < (*istime) + diffSeconds) {
++ipctime;
......
......@@ -1040,7 +1040,7 @@ BinaryOperation::buildBinaryOperationTable(
// Didn't find it. Try to use the RHS map.
// First, we have to get the (single) detector ID of the LHS
auto lhsDets_it = lhsDets.begin();
auto lhsDets_it = lhsDets.cbegin();
detid_t lhs_detector_ID = *lhsDets_it;
// Now we use the RHS map to find it. This only works if both the lhs and
......
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