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

Use to_string instead of lexical_cast.

parent 085529ef
......@@ -237,7 +237,7 @@ double GetEi2::calculateEi(const double initial_guess) {
if (!m_fixedei) {
throw std::invalid_argument(
"No peak found for the monitor with spectra num: " +
boost::lexical_cast<std::string>(spec_nums[i]) + " (at " +
std::to_string(spec_nums[i]) + " (at " +
boost::lexical_cast<std::string>(det_distances[i]) +
" metres from source).\n");
} else {
......
......@@ -257,7 +257,7 @@ void He3TubeEfficiency::getDetectorGeometry(
if (!shape_sptr) {
throw std::runtime_error(
"Detector geometry error: detector with id: " +
boost::lexical_cast<std::string>(det->getID()) +
std::to_string(det->getID()) +
" does not have shape. Is this a detectors group?\n"
"The algorithm works for instruments with one-to-one "
"spectra-to-detector maps only!");
......
......@@ -332,8 +332,7 @@ WorkspaceGroup_sptr PolarizationCorrection::execPA(WorkspaceGroup_sptr inWS) {
for (size_t i = 1; i < totalGroupEntries; i++) {
auto alg = this->createChildAlgorithm("ReplaceSpecialValues");
alg->setProperty("InputWorkspace", dataOut->getItem(i));
alg->setProperty("OutputWorkspace",
"dataOut_" + boost::lexical_cast<std::string>(i));
alg->setProperty("OutputWorkspace", "dataOut_" + std::to_string(i));
alg->setProperty("NaNValue", 0.0);
alg->setProperty("NaNError", 0.0);
alg->setProperty("InfinityValue", 0.0);
......
......@@ -319,11 +319,11 @@ void ReflectometryReductionOneAuto::exec() {
if (detStart == detStop) {
// If the range given only specifies one detector, we pass along just
// that one detector
processing_commands = boost::lexical_cast<std::string>(detStart);
processing_commands = std::to_string(detStart);
} else {
// Otherwise, we create a range.
processing_commands = boost::lexical_cast<std::string>(detStart) + ":" +
boost::lexical_cast<std::string>(detStop);
processing_commands =
std::to_string(detStart) + ":" + std::to_string(detStop);
}
} else {
std::vector<double> multiStart =
......@@ -334,10 +334,9 @@ void ReflectometryReductionOneAuto::exec() {
"must exist as an instrument parameter.\n"
"Please check if you meant to enter ProcessingInstructions or "
"if your instrument parameter file is correct.");
processing_commands =
boost::lexical_cast<std::string>(static_cast<int>(multiStart[0])) +
":" +
boost::lexical_cast<std::string>(in_ws->getNumberHistograms() - 1);
processing_commands = std::to_string(static_cast<int>(multiStart[0])) +
":" +
std::to_string(in_ws->getNumberHistograms() - 1);
}
} else {
std::string processing_commands_temp =
......@@ -735,10 +734,8 @@ bool ReflectometryReductionOneAuto::processGroups() {
// multiperiod)
size_t numMembers = group->size();
for (size_t i = 0; i < numMembers; ++i) {
const std::string IvsQName =
outputIvsQ + "_" + boost::lexical_cast<std::string>(i + 1);
const std::string IvsLamName =
outputIvsLam + "_" + boost::lexical_cast<std::string>(i + 1);
const std::string IvsQName = outputIvsQ + "_" + std::to_string(i + 1);
const std::string IvsLamName = outputIvsLam + "_" + std::to_string(i + 1);
// If our transmission run is a group and PolarizationCorrection is on
// then we sum our transmission group members.
......@@ -818,10 +815,9 @@ bool ReflectometryReductionOneAuto::processGroups() {
alg->setProperty("FirstTransmissionRun", "");
alg->setProperty("SecondTransmissionRun", "");
for (size_t i = 0; i < numMembers; ++i) {
const std::string IvsQName =
outputIvsQ + "_" + boost::lexical_cast<std::string>(i + 1);
const std::string IvsQName = outputIvsQ + "_" + std::to_string(i + 1);
const std::string IvsLamName =
outputIvsLam + "_" + boost::lexical_cast<std::string>(i + 1);
outputIvsLam + "_" + std::to_string(i + 1);
alg->setProperty("InputWorkspace", IvsLamName);
alg->setProperty("OutputWorkspace", IvsQName);
alg->setProperty("CorrectionAlgorithm", "None");
......
......@@ -131,7 +131,7 @@ double SANSCollimationLengthEstimator::getCollimationLengthWithGuides(
// else then default
std::vector<double> guideValues;
for (unsigned int i = 1; i <= numberOfGuides; i++) {
auto guideName = "Guide" + boost::lexical_cast<std::string>(i);
auto guideName = "Guide" + std::to_string(i);
if (inOutWS->run().hasProperty(guideName)) {
auto guideValue = getGuideValue(inOutWS->run().getProperty(guideName));
guideValues.push_back(guideValue);
......
......@@ -185,9 +185,8 @@ void SofQWCentre::exec() {
std::string mess =
"Energy transfer requested in Direct mode exceeds incident "
"energy.\n Found for det ID: " +
boost::lexical_cast<std::string>(idet) + " bin No " +
boost::lexical_cast<std::string>(j) + " with Ei=" +
boost::lexical_cast<std::string>(efixed) +
std::to_string(idet) + " bin No " + std::to_string(j) +
" with Ei=" + boost::lexical_cast<std::string>(efixed) +
" and energy transfer: " +
boost::lexical_cast<std::string>(deltaE);
throw std::runtime_error(mess);
......@@ -199,9 +198,8 @@ void SofQWCentre::exec() {
std::string mess =
"Incident energy of a neutron is negative. Are you trying to "
"process Direct data in Indirect mode?\n Found for det ID: " +
boost::lexical_cast<std::string>(idet) + " bin No " +
boost::lexical_cast<std::string>(j) + " with efied=" +
boost::lexical_cast<std::string>(efixed) +
std::to_string(idet) + " bin No " + std::to_string(j) +
" with efied=" + boost::lexical_cast<std::string>(efixed) +
" and energy transfer: " +
boost::lexical_cast<std::string>(deltaE);
throw std::runtime_error(mess);
......
......@@ -380,10 +380,8 @@ MatrixWorkspace_sptr Stitch1D::multiplyRange(MatrixWorkspace_sptr &input,
multiplyRange->setProperty("StartBin", startBin);
multiplyRange->setProperty("EndBin", endBin);
multiplyRange->setProperty("Factor", factor);
g_log.information("MultiplyRange StartBin: " +
boost::lexical_cast<std::string>(startBin));
g_log.information("MultiplyRange EndBin: " +
boost::lexical_cast<std::string>(endBin));
g_log.information("MultiplyRange StartBin: " + std::to_string(startBin));
g_log.information("MultiplyRange EndBin: " + std::to_string(endBin));
g_log.information("MultiplyRange Factor: " +
boost::lexical_cast<std::string>(factor));
multiplyRange->execute();
......@@ -404,8 +402,7 @@ MatrixWorkspace_sptr Stitch1D::multiplyRange(MatrixWorkspace_sptr &input,
multiplyRange->setProperty("InputWorkspace", input);
multiplyRange->setProperty("StartBin", startBin);
multiplyRange->setProperty("Factor", factor);
g_log.information("MultiplyRange StartBin: " +
boost::lexical_cast<std::string>(startBin));
g_log.information("MultiplyRange StartBin: " + std::to_string(startBin));
g_log.information("MultiplyRange Factor: " +
boost::lexical_cast<std::string>(factor));
multiplyRange->execute();
......
......@@ -211,7 +211,7 @@ void GoniometerAnglesFromPhiRotation::exec() {
}
int RunNum = PeaksRun2->getPeak(0).getRunNumber();
std::string RunNumStr = boost::lexical_cast<std::string>(RunNum);
std::string RunNumStr = std::to_string(RunNum);
int Npeaks = PeaksRun2->getNumberPeaks();
// n indexed, av err, phi, chi,omega
......
......@@ -1597,7 +1597,7 @@ void IntegratePeakTimeSlices::SetUpData1(
workspaceIndex = m_wi_to_detid_map.find(DetID)->second;
else {
throw std::runtime_error("No workspaceIndex for detID=" +
boost::lexical_cast<std::string>(DetID));
std::to_string(DetID));
}
IDetector_const_sptr Det = inpWkSpace->getDetector(workspaceIndex);
......@@ -1610,7 +1610,7 @@ void IntegratePeakTimeSlices::SetUpData1(
if (dist.scalar_prod(dist) < Radius * Radius)
{
spec_idList += boost::lexical_cast<std::string>(
spec_idList += std::to_string(
inpWkSpace->getSpectrum(workspaceIndex)->getSpectrumNo());
double R1 = dist.scalar_prod(m_yvec);
......
......@@ -196,7 +196,7 @@ LoadIsawPeaks::ApplyCalibInfo(std::ifstream &in, std::string startChar,
throw std::length_error("incorrect type of data for panel ");
}
std::string SbankNum = boost::lexical_cast<std::string>(bankNum);
std::string SbankNum = std::to_string(bankNum);
std::string bankName = "bank";
if (instr->getName() == "WISH") {
if (bankNum < 10)
......
......@@ -248,7 +248,7 @@ void OptimizeCrystalPlacement::exec() {
}
if (it1 == NOoptimizeRuns.end()) {
std::string runNumStr = boost::lexical_cast<std::string>(runNum);
std::string runNumStr = std::to_string(runNum);
OptRunNums += predChar + runNumStr;
predChar = "/";
ChRunNumList.push_back(runNumStr);
......@@ -474,7 +474,7 @@ void OptimizeCrystalPlacement::exec() {
for (int i = 0; i < OutPeaks->getNumberPeaks(); ++i) {
int RunNum = OutPeaks->getPeak(i).getRunNumber();
std::string RunNumStr = boost::lexical_cast<std::string>(RunNum);
std::string RunNumStr = std::to_string(RunNum);
Matrix<double> GonMatrix;
if (RunNum == prevRunNum ||
MapRunNum2GonMat.find(RunNum) != MapRunNum2GonMat.end())
......
......@@ -111,8 +111,7 @@ void OptimizeLatticeForCellType::exec() {
runWS[count]->addPeak(peak);
run = peak.getRunNumber();
AnalysisDataService::Instance().addOrReplace(
boost::lexical_cast<std::string>(run) + ws->getName(),
runWS[count]);
std::to_string(run) + ws->getName(), runWS[count]);
} else {
runWS[count]->addPeak(peak);
}
......
......@@ -245,7 +245,7 @@ void PeakHKLErrors::getRun2MatMap(
Geometry::IPeak &peak_old = Peaks->getPeak(i);
int runNum = peak_old.getRunNumber();
std::string runNumStr = boost::lexical_cast<std::string>(runNum);
std::string runNumStr = std::to_string(runNum);
size_t N = OptRuns.find("/" + runNumStr + "/");
if (N < OptRuns.size()) {
double chi =
......@@ -376,7 +376,7 @@ void PeakHKLErrors::function1D(double *out, const double *xValues,
IPeak &peak_old = Peaks->getPeak(peakNum);
int runNum = peak_old.getRunNumber();
std::string runNumStr = boost::lexical_cast<std::string>(runNum);
std::string runNumStr = std::to_string(runNum);
Peak peak =
SCDPanelErrors::createNewPeak(peak_old, instNew, 0, peak_old.getL1());
......@@ -475,7 +475,7 @@ void PeakHKLErrors::functionDeriv1D(Jacobian *out, const double *xValues,
SCDPanelErrors::createNewPeak(peak_old, instNew, 0, peak_old.getL1());
int runNum = peak_old.getRunNumber();
std::string runNumStr = boost::lexical_cast<std::string>(runNum);
std::string runNumStr = std::to_string(runNum);
for (int kk = 0; kk < static_cast<int>(nParams()); kk++) {
out->set(i, kk, 0.0);
......
......@@ -785,7 +785,7 @@ void SCDCalibratePanels::exec() {
g_log.error() << "Bank Group " << BankNameString
<< " does not have enough peaks for fitting" << endl;
saveIsawDetCal(instrument, MyBankNames, T0_bank,
DetCalFileName + boost::lexical_cast<std::string>(iGr));
DetCalFileName + std::to_string(iGr));
continue;
}
......@@ -1002,7 +1002,7 @@ void SCDCalibratePanels::exec() {
//-----------------------or xml(for LoadParameterFile) files-----------
this->progress(.94, "Saving detcal file");
saveIsawDetCal(NewInstrument, MyBankNames, result["t0"],
DetCalFileName + boost::lexical_cast<std::string>(iGr));
DetCalFileName + std::to_string(iGr));
this->progress(.96, "Saving xml param file");
string XmlFileName = getProperty("XmlFilename");
......@@ -1024,8 +1024,7 @@ void SCDCalibratePanels::exec() {
std::vector<double> l0vec, t0vec;
std::string line, seven;
for (int iGr = 0; iGr < nGroups; iGr++) {
std::ifstream infile(DetCalFileName +
boost::lexical_cast<std::string>(iGr));
std::ifstream infile(DetCalFileName + std::to_string(iGr));
while (std::getline(infile, line)) {
if (iGr == 0 && iIter == nIter - 1) {
if (line[0] == '#' || line[0] == '6')
......@@ -1040,10 +1039,8 @@ void SCDCalibratePanels::exec() {
detcal.push_back(line);
}
infile.close();
if (Poco::File(DetCalFileName + boost::lexical_cast<std::string>(iGr))
.exists())
Poco::File(DetCalFileName + boost::lexical_cast<std::string>(iGr))
.remove();
if (Poco::File(DetCalFileName + std::to_string(iGr)).exists())
Poco::File(DetCalFileName + std::to_string(iGr)).remove();
}
if (useL0) {
removeOutliers(l0vec);
......@@ -1208,7 +1205,7 @@ void SCDCalibratePanels::LoadISawDetCal(
depth >> detd >> x >> y >> z >> base_x >> base_y >> base_z >> up_x >>
up_y >> up_z;
string bankName = bankPrefixName + boost::lexical_cast<string>(id);
string bankName = bankPrefixName + std::to_string(id);
if (!AllBankName.empty() && AllBankName.find(bankName) == AllBankName.end())
continue;
......@@ -1316,7 +1313,7 @@ void SCDCalibratePanels::createResultWorkspace(const int numGroups,
Result->addColumn("str", "Field");
// and one for each group
for (int g = 0; g < numGroups; ++g) {
string GroupName = string("Group") + boost::lexical_cast<string>(g);
string GroupName = string("Group") + std::to_string(g);
Result->addColumn("double", GroupName);
}
Result->setRowCount(2 * (10 + nn));
......
......@@ -324,7 +324,7 @@ SCDPanelErrors::getNewInstrument(const Geometry::IPeak &peak) const {
boost::split(GroupBanks, BankNames, boost::is_any_of("!"));
for (size_t group = 0; group < (size_t)GroupBanks.size(); ++group) {
string prefix = "f" + boost::lexical_cast<std::string>(group) + "_";
string prefix = "f" + std::to_string(group) + "_";
std::vector<std::string> bankNames;
Quat rot = Quat(getParameter(prefix + "Xrot"), Kernel::V3D(1.0, 0.0, 0.0)) *
......@@ -692,7 +692,7 @@ void SCDPanelErrors::setAttribute(const std::string &attName,
}
NGroups = value.asInt();
for (int k = 1; k < NGroups; ++k) {
std::string prefix = "f" + boost::lexical_cast<std::string>(k) + "_";
std::string prefix = "f" + std::to_string(k) + "_";
declareParameter(prefix + "detWidthScale", 1.0, "panel Width");
declareParameter(prefix + "detHeightScale", 1.0, "panelHeight");
......
......@@ -121,7 +121,7 @@ void StatisticsOfPeaksWorkspace::exec() {
else
oldSequence = "0.5 - 0.0";
} else if (sortType.compare(0, 2, "Ru") == 0)
oldSequence = boost::lexical_cast<std::string>(peaks[0].getRunNumber());
oldSequence = std::to_string(peaks[0].getRunNumber());
else
oldSequence = peaks[0].getBankName();
// Go through each peak at this run / bank
......@@ -146,7 +146,7 @@ void StatisticsOfPeaksWorkspace::exec() {
else
sequence = "0.5 - 0.0";
} else if (sortType.compare(0, 2, "Ru") == 0)
sequence = boost::lexical_cast<std::string>(p.getRunNumber());
sequence = std::to_string(p.getRunNumber());
else
sequence = p.getBankName();
......
......@@ -70,7 +70,7 @@ DetectorParams ConvertToYSpace::getDetectorParameters(
} catch (Kernel::Exception::NotFoundError &) {
throw std::invalid_argument("ConvertToYSpace - Workspace has no detector "
"attached to histogram at index " +
boost::lexical_cast<std::string>(index));
std::to_string(index));
}
DetectorParams detpar;
......@@ -205,8 +205,7 @@ void ConvertToYSpace::exec() {
PARALLEL_START_INTERUPT_REGION
if (!convert(i)) {
g_log.warning("No detector defined for index=" +
boost::lexical_cast<std::string>(i) +
g_log.warning("No detector defined for index=" + std::to_string(i) +
". Zeroing spectrum.");
m_outputWS->maskWorkspaceIndex(i);
if (m_qOutputWS)
......
......@@ -152,7 +152,7 @@ void EstimatePeakErrors::exec() {
size_t np = fun->nParams();
IPeakFunction *peak = dynamic_cast<IPeakFunction *>(fun);
if (peak) {
std::string prefix = "f" + boost::lexical_cast<std::string>(i) + ".";
std::string prefix = "f" + std::to_string(i) + ".";
GSLMatrix covariance(*matrix, ip, ip, np, np);
calculatePeakValues(*peak, *results, covariance, prefix);
}
......
......@@ -197,8 +197,7 @@ void Fit::execConcrete() {
if (!errorString.empty()) {
errorString += '\n';
}
errorString += "Failed to converge after " +
boost::lexical_cast<std::string>(maxIterations) +
errorString += "Failed to converge after " + std::to_string(maxIterations) +
" iterations.";
}
......
......@@ -262,7 +262,7 @@ void PlotPeakByLogValue::exec() {
<< " with " << std::endl;
g_log.debug() << ifun->asString() << std::endl;
const std::string spectrum_index = boost::lexical_cast<std::string>(j);
const std::string spectrum_index = std::to_string(j);
std::string wsBaseName = "";
if (createFitOutput)
......@@ -326,7 +326,7 @@ void PlotPeakByLogValue::exec() {
row << chi2;
Prog += dProg;
std::string current = boost::lexical_cast<std::string>(i);
std::string current = std::to_string(i);
progress(Prog, ("Fitting Workspace: (" + current + ") - "));
interruption_point();
......@@ -418,8 +418,7 @@ PlotPeakByLogValue::getWorkspace(const InputData &data) {
boost::dynamic_pointer_cast<API::WorkspaceGroup>(rws);
if (gws) {
std::string propName =
"OUTPUTWORKSPACE_" +
boost::lexical_cast<std::string>(data.period);
"OUTPUTWORKSPACE_" + std::to_string(period);
if (load->existsProperty(propName)) {
Workspace_sptr rws1 = load->getProperty(propName);
out.ws =
......
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