Commit 9db0bda8 authored by Matthew Bowles's avatar Matthew Bowles
Browse files

clang formatting Re #19472

parent aeb640fc
......@@ -72,7 +72,7 @@ public:
*/
virtual void removePeak(int peakNum) = 0;
virtual void removePeaks(const std::vector<int>& badPeaks) = 0;
virtual void removePeaks(const std::vector<int> &badPeaks) = 0;
//---------------------------------------------------------------------------------------------
/** Add a peak to the list
......
......@@ -38,7 +38,8 @@ private:
void integrate();
void integrateEvent();
int findPixelID(std::string bankName, int col, int row);
void removeEdgePeaks(Mantid::DataObjects::PeaksWorkspace_sptr& peakWS, const int& edge);
void removeEdgePeaks(Mantid::DataObjects::PeaksWorkspace_sptr &peakWS,
const int &edge);
Geometry::Instrument_const_sptr inst;
/// Input 2D Workspace
......
......@@ -338,20 +338,21 @@ int CentroidPeaks::findPixelID(std::string bankName, int col, int row) {
}
}
void CentroidPeaks::removeEdgePeaks(Mantid::DataObjects::PeaksWorkspace_sptr& peakWS, const int& edge) {
std::vector<int> badPeaks;
for (int i = int(peakWS->getNumberPeaks()) - 1; i >= 0; --i) {
// Get a direct ref to that peak.
auto &peak = peakWS->getPeak(i);
int col = peak.getCol();
int row = peak.getRow();
std::string bankName = peak.getBankName();
if (edgePixel(inst, bankName, col, row, edge)) {
badPeaks.push_back(i);
}
void CentroidPeaks::removeEdgePeaks(
Mantid::DataObjects::PeaksWorkspace_sptr &peakWS, const int &edge) {
std::vector<int> badPeaks;
for (int i = int(peakWS->getNumberPeaks()) - 1; i >= 0; --i) {
// Get a direct ref to that peak.
auto &peak = peakWS->getPeak(i);
int col = peak.getCol();
int row = peak.getRow();
std::string bankName = peak.getBankName();
if (edgePixel(inst, bankName, col, row, edge)) {
badPeaks.push_back(i);
}
peakWS->removePeaks(badPeaks);
}
peakWS->removePeaks(badPeaks);
}
} // namespace Mantid
......
......@@ -84,7 +84,7 @@ void OptimizeLatticeForCellType::exec() {
const std::vector<Peak> &peaks = ws->getPeaks();
if (edgePixel(inst, peaks[i].getBankName(), peaks[i].getCol(),
peaks[i].getRow(), edge)) {
badPeaks.push_back(i);
badPeaks.push_back(i);
}
}
ws->removePeaks(badPeaks);
......
......@@ -112,7 +112,7 @@ void PeakIntegration::exec() {
size_t wi = wiEntry->second;
if ((matchRun && peak.getRunNumber() != inputW->getRunNumber()) ||
wi >= Numberwi)
badPeaks.push_back(i);
badPeaks.push_back(i);
} else // This is for appending peak workspaces when running
// SNSSingleCrystalReduction one bank at at time
if (i + 1 > MinPeaks)
......
......@@ -98,7 +98,7 @@ public:
int getNumberPeaks() const override;
std::string getConvention() const override;
void removePeak(int peakNum) override;
void removePeaks(const std::vector<int>& badPeaks);
void removePeaks(const std::vector<int> &badPeaks);
void addPeak(const Geometry::IPeak &peak) override;
/// Move a peak object into this peaks workspace
void addPeak(Peak &&peak);
......
......@@ -153,21 +153,22 @@ void PeaksWorkspace::removePeak(const int peakNum) {
/** Removes multiple peaks
* @param badPeaks peaks to be removed
*/
void PeaksWorkspace::removePeaks(const std::vector<int>& badPeaks) {
int i = 0;
auto first = peaks.begin();
auto result = first;
for (Peak p : peaks)
{
if (std::find(badPeaks.begin(), badPeaks.end(), i) == badPeaks.end())
{
*result = std::move(*first);
++result;
}
++first;
++i;
void PeaksWorkspace::removePeaks(const std::vector<int> &badPeaks) {
int i = 0;
auto first = peaks.begin();
auto result = first;
for (Peak p : peaks) {
//if index of peak is not in badPeaks
if (std::find(badPeaks.begin(), badPeaks.end(), i) == badPeaks.end()) {
//include in result
*result = std::move(*first);
++result;
}
peaks.erase(result, peaks.end());
++first;
++i;
}
//erase peaks outside of result
peaks.erase(result, peaks.end());
}
//---------------------------------------------------------------------------------------------
......
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