36 "An input workspace.");
38 "An output workspace.");
40 auto mustHave = std::make_shared<MandatoryValidator<std::string>>();
41 declareProperty(
"ColumnNameToSortBy",
"", mustHave,
"Column to sort by");
43 declareProperty(
"SortAscending",
true,
"Sort the OutputWorkspace by the target column in a Ascending fashion.");
50 const std::string columnToSortBy =
getProperty(
"ColumnNameToSortBy");
51 const bool sortAscending =
getProperty(
"SortAscending");
56 inputWS->getColumn(columnToSortBy);
58 if (inputWS != outputWS) {
59 outputWS = inputWS->clone();
62 std::vector<PeaksWorkspace::ColumnAndDirection> sortCriteria;
63 sortCriteria.emplace_back(columnToSortBy, sortAscending);
64 outputWS->sort(sortCriteria);
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
A property class for workspaces.
SortPeaksWorkspace : Sort a PeaksWorkspace by a range of properties.
int version() const override
Algorithm's version for identification.
const std::string category() const override
Algorithm's category for identification.
void init() override
Initialize the algorithm's properties.
void exec() override
Execute the algorithm.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
std::shared_ptr< IPeaksWorkspace > IPeaksWorkspace_sptr
shared pointer to Mantid::API::IPeaksWorkspace
@ Input
An input workspace.
@ Output
An output workspace.