globalIndex Class Reference

Calculates a unique integer (label so might not have enough room - 2G max) for processor + local index. E.g. More...

Classes

struct  gatherNone
 Dispatch tag. More...
 
struct  gatherOnly
 Dispatch tag. More...
 

Public Types

enum  accessType : char { OFFSETS , SIZES }
 Disambiguation tag (list construction dispatch) More...
 

Public Member Functions

 globalIndex ()=default
 Default construct. More...
 
 globalIndex (const labelUList &listOffsets)
 
 globalIndex (labelList &&listOffsets)
 
 globalIndex (const labelUList &offsetsOrSizes, enum accessType accType)
 
 globalIndex (const label localSize, const label comm=UPstream::worldComm, const bool parallel=UPstream::parRun())
 
 globalIndex (const label localSize, const globalIndex::gatherOnly, const label comm=UPstream::worldComm)
 
 globalIndex (const label localSize, const globalIndex::gatherNone, const label comm=-1)
 
 globalIndex (Istream &is)
 
bool empty () const
 Check for default constructed or global sum == 0. More...
 
label size () const
 Global sum of localSizes. Same as totalSize() More...
 
label totalSize () const
 Global sum of localSizes. More...
 
labelList sizes () const
 The local sizes. Same as localSizes() More...
 
const labelUList localStarts () const
 The local starts. More...
 
labelList localSizes () const
 The local sizes. More...
 
label maxSize () const
 Global max of localSizes. More...
 
const labelListoffsets () const noexcept
 Const-access to the offsets. More...
 
label nProcs () const noexcept
 The number of processors covered by the offsets. More...
 
labelRange allProcs () const noexcept
 Range of process indices for all addressed offsets (processes) More...
 
labelRange subProcs () const noexcept
 Range of process indices for addressed sub-offsets (processes) More...
 
labelListoffsets () noexcept
 Write-access to the offsets, for changing after construction. More...
 
void reset (const label localSize, const label comm=UPstream::worldComm, const bool parallel=UPstream::parRun())
 
void reset (const label localSize, const globalIndex::gatherOnly, const label comm=UPstream::worldComm)
 
void reset (const labelUList &localLens, const bool checkOverflow=false)
 
void setLocalSize (const label proci, const label len)
 Alter local size for given processor. More...
 
label localStart () const
 My local start. More...
 
label localSize () const
 My local size. More...
 
label maxNonLocalSize () const
 The max of localSizes, excluding current processor. More...
 
labelRange range () const
 Return start/size range of local processor data. More...
 
List< labelRangeranges () const
 Return start/size ranges for all data. More...
 
bool isLocal (const label i) const
 Is on local processor. More...
 
label toGlobal (const label i) const
 From local to global index. More...
 
labelList toGlobal (const labelUList &labels) const
 From local to global index. More...
 
void inplaceToGlobal (labelUList &labels) const
 From local to global index (inplace) More...
 
label toLocal (const label i) const
 From global to local on current processor. More...
 
label localStart (const label proci) const
 Start of proci data. More...
 
label localSize (const label proci) const
 Size of proci data. More...
 
label maxNonLocalSize (const label proci) const
 The max of localSizes, excluding the specified processor. More...
 
labelRange range (const label proci) const
 Return start/size range of proci data. More...
 
bool isLocal (const label proci, const label i) const
 Is on processor proci. More...
 
label toGlobal (const label proci, const label i) const
 From local to global on proci. More...
 
labelList toGlobal (const label proci, const labelUList &labels) const
 From local to global on proci. More...
 
void inplaceToGlobal (const label proci, labelUList &labels) const
 From local to global index on proci (inplace) More...
 
label toLocal (const label proci, const label i) const
 From global to local on proci. More...
 
template<class ProcIDsContainer , class Type >
void gather (const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes ct=UPstream::commsTypes::nonBlocking) const
 Collect data in processor order on master (== procIDs[0]). More...
 
template<class ProcIDsContainer , class Type >
void gather (const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes ct=UPstream::commsTypes::nonBlocking) const
 Inplace collect in processor order on master (== procIDs[0]). More...
 
template<class Type >
void gather (const UList< Type > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
 Collect data in processor order on master (in serial: performs a simple copy). More...
 
template<class Type , class Addr >
void gather (const IndirectListBase< Type, Addr > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
 Collect data indirectly in processor order on master (in serial: performs a simple copy). More...
 
template<class Type , class OutputContainer = List<Type>>
OutputContainer gather (const UList< Type > &sendData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
 Collect data in processor order on master (in serial: performs a simple copy). More...
 
template<class Type , class Addr , class OutputContainer = List<Type>>
OutputContainer gather (const IndirectListBase< Type, Addr > &sendData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
 Collect data indirectly in processor order on master. More...
 
template<class Type >
void gatherInplace (List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
 Inplace collect data in processor order on master (in serial: a no-op). More...
 
template<class Type , class OutputContainer = List<Type>>
void mpiGather (const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const
 Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy). More...
 
template<class Type , class OutputContainer = List<Type>>
OutputContainer mpiGather (const UList< Type > &sendData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const
 Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy). More...
 
template<class Type >
void mpiGatherInplace (List< Type > &fld, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const
 Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op). More...
 
template<class ProcIDsContainer , class Type >
void scatter (const label comm, const ProcIDsContainer &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes ct=UPstream::commsTypes::nonBlocking) const
 Distribute data in processor order. More...
 
template<class Type >
void scatter (const UList< Type > &allData, UList< Type > &localData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
 Distribute data in processor order. More...
 
template<class Type , class OutputContainer = List<Type>>
OutputContainer scatter (const UList< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
 Distribute data in processor order (in serial: performs a simple copy). More...
 
template<class Type , class CombineOp >
void get (List< Type > &allFld, const labelUList &globalIds, const CombineOp &cop, const label comm=UPstream::worldComm, const int tag=UPstream::msgType()) const
 Get (potentially remote) data. Elements required given as global indices. More...
 
 FOAM_DEPRECATED_FOR (2022-03, "construct without message tag") globalIndex(const label localSize
 Construct from local size, using gather/broadcast with default/specified communicator if parallel. More...
 
 FOAM_DEPRECATED_FOR (2022-03, "reset without message tag") void reset(const label localSize
 Reset from local size, using gather/broadcast with default/specified communicator if parallel. More...
 
 FOAM_DEPRECATED_FOR (2022-02, "use localStart()") label offset(const label proci) const
 Prefer localStart() to avoid confusing with offsets() More...
 

Static Public Member Functions

template<class ProcIDsContainer , class Type >
static void gatherValues (const label comm, const ProcIDsContainer &procIDs, const Type &localValue, List< Type > &allValues, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking)
 Which processor does global id come from? More...
 
template<class ProcIDsContainer , class Type >
static void gather (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking)
 Collect data in processor order on master (== procIDs[0]). More...
 
template<class Type , class Addr >
static void gather (const labelUList &offsets, const label comm, const UList< int > &procIDs, const IndirectListBase< Type, Addr > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking)
 Collect indirect data in processor order on master. More...
 
template<class ProcIDsContainer , class Type >
static void gather (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes ct=UPstream::commsTypes::nonBlocking)
 Inplace collect in processor order on master (== procIDs[0]). More...
 
template<class Type , class OutputContainer = List<Type>>
static void mpiGatherOp (const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType())
 Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy). More...
 
template<class Type , class OutputContainer = List<Type>>
static OutputContainer mpiGatherOp (const UList< Type > &sendData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType())
 Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy). More...
 
template<class Type >
static void mpiGatherInplaceOp (List< Type > &fld, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType())
 Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op). More...
 
template<class Type >
static void gatherOp (const UList< Type > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
 Collect data in processor order on master (in serial: performs a simple copy). More...
 
template<class Type , class Addr >
static void gatherOp (const IndirectListBase< Type, Addr > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
 Collect data in processor order on master (in serial: performs a simple copy). More...
 
template<class Type , class OutputContainer = List<Type>>
static OutputContainer gatherOp (const UList< Type > &sendData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
 Collect and return data in processor order on master (in serial: performs a simple copy). More...
 
template<class Type , class Addr , class OutputContainer = List<Type>>
static OutputContainer gatherOp (const IndirectListBase< Type, Addr > &sendData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
 Collect and return data in processor order on master (in serial: performs a simple copy). More...
 
template<class Type >
static void gatherInplaceOp (List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
 Inplace collect data in processor order on master (in serial: a no-op). More...
 
template<class ProcIDsContainer , class Type >
static void scatter (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking)
 Distribute data in processor order. More...
 

Public Attributes

const int tag
 
const int const label comm
 
const int const label const bool parallel
 

Friends

Istreamoperator>> (Istream &is, globalIndex &gi)
 
Ostreamoperator<< (Ostream &os, const globalIndex &gi)
 

Detailed Description

Calculates a unique integer (label so might not have enough room - 2G max) for processor + local index. E.g.

globalIndex globalFaces(mesh.nFaces()); label globalFacei = globalFaces.toGlobal(facei);

Source files

Definition at line 67 of file globalIndex.H.

Member Enumeration Documentation

◆ accessType

enum accessType : char

Disambiguation tag (list construction dispatch)

Enumerator
OFFSETS 
SIZES 

Definition at line 99 of file globalIndex.H.

Constructor & Destructor Documentation

◆ globalIndex() [1/8]

globalIndex ( )
default

Default construct.

◆ globalIndex() [2/8]

globalIndex ( const labelUList listOffsets)
inlineexplicit

Copy construct from a list of offsets. No communication required

Definition at line 34 of file globalIndexI.H.

References UList< T >::size().

Here is the call graph for this function:

◆ globalIndex() [3/8]

globalIndex ( labelList &&  listOffsets)
inlineexplicit

Move construct from a list of offsets. No communication required

Definition at line 46 of file globalIndexI.H.

◆ globalIndex() [4/8]

globalIndex ( const labelUList offsetsOrSizes,
enum accessType  accType 
)
inline

Copy construct from a list of offsets or sizes. No communication required

Definition at line 62 of file globalIndexI.H.

References UList< T >::size().

Here is the call graph for this function:

◆ globalIndex() [5/8]

globalIndex ( const label  localSize,
const label  comm = UPstream::worldComm,
const bool  parallel = UPstream::parRun() 
)
inlineexplicit

Construct from local size, using gather/broadcast with default/specified communicator if parallel.

Parameters
commcommunicator
paralleluse parallel comms

Definition at line 80 of file globalIndexI.H.

◆ globalIndex() [6/8]

globalIndex ( const label  localSize,
const globalIndex::gatherOnly  ,
const label  comm = UPstream::worldComm 
)
inline

Construct by gathering local sizes without rescattering. This 'one-sided' globalIndex will be empty on non-master processes.

Note
can be used when Pstream::parRun() is false.
Parameters
commcommunicator

Definition at line 91 of file globalIndexI.H.

References UPstream::listGatherValues().

Here is the call graph for this function:

◆ globalIndex() [7/8]

globalIndex ( const label  localSize,
const globalIndex::gatherNone  ,
const label  comm = -1 
)
inline

Construct with a single size entry. No communication required

Parameters
commno communicator needed

Definition at line 103 of file globalIndexI.H.

References globalIndex::localSize().

Here is the call graph for this function:

◆ globalIndex() [8/8]

globalIndex ( Istream is)
explicit

Construct from Istream. No communication required

Definition at line 123 of file globalIndex.C.

Member Function Documentation

◆ empty()

bool empty ( ) const
inline

Check for default constructed or global sum == 0.

Definition at line 119 of file globalIndexI.H.

◆ size()

Foam::label size ( ) const
inline

Global sum of localSizes. Same as totalSize()

Definition at line 132 of file globalIndexI.H.

◆ totalSize()

Foam::label totalSize ( ) const
inline

Global sum of localSizes.

Definition at line 125 of file globalIndexI.H.

Referenced by nearWallFields::calcAddressing(), metisLikeDecomp::decomposeGeneral(), distributedTriSurfaceMesh::globalSize(), globalIndex::mpiGather(), particleTracksSampler::nParticle(), regionSplit::nRegions(), SprayCloud< CloudType >::penetration(), and streamLineBase::writeToFile().

Here is the caller graph for this function:

◆ sizes()

Foam::labelList sizes ( ) const
inline

The local sizes. Same as localSizes()

Definition at line 138 of file globalIndexI.H.

◆ localStarts()

const Foam::labelUList localStarts ( ) const
inline

The local starts.

Definition at line 179 of file globalIndexI.H.

References UList< label >::null().

Here is the call graph for this function:

◆ localSizes()

Foam::labelList localSizes ( ) const

The local sizes.

Definition at line 292 of file globalIndex.C.

◆ maxSize()

Foam::label maxSize ( ) const
inline

Global max of localSizes.

Definition at line 213 of file globalIndexI.H.

◆ offsets() [1/2]

const Foam::labelList & offsets ( ) const
inlinenoexcept

Const-access to the offsets.

Definition at line 167 of file globalIndexI.H.

◆ nProcs()

Foam::label nProcs ( ) const
inlinenoexcept

The number of processors covered by the offsets.

Definition at line 144 of file globalIndexI.H.

Referenced by globalIndex::mpiGather().

Here is the caller graph for this function:

◆ allProcs()

Foam::labelRange allProcs ( ) const
inlinenoexcept

Range of process indices for all addressed offsets (processes)

Definition at line 151 of file globalIndexI.H.

◆ subProcs()

Foam::labelRange subProcs ( ) const
inlinenoexcept

Range of process indices for addressed sub-offsets (processes)

Definition at line 159 of file globalIndexI.H.

Referenced by faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), metisLikeDecomp::decomposeGeneral(), PatchTools::gatherAndMerge(), and Foam::vtk::writeListsParallel().

Here is the caller graph for this function:

◆ offsets() [2/2]

Foam::labelList & offsets ( )
inlinenoexcept

Write-access to the offsets, for changing after construction.

Definition at line 173 of file globalIndexI.H.

Referenced by globalIndex::gather().

Here is the caller graph for this function:

◆ reset() [1/3]

void reset ( const label  localSize,
const label  comm = UPstream::worldComm,
const bool  parallel = UPstream::parRun() 
)

Reset from local size, using gather/broadcast with default/specified communicator if parallel.

Parameters
commcommunicator
paralleluse parallel comms

Definition at line 206 of file globalIndex.C.

References Pstream::broadcast(), UPstream::listGatherValues(), processorFaPatch::myProcNo(), PstreamBuffers::nProcs(), UPstream::parRun(), List< T >::resize(), and Foam::Zero.

Referenced by snappyLayerDriver::addLayers(), globalIndex::FOAM_DEPRECATED_FOR(), globalMeshData::globalEdgeNumbering(), globalMeshData::globalPointNumbering(), distributedTriSurfaceMesh::globalTris(), particleTracksSampler::reset(), and particleTracksSampler::resetCloud().

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

◆ reset() [2/3]

void reset ( const label  localSize,
const globalIndex::gatherOnly  ,
const label  comm = UPstream::worldComm 
)

Reset by gathering local sizes without rescattering. This 'one-sided' globalIndex will be empty on non-master processes.

Note
can be used when Pstream::parRun() is false.
Parameters
commcommunicator

Definition at line 194 of file globalIndex.C.

References UPstream::listGatherValues().

Here is the call graph for this function:

◆ reset() [3/3]

void reset ( const labelUList localLens,
const bool  checkOverflow = false 
)

Reset from list of local sizes, with optional check for label overflow. No communication required

Definition at line 242 of file globalIndex.C.

References UList< T >::size().

Here is the call graph for this function:

◆ setLocalSize()

void setLocalSize ( const label  proci,
const label  len 
)

Alter local size for given processor.

Definition at line 274 of file globalIndex.C.

References delta.

◆ localStart() [1/2]

Foam::label localStart ( ) const
inline

My local start.

Definition at line 195 of file globalIndexI.H.

References processorFaPatch::myProcNo().

Referenced by viewFactor::calculate(), globalIndex::FOAM_DEPRECATED_FOR(), meshRefinement::getMasterEdges(), cellCellStencil::globalCellCells(), GAMGProcAgglomeration::globalCellCells(), lduPrimitiveMesh::globalCellCells(), globalIndex::mpiGather(), Foam::vtk::writeCellSetFaces(), Foam::vtk::writeFaceSet(), internalMeshWriter::writeGeometry(), patchMeshWriter::writeGeometry(), polyWriter::writeLineGeometry(), Foam::vtk::writeListParallel(), internalMeshWriter::writePointIDs(), polyWriter::writePolyGeometry(), and patchMeshWriter::writePolys().

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

◆ localSize() [1/2]

Foam::label localSize ( ) const
inline

My local size.

Definition at line 207 of file globalIndexI.H.

References processorFaPatch::myProcNo().

Referenced by holeToFace::calcClosure(), createShellMesh::calcPointRegions(), viewFactor::calculate(), metisLikeDecomp::decomposeGeneral(), mapDistributeBase::exchangeAddressing(), globalIndex::FOAM_DEPRECATED_FOR(), meshRefinement::getMasterEdges(), cellCellStencil::globalCellCells(), GAMGProcAgglomeration::globalCellCells(), globalIndex::globalIndex(), globalIndex::mpiGather(), regionSplit::nLocalRegions(), Foam::vtk::writeListsParallel(), and streamLineBase::writeToFile().

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

◆ maxNonLocalSize() [1/2]

Foam::label maxNonLocalSize ( ) const
inline

The max of localSizes, excluding current processor.

Definition at line 220 of file globalIndexI.H.

References processorFaPatch::myProcNo().

Referenced by Foam::vtk::writeListsParallel().

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

◆ range() [1/2]

Foam::labelRange range ( ) const
inline

Return start/size range of local processor data.

Definition at line 232 of file globalIndexI.H.

References processorFaPatch::myProcNo(), and range.

Referenced by faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), metisLikeDecomp::decomposeGeneral(), PatchTools::gatherAndMerge(), and globalIndex::mpiGather().

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

◆ ranges()

Foam::List< Foam::labelRange > ranges ( ) const

Return start/size ranges for all data.

Definition at line 315 of file globalIndex.C.

◆ isLocal() [1/2]

bool isLocal ( const label  i) const
inline

Is on local processor.

Definition at line 244 of file globalIndexI.H.

References processorFaPatch::myProcNo().

Referenced by decompositionMethod::calcCellCells(), mapDistributeBase::calcCompactAddressing(), addPatchCellLayer::calcExtrudeInfo(), refinementParameters::findCells(), fluxSummary::initialiseCellZoneAndDirection(), mapDistribute::mapDistributeBase(), regionSplit2D::regionSplit2D(), and mapDistributeBase::renumber().

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

◆ toGlobal() [1/4]

◆ toGlobal() [2/4]

Foam::labelList toGlobal ( const labelUList labels) const
inline

From local to global index.

Definition at line 279 of file globalIndexI.H.

References processorFaPatch::myProcNo().

Here is the call graph for this function:

◆ inplaceToGlobal() [1/2]

void inplaceToGlobal ( labelUList labels) const
inline

From local to global index (inplace)

Definition at line 303 of file globalIndexI.H.

References processorFaPatch::myProcNo().

Referenced by faceAreaWeightAMI::calculate(), faceAreaWeightAMI2D::calculate(), metisLikeDecomp::decomposeGeneral(), PatchTools::gatherAndMerge(), and cyclicAMIPolyPatch::setAMIFaces().

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

◆ toLocal() [1/2]

Foam::label toLocal ( const label  i) const
inline

From global to local on current processor.

FatalError if not on local processor.

Definition at line 325 of file globalIndexI.H.

References processorFaPatch::myProcNo().

Referenced by fvMeshPrimitiveLduAddressing::addAddressing(), decompositionMethod::calcCellCells(), mapDistributeBase::calcCompactAddressing(), addPatchCellLayer::calcExtrudeInfo(), viewFactor::calculate(), refinementParameters::findCells(), viewFactor::initialise(), fluxSummary::initialiseCellZoneAndDirection(), distributedTriSurfaceMesh::localQueries(), mapDistribute::mapDistributeBase(), mapDistributeBase::renumber(), and dynamicOversetFvMesh::updateAddressing().

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

◆ localStart() [2/2]

Foam::label localStart ( const label  proci) const
inline

Start of proci data.

Definition at line 189 of file globalIndexI.H.

◆ localSize() [2/2]

Foam::label localSize ( const label  proci) const
inline

Size of proci data.

Definition at line 201 of file globalIndexI.H.

◆ maxNonLocalSize() [2/2]

Foam::label maxNonLocalSize ( const label  proci) const

The max of localSizes, excluding the specified processor.

Definition at line 341 of file globalIndex.C.

References Foam::max().

Here is the call graph for this function:

◆ range() [2/2]

Foam::labelRange range ( const label  proci) const
inline

Return start/size range of proci data.

Definition at line 226 of file globalIndexI.H.

◆ isLocal() [2/2]

bool isLocal ( const label  proci,
const label  i 
) const
inline

Is on processor proci.

Definition at line 238 of file globalIndexI.H.

◆ toGlobal() [3/4]

Foam::label toGlobal ( const label  proci,
const label  i 
) const
inline

From local to global on proci.

Definition at line 250 of file globalIndexI.H.

◆ toGlobal() [4/4]

Foam::labelList toGlobal ( const label  proci,
const labelUList labels 
) const
inline

From local to global on proci.

Definition at line 266 of file globalIndexI.H.

◆ inplaceToGlobal() [2/2]

void inplaceToGlobal ( const label  proci,
labelUList labels 
) const
inline

From local to global index on proci (inplace)

Definition at line 288 of file globalIndexI.H.

◆ toLocal() [2/2]

Foam::label toLocal ( const label  proci,
const label  i 
) const
inline

From global to local on proci.

Definition at line 310 of file globalIndexI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.

Here is the call graph for this function:

◆ gatherValues()

void gatherValues ( const label  comm,
const ProcIDsContainer &  procIDs,
const Type &  localValue,
List< Type > &  allValues,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  preferredCommsType = UPstream::commsTypes::nonBlocking 
)
static

Which processor does global id come from?

Does an initial check for isLocal first (assumed to occur reasonably frequently) followed by a binary search. ! Fatal for out of range ids (eg, negative or >= totalSize() inline label whichProcID(const label i) const;

Iteration

! Forward input iterator with const access class const_iterator { ! The parent class for which this is an iterator const globalIndex* parent_;

! The index into the parent label proci_;

public:

Constructors

! Construct from globalIndex list at given index explicit const_iterator ( const globalIndex* globalIdx, const label proci = 0 ) noexcept;

Member Operators

! The associated local proc inline label proci() const noexcept;

! The local start inline label start() const;

! The local size inline label size() const;

! The local range inline labelRange range() const;

! The local range inline labelRange operator*() const;

inline const_iterator& operator++(); inline const_iterator operator++(int);

inline const_iterator& operator–(); inline const_iterator operator–(int);

inline bool operator==(const const_iterator& iter) const noexcept; inline bool operator!=(const const_iterator& iter) const noexcept; };

! A const_iterator set to the beginning inline const_iterator cbegin() const noexcept;

! A const_iterator set to beyond the end inline const const_iterator cend() const noexcept;

! A const_iterator set to the beginning inline const_iterator begin() const noexcept;

! A const_iterator set to beyond the end inline const const_iterator end() const noexcept;

Helper Functions

! Calculate offsets from a list of local sizes, ! with optional check for label overflow static labelList calcOffsets ( const labelUList& localLens, const bool checkOverflow = false );

! Calculate offsets from list of lists, ! with optional check for label overflow template<class SubListType> static labelList calcListOffsets ( const List<SubListType>& lists, const bool checkOverflow = false );

! Calculate ranges (offset/size) from a list of local sizes, ! with optional check for label overflow static List<labelRange> calcRanges ( const labelUList& localLens, const bool checkOverflow = false );

! Collect single values in processor order on master (== procIDs[0]). /*! Handles contiguous/non-contiguous data.

Parameters
commcommunicator
tagoutput field (master only)

Definition at line 68 of file globalIndexTemplates.C.

References List< T >::clear(), processorFaPatch::myProcNo(), UPstream::nonBlocking, UPstream::nRequests(), kEpsilonLopesdaCosta< BasicTurbulenceModel >::read(), List< T >::resize_nocopy(), UPstream::scheduled, UPstream::waitRequests(), and ObukhovLength::write().

Referenced by GAMGAgglomeration::procAgglomerateRestrictAddressing().

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

◆ gather() [1/9]

void gather ( const labelUList offsets,
const label  comm,
const ProcIDsContainer &  procIDs,
const UList< Type > &  fld,
List< Type > &  allFld,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  preferredCommsType = UPstream::commsTypes::nonBlocking 
)
static

Collect data in processor order on master (== procIDs[0]).

Handles contiguous/non-contiguous data, skips empty fields.

Parameters
offsetsoffsets (master only)
commcommunicator
tagoutput field (master only)

Definition at line 152 of file globalIndexTemplates.C.

References UList< T >::data_bytes(), UList< T >::empty(), fld(), UList< T >::last(), processorFaPatch::myProcNo(), UPstream::nonBlocking, UPstream::nRequests(), kEpsilonLopesdaCosta< BasicTurbulenceModel >::read(), List< T >::resize_nocopy(), UPstream::scheduled, UList< T >::size_bytes(), UPstream::waitRequests(), and ObukhovLength::write().

Referenced by faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), simpleGeomDecomp::decompose(), metisLikeDecomp::decomposeGeneral(), globalIndex::gather(), PatchTools::gatherAndMerge(), globalIndex::gatherInplaceOp(), globalIndex::gatherOp(), globalIndex::mpiGather(), GAMGAgglomeration::procAgglomerateRestrictAddressing(), and GAMGAgglomeration::restrictField().

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

◆ gather() [2/9]

void gather ( const labelUList offsets,
const label  comm,
const UList< int > &  procIDs,
const IndirectListBase< Type, Addr > &  fld,
List< Type > &  allFld,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  preferredCommsType = UPstream::commsTypes::nonBlocking 
)
static

Collect indirect data in processor order on master.

Handles contiguous/non-contiguous data, skips empty fields.

Parameters
offsetsoffsets (master only)
commcommunicator
tagoutput field (master only)

Definition at line 252 of file globalIndexTemplates.C.

References UList< T >::empty(), fld(), UList< T >::last(), processorFaPatch::myProcNo(), UPstream::nonBlocking, UPstream::nRequests(), List< T >::resize_nocopy(), UPstream::scheduled, UList< T >::size(), and UPstream::waitRequests().

Here is the call graph for this function:

◆ gather() [3/9]

static void gather ( const labelUList offsets,
const label  comm,
const ProcIDsContainer &  procIDs,
List< Type > &  fld,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  ct = UPstream::commsTypes::nonBlocking 
)
inlinestatic

Inplace collect in processor order on master (== procIDs[0]).

Note: adjust naming?

Parameters
offsetsoffsets (master only)
commcommunicator
fldin/out field

Definition at line 460 of file globalIndex.H.

References globalIndex::comm, fld(), globalIndex::gather(), processorFaPatch::myProcNo(), globalIndex::offsets(), and globalIndex::tag.

Here is the call graph for this function:

◆ gather() [4/9]

void gather ( const label  comm,
const ProcIDsContainer &  procIDs,
const UList< Type > &  fld,
List< Type > &  allFld,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  ct = UPstream::commsTypes::nonBlocking 
) const
inline

Collect data in processor order on master (== procIDs[0]).

Note
the globalIndex offsets needed on master only.
Parameters
commcommunicator
fldinput field
tagoutput field (master only)

Definition at line 481 of file globalIndex.H.

References globalIndex::comm, fld(), globalIndex::gather(), and globalIndex::tag.

Here is the call graph for this function:

◆ gather() [5/9]

void gather ( const label  comm,
const ProcIDsContainer &  procIDs,
List< Type > &  fld,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  ct = UPstream::commsTypes::nonBlocking 
) const
inline

Inplace collect in processor order on master (== procIDs[0]).

Note
the globalIndex offsets needed on master only. Note: adjust naming?
Parameters
commcommunicator
fldin/out field

Definition at line 498 of file globalIndex.H.

References globalIndex::comm, fld(), globalIndex::gather(), and globalIndex::tag.

Here is the call graph for this function:

◆ gather() [6/9]

void gather ( const UList< Type > &  sendData,
List< Type > &  allData,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const label  comm = UPstream::worldComm 
) const

Collect data in processor order on master (in serial: performs a simple copy).

Communication with default/specified communicator, message tag.

Parameters
commcommunicator

Definition at line 350 of file globalIndexTemplates.C.

References List< T >::clear(), globalIndex::gather(), splitCell::master(), and UPstream::parRun().

Here is the call graph for this function:

◆ gather() [7/9]

void gather ( const IndirectListBase< Type, Addr > &  sendData,
List< Type > &  allData,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const label  comm = UPstream::worldComm 
) const

Collect data indirectly in processor order on master (in serial: performs a simple copy).

Communication with default/specified communicator, message tag.

Parameters
commcommunicator

Definition at line 386 of file globalIndexTemplates.C.

References List< T >::clear(), globalIndex::gather(), splitCell::master(), and UPstream::parRun().

Here is the call graph for this function:

◆ gather() [8/9]

OutputContainer gather ( const UList< Type > &  sendData,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const label  comm = UPstream::worldComm 
) const

Collect data in processor order on master (in serial: performs a simple copy).

Communication with default/specified communicator, message tag.

Returns
output (master), zero-sized on non-master
Parameters
commcommunicator

Definition at line 422 of file globalIndexTemplates.C.

◆ gather() [9/9]

OutputContainer gather ( const IndirectListBase< Type, Addr > &  sendData,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const label  comm = UPstream::worldComm 
) const

Collect data indirectly in processor order on master.

Communication with default/specified communicator, message tag.

Returns
output (master), zero-sized on non-master
Parameters
commcommunicator

Definition at line 437 of file globalIndexTemplates.C.

◆ gatherInplace()

void gatherInplace ( List< Type > &  fld,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const label  comm = UPstream::worldComm 
) const

Inplace collect data in processor order on master (in serial: a no-op).

Communication with default/specified communicator, message tag. After the gather, the field is zero-sized on the slaves.

Parameters
commcommunicator

Definition at line 452 of file globalIndexTemplates.C.

References fld(), splitCell::master(), and UPstream::parRun().

Referenced by particleTracksSampler::gatherInplace(), and SprayCloud< CloudType >::penetration().

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

◆ mpiGather() [1/2]

void mpiGather ( const UList< Type > &  sendData,
OutputContainer &  allData,
const label  comm = UPstream::worldComm,
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const int  tag = UPstream::msgType() 
) const

Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy).

Communication with default/specified communicator.

Attention
The nProcs for globalIndex and communicator must match!!

The allData is output (master), zero-sized on non-master

Parameters
commcommunicator

Definition at line 479 of file globalIndexTemplates.C.

References UPstream::broadcast(), UList< T >::cdata(), UList< T >::cdata_bytes(), UPstream::gather(), globalIndex::gather(), globalIndex::localSize(), globalIndex::localStart(), splitCell::master(), globalIndex::nProcs(), UPstream::parRun(), globalIndex::range(), List< T >::resize(), UList< T >::size(), UList< T >::size_bytes(), and globalIndex::totalSize().

Referenced by globalIndex::mpiGatherOp().

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

◆ mpiGather() [2/2]

OutputContainer mpiGather ( const UList< Type > &  sendData,
const label  comm = UPstream::worldComm,
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const int  tag = UPstream::msgType() 
) const

Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy).

Communication with default/specified communicator.

Attention
The nProcs for globalIndex and communicator must match!!
Returns
output (master), zero-sized on non-master
Parameters
commcommunicator

Definition at line 643 of file globalIndexTemplates.C.

◆ mpiGatherInplace()

void mpiGatherInplace ( List< Type > &  fld,
const label  comm = UPstream::worldComm,
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const int  tag = UPstream::msgType() 
) const

Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op).

Communication with default/specified communicator.

Attention
The nProcs for globalIndex and communicator must match!!

After the gather, the field is zero-sized on non-master.

Parameters
commcommunicator

Definition at line 659 of file globalIndexTemplates.C.

References fld(), splitCell::master(), and UPstream::parRun().

Here is the call graph for this function:

◆ mpiGatherOp() [1/2]

void mpiGatherOp ( const UList< Type > &  sendData,
OutputContainer &  allData,
const label  comm = UPstream::worldComm,
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const int  tag = UPstream::msgType() 
)
static

Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy).

Communication with default/specified communicator.

The allData is output (master), zero-sized on non-master

Parameters
commcommunicator

Definition at line 687 of file globalIndexTemplates.C.

References globalIndex::mpiGather(), UPstream::parRun(), and UList< T >::size().

Here is the call graph for this function:

◆ mpiGatherOp() [2/2]

OutputContainer mpiGatherOp ( const UList< Type > &  sendData,
const label  comm = UPstream::worldComm,
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const int  tag = UPstream::msgType() 
)
static

Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy).

Communication with default/specified communicator.

Returns
output (master), zero-sized on non-master
Parameters
commcommunicator

Definition at line 712 of file globalIndexTemplates.C.

◆ mpiGatherInplaceOp()

void mpiGatherInplaceOp ( List< Type > &  fld,
const label  comm = UPstream::worldComm,
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const int  tag = UPstream::msgType() 
)
static

Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op).

Communication with default/specified communicator.

After the gather, the field is zero-sized on non-master.

Parameters
commcommunicator

Definition at line 728 of file globalIndexTemplates.C.

References fld(), splitCell::master(), and UPstream::parRun().

Here is the call graph for this function:

◆ gatherOp() [1/4]

void gatherOp ( const UList< Type > &  sendData,
List< Type > &  allData,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const label  comm = UPstream::worldComm 
)
static

Collect data in processor order on master (in serial: performs a simple copy).

Communication with default/specified communicator, message tag.

The allFld is output (master), zero-sized on non-master

Parameters
commcommunicator

Definition at line 756 of file globalIndexTemplates.C.

References globalIndex::gather(), UPstream::parRun(), and UList< T >::size().

Referenced by coordSet::gatherSort(), mergedSurf::merge(), and surfaceWriter::mergeFieldTemplate().

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

◆ gatherOp() [2/4]

void gatherOp ( const IndirectListBase< Type, Addr > &  sendData,
List< Type > &  allData,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const label  comm = UPstream::worldComm 
)
static

Collect data in processor order on master (in serial: performs a simple copy).

Communication with default/specified communicator, message tag.

The allFld is output (master), zero-sized on non-master

Parameters
commcommunicator

Definition at line 780 of file globalIndexTemplates.C.

References globalIndex::gather(), UPstream::parRun(), and IndirectListBase< T, Addr >::size().

Here is the call graph for this function:

◆ gatherOp() [3/4]

OutputContainer gatherOp ( const UList< Type > &  sendData,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const label  comm = UPstream::worldComm 
)
static

Collect and return data in processor order on master (in serial: performs a simple copy).

Communication with default/specified communicator, message tag.

Returns
output (master), zero-sized on non-master
Parameters
commcommunicator

Definition at line 804 of file globalIndexTemplates.C.

◆ gatherOp() [4/4]

OutputContainer gatherOp ( const IndirectListBase< Type, Addr > &  sendData,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const label  comm = UPstream::worldComm 
)
static

Collect and return data in processor order on master (in serial: performs a simple copy).

Communication with default/specified communicator, message tag.

Returns
output (master), zero-sized on non-master
Parameters
commcommunicator

Definition at line 819 of file globalIndexTemplates.C.

◆ gatherInplaceOp()

void gatherInplaceOp ( List< Type > &  fld,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const label  comm = UPstream::worldComm 
)
static

Inplace collect data in processor order on master (in serial: a no-op).

Communication with default/specified communicator, message tag.

After the gather, the field is zero-sized on the slaves.

Parameters
commcommunicator

Definition at line 834 of file globalIndexTemplates.C.

References fld(), globalIndex::gather(), and UPstream::parRun().

Here is the call graph for this function:

◆ scatter() [1/4]

void scatter ( const labelUList offsets,
const label  comm,
const ProcIDsContainer &  procIDs,
const UList< Type > &  allFld,
UList< Type > &  fld,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  preferredCommsType = UPstream::commsTypes::nonBlocking 
)
static

Distribute data in processor order.

Requires fld to be correctly sized! Communication with default/specified communicator, message tag.

Parameters
offsetsoffsets (master only)
commcommunicator

Definition at line 853 of file globalIndexTemplates.C.

References UList< T >::cdata_bytes(), UList< T >::empty(), fld(), processorFaPatch::myProcNo(), UPstream::nonBlocking, UPstream::nRequests(), kEpsilonLopesdaCosta< BasicTurbulenceModel >::read(), UPstream::scheduled, UList< T >::size_bytes(), UPstream::waitRequests(), and ObukhovLength::write().

Referenced by simpleGeomDecomp::decompose(), metisLikeDecomp::decomposeGeneral(), GAMGAgglomeration::prolongField(), and globalIndex::scatter().

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

◆ scatter() [2/4]

void scatter ( const label  comm,
const ProcIDsContainer &  procIDs,
const UList< Type > &  allFld,
UList< Type > &  fld,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  ct = UPstream::commsTypes::nonBlocking 
) const
inline

Distribute data in processor order.

Requires fld to be correctly sized! Communication with default/specified communicator, message tag.

Note
the globalIndex offsets needed on master only.
Parameters
commcommunicator

Definition at line 783 of file globalIndex.H.

References globalIndex::comm, fld(), globalIndex::scatter(), and globalIndex::tag.

Here is the call graph for this function:

◆ scatter() [3/4]

void scatter ( const UList< Type > &  allData,
UList< Type > &  localData,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const label  comm = UPstream::worldComm 
) const

Distribute data in processor order.

Requires fld to be correctly sized! Communication with default/specified communicator, message tag.

Note
the globalIndex offsets needed on master only.
Parameters
commcommunicator

Definition at line 955 of file globalIndexTemplates.C.

References UList< T >::deepCopy(), and UPstream::parRun().

Here is the call graph for this function:

◆ scatter() [4/4]

OutputContainer scatter ( const UList< Type > &  allData,
const int  tag = UPstream::msgType(),
const UPstream::commsTypes  commsType = UPstream::commsTypes::nonBlocking,
const label  comm = UPstream::worldComm 
) const

Distribute data in processor order (in serial: performs a simple copy).

Communication with default/specified communicator, message tag.

Note
the globalIndex offsets needed on master only.
Parameters
commcommunicator

Definition at line 987 of file globalIndexTemplates.C.

References UPstream::parRun().

Here is the call graph for this function:

◆ get()

void get ( List< Type > &  allFld,
const labelUList globalIds,
const CombineOp &  cop,
const label  comm = UPstream::worldComm,
const int  tag = UPstream::msgType() 
) const

Get (potentially remote) data. Elements required given as global indices.

Communication with default/specified communicator, message tag.

Parameters
commcommunicator

Definition at line 1019 of file globalIndexTemplates.C.

References PstreamBuffers::allProcs(), PstreamBuffers::finishedSends(), fld(), UPstream::nonBlocking, PstreamBuffers::nProcs(), CompactListList< T >::offsets(), os(), PstreamBuffers::recvDataCount(), List< T >::resize_nocopy(), and UList< T >::size().

Here is the call graph for this function:

◆ FOAM_DEPRECATED_FOR() [1/3]

FOAM_DEPRECATED_FOR ( 2022-  03,
"construct without message tag  
) const

Construct from local size, using gather/broadcast with default/specified communicator if parallel.

◆ FOAM_DEPRECATED_FOR() [2/3]

FOAM_DEPRECATED_FOR ( 2022-  03,
"reset without message tag  
) const

Reset from local size, using gather/broadcast with default/specified communicator if parallel.

References globalIndex::comm, globalIndex::localSize(), globalIndex::parallel, and globalIndex::reset().

Here is the call graph for this function:

◆ FOAM_DEPRECATED_FOR() [3/3]

FOAM_DEPRECATED_FOR ( 2022-  02,
"use localStart()"   
) const
inline

Prefer localStart() to avoid confusing with offsets()

Definition at line 878 of file globalIndex.H.

References globalIndex::localStart().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator>>

Istream & operator>> ( Istream is,
globalIndex gi 
)
friend

◆ operator<<

Ostream & operator<< ( Ostream os,
const globalIndex gi 
)
friend

Member Data Documentation

◆ tag

const int tag

Definition at line 855 of file globalIndex.H.

Referenced by globalIndex::gather(), and globalIndex::scatter().

◆ comm

const int const label comm

◆ parallel

const int const label const bool parallel
Initial value:
{
label localSize() const
My local size.
Definition: globalIndexI.H:207
void reset(const label localSize, const label comm=UPstream::worldComm, const bool parallel=UPstream::parRun())
Definition: globalIndex.C:207
const int const label comm
Definition: globalIndex.H:856
const int const label const bool parallel
Definition: globalIndex.H:859

Definition at line 857 of file globalIndex.H.

Referenced by globalIndex::FOAM_DEPRECATED_FOR().


The documentation for this class was generated from the following files: