File tree Expand file tree Collapse file tree 4 files changed +29
-0
lines changed Expand file tree Collapse file tree 4 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include " ArgSort.h"
Original file line number Diff line number Diff line change
1
+ #ifndef PBAT_COMMON_ARG_SORT_H
2
+ #define PBAT_COMMON_ARG_SORT_H
3
+
4
+ #include < algorithm>
5
+ #include < concepts>
6
+ #include < iterator>
7
+ #include < numeric>
8
+ #include < vector>
9
+
10
+ namespace pbat {
11
+ namespace common {
12
+
13
+ template <std::integral TIndex, class FLess >
14
+ std::vector<TIndex> ArgSort (auto n, FLess less)
15
+ {
16
+ std::vector<TIndex> inds (n);
17
+ std::iota (inds.begin (), inds.end (), TIndex (0 ));
18
+ std::sort (inds.begin (), inds.end (), less);
19
+ return inds;
20
+ }
21
+
22
+ } // namespace common
23
+ } // namespace pbat
24
+
25
+ #endif // PBAT_COMMON_ARG_SORT_H
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ target_sources(PhysicsBasedAnimationToolkit_PhysicsBasedAnimationToolkit
2
2
PUBLIC
3
3
FILE_SET api
4
4
FILES
5
+ "ArgSort.h"
5
6
"Common.h"
6
7
"Concepts.h"
7
8
"ConstexprFor.h"
@@ -13,6 +14,7 @@ target_sources(PhysicsBasedAnimationToolkit_PhysicsBasedAnimationToolkit
13
14
)
14
15
target_sources (PhysicsBasedAnimationToolkit_PhysicsBasedAnimationToolkit
15
16
PRIVATE
17
+ "ArgSort.cpp"
16
18
"Eigen.cpp"
17
19
"Indexing.cpp"
18
20
"Queue.cpp"
Original file line number Diff line number Diff line change 1
1
#ifndef PBAT_COMMON_COMMON_H
2
2
#define PBAT_COMMON_COMMON_H
3
3
4
+ #include "ArgSort.h"
4
5
#include "Concepts.h"
5
6
#include "ConstexprFor.h"
6
7
#include "Eigen.h"
You can’t perform that action at this time.
0 commit comments