24 : storage(std::move(other)) {}
30 : storage(
std::move(other.storage)) {}
35 for (
Size i = 0; i < n; ++i) {
41 storage = std::move(other.storage);
46 template <
typename TBinaryPredicate>
47 void shuffle(TBinaryPredicate&& predicate) {
48 std::sort(storage.
begin(), storage.
end(), predicate);
54 for (
Size i = 0; i < storage.
size(); ++i) {
55 inverted[storage[i]] = i;
62 return storage.
clone();
68 for (
Size i = 0; i < storage.
size(); ++i) {
69 composed[i] = storage[other[i]];
78 for (
Size i = 0; i < input.
size(); ++i) {
79 sorted[i] = input[storage[i]];
89 return storage.
size();
93 return storage == other.storage;
100 template <
typename TLess = std::less<Float>>
103 order.shuffle([values, &
less](
Size i,
Size j) {
return less(values[i], values[j]); });
104 return order.getInverted();
INLINE auto less(const AntisymmetricTensor &t1, const AntisymmetricTensor &t2)
Generic dynamically allocated resizable storage.
uint32_t Size
Integral type used to index arrays (by default).
Vectorized computations with integral numbers.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
INLINE Order getOrder(ArrayView< const Float > values, const TLess less=TLess{})
Finds the order of values in given array.
INLINE TCounter size() const
INLINE Iterator< StorageType > end() noexcept
INLINE void push(U &&u)
Adds new element to the end of the array, resizing the array if necessary.
INLINE TCounter size() const noexcept
INLINE Iterator< StorageType > begin() noexcept
Array clone() const
Performs a deep copy of all elements of the array.
Permutation, i.e. (discrete) invertible function int->int.
Array< T > apply(const Array< T > &input)
Shuffles given array using this order.
INLINE bool operator==(const Order &other) const
Order(const Size n)
Construct identity of given size.
Order compose(const Order &other) const
Composes two orders.
void shuffle(TBinaryPredicate &&predicate)
Shuffles the order using a binary predicate.
Order & operator=(Order &&other)
INLINE Size operator[](const Size idx) const
Order getInverted() const
Returns the inverted order.
Order clone() const
Clones the order.
Overload of std::swap for Sph::Array.
Object with deleted copy constructor and copy operator.