Commit 6f2d43a6 authored by David Fairbrother's avatar David Fairbrother
Browse files

Clang-tidy: performance-move-const-arg

Removes instances of std::move where:
- We have a constant argument
- For trivial types
- For cr-types
parent 16b1901f
......@@ -34,7 +34,7 @@ AlgorithmObserver::AlgorithmObserver(const IAlgorithm_const_sptr &alg)
m_finishObserver(*this, &AlgorithmObserver::_finishHandle),
m_errorObserver(*this, &AlgorithmObserver::_errorHandle),
m_startingObserver(*this, &AlgorithmObserver::_startingHandle) {
observeAll(std::move(alg));
observeAll(alg);
}
/// Virtual destructor
......
......@@ -111,7 +111,7 @@ void BoxControllerSettingsAlgorithm::setBoxController(const BoxController_sptr &
const Mantid::Geometry::Instrument_const_sptr &instrument) {
size_t nd = bc->getNDims();
takeDefaultsFromInstrument(std::move(instrument), nd);
takeDefaultsFromInstrument(instrument, nd);
setBoxController(bc);
}
......
......@@ -17,8 +17,8 @@ namespace Mantid {
namespace API {
IndexProperty::IndexProperty(const std::string &name, const IWorkspaceProperty &workspaceProp,
const IndexTypeProperty &indexTypeProp, const Kernel::IValidator_sptr &validator)
: ArrayProperty(name, "", std::move(validator)), m_workspaceProp(workspaceProp), m_indexTypeProp(indexTypeProp),
m_indices(0), m_indicesExtracted(false) {}
: ArrayProperty(name, "", validator), m_workspaceProp(workspaceProp), m_indexTypeProp(indexTypeProp), m_indices(0),
m_indicesExtracted(false) {}
IndexProperty *IndexProperty::clone() const { return new IndexProperty(*this); }
......
......@@ -24,7 +24,7 @@ ScopedWorkspace::ScopedWorkspace() : m_name(generateUniqueName()) {}
/**
* Workspace constructor
*/
ScopedWorkspace::ScopedWorkspace(const Workspace_sptr &ws) : m_name(generateUniqueName()) { set(std::move(ws)); }
ScopedWorkspace::ScopedWorkspace(const Workspace_sptr &ws) : m_name(generateUniqueName()) { set(ws); }
//----------------------------------------------------------------------------------------------
/**
......
......@@ -219,7 +219,7 @@ void AlignDetectors::getCalibrationWS(const MatrixWorkspace_sptr &inputWS) {
const std::string calFileName = getPropertyValue("CalibrationFile");
if (!calFileName.empty()) {
progress(0.0, "Reading calibration file");
loadCalFile(std::move(inputWS), calFileName);
loadCalFile(inputWS, calFileName);
return;
}
......
......@@ -273,13 +273,13 @@ MatrixWorkspace_sptr CalculateIqt::calculateIqt(MatrixWorkspace_sptr workspace,
const MatrixWorkspace_sptr &resolutionWorkspace,
const std::string &rebinParams) {
workspace = normalizedFourierTransform(workspace, rebinParams);
return divide(workspace, std::move(resolutionWorkspace));
return divide(workspace, resolutionWorkspace);
}
MatrixWorkspace_sptr CalculateIqt::doSimulation(MatrixWorkspace_sptr sample, const MatrixWorkspace_sptr &resolution,
const std::string &rebinParams, MersenneTwister &mTwister) {
auto simulatedWorkspace = randomizeWorkspaceWithinError(std::move(sample), mTwister);
return calculateIqt(simulatedWorkspace, std::move(resolution), rebinParams);
return calculateIqt(simulatedWorkspace, resolution, rebinParams);
}
MatrixWorkspace_sptr
......
......@@ -276,7 +276,7 @@ API::MatrixWorkspace_sptr CalculateTransmission::extractSpectra(const API::Matri
API::MatrixWorkspace_sptr CalculateTransmission::fit(const API::MatrixWorkspace_sptr &raw,
const std::vector<double> &rebinParams,
const std::string &fitMethod) {
MatrixWorkspace_sptr output = this->extractSpectra(std::move(raw), std::vector<size_t>(1, 0));
MatrixWorkspace_sptr output = this->extractSpectra(raw, std::vector<size_t>(1, 0));
Progress progress(this, m_done, 1.0, 4);
progress.report("CalculateTransmission: Performing fit");
......
......@@ -130,7 +130,7 @@ double ChangeTimeZero::getTimeShift(const API::MatrixWorkspace_sptr &ws) const {
std::string timeOffset = getProperty("AbsoluteTimeOffset");
if (isAbsoluteTimeShift(timeOffset)) {
DateAndTime desiredTime(timeOffset);
DateAndTime originalTime(getStartTimeFromWorkspace(std::move(ws)));
DateAndTime originalTime(getStartTimeFromWorkspace(ws));
timeShift = DateAndTime::secondsFromDuration(desiredTime - originalTime);
} else {
timeShift = getProperty("RelativeTimeOffset");
......
......@@ -299,9 +299,9 @@ void ConjoinXRuns::joinSpectrum(int64_t wsIndex) {
}
if (!xerrors.empty())
m_outWS->setPointStandardDeviations(index, std::move(xerrors));
m_outWS->mutableY(index) = std::move(spectrum);
m_outWS->mutableE(index) = std::move(errors);
m_outWS->mutableX(index) = std::move(axis);
m_outWS->mutableY(index) = spectrum;
m_outWS->mutableE(index) = errors;
m_outWS->mutableX(index) = axis;
}
//----------------------------------------------------------------------------------------------
......
......@@ -55,7 +55,7 @@ size_t ConvertToHistogram::getNewXSize(const std::size_t ySize) const { return y
*/
Kernel::cow_ptr<HistogramData::HistogramX>
ConvertToHistogram::calculateXPoints(Kernel::cow_ptr<HistogramData::HistogramX> inputX) const {
return HistogramData::BinEdges(HistogramData::Points(std::move(inputX))).cowData();
return HistogramData::BinEdges(HistogramData::Points(inputX)).cowData();
}
} // namespace Algorithms
} // namespace Mantid
......@@ -51,7 +51,7 @@ size_t ConvertToPointData::getNewXSize(const std::size_t ySize) const { return y
*/
Kernel::cow_ptr<HistogramData::HistogramX>
ConvertToPointData::calculateXPoints(Kernel::cow_ptr<HistogramData::HistogramX> inputX) const {
return HistogramData::Points(HistogramData::BinEdges(std::move(inputX))).cowData();
return HistogramData::Points(HistogramData::BinEdges(inputX)).cowData();
}
} // namespace Algorithms
} // namespace Mantid
......@@ -215,7 +215,7 @@ MatrixWorkspace_sptr ConvertUnitsUsingDetectorTable::convertViaTOF(Kernel::Unit_
// Convert from time-of-flight to the desired unit
localOutputUnit->fromTOF(values, emptyVec, l1, emode, pmap);
outputWS->mutableX(wsid) = std::move(values);
outputWS->mutableX(wsid) = values;
// EventWorkspace part, modifying the EventLists.
if (m_inputEvents) {
......
......@@ -37,7 +37,7 @@ void copyDataRange(const MatrixWorkspace_const_sptr &inputWorkspace, const Matri
auto const xMinIndex = static_cast<int>(inputWorkspace->yIndexOfX(xMin, 0));
auto const xMaxIndex = static_cast<int>(inputWorkspace->yIndexOfX(xMax, 0));
copyDataRange(inputWorkspace, std::move(destWorkspace), specMin, specMax, xMinIndex, xMaxIndex, yInsertionIndex,
copyDataRange(inputWorkspace, destWorkspace, specMin, specMax, xMinIndex, xMaxIndex, yInsertionIndex,
xInsertionIndex);
}
......
......@@ -76,7 +76,7 @@ void CreateUserDefinedBackground::exec() {
// Generate output workspace with background data
const auto outputWS = createBackgroundWorkspace(pointsTable, inputWS);
setProperty("OutputBackgroundWorkspace", API::MatrixWorkspace_sptr(std::move(outputWS)));
setProperty("OutputBackgroundWorkspace", API::MatrixWorkspace_sptr(outputWS));
}
/**
......
......@@ -148,9 +148,9 @@ void CropWorkspaceRagged::exec() {
dataE.resize(newE.size());
// update the data
outputWS->mutableX(i) = std::move(newX);
outputWS->mutableY(i) = std::move(newY);
outputWS->mutableE(i) = std::move(newE);
outputWS->mutableX(i) = newX;
outputWS->mutableY(i) = newY;
outputWS->mutableE(i) = newE;
PARALLEL_END_INTERUPT_REGION
}
PARALLEL_CHECK_INTERUPT_REGION
......
......@@ -443,7 +443,7 @@ double FitOneSinglePeak::fitPeakFunction(const API::IPeakFunction_sptr &peakfunc
m_sstream << "Function (to fit): " << peakfunc->asString() << " From " << startx << " to " << endx << ".\n";
double goodness = fitFunctionSD(peakfunc, std::move(dataws), wsindex, startx, endx);
double goodness = fitFunctionSD(peakfunc, dataws, wsindex, startx, endx);
return goodness;
}
......
......@@ -1660,8 +1660,8 @@ API::MatrixWorkspace_sptr FitPeaks::createMatrixWorkspace(const std::vector<doub
size_t ysize = vec_y.size();
HistogramBuilder builder;
builder.setX(std::move(size));
builder.setY(std::move(ysize));
builder.setX(size);
builder.setY(ysize);
MatrixWorkspace_sptr matrix_ws = create<Workspace2D>(1, builder.build());
auto &dataX = matrix_ws->mutableX(0);
......
......@@ -590,7 +590,7 @@ double GetEi2::calculatePeakWidthAtHalfHeight(const API::MatrixWorkspace_sptr &d
*/
double GetEi2::calculateFirstMoment(const API::MatrixWorkspace_sptr &monitor_ws, const double prominence) {
std::vector<double> peak_x, peak_y, peak_e;
calculatePeakWidthAtHalfHeight(std::move(monitor_ws), prominence, peak_x, peak_y, peak_e);
calculatePeakWidthAtHalfHeight(monitor_ws, prominence, peak_x, peak_y, peak_e);
// Area
double area(0.0), dummy(0.0);
......
......@@ -151,7 +151,7 @@ void IQTransform::exec() {
API::MatrixWorkspace_sptr IQTransform::subtractBackgroundWS(const API::MatrixWorkspace_sptr &ws,
const API::MatrixWorkspace_sptr &background) {
g_log.debug() << "Subtracting the workspace " << background->getName() << " from the input workspace.\n";
return std::move(ws) - background;
return ws - background;
}
/** @name Available transformation functions */
......
......@@ -892,11 +892,11 @@ void MaxEnt::populateImageWS(MatrixWorkspace_const_sptr &inWS, size_t spec, size
}
}
outWS->mutableX(spec) = std::move(X);
outWS->mutableY(spec) = std::move(YR);
outWS->mutableE(spec) = std::move(E);
outWS->mutableX(spec) = X;
outWS->mutableY(spec) = YR;
outWS->mutableE(spec) = E;
outWS->setSharedX(nspec + spec, outWS->sharedX(spec));
outWS->mutableY(nspec + spec) = std::move(YI);
outWS->mutableY(nspec + spec) = YI;
outWS->setSharedE(nspec + spec, outWS->sharedE(spec));
}
......@@ -968,10 +968,10 @@ void MaxEnt::populateDataWS(MatrixWorkspace_const_sptr &inWS, size_t spec, size_
}
}
outWS->mutableX(specA) = std::move(X);
outWS->mutableY(specA) = std::move(YR);
outWS->mutableE(specA) = std::move(E);
outWS->mutableY(nspec + specA) = std::move(YI);
outWS->mutableX(specA) = X;
outWS->mutableY(specA) = YR;
outWS->mutableE(specA) = E;
outWS->mutableY(nspec + specA) = YI;
outWS->setSharedX(nspec + specA, outWS->sharedX(spec));
outWS->setSharedE(nspec + specA, outWS->sharedE(spec));
} // Next spectrum if concatenated
......
Markdown is supported
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