Skip to content
Snippets Groups Projects
Commit d3388b3e authored by Zhang, Chen's avatar Zhang, Chen
Browse files

easy fix to make sort work for leanpws

parent 4f55a3ea
No related branches found
No related tags found
No related merge requests found
...@@ -37,10 +37,10 @@ const std::string SortPeaksWorkspace::category() const { ...@@ -37,10 +37,10 @@ const std::string SortPeaksWorkspace::category() const {
/** Initialize the algorithm's properties. /** Initialize the algorithm's properties.
*/ */
void SortPeaksWorkspace::init() { void SortPeaksWorkspace::init() {
declareProperty(std::make_unique<WorkspaceProperty<PeaksWorkspace>>( declareProperty(std::make_unique<WorkspaceProperty<IPeaksWorkspace>>(
"InputWorkspace", "", Direction::Input), "InputWorkspace", "", Direction::Input),
"An input workspace."); "An input workspace.");
declareProperty(std::make_unique<WorkspaceProperty<PeaksWorkspace>>( declareProperty(std::make_unique<WorkspaceProperty<IPeaksWorkspace>>(
"OutputWorkspace", "", Direction::Output), "OutputWorkspace", "", Direction::Output),
"An output workspace."); "An output workspace.");
...@@ -58,8 +58,8 @@ void SortPeaksWorkspace::init() { ...@@ -58,8 +58,8 @@ void SortPeaksWorkspace::init() {
void SortPeaksWorkspace::exec() { void SortPeaksWorkspace::exec() {
const std::string columnToSortBy = getProperty("ColumnNameToSortBy"); const std::string columnToSortBy = getProperty("ColumnNameToSortBy");
const bool sortAscending = getProperty("SortAscending"); const bool sortAscending = getProperty("SortAscending");
PeaksWorkspace_sptr inputWS = getProperty("InputWorkspace"); IPeaksWorkspace_sptr inputWS = getProperty("InputWorkspace");
PeaksWorkspace_sptr outputWS = getProperty("OutputWorkspace"); IPeaksWorkspace_sptr outputWS = getProperty("OutputWorkspace");
// Try to get the column. This will throw if the column does not exist. // Try to get the column. This will throw if the column does not exist.
inputWS->getColumn(columnToSortBy); inputWS->getColumn(columnToSortBy);
...@@ -68,7 +68,6 @@ void SortPeaksWorkspace::exec() { ...@@ -68,7 +68,6 @@ void SortPeaksWorkspace::exec() {
outputWS = inputWS->clone(); outputWS = inputWS->clone();
} }
// Perform the sorting.
std::vector<PeaksWorkspace::ColumnAndDirection> sortCriteria; std::vector<PeaksWorkspace::ColumnAndDirection> sortCriteria;
sortCriteria.emplace_back(columnToSortBy, sortAscending); sortCriteria.emplace_back(columnToSortBy, sortAscending);
outputWS->sort(sortCriteria); outputWS->sort(sortCriteria);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment