Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
a336cd41
Commit
a336cd41
authored
6 years ago
by
Sam
Committed by
Samuel Jones
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Re #22515 ClangFormat
Re #22515
parent
aa602c15
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/Algorithms/inc/MantidAlgorithms/SortXAxis2.h
+1
-1
1 addition, 1 deletion
Framework/Algorithms/inc/MantidAlgorithms/SortXAxis2.h
Framework/Algorithms/src/SortXAxis2.cpp
+11
-10
11 additions, 10 deletions
Framework/Algorithms/src/SortXAxis2.cpp
with
12 additions
and
11 deletions
Framework/Algorithms/inc/MantidAlgorithms/SortXAxis2.h
+
1
−
1
View file @
a336cd41
...
...
@@ -71,7 +71,7 @@ private:
Mantid
::
API
::
MatrixWorkspace_const_sptr
inputWorkspace
,
Mantid
::
API
::
MatrixWorkspace_sptr
outputWorkspace
,
const
size_t
sizeOfX
,
const
size_t
sizeOfY
,
unsigned
int
specNum
);
unsigned
int
specNum
);
};
}
// namespace Algorithms
...
...
This diff is collapsed.
Click to expand it.
Framework/Algorithms/src/SortXAxis2.cpp
+
11
−
10
View file @
a336cd41
...
...
@@ -69,14 +69,13 @@ std::vector<std::size_t> SortXAxis::createIndexes(const size_t sizeOfX) {
template
<
typename
Comparator
>
void
sortByXValue
(
std
::
vector
<
std
::
size_t
>
&
workspaceIndicies
,
MatrixWorkspace_const_sptr
inputWorkspace
,
unsigned
int
specNum
,
Comparator
const
&
compare
)
{
std
::
sort
(
workspaceIndicies
.
begin
(),
workspaceIndicies
.
end
(),
[
&
](
std
::
size_t
lhs
,
std
::
size_t
rhs
)
->
bool
{
return
compare
(
inputWorkspace
->
x
(
specNum
)[
lhs
],
inputWorkspace
->
x
(
specNum
)[
rhs
]);
});
MatrixWorkspace_const_sptr
inputWorkspace
,
unsigned
int
specNum
,
Comparator
const
&
compare
)
{
std
::
sort
(
workspaceIndicies
.
begin
(),
workspaceIndicies
.
end
(),
[
&
](
std
::
size_t
lhs
,
std
::
size_t
rhs
)
->
bool
{
return
compare
(
inputWorkspace
->
x
(
specNum
)[
lhs
],
inputWorkspace
->
x
(
specNum
)[
rhs
]);
});
}
void
SortXAxis
::
sortIndicesByX
(
std
::
vector
<
std
::
size_t
>
&
workspaceIndicies
,
...
...
@@ -84,9 +83,11 @@ void SortXAxis::sortIndicesByX(std::vector<std::size_t> &workspaceIndicies,
MatrixWorkspace_const_sptr
inputWorkspace
,
unsigned
int
specNum
)
{
if
(
order
==
"Ascending"
)
{
sortByXValue
(
workspaceIndicies
,
inputWorkspace
,
specNum
,
std
::
less
<
double
>
());
sortByXValue
(
workspaceIndicies
,
inputWorkspace
,
specNum
,
std
::
less
<
double
>
());
}
else
if
(
order
==
"Descending"
)
{
sortByXValue
(
workspaceIndicies
,
inputWorkspace
,
specNum
,
std
::
greater
<
double
>
());
sortByXValue
(
workspaceIndicies
,
inputWorkspace
,
specNum
,
std
::
greater
<
double
>
());
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment