Commit 14ca16f2 authored by Whitfield, Ross's avatar Whitfield, Ross
Browse files

Change member variables to m_ in LeanElastic/PeaksWorkspace

parent 4be908e0
......@@ -131,7 +131,7 @@ public:
// ==================================
/// Number of columns in the workspace.
size_t columnCount() const override {
return static_cast<int>(columns.size());
return static_cast<int>(m_columns.size());
}
/// Number of rows in the workspace.
......@@ -164,7 +164,7 @@ public:
//---------------------------------------------------------------------------------------------
/// Returns a vector of all column names.
std::vector<std::string> getColumnNames() const override {
return this->columnNames;
return this->m_columnNames;
}
/// This is always threadsafe
bool threadSafe() const override { return true; }
......@@ -274,14 +274,14 @@ private:
// ==================================
/** Vector of Peak contained within. */
std::vector<LeanElasticPeak> peaks;
std::vector<LeanElasticPeak> m_peaks;
/** Column shared pointers. */
std::vector<std::shared_ptr<Mantid::DataObjects::PeakColumn<LeanElasticPeak>>>
columns;
m_columns;
/** Column names */
std::vector<std::string> columnNames;
std::vector<std::string> m_columnNames;
/// Coordinates
Kernel::SpecialCoordinateSystem m_coordSystem;
......
......@@ -129,7 +129,7 @@ public:
// ==================================
/// Number of columns in the workspace.
size_t columnCount() const override {
return static_cast<int>(columns.size());
return static_cast<int>(m_columns.size());
}
/// Number of rows in the workspace.
......@@ -162,7 +162,7 @@ public:
//---------------------------------------------------------------------------------------------
/// Returns a vector of all column names.
std::vector<std::string> getColumnNames() const override {
return this->columnNames;
return this->m_columnNames;
}
/// This is always threadsafe
bool threadSafe() const override { return true; }
......@@ -266,13 +266,13 @@ private:
// ==================================
/** Vector of Peak contained within. */
std::vector<Peak> peaks;
std::vector<Peak> m_peaks;
/** Column shared pointers. */
std::vector<std::shared_ptr<Mantid::DataObjects::PeakColumn<Peak>>> columns;
std::vector<std::shared_ptr<Mantid::DataObjects::PeakColumn<Peak>>> m_columns;
/** Column names */
std::vector<std::string> columnNames;
std::vector<std::string> m_columnNames;
/// Coordinates
Kernel::SpecialCoordinateSystem m_coordSystem;
......
......@@ -36,7 +36,7 @@ DECLARE_WORKSPACE(LeanElasticPeaksWorkspace)
* @return LeanElasticPeaksWorkspace object
*/
LeanElasticPeaksWorkspace::LeanElasticPeaksWorkspace()
: IPeaksWorkspace(), peaks(), columns(), columnNames(),
: IPeaksWorkspace(), m_peaks(), m_columns(), m_columnNames(),
m_coordSystem(None) {
initColumns();
// LeanElasticPeaksWorkspace does not use the grouping mechanism of
......@@ -51,8 +51,8 @@ LeanElasticPeaksWorkspace::LeanElasticPeaksWorkspace()
*/
LeanElasticPeaksWorkspace::LeanElasticPeaksWorkspace(
const LeanElasticPeaksWorkspace &other)
: IPeaksWorkspace(other), peaks(other.peaks), columns(), columnNames(),
m_coordSystem(other.m_coordSystem) {
: IPeaksWorkspace(other), m_peaks(other.m_peaks), m_columns(),
m_columnNames(), m_coordSystem(other.m_coordSystem) {
initColumns();
// LeanElasticPeaksWorkspace does not use the grouping mechanism of
// ExperimentInfo.
......@@ -118,14 +118,14 @@ public:
void LeanElasticPeaksWorkspace::sort(
std::vector<ColumnAndDirection> &criteria) {
PeakComparator comparator(criteria);
std::stable_sort(peaks.begin(), peaks.end(), comparator);
std::stable_sort(m_peaks.begin(), m_peaks.end(), comparator);
}
//---------------------------------------------------------------------------------------------
/** @return the number of peaks
*/
int LeanElasticPeaksWorkspace::getNumberPeaks() const {
return int(peaks.size());
return int(m_peaks.size());
}
//---------------------------------------------------------------------------------------------
......@@ -140,11 +140,11 @@ std::string LeanElasticPeaksWorkspace::getConvention() const {
* @param peakNum the peak to remove. peakNum starts at 0
*/
void LeanElasticPeaksWorkspace::removePeak(const int peakNum) {
if (peakNum >= static_cast<int>(peaks.size()) || peakNum < 0) {
if (peakNum >= static_cast<int>(m_peaks.size()) || peakNum < 0) {
throw std::invalid_argument(
"LeanElasticPeaksWorkspace::removePeak(): peakNum is out of range.");
}
peaks.erase(peaks.begin() + peakNum);
m_peaks.erase(m_peaks.begin() + peakNum);
}
/** Removes multiple peaks
......@@ -156,13 +156,13 @@ void LeanElasticPeaksWorkspace::removePeaks(std::vector<int> badPeaks) {
// if index of peak is in badPeaks remove
int ip = -1;
auto it = std::remove_if(
peaks.begin(), peaks.end(), [&ip, badPeaks](LeanElasticPeak &pk) {
m_peaks.begin(), m_peaks.end(), [&ip, badPeaks](LeanElasticPeak &pk) {
(void)pk;
ip++;
return std::any_of(badPeaks.cbegin(), badPeaks.cend(),
[ip](int badPeak) { return badPeak == ip; });
});
peaks.erase(it, peaks.end());
m_peaks.erase(it, m_peaks.end());
}
//---------------------------------------------------------------------------------------------
......@@ -171,9 +171,9 @@ void LeanElasticPeaksWorkspace::removePeaks(std::vector<int> badPeaks) {
*/
void LeanElasticPeaksWorkspace::addPeak(const Geometry::IPeak &ipeak) {
if (dynamic_cast<const LeanElasticPeak *>(&ipeak)) {
peaks.emplace_back((const LeanElasticPeak &)ipeak);
m_peaks.emplace_back((const LeanElasticPeak &)ipeak);
} else {
peaks.emplace_back(LeanElasticPeak(ipeak));
m_peaks.emplace_back(LeanElasticPeak(ipeak));
}
}
......@@ -193,7 +193,7 @@ void LeanElasticPeaksWorkspace::addPeak(const V3D &position,
* @param peak :: Peak object to add (move) into this.
*/
void LeanElasticPeaksWorkspace::addPeak(LeanElasticPeak &&peak) {
peaks.emplace_back(peak);
m_peaks.emplace_back(peak);
}
//---------------------------------------------------------------------------------------------
......@@ -202,11 +202,11 @@ void LeanElasticPeaksWorkspace::addPeak(LeanElasticPeak &&peak) {
* @return a reference to a Peak object.
*/
LeanElasticPeak &LeanElasticPeaksWorkspace::getPeak(const int peakNum) {
if (peakNum >= static_cast<int>(peaks.size()) || peakNum < 0) {
if (peakNum >= static_cast<int>(m_peaks.size()) || peakNum < 0) {
throw std::invalid_argument(
"LeanElasticPeaksWorkspace::getPeak(): peakNum is out of range.");
}
return peaks[peakNum];
return m_peaks[peakNum];
}
//---------------------------------------------------------------------------------------------
......@@ -216,11 +216,11 @@ LeanElasticPeak &LeanElasticPeaksWorkspace::getPeak(const int peakNum) {
*/
const LeanElasticPeak &
LeanElasticPeaksWorkspace::getPeak(const int peakNum) const {
if (peakNum >= static_cast<int>(peaks.size()) || peakNum < 0) {
if (peakNum >= static_cast<int>(m_peaks.size()) || peakNum < 0) {
throw std::invalid_argument(
"LeanElasticPeaksWorkspace::getPeak(): peakNum is out of range.");
}
return peaks[peakNum];
return m_peaks[peakNum];
}
//---------------------------------------------------------------------------------------------
......@@ -356,13 +356,13 @@ int LeanElasticPeaksWorkspace::peakInfoNumber(const Kernel::V3D &, bool) const {
//---------------------------------------------------------------------------------------------
/** Return a reference to the Peaks vector */
std::vector<LeanElasticPeak> &LeanElasticPeaksWorkspace::getPeaks() {
return peaks;
return m_peaks;
}
/** Return a const reference to the Peaks vector */
const std::vector<LeanElasticPeak> &
LeanElasticPeaksWorkspace::getPeaks() const {
return peaks;
return m_peaks;
}
/** Getter for the integration status.
......@@ -425,19 +425,19 @@ void LeanElasticPeaksWorkspace::initColumns() {
**/
void LeanElasticPeaksWorkspace::addPeakColumn(const std::string &name) {
// Create the PeakColumn.
columns.emplace_back(
std::make_shared<DataObjects::PeakColumn<LeanElasticPeak>>(this->peaks,
m_columns.emplace_back(
std::make_shared<DataObjects::PeakColumn<LeanElasticPeak>>(this->m_peaks,
name));
// Cache the names
columnNames.emplace_back(name);
m_columnNames.emplace_back(name);
}
//---------------------------------------------------------------------------------------------
/// @return the index of the column with the given name.
size_t
LeanElasticPeaksWorkspace::getColumnIndex(const std::string &name) const {
for (size_t i = 0; i < columns.size(); i++)
if (columns[i]->name() == name)
for (size_t i = 0; i < m_columns.size(); i++)
if (m_columns[i]->name() == name)
return i;
throw std::invalid_argument(
"Column named " + name +
......@@ -448,20 +448,20 @@ LeanElasticPeaksWorkspace::getColumnIndex(const std::string &name) const {
/// Gets the shared pointer to a column by index.
std::shared_ptr<Mantid::API::Column>
LeanElasticPeaksWorkspace::getColumn(size_t index) {
if (index >= columns.size())
if (index >= m_columns.size())
throw std::invalid_argument(
"LeanElasticPeaksWorkspace::getColumn() called with invalid index.");
return columns[index];
return m_columns[index];
}
//---------------------------------------------------------------------------------------------
/// Gets the shared pointer to a column by index.
std::shared_ptr<const Mantid::API::Column>
LeanElasticPeaksWorkspace::getColumn(size_t index) const {
if (index >= columns.size())
if (index >= m_columns.size())
throw std::invalid_argument(
"LeanElasticPeaksWorkspace::getColumn() called with invalid index.");
return columns[index];
return m_columns[index];
}
void LeanElasticPeaksWorkspace::saveNexus(::NeXus::File *) const {
......
......@@ -38,7 +38,7 @@ Mantid::Kernel::Logger g_log("PeaksWorkspace");
* @return PeaksWorkspace object
*/
PeaksWorkspace::PeaksWorkspace()
: IPeaksWorkspace(), peaks(), columns(), columnNames(),
: IPeaksWorkspace(), m_peaks(), m_columns(), m_columnNames(),
m_coordSystem(None) {
initColumns();
// PeaksWorkspace does not use the grouping mechanism of ExperimentInfo.
......@@ -52,8 +52,8 @@ PeaksWorkspace::PeaksWorkspace()
*/
// PeaksWorkspace::PeaksWorkspace(const PeaksWorkspace &other) = default;
PeaksWorkspace::PeaksWorkspace(const PeaksWorkspace &other)
: IPeaksWorkspace(other), peaks(other.peaks), columns(), columnNames(),
m_coordSystem(other.m_coordSystem) {
: IPeaksWorkspace(other), m_peaks(other.m_peaks), m_columns(),
m_columnNames(), m_coordSystem(other.m_coordSystem) {
initColumns();
// PeaksWorkspace does not use the grouping mechanism of ExperimentInfo.
setNumberOfDetectorGroups(0);
......@@ -117,13 +117,13 @@ public:
*/
void PeaksWorkspace::sort(std::vector<ColumnAndDirection> &criteria) {
PeakComparator comparator(criteria);
std::stable_sort(peaks.begin(), peaks.end(), comparator);
std::stable_sort(m_peaks.begin(), m_peaks.end(), comparator);
}
//---------------------------------------------------------------------------------------------
/** @return the number of peaks
*/
int PeaksWorkspace::getNumberPeaks() const { return int(peaks.size()); }
int PeaksWorkspace::getNumberPeaks() const { return int(m_peaks.size()); }
//---------------------------------------------------------------------------------------------
/** @return the convention
......@@ -135,11 +135,11 @@ std::string PeaksWorkspace::getConvention() const { return convention; }
* @param peakNum the peak to remove. peakNum starts at 0
*/
void PeaksWorkspace::removePeak(const int peakNum) {
if (peakNum >= static_cast<int>(peaks.size()) || peakNum < 0) {
if (peakNum >= static_cast<int>(m_peaks.size()) || peakNum < 0) {
throw std::invalid_argument(
"PeaksWorkspace::removePeak(): peakNum is out of range.");
}
peaks.erase(peaks.begin() + peakNum);
m_peaks.erase(m_peaks.begin() + peakNum);
}
/** Removes multiple peaks
......@@ -151,13 +151,13 @@ void PeaksWorkspace::removePeaks(std::vector<int> badPeaks) {
// if index of peak is in badPeaks remove
int ip = -1;
auto it =
std::remove_if(peaks.begin(), peaks.end(), [&ip, badPeaks](Peak &pk) {
std::remove_if(m_peaks.begin(), m_peaks.end(), [&ip, badPeaks](Peak &pk) {
(void)pk;
ip++;
return std::any_of(badPeaks.cbegin(), badPeaks.cend(),
[ip](int badPeak) { return badPeak == ip; });
});
peaks.erase(it, peaks.end());
m_peaks.erase(it, m_peaks.end());
}
//---------------------------------------------------------------------------------------------
......@@ -166,9 +166,9 @@ void PeaksWorkspace::removePeaks(std::vector<int> badPeaks) {
*/
void PeaksWorkspace::addPeak(const Geometry::IPeak &ipeak) {
if (dynamic_cast<const Peak *>(&ipeak)) {
peaks.emplace_back((const Peak &)ipeak);
m_peaks.emplace_back((const Peak &)ipeak);
} else {
peaks.emplace_back(Peak(ipeak));
m_peaks.emplace_back(Peak(ipeak));
}
}
......@@ -187,7 +187,7 @@ void PeaksWorkspace::addPeak(const V3D &position,
/** Add a peak to the list
* @param peak :: Peak object to add (move) into this.
*/
void PeaksWorkspace::addPeak(Peak &&peak) { peaks.emplace_back(peak); }
void PeaksWorkspace::addPeak(Peak &&peak) { m_peaks.emplace_back(peak); }
//---------------------------------------------------------------------------------------------
/** Return a reference to the Peak
......@@ -195,11 +195,11 @@ void PeaksWorkspace::addPeak(Peak &&peak) { peaks.emplace_back(peak); }
* @return a reference to a Peak object.
*/
Peak &PeaksWorkspace::getPeak(const int peakNum) {
if (peakNum >= static_cast<int>(peaks.size()) || peakNum < 0) {
if (peakNum >= static_cast<int>(m_peaks.size()) || peakNum < 0) {
throw std::invalid_argument(
"PeaksWorkspace::getPeak(): peakNum is out of range.");
}
return peaks[peakNum];
return m_peaks[peakNum];
}
//---------------------------------------------------------------------------------------------
......@@ -208,11 +208,11 @@ Peak &PeaksWorkspace::getPeak(const int peakNum) {
* @return a reference to a Peak object.
*/
const Peak &PeaksWorkspace::getPeak(const int peakNum) const {
if (peakNum >= static_cast<int>(peaks.size()) || peakNum < 0) {
if (peakNum >= static_cast<int>(m_peaks.size()) || peakNum < 0) {
throw std::invalid_argument(
"PeaksWorkspace::getPeak(): peakNum is out of range.");
}
return peaks[peakNum];
return m_peaks[peakNum];
}
//---------------------------------------------------------------------------------------------
......@@ -570,10 +570,10 @@ int PeaksWorkspace::peakInfoNumber(const Kernel::V3D &qFrame,
//---------------------------------------------------------------------------------------------
/** Return a reference to the Peaks vector */
std::vector<Peak> &PeaksWorkspace::getPeaks() { return peaks; }
std::vector<Peak> &PeaksWorkspace::getPeaks() { return m_peaks; }
/** Return a const reference to the Peaks vector */
const std::vector<Peak> &PeaksWorkspace::getPeaks() const { return peaks; }
const std::vector<Peak> &PeaksWorkspace::getPeaks() const { return m_peaks; }
/** Getter for the integration status.
@return TRUE if it has been integrated using a peak integration algorithm.
......@@ -611,7 +611,7 @@ API::ITableWorkspace_sptr PeaksWorkspace::createDetectorTable() const {
const auto npeaks(static_cast<int>(this->rowCount()));
int nrows(0);
for (int i = 0; i < npeaks; ++i) {
const Peak &peak = this->peaks[i];
const Peak &peak = this->m_peaks[i];
auto detIDs = peak.getContributingDetIDs();
auto itEnd = detIDs.end();
for (auto it = detIDs.begin(); it != itEnd; ++it) {
......@@ -658,17 +658,17 @@ void PeaksWorkspace::initColumns() {
**/
void PeaksWorkspace::addPeakColumn(const std::string &name) {
// Create the PeakColumn.
columns.emplace_back(
std::make_shared<DataObjects::PeakColumn<Peak>>(this->peaks, name));
m_columns.emplace_back(
std::make_shared<DataObjects::PeakColumn<Peak>>(this->m_peaks, name));
// Cache the names
columnNames.emplace_back(name);
m_columnNames.emplace_back(name);
}
//---------------------------------------------------------------------------------------------
/// @return the index of the column with the given name.
size_t PeaksWorkspace::getColumnIndex(const std::string &name) const {
for (size_t i = 0; i < columns.size(); i++)
if (columns[i]->name() == name)
for (size_t i = 0; i < m_columns.size(); i++)
if (m_columns[i]->name() == name)
return i;
throw std::invalid_argument("Column named " + name +
" was not found in the PeaksWorkspace.");
......@@ -677,26 +677,26 @@ size_t PeaksWorkspace::getColumnIndex(const std::string &name) const {
//---------------------------------------------------------------------------------------------
/// Gets the shared pointer to a column by index.
std::shared_ptr<Mantid::API::Column> PeaksWorkspace::getColumn(size_t index) {
if (index >= columns.size())
if (index >= m_columns.size())
throw std::invalid_argument(
"PeaksWorkspace::getColumn() called with invalid index.");
return columns[index];
return m_columns[index];
}
//---------------------------------------------------------------------------------------------
/// Gets the shared pointer to a column by index.
std::shared_ptr<const Mantid::API::Column>
PeaksWorkspace::getColumn(size_t index) const {
if (index >= columns.size())
if (index >= m_columns.size())
throw std::invalid_argument(
"PeaksWorkspace::getColumn() called with invalid index.");
return columns[index];
return m_columns[index];
}
void PeaksWorkspace::saveNexus(::NeXus::File *file) const {
// Number of Peaks
const size_t np(peaks.size());
const size_t np(m_peaks.size());
// Column vectors for peaks table
std::vector<int> detectorID(np);
......@@ -721,7 +721,7 @@ void PeaksWorkspace::saveNexus(::NeXus::File *file) const {
// Populate column vectors from Peak Workspace
size_t maxShapeJSONLength = 0;
for (size_t i = 0; i < np; i++) {
Peak p = peaks[i];
Peak p = m_peaks[i];
detectorID[i] = p.getDetectorID();
H[i] = p.getH();
K[i] = p.getK();
......@@ -902,7 +902,7 @@ void PeaksWorkspace::saveNexus(::NeXus::File *file) const {
// Goniometer Matrix Column
std::vector<int> array_dims;
array_dims.emplace_back(static_cast<int>(peaks.size()));
array_dims.emplace_back(static_cast<int>(m_peaks.size()));
array_dims.emplace_back(9);
file->writeData("column_15", goniometerMatrix, array_dims);
file->openData("column_15");
......
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