Various utility functions to work on Lists. More...
Classes | |
| struct | appendEqOp |
| List helper to append y elements onto the end of x. More... | |
| struct | uniqueEqOp |
| List helper to append y unique elements onto the end of x. More... | |
| struct | unionEqOp |
| List helper to add y unique elements to x. More... | |
| struct | less |
| A list compare binary predicate for normal sort. More... | |
| struct | greater |
| A list compare binary predicate for reverse sort. More... | |
Functions | |
| template<class Type1, class Type2> | |
| bool | equal (const UList< Type1 > &a, const UList< Type2 > &b) |
| Test for list equality with different but compatible data types. Eg, int32 and int64. | |
| template<class Type1, class Type2, class BinaryPredicate> | |
| bool | equal (const UList< Type1 > &a, const UList< Type2 > &b, BinaryPredicate pred) |
| Test for list equality with different but compatible data types. | |
| void | identity (labelUList &map, label start=0) |
| Fill an identity map with (map[i] == i). | |
| template<class ListType> | |
| label | count (const ListType &input, typename ListType::const_reference val, const label start=0) |
| Count the occurrences of the given element. | |
| template<class ListType, class UnaryPredicate> | |
| label | count_if (const ListType &input, const UnaryPredicate &pred, const label start=0) |
| Count the number of matching entries. | |
| template<class ListType, class UnaryPredicate> | |
| label | find_if (const ListType &input, const UnaryPredicate &pred, const label start=0) |
| Find index of the first occurrence that satisfies the predicate. | |
| template<class ListType, class UnaryPredicate> | |
| label | find (const ListType &input, const UnaryPredicate &pred, const label start=0) |
| Same as ListOps::find_if. | |
| template<class ListType, class UnaryPredicate> | |
| 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. | |
| template<class ListType, class UnaryPredicate> | |
| bool | found (const ListType &input, const UnaryPredicate &pred, const label start=0) |
| Same as found_if. | |
| template<class ListType, class UnaryPredicate> | |
| labelList | findIndices (const ListType &input, const UnaryPredicate &pred, label start=0) |
| Linear search to find all occurences of given element. | |
| template<class T> | |
| void | setValue (UList< T > &list, const labelUList &locations, const T &val) |
| Set various locations of the list with a specified value. | |
| template<class T> | |
| void | setValue (UList< T > &list, const labelHashSet &locations, const T &val) |
| Set various locations of the list with a specified value. | |
| template<class T> | |
| void | setValue (UList< T > &list, const UList< bool > &locations, const T &val) |
| Set various locations of the list with a specified value. | |
| template<class T> | |
| void | setValue (UList< T > &list, const bitSet &locations, const T &val) |
| Set various locations of the list with a specified value. | |
| template<class T, class T2, class UnaryOperation> | |
| List< T > | create (const UList< T2 > &input, const UnaryOperation &op) |
| Create a List from a List of a dissimilar type, using the entire list. | |
| template<class T, class InputIterator, class UnaryOperation> | |
| List< T > | create (InputIterator first, InputIterator last, const UnaryOperation &op) |
| Create a List from an iterator range [first,last) of a dissimilar type. | |
| template<class T> | |
| 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. | |
| template<class T> | |
| List< T > | createWithValue (const label len, const labelHashSet &locations, const T &val, const T &deflt=T()) |
| Create a List filled with default values and various locations with another specified value. | |
| template<class T> | |
| List< T > | createWithValue (const label len, const UList< bool > &locations, const T &val, const T &deflt=T()) |
| Create a List filled with default values and various locations with another specified value. | |
| template<class T> | |
| List< T > | createWithValue (const label len, const bitSet &locations, const T &val, const T &deflt=T()) |
| Create a List filled with default values and various locations with another specified value. | |
| template<class T> | |
| List< T > | createWithValue (const label len, const label index, const T &val, const T &deflt=T()) |
| Create a List filled with default values and one specified value, which is copy assigned at the specified index. | |
| template<class T> | |
| List< T > | createWithValue (const label len, const label index, T &&val, const T &deflt=T()) |
| Create a List filled with default values and one specified value, which is move assigned at the specified index. | |
| bool equal | ( | const UList< Type1 > & | a, |
| const UList< Type2 > & | b ) |
Test for list equality with different but compatible data types. Eg, int32 and int64.
Definition at line 1120 of file ListOpsTemplates.C.
References b, UList< T >::cbegin(), UList< T >::cend(), and UList< T >::size().

| bool equal | ( | const UList< Type1 > & | a, |
| const UList< Type2 > & | b, | ||
| BinaryPredicate | pred ) |
Test for list equality with different but compatible data types.
Definition at line 1135 of file ListOpsTemplates.C.
References b, UList< T >::cbegin(), UList< T >::cend(), and UList< T >::size().

|
inline |
Fill an identity map with (map[i] == i).
Optionally with an alternative start index, so that (map[i] == i+start)
Definition at line 796 of file ListOps.H.
References Foam::identity(), and identity().
Referenced by identity().


| label count | ( | const ListType & | input, |
| typename ListType::const_reference | val, | ||
| const label | start = 0 ) |
Count the occurrences of the given element.
When start is specified, any occurrences before start are ignored. Like std::count but works with list indexing
| label count_if | ( | const ListType & | input, |
| const UnaryPredicate & | pred, | ||
| const label | start = 0 ) |
Count the number of matching entries.
When start is specified, any occurrences before start are ignored. Linear search. Like std::count_if but works with list indexing
| label find_if | ( | const ListType & | input, |
| const UnaryPredicate & | pred, | ||
| const label | start = 0 ) |
Find index of the first occurrence that satisfies the predicate.
When start is specified, any occurrences before start are ignored. Linear search. Like std::find_if but works with list indexing.
Referenced by find(), and found_if().

| label find | ( | const ListType & | input, |
| const UnaryPredicate & | pred, | ||
| const label | start = 0 ) |
Same as ListOps::find_if.
Definition at line 854 of file ListOps.H.
References find_if().

| 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.
When start is specified, any occurrences before start are ignored. Linear search.
Definition at line 1230 of file ListOpsTemplates.C.
References find_if().
Referenced by found().


| bool found | ( | const ListType & | input, |
| const UnaryPredicate & | pred, | ||
| const label | start = 0 ) |
Same as found_if.
Definition at line 885 of file ListOps.H.
References found_if().
Referenced by ABAQUSsurfaceFormat< Face >::write(), NASsurfaceFormat< Face >::write(), STARCDsurfaceFormat< Face >::write(), writeObjects::write(), starcdWriter::write(), nastranWriter::writeTemplate(), and starcdWriter::writeTemplate().


| labelList findIndices | ( | const ListType & | input, |
| const UnaryPredicate & | pred, | ||
| label | start = 0 ) |
Linear search to find all occurences of given element.
References Foam::T().

| void setValue | ( | UList< T > & | list, |
| const labelUList & | locations, | ||
| const T & | val ) |
Set various locations of the list with a specified value.
| list | the list to modify |
| locations | where to apply the specified value An out-of-range index is silently ignored. |
| val | the value to set at the specified locations |
Definition at line 1291 of file ListOpsTemplates.C.
References UList< T >::size(), and Foam::T().

| void setValue | ( | UList< T > & | list, |
| const labelHashSet & | locations, | ||
| const T & | val ) |
Set various locations of the list with a specified value.
| list | the list to modify |
| locations | where to apply the specified value An out-of-range index is silently ignored. |
| val | the value to set at the specified locations |
Definition at line 1312 of file ListOpsTemplates.C.
References UList< T >::size(), and Foam::T().

| void setValue | ( | UList< T > & | list, |
| const UList< bool > & | locations, | ||
| const T & | val ) |
Set various locations of the list with a specified value.
| list | the list to modify |
| locations | where to apply the specified value An out-of-range index is silently ignored. |
| val | the value to set at the specified locations |
Definition at line 1333 of file ListOpsTemplates.C.
References Foam::min(), UList< T >::size(), and Foam::T().

Set various locations of the list with a specified value.
| list | the list to modify |
| locations | where to apply the specified value An out-of-range index is silently ignored. |
| val | the value to set at the specified locations |
Definition at line 1354 of file ListOpsTemplates.C.
References bitSet::find_first(), bitSet::find_next(), Foam::pos(), UList< T >::size(), and Foam::T().

| List< T > create | ( | const UList< T2 > & | input, |
| const UnaryOperation & | op ) |
Create a List from a List of a dissimilar type, using the entire list.
For example, convert a list of ints to floats, vectors etc.
| input | the list input values. |
| op | the unary conversion operator, which can be used to convert to other types. |
Referenced by distanceSurface::filterRegionProximity(), and triSurface::transfer().

| List< T > create | ( | InputIterator | first, |
| InputIterator | last, | ||
| const UnaryOperation & | op ) |
Create a List from an iterator range [first,last) of a dissimilar type.
Uses std::distance for the size.
| first | the begin of the iterator range |
| last | the end of the iterator range |
| op | the unary conversion operator, which can be used to convert to other types. |
| 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.
| len | the length of the list |
| locations | where to apply the specified value An out-of-range index is silently ignored. |
| val | the value to set at the specified locations |
| deflt | the initialization default value |
References Foam::T().
Referenced by mapDistributePolyMesh::distributeCellIndices(), mapDistributePolyMesh::distributeFaceIndices(), mapDistributePolyMesh::distributePatchIndices(), mapDistributePolyMesh::distributePointIndices(), distanceSurface::filterFaceProximity(), and distanceSurface::filterRegionProximity().


| List< T > createWithValue | ( | const label | len, |
| const labelHashSet & | locations, | ||
| const T & | val, | ||
| const T & | deflt = T() ) |
Create a List filled with default values and various locations with another specified value.
| len | the length of the list |
| locations | where to apply the specified value An out-of-range index is silently ignored. |
| val | the value to set at the specified locations |
| deflt | the initialization default value |
References Foam::T().

| List< T > createWithValue | ( | const label | len, |
| const UList< bool > & | locations, | ||
| const T & | val, | ||
| const T & | deflt = T() ) |
Create a List filled with default values and various locations with another specified value.
| len | the length of the list |
| locations | where to apply the specified value An out-of-range index is silently ignored. |
| val | the value to set at the specified locations |
| deflt | the initialization default value |
References Foam::T().

| List< T > createWithValue | ( | const label | len, |
| const bitSet & | locations, | ||
| const T & | val, | ||
| const T & | deflt = T() ) |
Create a List filled with default values and various locations with another specified value.
| len | the length of the list |
| locations | where to apply the specified value An out-of-range index is silently ignored. |
| val | the value to set at the specified locations |
| deflt | the initialization default value |
References Foam::T().

| List< T > createWithValue | ( | const label | len, |
| const label | index, | ||
| const T & | val, | ||
| const T & | deflt = T() ) |
Create a List filled with default values and one specified value, which is copy assigned at the specified index.
| len | the length of the list |
| index | where to apply the specified value. An out-of-range index is silently ignored. |
| val | the value to copy assign at the specified index |
| deflt | the initialization default value |
References Foam::T().

| List< T > createWithValue | ( | const label | len, |
| const label | index, | ||
| T && | val, | ||
| const T & | deflt = T() ) |
Create a List filled with default values and one specified value, which is move assigned at the specified index.
| len | the length of the list |
| index | where to apply the specified value. An out-of-range index is silently ignored. |
| val | the value to move assign at the specified index |
| deflt | the initialization default value |
For example,
References Foam::T().
