void Foam::inplaceSubsetMatchingStrings ( const Matcher& matcher, StringListType& lst, const bool invert ) { label nElem = 0; forAll(lst, elemI) { if (matcher.match(lst[elemI]) ? !invert : invert) { lst[nElem++] = lst[elemI]; } } lst.setSize(nElem); }
StringListType Foam::subsetMatchingStrings ( const Matcher& matcher, const StringListType& lst, const bool invert ) { StringListType newLst(lst.size()); label nElem = 0; forAll(lst, elemI) { if (matcher.match(lst[elemI]) ? !invert : invert) { newLst[nElem++] = lst[elemI]; } } newLst.setSize(nElem); return newLst; }
Foam::labelList Foam::findMatchingStrings ( const Matcher& matcher, const UList<StringType>& lst, const bool invert ) { labelList indices(lst.size()); label nElem = 0; forAll(lst, elemI) { if (matcher.match(lst[elemI]) ? !invert : invert) { indices[nElem++] = elemI; } } indices.setSize(nElem); return indices; }