Commit 2357c748 authored by David Fairbrother's avatar David Fairbrother
Browse files

Clang-tidy pass by ref

Runs clang-tidy pass by ref across the codebase to fix-up various
warnings we are seeing in cppcheck
parent 08088625
......@@ -880,14 +880,14 @@ private:
}
Instrument_sptr
addInstrumentWithIndirectEmodeParameter(ExperimentInfo_sptr exptInfo) {
addInstrumentWithIndirectEmodeParameter(const ExperimentInfo_sptr &exptInfo) {
Instrument_sptr inst = addInstrument(exptInfo);
exptInfo->instrumentParameters().addString(inst.get(), "deltaE-mode",
"indirect");
return inst;
}
Instrument_sptr addInstrument(ExperimentInfo_sptr exptInfo) {
Instrument_sptr addInstrument(const ExperimentInfo_sptr &exptInfo) {
Instrument_sptr inst =
ComponentCreationHelper::createTestInstrumentCylindrical(1);
exptInfo->setInstrument(inst);
......
......@@ -476,7 +476,7 @@ public:
TS_ASSERT(second);
// test each individual function
auto testFunc = [](CompositeFunction_sptr f) {
auto testFunc = [](const CompositeFunction_sptr &f) {
if (f) {
TS_ASSERT_EQUALS(f->nFunctions(), 2);
TS_ASSERT_EQUALS(f->getFunction(0)->name(),
......
......@@ -14,6 +14,8 @@
#include <Poco/Path.h>
#include <cxxtest/TestSuite.h>
#include <utility>
using namespace Mantid;
using namespace Mantid::API;
......@@ -29,7 +31,7 @@ class MockLiveListenerInstantiator
public:
MockLiveListenerInstantiator(
boost::shared_ptr<Mantid::API::ILiveListener> product)
: product(product) {}
: product(std::move(product)) {}
boost::shared_ptr<Mantid::API::ILiveListener>
createInstance() const override {
......
......@@ -63,7 +63,8 @@ void addTestTimeSeries(LogManager &run, const std::string &name) {
}
} // namespace
void addTimeSeriesEntry(LogManager &runInfo, std::string name, double val) {
void addTimeSeriesEntry(LogManager &runInfo, const std::string &name,
double val) {
TimeSeriesProperty<double> *tsp;
tsp = new TimeSeriesProperty<double>(name);
tsp->addValue("2011-05-24T00:00:00", val);
......
......@@ -28,7 +28,7 @@ class MultiPeriodGroupTestBase {
protected:
// Helper method to add multiperiod logs to make a workspacegroup look like a
// real multiperiod workspace group.
void add_periods_logs(WorkspaceGroup_sptr ws) {
void add_periods_logs(const WorkspaceGroup_sptr &ws) {
int nperiods = static_cast<int>(ws->size());
for (size_t i = 0; i < ws->size(); ++i) {
MatrixWorkspace_sptr currentWS =
......@@ -45,7 +45,7 @@ protected:
/// Helper to fabricate a workspace group consisting of equal sized
/// matrixworkspaces.
WorkspaceGroup_sptr
create_good_multiperiod_workspace_group(const std::string name) {
create_good_multiperiod_workspace_group(const std::string &name) {
MatrixWorkspace_sptr a = MatrixWorkspace_sptr(new WorkspaceTester);
MatrixWorkspace_sptr b = MatrixWorkspace_sptr(new WorkspaceTester);
......
......@@ -84,7 +84,8 @@ private:
return gaussian;
}
double getGaussianAnalyticalInfiniteIntegral(IPeakFunction_sptr gaussian) {
double
getGaussianAnalyticalInfiniteIntegral(const IPeakFunction_sptr &gaussian) {
return gaussian->height() * gaussian->fwhm() / (2.0 * sqrt(M_LN2)) *
sqrt(M_PI);
}
......
......@@ -427,7 +427,7 @@ public:
TS_ASSERT_EQUALS(runCopy.getGoniometer().getNumberAxes(), 3);
}
void addTimeSeriesEntry(Run &runInfo, std::string name, double val) {
void addTimeSeriesEntry(Run &runInfo, const std::string &name, double val) {
TimeSeriesProperty<double> *tsp;
tsp = new TimeSeriesProperty<double>(name);
tsp->addValue("2011-05-24T00:00:00", val);
......
......@@ -50,7 +50,7 @@ public:
class WorkspaceGroupTest : public CxxTest::TestSuite {
private:
/// Helper method to add an 'nperiods' log value to each workspace in a group.
void add_periods_logs(WorkspaceGroup_sptr ws, int nperiods = -1) {
void add_periods_logs(const WorkspaceGroup_sptr &ws, int nperiods = -1) {
for (size_t i = 0; i < ws->size(); ++i) {
MatrixWorkspace_sptr currentWS =
boost::dynamic_pointer_cast<MatrixWorkspace>(ws->getItem(i));
......
......@@ -59,7 +59,7 @@ private:
: public Mantid::API::WorkspaceNearestNeighbours {
public:
ExposedNearestNeighbours(const SpectrumInfo &spectrumInfo,
const std::vector<specnum_t> spectrumNumbers,
const std::vector<specnum_t> &spectrumNumbers,
bool ignoreMasked = false)
: WorkspaceNearestNeighbours(8, spectrumInfo, spectrumNumbers,
ignoreMasked) {}
......
......@@ -76,21 +76,22 @@ private:
Types::Core::DateAndTime getRunStart(API::Run &run_obj);
/// get value vector of the integer TimeSeriesProperty entries
std::vector<int> getIntValues(API::MatrixWorkspace_const_sptr dataws,
std::vector<int> getIntValues(const API::MatrixWorkspace_const_sptr &dataws,
int workspace_index);
/// get value vector of the double TimeSeriesProperty entries
std::vector<double> getDblValues(API::MatrixWorkspace_const_sptr dataws,
int workspace_index);
std::vector<double>
getDblValues(const API::MatrixWorkspace_const_sptr &dataws,
int workspace_index);
/// get the vector of times of the TimeSeriesProperty entries
std::vector<Types::Core::DateAndTime>
getTimes(API::MatrixWorkspace_const_sptr dataws, int workspace_index,
getTimes(const API::MatrixWorkspace_const_sptr &dataws, int workspace_index,
bool is_epoch, bool is_second, API::Run &run_obj);
/// get meta data from input workspace or user input
void getMetaData(API::MatrixWorkspace_const_sptr dataws, bool &epochtime,
std::string &timeunit);
void getMetaData(const API::MatrixWorkspace_const_sptr &dataws,
bool &epochtime, std::string &timeunit);
};
} // namespace Algorithms
......
......@@ -73,9 +73,9 @@ private:
void align(const ConversionFactors &converter, API::Progress &progress,
DataObjects::EventWorkspace &outputWS);
void loadCalFile(API::MatrixWorkspace_sptr inputWS,
void loadCalFile(const API::MatrixWorkspace_sptr &inputWS,
const std::string &filename);
void getCalibrationWS(API::MatrixWorkspace_sptr inputWS);
void getCalibrationWS(const API::MatrixWorkspace_sptr &inputWS);
Mantid::API::ITableWorkspace_sptr m_calibrationWS;
......
......@@ -47,7 +47,7 @@ private:
DataObjects::EventWorkspace_sptr
m_inputWS; ///< Pointer to the input event workspace
int m_numberOfSpectra; ///< The number of spectra in the workspace
void normalizeToBinArea(API::MatrixWorkspace_sptr outWS);
void normalizeToBinArea(const API::MatrixWorkspace_sptr &outWS);
};
double calcD(double wavelength, double sintheta);
......
......@@ -193,7 +193,7 @@ protected:
(void)ans;
};
OperandType getOperandType(const API::MatrixWorkspace_const_sptr ws);
OperandType getOperandType(const API::MatrixWorkspace_const_sptr &ws);
virtual void checkRequirements();
......@@ -255,8 +255,8 @@ private:
void doSingleColumn();
void do2D(bool mismatchedSpectra);
void propagateBinMasks(const API::MatrixWorkspace_const_sptr rhs,
API::MatrixWorkspace_sptr out);
void propagateBinMasks(const API::MatrixWorkspace_const_sptr &rhs,
const API::MatrixWorkspace_sptr &out);
/// Progress reporting
std::unique_ptr<API::Progress> m_progress = nullptr;
};
......
......@@ -61,10 +61,10 @@ private:
API::MatrixWorkspace_sptr
createOutputWorkspace(const API::MatrixWorkspace_sptr &inputWS,
const std::string) const;
void deleteWorkspace(API::MatrixWorkspace_sptr workspace);
const std::string &) const;
void deleteWorkspace(const API::MatrixWorkspace_sptr &workspace);
API::MatrixWorkspace_sptr
setUncertainties(API::MatrixWorkspace_sptr workspace);
setUncertainties(const API::MatrixWorkspace_sptr &workspace);
};
} // namespace Algorithms
......
......@@ -25,8 +25,8 @@ public:
private:
void init() override;
void exec() override;
void calculateQMinMax(API::MatrixWorkspace_sptr, const std::vector<size_t> &,
const std::string &);
void calculateQMinMax(const API::MatrixWorkspace_sptr &,
const std::vector<size_t> &, const std::string &);
};
} // namespace Algorithms
......
......@@ -70,19 +70,19 @@ private:
void exec() override;
/// Sum all detectors, excluding monitors and masked detectors
void sumUnmaskedDetectors(API::MatrixWorkspace_sptr rebinnedWS, double &sum,
double &error, int &nPixels);
void sumUnmaskedDetectors(const API::MatrixWorkspace_sptr &rebinnedWS,
double &sum, double &error, int &nPixels);
/// Normalize all detectors to get the relative efficiency
void normalizeDetectors(API::MatrixWorkspace_sptr rebinnedWS,
API::MatrixWorkspace_sptr outputWS, double sum,
void normalizeDetectors(const API::MatrixWorkspace_sptr &rebinnedWS,
const API::MatrixWorkspace_sptr &outputWS, double sum,
double error, int nPixels, double min_eff,
double max_eff);
void maskComponent(API::MatrixWorkspace &ws,
const std::string &componentName);
void maskEdges(API::MatrixWorkspace_sptr ws, int high, int low, int left,
int right, const std::string &componentName);
void maskEdges(const API::MatrixWorkspace_sptr &ws, int high, int low,
int left, int right, const std::string &componentName);
};
} // namespace Algorithms
......
......@@ -28,24 +28,26 @@ private:
std::map<std::string, std::string> validateInputs() override;
std::string rebinParamsAsString();
API::MatrixWorkspace_sptr
monteCarloErrorCalculation(API::MatrixWorkspace_sptr sample,
API::MatrixWorkspace_sptr resolution,
monteCarloErrorCalculation(const API::MatrixWorkspace_sptr &sample,
const API::MatrixWorkspace_sptr &resolution,
const std::string &rebinParams, const int seed,
const bool calculateErrors, const int nIterations);
API::MatrixWorkspace_sptr rebin(API::MatrixWorkspace_sptr workspace,
API::MatrixWorkspace_sptr rebin(const API::MatrixWorkspace_sptr &workspace,
const std::string &params);
API::MatrixWorkspace_sptr integration(API::MatrixWorkspace_sptr workspace);
API::MatrixWorkspace_sptr
convertToPointData(API::MatrixWorkspace_sptr workspace);
integration(const API::MatrixWorkspace_sptr &workspace);
API::MatrixWorkspace_sptr
extractFFTSpectrum(API::MatrixWorkspace_sptr workspace);
API::MatrixWorkspace_sptr divide(API::MatrixWorkspace_sptr lhsWorkspace,
API::MatrixWorkspace_sptr rhsWorkspace);
API::MatrixWorkspace_sptr cropWorkspace(API::MatrixWorkspace_sptr workspace,
const double xMax);
convertToPointData(const API::MatrixWorkspace_sptr &workspace);
API::MatrixWorkspace_sptr
replaceSpecialValues(API::MatrixWorkspace_sptr workspace);
extractFFTSpectrum(const API::MatrixWorkspace_sptr &workspace);
API::MatrixWorkspace_sptr
divide(const API::MatrixWorkspace_sptr &lhsWorkspace,
const API::MatrixWorkspace_sptr &rhsWorkspace);
API::MatrixWorkspace_sptr
cropWorkspace(const API::MatrixWorkspace_sptr &workspace, const double xMax);
API::MatrixWorkspace_sptr
replaceSpecialValues(const API::MatrixWorkspace_sptr &workspace);
API::MatrixWorkspace_sptr
removeInvalidData(API::MatrixWorkspace_sptr workspace);
......@@ -54,7 +56,7 @@ private:
const std::string &rebinParams);
API::MatrixWorkspace_sptr
calculateIqt(API::MatrixWorkspace_sptr workspace,
API::MatrixWorkspace_sptr resolutionWorkspace,
const API::MatrixWorkspace_sptr &resolutionWorkspace,
const std::string &rebinParams);
API::MatrixWorkspace_sptr doSimulation(API::MatrixWorkspace_sptr sample,
API::MatrixWorkspace_sptr resolution,
......
......@@ -80,27 +80,27 @@ private:
void exec() override;
/// Pull out a single spectrum from a 2D workspace
API::MatrixWorkspace_sptr extractSpectra(API::MatrixWorkspace_sptr ws,
API::MatrixWorkspace_sptr extractSpectra(const API::MatrixWorkspace_sptr &ws,
const std::vector<size_t> &indices);
/// Returns a workspace with the evaulation of the fit to the calculated
/// transmission fraction
API::MatrixWorkspace_sptr fit(API::MatrixWorkspace_sptr raw,
API::MatrixWorkspace_sptr fit(const API::MatrixWorkspace_sptr &raw,
const std::vector<double> &rebinParams,
const std::string fitMethod);
const std::string &fitMethod);
/// Call the Linear fitting algorithm as a child algorithm
API::MatrixWorkspace_sptr fitData(API::MatrixWorkspace_sptr WS, double &grad,
double &offset);
API::MatrixWorkspace_sptr fitData(const API::MatrixWorkspace_sptr &WS,
double &grad, double &offset);
/// Call the Polynomial fitting algorithm as a child algorithm
API::MatrixWorkspace_sptr fitPolynomial(API::MatrixWorkspace_sptr WS,
API::MatrixWorkspace_sptr fitPolynomial(const API::MatrixWorkspace_sptr &WS,
int order,
std::vector<double> &coeficients);
/// Calls the rebin algorithm
API::MatrixWorkspace_sptr rebin(const std::vector<double> &binParams,
API::MatrixWorkspace_sptr ws);
const API::MatrixWorkspace_sptr &ws);
/// Outpus message to log if the detector at the given index is not a monitor
/// in both input workspaces.
void logIfNotMonitor(API::MatrixWorkspace_sptr sampleWS,
API::MatrixWorkspace_sptr directWS, size_t index);
void logIfNotMonitor(const API::MatrixWorkspace_sptr &sampleWS,
const API::MatrixWorkspace_sptr &directWS, size_t index);
};
} // namespace Algorithms
......
......@@ -85,12 +85,12 @@ private:
void exec() override;
/// Pull out a single spectrum from a 2D workspace
API::MatrixWorkspace_sptr extractSpectrum(API::MatrixWorkspace_sptr WS,
API::MatrixWorkspace_sptr extractSpectrum(const API::MatrixWorkspace_sptr &WS,
const size_t index);
/// Call the Linear fitting algorithm as a child algorithm
API::MatrixWorkspace_sptr fitToData(API::MatrixWorkspace_sptr WS);
API::MatrixWorkspace_sptr fitToData(const API::MatrixWorkspace_sptr &WS);
/// Sum the total detector, excluding masked pixels and monitors
API::MatrixWorkspace_sptr sumSpectra(API::MatrixWorkspace_sptr WS);
API::MatrixWorkspace_sptr sumSpectra(const API::MatrixWorkspace_sptr &WS);
bool logFit =
false; ///< If true, will take log of transmission curve before fitting
......
......@@ -58,10 +58,10 @@ private:
double coeff1, double coeff2, double coeff3, bool doAbs,
bool doMS);
API::MatrixWorkspace_sptr multiply(const API::MatrixWorkspace_sptr lhsWS,
const API::MatrixWorkspace_sptr rhsWS);
API::MatrixWorkspace_sptr minus(const API::MatrixWorkspace_sptr lhsWS,
const API::MatrixWorkspace_sptr rhsWS);
API::MatrixWorkspace_sptr multiply(const API::MatrixWorkspace_sptr &lhsWS,
const API::MatrixWorkspace_sptr &rhsWS);
API::MatrixWorkspace_sptr minus(const API::MatrixWorkspace_sptr &lhsWS,
const API::MatrixWorkspace_sptr &rhsWS);
};
} // namespace Algorithms
......
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