OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen OpenCFD Solutions Contact OpenFOAM

ListOps.H File Reference


Detailed Description

View ListOps.H
License
This file is part of OpenFOAM.

OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.

OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Various functions to operate on Lists.

Source files

Definition in file ListOps.H.

Go to the source code of this file.


Namespaces

namespace  Foam

Functions

template<class List>
List renumber (const labelList &oldToNew, const List &)
 Renumber the values (not the indices) of a list. List elements <= 0 are.
template<class List>
void inplaceRenumber (const labelList &oldToNew, List &)
 Inplace renumber the values of a list. List elements <= 0 are.
template<class List>
List reorder (const labelList &oldToNew, const List &)
 Reorder the elements (indices, not values) of a list.
template<class List>
void inplaceReorder (const labelList &oldToNew, List &)
 Inplace reorder the elements of a list.
template<class T, class List>
List extract (const UList< T > &regions, const T &region, const List &)
 Extract elements of List whose region is certain value. Use e.g.
labelList invert (const label len, const labelList &oldToNew)
 Invert one-to-one map. Unmapped elements will be -1.
labelListList invertOneToMany (const label len, const labelList &)
 Invert one-to-many map. Unmapped elements will be size 0.
labelList identity (const label len)
 Create identity map (map[i] == i) of given length.
template<class List>
label findIndex (const List &, typename List::const_reference)
 Find first occurence of given element and return index,.
template<class List>
labelList findIndices (const List &, typename List::const_reference)
 Find all occurences of given element. Linear search.
template<class List>
void setValues (List &, const labelList &indices, typename List::const_reference)
 Opposite of findIndices: set values at indices to given value.
template<class List>
List createWithValues (const label sz, const typename List::const_reference initValue, const labelList &indices, typename List::const_reference setValue)
 Opposite of findIndices: set values at indices to given value.
template<class List>
label findMax (const List &)
 Find index of max element (and larger than given element).
template<class List>
label findMin (const List &)
 Find index of min element (and less than given element).
template<class List>
label findSortedIndex (const List &, typename List::const_reference)
 Find first occurence of given element in sorted list and return index,.
template<class List>
label findLower (const List &, typename List::const_reference)
 Find last element < given value in sorted list and return index,.
Copyright © 2000-2007 OpenCFD Ltd