31 template<
class UnaryMatchPredicate,
class StringType>
34 const UnaryMatchPredicate& matcher,
35 const UList<StringType>&
input,
39 const label len =
input.size();
41 for (label i=0; i < len; ++i)
53 template<
class UnaryMatchPredicate,
class StringType>
56 const UnaryMatchPredicate& matcher,
57 const UList<StringType>&
input,
61 const label len =
input.size();
66 for (label i=0; i < len; ++i)
74 indices.resize(
count);
80 template<
class UnaryMatchPredicate,
class StringListType>
83 const UnaryMatchPredicate& matcher,
84 const StringListType&
input,
88 const label len =
input.size();
90 StringListType
output(len);
94 for (label i=0; i < len; ++i)
108 template<
class UnaryMatchPredicate,
class StringListType>
111 const UnaryMatchPredicate& matcher,
112 StringListType&
input,
116 const label len =
input.size();
119 for (label i=0; i < len; ++i)
134 template<
class StringListType,
class AccessOp>
137 const StringListType&
input,
138 const wordRes::filter& pred,
142 const label len =
input.size();
153 for (label i=0; i < len; ++i)
155 const std::string& text = aop(
input[i]);
163 indices.resize(
count);
169 template<
class StringListType,
class AccessOp>
172 const StringListType&
input,
173 const wordRes& allow,
178 if (allow.empty() && deny.empty())
185 const wordRes::filter pred(allow, deny);
StringListType subsetMatchingStrings(const UnaryMatchPredicate &matcher, const StringListType &input, const bool invert=false)
Extract elements of StringList when regular expression matches.
labelList findMatching(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
Extract list indices for all items with 'name()' that matches.
labelList findMatchingStrings(const UnaryMatchPredicate &matcher, const UList< StringType > &input, const bool invert=false)
Extract list indices for all matches.
label firstMatchingString(const UnaryMatchPredicate &matcher, const UList< StringType > &input, const bool invert=false)
Find first list item that matches, -1 on failure.
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), works like std::iota() but returning a...
static Istream & input(Istream &is, IntRange< T > &range)
labelList findMatching(const StringListType &input, const wordRes::filter &pred, AccessOp aop=identityOp())
Return ids for items with matching names.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
static Ostream & output(Ostream &os, const IntRange< T > &range)
List< label > labelList
A List of labels.
void inplaceSubsetMatchingStrings(const UnaryMatchPredicate &matcher, StringListType &input, const bool invert=false)
Inplace extract elements of StringList when regular expression matches.