45 #ifndef Foam_ListOps_H 46 #define Foam_ListOps_H 64 template<
class IntListType>
69 template<
class IntListType>
78 template<
class ListType>
82 const ListType&
input,
83 const bool prune =
false 91 template<
class ListType>
96 const bool prune =
false 103 template<
unsigned W
idth>
107 const PackedList<Width>&
input,
108 const bool prune =
false 114 template<
unsigned W
idth>
118 PackedList<Width>&
input,
119 const bool prune =
false 129 const bool prune =
false 138 const bool prune =
false 144 template<
class Container>
149 template<
class Container>
178 template<
class Container>
192 template<
class T,
class ListComparePredicate>
195 const UList<T>&
input,
197 const ListComparePredicate& comp
211 template<
class T,
class ListComparePredicate>
214 const UList<T>&
input,
216 const ListComparePredicate& comp
226 template<
class ListType>
231 template<
class ListType,
class ListComparePredicate>
235 const ListComparePredicate& comp
254 template<
class BoolListType,
class T>
257 const BoolListType&
select,
258 const UList<T>&
input,
274 const UList<T>&
input,
286 template<
class BoolListType,
class ListType>
289 const BoolListType&
select,
302 template<
class ListType>
318 template<
class T,
class UnaryPredicate>
321 const UList<T>&
input,
322 const UnaryPredicate& pred,
333 template<
class ListType,
class UnaryPredicate>
337 const UnaryPredicate& pred,
371 template<
class InputIntListType,
class OutputIntListType>
375 const UList<InputIntListType>&
input,
376 List<OutputIntListType>&
output 379 template<
class InputIntListType,
class OutputIntListType>
383 const UList<InputIntListType>&
input 386 List<OutputIntListType>
output;
387 invertManyToMany<InputIntListType,OutputIntListType>(len,
input,
output);
395 template<
class ListType>
399 const ListType&
input,
400 typename ListType::const_reference val,
404 return input.find(val, start);
409 template<
class ListType>
412 const ListType&
input,
413 typename ListType::const_reference val,
427 template<
class ListType>
439 template<
class ListType>
453 template<
class ListType>
471 template<
class ListType>
474 const ListType&
input,
475 typename ListType::const_reference val,
498 template<
class ListType,
class T,
class ComparePredicate>
501 const ListType&
input,
504 const ComparePredicate& comp
522 template<
class ListType,
class T>
525 const ListType&
input,
532 template<
class ListType>
537 template<
class ListType>
544 template<
class ListType>
545 ListType
rotateList(
const ListType& list,
const label
n);
549 template<
template<
typename>
class ListType,
class DataType>
584 template<
class ListType>
589 less(
const ListType& list)
594 bool operator()(
const label a,
const label
b)
const 602 template<
class ListType>
612 bool operator()(
const label a,
const label
b)
const 632 template<
class ListType,
class UnaryPredicate>
635 const ListType&
input,
636 const UnaryPredicate& pred,
646 template<
class ListType,
class UnaryPredicate>
649 const ListType&
input,
650 const UnaryPredicate& pred,
656 template<
class ListType,
class UnaryPredicate>
659 const ListType&
input,
660 const UnaryPredicate& pred,
672 template<
class ListType,
class UnaryPredicate>
675 const ListType&
input,
676 const UnaryPredicate& pred,
682 template<
class ListType,
class UnaryPredicate>
685 const ListType&
input,
686 const UnaryPredicate& pred,
695 template<
class ListType,
class UnaryPredicate>
698 const ListType&
input,
699 const UnaryPredicate& pred,
791 template<
class T,
class T2,
class UnaryOperation>
795 const UnaryOperation& op
806 template<
class T,
class InputIterator,
class UnaryOperation>
811 const UnaryOperation& op
List< T > uniqueSort(const UList< T > &input)
Return sorted list with removal of duplicates.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as ListOps::find_if.
label findMax(const ListType &input, label start=0)
Linear search for the index of the max element, similar to std::max_element but for lists and returns...
void operator()(labelList &x, const labelList &y) const
label findLower(const ListType &input, const T &val, const label start, const ComparePredicate &comp)
Binary search to find the index of the last element in a sorted list that is less than value...
label count_if(const ListType &input, const UnaryPredicate &pred, const label start=0)
Count the number of matching entries.
labelPair findMinMax(const ListType &input, label start=0)
Linear search for the index of the min/max element, similar to std::minmax_element but for lists and ...
labelList findIndices(const ListType &input, const UnaryPredicate &pred, label start=0)
Linear search to find all occurences of given element.
bool operator()(const label a, const label b) const
bool found(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as found_if.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
ListType rotateList(const ListType &list, const label n)
Rotate a list by n places.
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
labelList duplicateOrder(const UList< T > &input)
Return (sorted) indices corresponding to duplicate list values.
List< bool > select(const label n, const labelUList &locations)
Construct a selection list of bools (all false) with the given pre-size, subsequently add specified l...
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
label findSortedIndex(const ListType &input, typename ListType::const_reference val, const label start=0)
Binary search to find the index of the last element in a sorted list that is less than value...
Various functors for unary and binary operations. Can be used for parallel combine-reduce operations ...
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
label inplaceMapValue(const labelUList &oldToNew, Container &input)
Map values. Ignore negative values.
greater(const ListType &list)
void inplaceSubset(const BoolListType &select, ListType &input, const bool invert=false)
Inplace extract elements of the input list when select is true.
List< labelList > labelListList
List of labelList.
static bool less(const vector &x, const vector &y)
To compare normals.
UList< label > labelUList
A UList of labels.
void inplaceSubsetList(ListType &input, const UnaryPredicate &pred, const bool invert=false)
Inplace subset of the list when predicate is true.
void operator()(List< T > &x, const List< T > &y) const
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
bool found_if(const ListType &input, const UnaryPredicate &pred, const label start=0)
True if there is a value in the list that satisfies the predicate.
label findMin(const ListType &input, label start=0)
Linear search for the index of the min element, similar to std::min_element but for lists and returns...
ListType reverseList(const ListType &input)
Reverse a list. First element becomes last element etc.
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
List< T > subsetList(const UList< T > &input, const UnaryPredicate &pred, const bool invert=false)
Copy a subset of the input list when predicate is true.
void identity(labelUList &map, label start=0)
Fill an identity map with (map[i] == i)
static Istream & input(Istream &is, IntRange< T > &range)
void operator()(List< T > &x, const List< T > &y) const
void inplaceUniqueSort(ListType &input)
Inplace sorting and removal of duplicates.
#define FOAM_DEPRECATED_STRICT(since, replacement)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
List< T > create(const UList< T2 > &input, const UnaryOperation &op)
Create a List from a List of a dissimilar type, using the entire list.
Pair< label > labelPair
A pair of labels.
void inplaceMapKey(const labelUList &oldToNew, Container &input)
Rewrite with mapped keys. Ignore elements with negative key.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
labelList uniqueOrder(const UList< T > &input)
Return (sorted) indices corresponding to unique list values.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
List< T > subset(const BoolListType &select, const UList< T > &input, const bool invert=false)
Extract elements of the input list when select is true.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void inplaceRotateList(ListType< DataType > &list, label n)
Inplace reversal of a list using the Reversal Block Swapping algorithm.
label find_if(const ListType &input, const UnaryPredicate &pred, const label start=0)
Find index of the first occurrence that satisfies the predicate.
static Ostream & output(Ostream &os, const IntRange< T > &range)
bool operator()(const label a, const label b) const
List< T > createWithValue(const label len, const labelUList &locations, const T &val, const T &deflt=T())
Create a List filled with default values and various locations with another specified value...
label findIndex(const ListType &input, typename ListType::const_reference val, const label start=0)
Deprecated(2017-10) search for first occurrence of the given element.
List< label > labelList
A List of labels.
void setValue(UList< T > &list, const labelUList &locations, const T &val)
Set various locations of the list with a specified value.
void invertManyToMany(const label len, const UList< InputIntListType > &input, List< OutputIntListType > &output)
Invert many-to-many.
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
Reorder the elements of a list.
void inplaceReverseList(ListType &input)
Inplace reversal of a list using Swap.
less(const ListType &list)