FreeFOAM The Cross-Platform CFD Toolkit
ListOps.H File Reference

Various functions to operate on Lists. More...


Detailed Description

+ Include dependency graph for ListOps.H:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Foam
 Namespace for OpenFOAM.

Functions

template<class ListType >
ListType renumber (const UList< label > &oldToNew, const ListType &)
 Renumber the values (not the indices) of a list.
template<class ListType >
void inplaceRenumber (const UList< label > &oldToNew, ListType &)
 Inplace renumber the values of a list.
template<class ListType >
ListType reorder (const UList< label > &oldToNew, const ListType &)
 Reorder the elements (indices, not values) of a list.
template<class ListType >
void inplaceReorder (const UList< label > &oldToNew, ListType &)
 Inplace reorder the elements of a list.
template<class Container >
void inplaceMapValue (const UList< label > &oldToNew, Container &)
 Map values. Do not map negative values.
template<class Container >
void inplaceMapKey (const UList< label > &oldToNew, Container &)
 Recreate with mapped keys. Do not map elements with negative key.
template<class T >
void sortedOrder (const UList< T > &, labelList &order)
 Generate the (stable) sort order for the list.
template<class T >
void duplicateOrder (const UList< T > &, labelList &order)
 Generate (sorted) indices corresponding to duplicate list values.
template<class T >
void uniqueOrder (const UList< T > &, labelList &order)
 Generate (sorted) indices corresponding to unique list values.
template<class T , class ListType >
ListType subset (const UList< T > &select, const T &value, const ListType &)
 Extract elements of List when select is a certain value.
template<class T , class ListType >
void inplaceSubset (const UList< T > &select, const T &value, ListType &)
 Inplace extract elements of List when select is a certain value.
template<class BoolListType , class ListType >
ListType subset (const BoolListType &select, const ListType &)
 Extract elements of List when select is true.
template<class BoolListType , class ListType >
void inplaceSubset (const BoolListType &select, ListType &)
 Inplace extract elements of List when select is true.
labelList invert (const label len, const UList< label > &)
 Invert one-to-one map. Unmapped elements will be -1.
labelListList invertOneToMany (const label len, const UList< label > &)
 Invert one-to-many map. Unmapped elements will be size 0.
template<class InList , class OutList >
void invertManyToMany (const label len, const UList< InList > &, List< OutList > &)
 Invert many-to-many.
template<class InList , class OutList >
List< OutList > invertManyToMany (const label len, const UList< InList > &in)
labelList identity (const label len)
 Create identity map (map[i] == i) of given length.
template<class ListType >
label findIndex (const ListType &, typename ListType::const_reference, const label start=0)
 Find first occurence of given element and return index,.
template<class ListType >
labelList findIndices (const ListType &, typename ListType::const_reference, const label start=0)
 Find all occurences of given element. Linear search.
template<class ListType >
void setValues (ListType &, const UList< label > &indices, typename ListType::const_reference)
 Opposite of findIndices: set values at indices to given value.
template<class ListType >
ListType createWithValues (const label sz, typename ListType::const_reference initValue, const UList< label > &indices, typename ListType::const_reference setValue)
 Opposite of findIndices: set values at indices to given value.
template<class ListType >
label findMax (const ListType &, const label start=0)
 Find index of max element (and larger than given element).
template<class ListType >
label findMin (const ListType &, const label start=0)
 Find index of min element (and less than given element).
template<class ListType >
label findSortedIndex (const ListType &, typename ListType::const_reference, const label start=0)
 Find first occurence of given element in sorted list and return index,.
template<class ListType >
label findLower (const ListType &, typename ListType::const_reference, const label start=0)
 Find last element < given value in sorted list and return index,.
template<class Container , class T , int nRows>
List< Container > initList (const T[nRows])
 To construct a List from a C array. Has extra Container type.
template<class Container , class T , int nRows, int nColumns>
List< Container > initListList (const T[nRows][nColumns])
 To construct a (square) ListList from a C array. Has extra Container type.