Commit bd7aded4 authored by Matthew Bowles's avatar Matthew Bowles
Browse files

requested changes including removePeaks pass by val Re #19472

parent b44cc299
......@@ -72,7 +72,7 @@ public:
*/
virtual void removePeak(int peakNum) = 0;
virtual void removePeaks(std::vector<int> &&badPeaks) = 0;
virtual void removePeaks(std::vector<int> badPeaks) = 0;
//---------------------------------------------------------------------------------------------
/** Add a peak to the list
......
......@@ -38,7 +38,7 @@ private:
void integrate();
void integrateEvent();
int findPixelID(std::string bankName, int col, int row);
void removeEdgePeaks(Mantid::DataObjects::PeaksWorkspace *peakWS);
void removeEdgePeaks(Mantid::DataObjects::PeaksWorkspace &peakWS);
Geometry::Instrument_const_sptr inst;
/// Input 2D Workspace
......
......@@ -168,7 +168,7 @@ void CentroidPeaks::integrate() {
PARALLEL_END_INTERUPT_REGION
}
PARALLEL_CHECK_INTERUPT_REGION
removeEdgePeaks(peakWS.get());
removeEdgePeaks(*peakWS);
// Save the output
setProperty("OutPeaksWorkspace", peakWS);
......@@ -287,7 +287,7 @@ void CentroidPeaks::integrateEvent() {
PARALLEL_END_INTERUPT_REGION
}
PARALLEL_CHECK_INTERUPT_REGION
removeEdgePeaks(peakWS.get());
removeEdgePeaks(*peakWS);
// Save the output
setProperty("OutPeaksWorkspace", peakWS);
......@@ -337,13 +337,13 @@ int CentroidPeaks::findPixelID(std::string bankName, int col, int row) {
}
void CentroidPeaks::removeEdgePeaks(
Mantid::DataObjects::PeaksWorkspace *peakWS) {
Mantid::DataObjects::PeaksWorkspace &peakWS) {
int Edge = getProperty("EdgePixels");
std::vector<int> badPeaks;
size_t numPeaks = peakWS->getNumberPeaks() - 1;
size_t numPeaks = peakWS.getNumberPeaks() - 1;
for (int i = 0; i < static_cast<int>(numPeaks); i++) {
// Get a direct ref to that peak.
const auto &peak = peakWS->getPeak(i);
const auto &peak = peakWS.getPeak(i);
int col = peak.getCol();
int row = peak.getRow();
const std::string &bankName = peak.getBankName();
......@@ -352,7 +352,7 @@ void CentroidPeaks::removeEdgePeaks(
badPeaks.push_back(i);
}
}
peakWS->removePeaks(std::move(badPeaks));
peakWS.removePeaks(std::move(badPeaks));
}
} // namespace Mantid
......
......@@ -98,7 +98,7 @@ public:
int getNumberPeaks() const override;
std::string getConvention() const override;
void removePeak(int peakNum) override;
void removePeaks(std::vector<int> &&badPeaks) override;
void removePeaks(std::vector<int> badPeaks) override;
void addPeak(const Geometry::IPeak &peak) override;
/// Move a peak object into this peaks workspace
void addPeak(Peak &&peak);
......
......@@ -153,8 +153,8 @@ void PeaksWorkspace::removePeak(const int peakNum) {
/** Removes multiple peaks
* @param badPeaks peaks to be removed. Takes ownership of container.
*/
void PeaksWorkspace::removePeaks(std::vector<int> &&badPeaks) {
if (badPeaks.size() == 0)
void PeaksWorkspace::removePeaks(std::vector<int> badPeaks) {
if (badPeaks.empty())
return;
std::sort(badPeaks.begin(), badPeaks.end());
auto index = peaks.begin();
......
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