Foam::ListListOps Namespace Reference

Various utility functions to work on Lists of Lists (usually resulting from 'gather'ing and combining information from individual processors) More...

Functions

template<class ListType , class T >
ListType concat (List< T > &lists)
 Concatenate sub-lists (moving their content) into a single list. More...
 
template<class T >
label totalSize (const UList< T > &lists)
 The total size of all sub-lists. More...
 
template<class T , class AccessOp >
labelList subSizes (const UList< T > &lists, AccessOp aop=accessOp< T >())
 Return the sizes of the sub-lists. More...
 
template<class T , class AccessOp >
label sumSizes (const UList< T > &lists, AccessOp aop=accessOp< T >())
 The total size of all sub-lists. More...
 
template<class AccessType , class T , class AccessOp >
AccessType combine (const UList< T > &lists, AccessOp aop=accessOp< T >())
 Combines sub-lists into a single list. More...
 
template<class AccessType , class T , class AccessOp , class OffsetOp >
AccessType combineOffset (const UList< T > &lists, const labelUList &offsets, AccessOp aop, OffsetOp oop=offsetOp< T >())
 Like combine but also offsets sublists based on passed sizes. More...
 
template<class IntListListType >
void inplaceRenumber (const labelUList &oldToNew, IntListListType &lists)
 Inplace renumber the values (not the indices) of a list of lists. More...
 
template<class IntListListType >
void inplaceRenumber (const Map< label > &oldToNew, IntListListType &lists)
 Inplace renumber the values of a list of lists. More...
 

Detailed Description

Various utility functions to work on Lists of Lists (usually resulting from 'gather'ing and combining information from individual processors)

  • concat :
    simple (move) concatenation of sublists into one big list.
  • combine :
    takes (elements of) sublists and appends them into one big list.
  • combineOffset :
    similar and also adds offset.

The access of data is through an AccessOp so that data can be 'gather'ed in one go, minimizing communication, and then picked apart and recombined.

Example:

// Assuming myContainer defined which holds all the data I want to
// transfer (say a pointField and a faceList). myContainer also defines
// access operators to
// access the individual elements, say myContainerPoints::operator(),
// and myContainerFaces::operator()
List<myContainer> gatheredData(Pstream::nProcs());
gatheredData[Pstream::myProcNo()] = myContainer(points, faces);
// Gather data onto master
Pstream::gatherList(gatheredData);
// Combine
pointField combinedPoints
(
ListListOps::combine<pointField>
(
gatheredData,
myContainerPoints()
)
);
// Combine and renumber (so combinedFaces indexes combinedPoints)
// Extract sizes of individual lists
labelList sizes
(
ListListOps::subSizes(gatheredData, myContainerPoints())
);
// Renumber using user-defined operator offsetOp<face>()
faceList combinedFaces
(
ListListOps::combineOffset<faceList>
(
gatheredData, sizes, myContainerFaces(), offsetOp<face>()
)
);
Source files

Function Documentation

◆ concat()

ListType concat ( List< T > &  lists)

Concatenate sub-lists (moving their content) into a single list.

The input lists parameter is cleared on completion.

Definition at line 75 of file ListListOps.C.

Referenced by Foam::rmDir().

Here is the caller graph for this function:

◆ totalSize()

label Foam::ListListOps::totalSize ( const UList< T > &  lists)

◆ subSizes()

labelList Foam::ListListOps::subSizes ( const UList< T > &  lists,
AccessOp  aop = accessOpT >() 
)

Return the sizes of the sub-lists.

◆ sumSizes()

label Foam::ListListOps::sumSizes ( const UList< T > &  lists,
AccessOp  aop = accessOpT >() 
)

The total size of all sub-lists.

◆ combine()

AccessType combine ( const UList< T > &  lists,
AccessOp  aop = accessOp<T>() 
)

Combines sub-lists into a single list.

Definition at line 102 of file ListListOps.C.

Referenced by badQualityToCell::applyToSet(), badQualityToFace::applyToSet(), regionsToCell::applyToSet(), boundaryToCell::applyToSet(), boundaryToFace::applyToSet(), nbrToCell::applyToSet(), nearestToPoint::applyToSet(), nearestToCell::applyToSet(), patchToPoint::applyToSet(), patchToCell::applyToSet(), clipPlaneToPoint::applyToSet(), clipPlaneToCell::applyToSet(), clipPlaneToFace::applyToSet(), searchableSurfaceToPoint::applyToSet(), patchToFace::applyToSet(), searchableSurfaceToCell::applyToSet(), haloToCell::applyToSet(), searchableSurfaceToFace::applyToSet(), shapeToCell::applyToSet(), sphereToFace::applyToSet(), sphereToPoint::applyToSet(), sphereToCell::applyToSet(), boxToPoint::applyToSet(), boxToFace::applyToSet(), boxToCell::applyToSet(), holeToFace::applyToSet(), regionToFace::applyToSet(), targetVolumeToCell::applyToSet(), rotatedBoxToCell::applyToSet(), patchDistanceToCell::applyToSet(), faceToPoint::applyToSet(), cylinderToPoint::applyToSet(), cylinderToFace::applyToSet(), cylinderToCell::applyToSet(), zoneToCell::applyToSet(), zoneToPoint::applyToSet(), zoneToFace::applyToSet(), planeToFaceZone::applyToSet(), cellToPoint::applyToSet(), pointToCell::applyToSet(), regionToCell::applyToSet(), pointToFace::applyToSet(), surfaceToPoint::applyToSet(), cellToFace::applyToSet(), faceToCell::applyToSet(), faceZoneToCell::applyToSet(), surfaceToCell::applyToSet(), InflationInjection< CloudType >::parcelsToInject(), syncTools::syncEdgeMap(), and syncTools::syncPointMap().

◆ combineOffset()

AccessType combineOffset ( const UList< T > &  lists,
const labelUList offsets,
AccessOp  aop,
OffsetOp  oop = offsetOp<T>() 
)

Like combine but also offsets sublists based on passed sizes.

Definition at line 132 of file ListListOps.C.

References UList< T >::begin().

Here is the call graph for this function:

◆ inplaceRenumber() [1/2]

void inplaceRenumber ( const labelUList oldToNew,
IntListListType &  lists 
)

Inplace renumber the values (not the indices) of a list of lists.

Negative elements are left untouched.

Definition at line 69 of file ListOpsTemplates.C.

◆ inplaceRenumber() [2/2]

void inplaceRenumber ( const Map< label > &  oldToNew,
IntListListType &  lists 
)

Inplace renumber the values of a list of lists.

Values that are not mapped by oldToNew are left untouched.

Definition at line 108 of file ListOpsTemplates.C.

References HashTable< T, Key, Hash >::cfind(), and HashTable< T, Key, Hash >::Iterator< Const >::good().

Here is the call graph for this function: