35 const UPtrList<T>& list
47 const UPtrList<T>& list,
55 template<
class T,
class ListComparePredicate>
58 const UPtrList<T>& list,
60 const ListComparePredicate& comp
68 for (label& item : order)
74 std::stable_sort(order.begin(), order.end(), comp);
86 list.sortOrder(order,
false);
91 template<
class ReturnType,
class T,
class AccessOp>
94 const UPtrList<T>& list,
98 const label len = list.size();
100 List<ReturnType>
output(len);
103 for (label i = 0; i < len; ++i)
105 const T* ptr = list.get(i);
119 template<
class T,
class UnaryMatchPredicate>
122 const UPtrList<T>& list,
123 const UnaryMatchPredicate& matcher
128 const label len = list.
size();
133 for (label i = 0; i < len; ++i)
135 const T* ptr = list.get(i);
137 if (
bool(ptr) && matcher(ptr->name()))
152 const UPtrList<T>& list
159 template<
class T,
class UnaryMatchPredicate>
162 const UPtrList<T>& list,
163 const UnaryMatchPredicate& matcher
166 const label len = list.size();
168 for (label i = 0; i < len; ++i)
170 const T* ptr = list.get(i);
172 if (
bool(ptr) && matcher(ptr->name()))
182 template<
class T,
class UnaryMatchPredicate>
185 const UPtrList<T>& list,
186 const UnaryMatchPredicate& matcher
189 const label len = list.
size();
194 for (label i = 0; i < len; ++i)
196 const T* ptr = list.get(i);
198 if (
bool(ptr) && matcher(ptr->name()))
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
void size(const label n)
Older name for setAddressableSize.
labelList findMatching(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
Extract list indices for all items with 'name()' that matches.
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
List of names generated by calling name() for each list item and filtered for matches.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
Functions to operate on Pointer Lists.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
static Ostream & output(Ostream &os, const IntRange< T > &range)
List< label > labelList
A List of labels.
void shuffle(UList< T > &list)
Randomise the list order.
label firstMatching(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
Find first list item with 'name()' that matches, -1 on failure.
A UPtrList compare binary predicate for normal sort order. Null entries (if any) sort to the end...