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 T , class Addr , class AccessOp >
labelList subSizes (const IndirectListBase< T, Addr > &lists, AccessOp aop)
 Return the sizes of the sub-lists. More...
 
template<class IntListType >
void inplaceRenumber (const labelUList &oldToNew, IntListType &lists)
 Inplace renumber the values (not the indices) of a list of 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...
 

Detailed Description

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

- 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

◆ subSizes() [1/2]

labelList Foam::ListListOps::subSizes ( const IndirectListBase< T, Addr > &  lists,
AccessOp  aop 
)

Return the sizes of the sub-lists.

Definition at line 67 of file ensightOutput.H.

References Foam::output(), IndirectListBase< T, Addr >::size(), and Foam::T().

Here is the call graph for this function:

◆ inplaceRenumber()

void Foam::ListListOps::inplaceRenumber ( const labelUList oldToNew,
IntListType &  lists 
)

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

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

Negative IntListType elements are left untouched.

Definition at line 89 of file ensightOutput.H.

References Foam::input().

Referenced by fvMeshAdder::add(), fvMeshPrimitiveLduAddressing::addAddressing(), cellTable::combine(), ABAQUSCore::readHelper::compact_nodes(), STARCDMeshReader::cullPoints(), PatchTools::gatherAndMerge(), isoSurfaceCell::isoSurfaceCell(), isoSurfacePoint::isoSurfacePoint(), surfaceIntersection::mergePoints(), foamVtkMeshMaps::renumberCells(), foamVtkMeshMaps::renumberPoints(), extendedEdgeMesh::setFromStatus(), extendedEdgeMesh::sortPointsAndEdges(), meshRefinement::splitFacesUndo(), duplicatePoints::updateMesh(), combineFaces::updateMesh(), tetDecomposer::updateMesh(), FacePostProcessing< CloudType >::write(), ensightFaces::write(), and externalCoupled::writeGeometry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ subSizes() [2/2]

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 69 of file ListListOps.C.

References Foam::output(), and T.

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 99 of file ListListOps.C.

References UList< T >::begin(), Foam::output(), and T.

Here is the call graph for this function:
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::ListListOps::subSizes
labelList subSizes(const IndirectListBase< T, Addr > &lists, AccessOp aop)
Return the sizes of the sub-lists.
Definition: ensightOutput.H:67
Foam::Pstream::gatherList
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
Definition: gatherScatterList.C:52
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:463
Foam::faceList
List< face > faceList
A List of faces.
Definition: faceListFwd.H:47
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::UPstream::nProcs
static label nProcs(const label communicator=worldComm)
Number of processes in parallel run, and 1 for serial run.
Definition: UPstream.H:445