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()
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>()
)
);
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
static void gatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
int myProcNo() const noexcept
Return processor number.
const pointField & points
labelList subSizes(const IndirectListBase< T, Addr > &lists, AccessOp aop)
Return the sizes of the sub-lists.
Definition: ensightOutput.H:68
Offset operator for ListListOps::combineOffset()
Definition: ListListOps.H:102
Source files

Function Documentation

◆ subSizes() [1/2]

labelList 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 T.

Here is the call graph for this function:

◆ inplaceRenumber()

void inplaceRenumber ( const labelUList oldToNew,
IntListType &  lists 
)

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

Negative IntListType elements are left untouched.

Definition at line 89 of file ensightOutput.H.

Referenced by ensightFaces::write().

Here is the caller graph for this function:

◆ subSizes() [2/2]

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

Return the sizes of the sub-lists.

◆ sumSizes()

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

References T.

Referenced by InflationInjection< CloudType >::parcelsToInject().

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

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

Here is the call graph for this function: