OpenFOAM logo
Open Source CFD Toolkit

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.
template<class List>
void inplaceRenumber (const labelList &oldToNew, List &)
 Inplace renumber the values of a list.
template<class List>
List reorder (const labelList &oldToNew, const List &)
 Reorder the elements (indices, not values) of a list. Does not do any.
template<class List>
void inplaceReorder (const labelList &oldToNew, List &)
 Inplace reorder the elements of a list. Does not do any.
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>
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,.


Function Documentation

List extract const UList< T > &  regions,
const T &  region,
const List & 
 

Extract elements of List whose region is certain value. Use e.g.

to extract all selected elements: extract<boolList, labelList>(selectedElems, true, lst);

label findIndex const List &  ,
typename List::const_reference 
 

Find first occurence of given element and return index,.

return -1 if not found. Linear search.

label findLower const List &  ,
typename List::const_reference 
 

Find last element < given value in sorted list and return index,.

return -1 if not found. Binary search.

label findMax const List &   ) 
 

Find index of max element (and larger than given element).

return -1 if not found. Linear search.

label findMin const List &   ) 
 

Find index of min element (and less than given element).

return -1 if not found. Linear search.

label findSortedIndex const List &  ,
typename List::const_reference 
 

Find first occurence of given element in sorted list and return index,.

return -1 if not found. Binary search.

labelList identity const label  len  ) 
 

Create identity map (map[i] == i) of given length.

void inplaceRenumber const labelList oldToNew,
List & 
 

Inplace renumber the values of a list.

void inplaceReorder const labelList oldToNew,
List & 
 

Inplace reorder the elements of a list. Does not do any.

check for illegal indices.

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.

List renumber const labelList oldToNew,
const List & 
 

Renumber the values (not the indices) of a list.

List reorder const labelList oldToNew,
const List & 
 

Reorder the elements (indices, not values) of a list. Does not do any.

check for illegal indices (e.g. -1)

For further information go to www.openfoam.org