globalIndex Class Reference

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

Classes

class  const_iterator
 Forward input iterator with const access that is used to iterate across the globalIndex offsets() table. More...
 
struct  gatherNone
 Dispatch tag: Construct with a single (local size) entry, no communication. More...
 
struct  gatherNonLocal
 Dispatch tag: Construct 'one-sided' from the non-master local sizes using gather but no broadcast. More...
 
struct  gatherOnly
 Dispatch tag: Construct 'one-sided' from local sizes, using gather but no broadcast. More...
 

Public Member Functions

 globalIndex () noexcept=default
 Default construct (empty) More...
 
 globalIndex (const labelUList &listOffsets)
 Copy construct from a list of offsets. No communication required. More...
 
 globalIndex (labelList &&listOffsets)
 Move construct from a list of offsets. No communication required. More...
 
 globalIndex (const globalIndex::gatherNone, const labelUList &localSizes)
 Construct from a list of sizes and calculate the offsets. No communication required. More...
 
 globalIndex (const label localSize, const label comm=UPstream::worldComm, const bool parallel=UPstream::parRun())
 Construct from local size, using gather/broadcast with default/specified communicator if parallel. More...
 
 globalIndex (const globalIndex::gatherNone, const label localSize, const label comm=-1)
 Construct with a single (local size) entry, no communication. More...
 
 globalIndex (const globalIndex::gatherOnly, const label localSize, const label comm=UPstream::worldComm)
 Construct 'one-sided' from local sizes. Uses UPstream::listGatherValues, but no broadcast. Will be empty on non-master processes. More...
 
 globalIndex (const globalIndex::gatherNonLocal, const label localSize, const label comm=UPstream::worldComm)
 Construct 'one-sided' from the non-master local sizes (ie, master size is treated as 0). Uses UPstream::listGatherValues, but no broadcast. Will be empty on non-master processes. More...
 
 globalIndex (Istream &is)
 Construct from Istream. No communication required. More...
 
bool empty () const noexcept
 Check for default constructed or total-size == 0. More...
 
label length () const noexcept
 The number of items covered by the offsets. More...
 
label size () const
 Global sum of localSizes. Same as totalSize() More...
 
label span () const noexcept
 The span size covered by the offsets, zero if empty. More...
 
label totalSize () const noexcept
 The total addressed size, which corresponds to the end offset and also the sum of all 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...
 
List< labelRangeranges () const
 Return start/size ranges for all data. More...
 
label maxSize () const
 Global max of localSizes. More...
 
const labelListoffsets () const noexcept
 Const-access to the offsets. More...
 
labelListoffsets () noexcept
 Write-access to the offsets, for changing after construction. More...
 
bool single () const noexcept
 True if local-only content (ie, nProcs == 1). Such content is often created with gatherNone. More...
 
label nProcs () const noexcept
 The number of processors covered by the offsets, same as the primary length() 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...
 
label begin_value () const noexcept
 The value corresponding to the first offset. More...
 
label end_value () const noexcept
 The value corresponding to the last offset (end offset), which is 1 beyond the end of the range. More...
 
labelRange front () const
 The first offset range. It is (0,0) if globalIndex is empty. More...
 
labelRange back () const
 The last offset range. It is (0,0) if globalIndex is empty. More...
 
void clear ()
 Reset to be empty (no offsets) More...
 
void resize (const label n)
 Change the number of entries (nProcs) in the offsets table. Extending will fill with empty local sizes. More...
 
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. More...
 
void reset (const labelUList &counts, const bool checkOverflow=false)
 Reset offsets from a list of local sizes, with optional check for label overflow. No communication required. More...
 
void reset (const globalIndex::gatherNone, const label localSize, const label comm=-1)
 Reset to a single (local size) entry, no communication. More...
 
void reset (const globalIndex::gatherOnly, const label localSize, const label comm=UPstream::worldComm)
 Reset as 'one-sided' from local sizes. Uses UPstream::listGatherValues, but no broadcast. Will be empty on non-master processes. More...
 
void reset (const globalIndex::gatherNonLocal, const label localSize, const label comm=UPstream::worldComm)
 Reset as 'one-sided' from the non-master local sizes (ie, master size is treated as 0). Uses UPstream::listGatherValues, but no broadcast. Will be empty on non-master processes. More...
 
void reset (const globalIndex &gi)
 Reset the globalIndex. Same as copy assignment. More...
 
void setLocalSize (const label proci, const label len)
 Alter local size for given processor. More...
 
bool contains (const label i) const noexcept
 True if contained within the offsets range. More...
 
label localStart (const label proci) const
 Start of proci data. More...
 
label localEnd (const label proci) const
 End 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...
 
label findProc (const label proci, const label i) const
 Find processor with specified global id. Check proci first, followed by binary search. More...
 
label findProcAbove (const label proci, const label i) const
 Find processor above proci with specified global id - binary search. More...
 
label findProcBelow (const label proci, const label i) const
 Find processor below proci with specified global id - binary search. More...
 
label whichProcID (const label proci, const label i) const
 Which processor does global id come from? Checks proci first (assumed to occur reasonably frequently) followed by a binary search. Fatal for out-of-range indices. More...
 
label localStart () const
 Local start on myProcNo() More...
 
label localEnd () const
 Local end on myProcNo() More...
 
label localSize () const
 Local size on myProcNo() More...
 
label maxNonLocalSize () const
 The max of localSizes, excluding current (myProcNo) rank. More...
 
labelRange range () const
 Return start/size range of local (myProcNo) 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 whichProcID (const label i) const
 Which processor does global id come from? More...
 
const_iterator cbegin () const noexcept
 A const_iterator set to the beginning. More...
 
const const_iterator cend () const noexcept
 A const_iterator set to beyond the end. More...
 
const_iterator begin () const noexcept
 A const_iterator set to the beginning. More...
 
const const_iterator end () const noexcept
 A const_iterator set to beyond the end. More...
 
const_iterator cbegin (const label proci) const noexcept
 Return const_iterator at offset proci from begin, clamped to [0,nProcs] range. More...
 
const_iterator begin (const label proci) const noexcept
 Return const_iterator at offset proci from begin, clamped to [0,nProcs] range. 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...
 
bool operator== (const globalIndex &rhs) const
 Compare for equality - uses the offsets. More...
 
bool operator!= (const globalIndex &rhs) const
 Compare for inequality - uses the offsets. More...
 
bool operator< (const globalIndex &rhs) const
 Compare for less-than - uses the offsets. More...
 
 globalIndex (const label localSize, const int tag, const label comm, const bool parallel)
 Construct from local size, using gather/broadcast with default/specified communicator if parallel. More...
 
void reset (const label localSize, const int tag, const label comm, const bool parallel)
 Reset from local size, using gather/broadcast with default/specified communicator if parallel. More...
 
label offset (const label proci) const
 Prefer localStart() to avoid confusing with offsets() More...
 
template<class Addr >
Foam::labelList calcOffsets (const IndirectListBase< label, Addr > &counts, const bool checkOverflow)
 
template<class SubListType >
Foam::labelList calcListOffsets (const List< SubListType > &lists, const bool checkOverflow)
 

Static Public Member Functions

static labelRange calcRange (const label localSize, const label comm=UPstream::worldComm, const bool checkOverflow=false)
 Calculate globally-consistent local range (offset/size) based on the local input size(s). More...
 
static label calcOffset (const label localSize, const label comm=UPstream::worldComm, const bool checkOverflow=false)
 Calculate globally-consistent local start offset based on the local input size(s). More...
 
static labelList calcOffsets (const labelUList &counts, const bool checkOverflow=false)
 Calculate offsets from a list of local sizes, with optional check for label overflow. More...
 
template<class Addr >
static labelList calcOffsets (const IndirectListBase< label, Addr > &counts, const bool checkOverflow=false)
 Calculate offsets from an indirect list of local sizes, with optional check for label overflow. More...
 
template<class SubListType >
static labelList calcListOffsets (const List< SubListType > &lists, const bool checkOverflow=false)
 Calculate offsets from list of lists, with optional check for label overflow. More...
 
static List< labelRangecalcRanges (const labelUList &counts, const bool checkOverflow=false)
 Calculate ranges (offset/size) from a list of local sizes, with optional check for label overflow. More...
 
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)
 Collect single values in processor order on master (== procIDs[0]). 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 ProcIDsContainer , class Type , class Addr >
static void gather (const labelUList &offsets, const label comm, const ProcIDsContainer &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...
 

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 61 of file globalIndex.H.

Constructor & Destructor Documentation

◆ globalIndex() [1/10]

globalIndex ( )
defaultnoexcept

Default construct (empty)

◆ globalIndex() [2/10]

globalIndex ( const labelUList listOffsets)
inlineexplicit

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

Definition at line 27 of file globalIndexI.H.

References UList< T >::size().

Here is the call graph for this function:

◆ globalIndex() [3/10]

globalIndex ( labelList &&  listOffsets)
inlineexplicit

Move construct from a list of offsets. No communication required.

Definition at line 39 of file globalIndexI.H.

◆ globalIndex() [4/10]

globalIndex ( const globalIndex::gatherNone  ,
const labelUList localSizes 
)
inline

Construct from a list of sizes and calculate the offsets. No communication required.

Definition at line 53 of file globalIndexI.H.

◆ globalIndex() [5/10]

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 63 of file globalIndexI.H.

◆ globalIndex() [6/10]

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

Construct with a single (local size) entry, no communication.

Parameters
commno communicator needed

Definition at line 74 of file globalIndexI.H.

◆ globalIndex() [7/10]

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

Construct 'one-sided' from local sizes. Uses UPstream::listGatherValues, but no broadcast. Will be empty on non-master processes.

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

Definition at line 88 of file globalIndexI.H.

◆ globalIndex() [8/10]

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

Construct 'one-sided' from the non-master local sizes (ie, master size is treated as 0). Uses UPstream::listGatherValues, but no broadcast. Will be empty on non-master processes.

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

Definition at line 100 of file globalIndexI.H.

◆ globalIndex() [9/10]

globalIndex ( Istream is)
explicit

Construct from Istream. No communication required.

Definition at line 261 of file globalIndex.C.

◆ globalIndex() [10/10]

globalIndex ( const label  localSize,
const int  tag,
const label  comm,
const bool  parallel 
)
inline

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

Definition at line 1308 of file globalIndex.H.

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

Here is the call graph for this function:

Member Function Documentation

◆ empty()

bool empty ( ) const
inlinenoexcept

Check for default constructed or total-size == 0.

Definition at line 120 of file globalIndexI.H.

References UList< T >::cdata(), and UList< T >::size().

Here is the call graph for this function:

◆ length()

Foam::label length ( ) const
inlinenoexcept

The number of items covered by the offsets.

Definition at line 133 of file globalIndexI.H.

◆ size()

Foam::label size ( ) const
inline

Global sum of localSizes. Same as totalSize()

Definition at line 171 of file globalIndexI.H.

◆ span()

Foam::label span ( ) const
inlinenoexcept

The span size covered by the offsets, zero if empty.

Definition at line 140 of file globalIndexI.H.

◆ totalSize()

Foam::label totalSize ( ) const
inlinenoexcept

The total addressed size, which corresponds to the end offset and also the sum of all localSizes.

Definition at line 165 of file globalIndexI.H.

Referenced by nearWallFields::calcAddressing(), distributedTriSurfaceMesh::globalSize(), globalIndex::mpiGather(), particleTracksSampler::nParticle(), regionSplit::nRegions(), SprayCloud< Foam::DSMCCloud >::penetration(), and particleTracksSampler::setSampleRate().

Here is the caller graph for this function:

◆ sizes()

Foam::labelList sizes ( ) const
inline

The local sizes. Same as localSizes()

Definition at line 177 of file globalIndexI.H.

◆ localStarts()

const Foam::labelUList localStarts ( ) const
inline

The local starts.

Definition at line 223 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 433 of file globalIndex.C.

References Foam::HashTableOps::values().

Here is the call graph for this function:

◆ ranges()

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

Return start/size ranges for all data.

Definition at line 456 of file globalIndex.C.

References Foam::HashTableOps::values().

Here is the call graph for this function:

◆ maxSize()

Foam::label maxSize ( ) const
inline

Global max of localSizes.

Definition at line 269 of file globalIndexI.H.

◆ offsets() [1/2]

const Foam::labelList & offsets ( ) const
inlinenoexcept

Const-access to the offsets.

Definition at line 205 of file globalIndexI.H.

Referenced by surfaceNoise::calculate(), globalIndex::gather(), globalIndex::operator<(), Foam::operator<<(), globalIndex::operator==(), and Foam::operator>>().

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 211 of file globalIndexI.H.

◆ single()

bool single ( ) const
inlinenoexcept

True if local-only content (ie, nProcs == 1). Such content is often created with gatherNone.

Definition at line 127 of file globalIndexI.H.

◆ nProcs()

Foam::label nProcs ( ) const
inlinenoexcept

The number of processors covered by the offsets, same as the primary length()

Definition at line 183 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 189 of file globalIndexI.H.

◆ subProcs()

Foam::labelRange subProcs ( ) const
inlinenoexcept

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

Definition at line 197 of file globalIndexI.H.

Referenced by faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), and PatchTools::gatherAndMerge().

Here is the caller graph for this function:

◆ begin_value()

Foam::label begin_value ( ) const
inlinenoexcept

The value corresponding to the first offset.

Definition at line 146 of file globalIndexI.H.

◆ end_value()

Foam::label end_value ( ) const
inlinenoexcept

The value corresponding to the last offset (end offset), which is 1 beyond the end of the range.

Definition at line 152 of file globalIndexI.H.

◆ front()

Foam::labelRange front ( ) const

The first offset range. It is (0,0) if globalIndex is empty.

Definition at line 506 of file globalIndex.C.

◆ back()

Foam::labelRange back ( ) const

The last offset range. It is (0,0) if globalIndex is empty.

Definition at line 517 of file globalIndex.C.

◆ clear()

void clear ( )
inline

Reset to be empty (no offsets)

Definition at line 217 of file globalIndexI.H.

Referenced by mergedSurf::clear().

Here is the caller graph for this function:

◆ resize()

void resize ( const label  n)

Change the number of entries (nProcs) in the offsets table. Extending will fill with empty local sizes.

Definition at line 332 of file globalIndex.C.

References n.

◆ reset() [1/7]

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 346 of file globalIndex.C.

References UPstream::allGatherValues(), UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), List< T >::resize(), and Foam::Zero.

Referenced by surfaceNoise::calculate(), PatchTools::gatherAndMerge(), globalMeshData::globalEdgeNumbering(), globalIndex::globalIndex(), globalMeshData::globalPointNumbering(), distributedTriSurfaceMesh::globalTris(), particleTracksSampler::reset(), globalIndex::reset(), and particleTracksSampler::resetCloud().

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

◆ reset() [2/7]

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

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

Definition at line 383 of file globalIndex.C.

References Foam::BitOps::count(), and UList< T >::size().

Here is the call graph for this function:

◆ reset() [3/7]

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

Reset to a single (local size) entry, no communication.

Parameters
commno communicator needed

Definition at line 514 of file globalIndexI.H.

◆ reset() [4/7]

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

Reset as 'one-sided' from local sizes. Uses UPstream::listGatherValues, but no broadcast. Will be empty on non-master processes.

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

Definition at line 527 of file globalIndexI.H.

References UPstream::listGatherValues().

Here is the call graph for this function:

◆ reset() [5/7]

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

Reset as 'one-sided' from the non-master local sizes (ie, master size is treated as 0). Uses UPstream::listGatherValues, but no broadcast. Will be empty on non-master processes.

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

Definition at line 539 of file globalIndexI.H.

References UPstream::listGatherValues(), and UPstream::master().

Here is the call graph for this function:

◆ reset() [6/7]

void reset ( const globalIndex gi)
inline

Reset the globalIndex. Same as copy assignment.

Definition at line 557 of file globalIndexI.H.

◆ setLocalSize()

void setLocalSize ( const label  proci,
const label  len 
)

Alter local size for given processor.

Definition at line 415 of file globalIndex.C.

References delta.

◆ contains()

bool contains ( const label  i) const
inlinenoexcept

True if contained within the offsets range.

Definition at line 159 of file globalIndexI.H.

◆ localStart() [1/2]

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

◆ localEnd() [1/2]

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

End of proci data.

Definition at line 245 of file globalIndexI.H.

◆ localSize() [1/2]

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

◆ maxNonLocalSize() [1/2]

Foam::label maxNonLocalSize ( const label  proci) const

The max of localSizes, excluding the specified processor.

Definition at line 482 of file globalIndex.C.

References Foam::BitOps::count(), and Foam::max().

Here is the call graph for this function:

◆ range() [1/2]

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

Return start/size range of proci data.

Definition at line 282 of file globalIndexI.H.

Referenced by faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), PatchTools::gatherAndMerge(), globalIndex::mpiGather(), and surfaceNoise::readSurfaceData().

Here is the caller graph for this function:

◆ isLocal() [1/2]

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

Is on processor proci.

Definition at line 294 of file globalIndexI.H.

Referenced by globalMeshData::calcCellCells(), mapDistributeBase::calcCompactAddressing(), addPatchCellLayer::calcExtrudeInfo(), and mapDistributeBase::renumber().

Here is the caller graph for this function:

◆ toGlobal() [1/4]

◆ toGlobal() [2/4]

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

From local to global on proci.

Definition at line 324 of file globalIndexI.H.

◆ inplaceToGlobal() [1/2]

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

From local to global index on proci (inplace)

Definition at line 351 of file globalIndexI.H.

Referenced by globalMeshData::calcCellCells(), faceAreaWeightAMI2D::calculate(), faceAreaWeightAMI::calculate(), PatchTools::gatherAndMerge(), and inverseDistance::holeExtrapolationStencil().

Here is the caller graph for this function:

◆ toLocal() [1/2]

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

◆ findProc()

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

Find processor with specified global id. Check proci first, followed by binary search.

Returns
the processor number or -1 (not found)

Definition at line 399 of file globalIndexI.H.

References Foam::findLower().

Here is the call graph for this function:

◆ findProcAbove()

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

Find processor above proci with specified global id - binary search.

Returns
the processor above proci or -1 otherwise (including for out-of-range indices)

Definition at line 438 of file globalIndexI.H.

References Foam::findLower().

Here is the call graph for this function:

◆ findProcBelow()

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

Find processor below proci with specified global id - binary search.

Binary search.

Returns
the processor below proci or -1 otherwise (including for out-of-range indices)

Definition at line 461 of file globalIndexI.H.

References Foam::findLower().

Here is the call graph for this function:

◆ whichProcID() [1/2]

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

Which processor does global id come from? Checks proci first (assumed to occur reasonably frequently) followed by a binary search. Fatal for out-of-range indices.

Definition at line 485 of file globalIndexI.H.

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

Referenced by fvMeshPrimitiveLduAddressing::addAddressing(), mapDistributeBase::calcCompactAddressing(), addPatchCellLayer::calcExtrudeInfo(), viewFactor::calculate(), distributedTriSurfaceMesh::findNearest(), viewFactor::initialise(), distributedTriSurfaceMesh::localQueries(), and mapDistributeBase::renumber().

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

◆ localStart() [2/2]

Foam::label localStart ( ) const
inline

Local start on myProcNo()

Definition at line 239 of file globalIndexI.H.

References UPstream::myProcNo(), and UPstream::worldComm.

Referenced by globalIndex::offset().

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

◆ localEnd() [2/2]

Foam::label localEnd ( ) const
inline

Local end on myProcNo()

Definition at line 251 of file globalIndexI.H.

References UPstream::myProcNo(), and UPstream::worldComm.

Here is the call graph for this function:

◆ localSize() [2/2]

Foam::label localSize ( ) const
inline

Local size on myProcNo()

Definition at line 263 of file globalIndexI.H.

References UPstream::myProcNo(), and UPstream::worldComm.

Referenced by globalIndex::globalIndex(), and globalIndex::reset().

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

◆ maxNonLocalSize() [2/2]

Foam::label maxNonLocalSize ( ) const
inline

The max of localSizes, excluding current (myProcNo) rank.

Definition at line 276 of file globalIndexI.H.

References UPstream::myProcNo(), and UPstream::worldComm.

Here is the call graph for this function:

◆ range() [2/2]

Foam::labelRange range ( ) const
inline

Return start/size range of local (myProcNo) data.

Definition at line 288 of file globalIndexI.H.

References UPstream::myProcNo(), range, and UPstream::worldComm.

Here is the call graph for this function:

◆ isLocal() [2/2]

bool isLocal ( const label  i) const
inline

Is on local processor.

Definition at line 301 of file globalIndexI.H.

References UPstream::myProcNo(), and UPstream::worldComm.

Here is the call graph for this function:

◆ toGlobal() [3/4]

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

From local to global index.

Definition at line 317 of file globalIndexI.H.

References UPstream::myProcNo(), and UPstream::worldComm.

Here is the call graph for this function:

◆ toGlobal() [4/4]

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

From local to global index.

Definition at line 342 of file globalIndexI.H.

References UPstream::myProcNo(), and UPstream::worldComm.

Here is the call graph for this function:

◆ inplaceToGlobal() [2/2]

void inplaceToGlobal ( labelUList labels) const
inline

From local to global index (inplace)

Definition at line 370 of file globalIndexI.H.

References UPstream::myProcNo(), and UPstream::worldComm.

Here is the call graph for this function:

◆ toLocal() [2/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 392 of file globalIndexI.H.

References UPstream::myProcNo(), and UPstream::worldComm.

Here is the call graph for this function:

◆ whichProcID() [2/2]

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

Which processor does global id come from?

Uses myProcNo for the initial local check.

Definition at line 505 of file globalIndexI.H.

References UPstream::myProcNo(), and UPstream::worldComm.

Here is the call graph for this function:

◆ cbegin() [1/2]

Foam::globalIndex::const_iterator cbegin ( ) const
inlinenoexcept

A const_iterator set to the beginning.

Definition at line 679 of file globalIndexI.H.

◆ cend()

const Foam::globalIndex::const_iterator cend ( ) const
inlinenoexcept

A const_iterator set to beyond the end.

Definition at line 686 of file globalIndexI.H.

◆ begin() [1/2]

Foam::globalIndex::const_iterator begin ( ) const
inlinenoexcept

A const_iterator set to the beginning.

Definition at line 693 of file globalIndexI.H.

◆ end()

const Foam::globalIndex::const_iterator end ( ) const
inlinenoexcept

A const_iterator set to beyond the end.

Definition at line 700 of file globalIndexI.H.

◆ cbegin() [2/2]

Foam::globalIndex::const_iterator cbegin ( const label  proci) const
inlinenoexcept

Return const_iterator at offset proci from begin, clamped to [0,nProcs] range.

Definition at line 707 of file globalIndexI.H.

◆ begin() [2/2]

Foam::globalIndex::const_iterator begin ( const label  proci) const
inlinenoexcept

Return const_iterator at offset proci from begin, clamped to [0,nProcs] range.

Definition at line 715 of file globalIndexI.H.

References stdFoam::cbegin().

Here is the call graph for this function:

◆ calcRange()

Foam::labelRange calcRange ( const label  localSize,
const label  comm = UPstream::worldComm,
const bool  checkOverflow = false 
)
static

Calculate globally-consistent local range (offset/size) based on the local input size(s).

Effectively the same as globalIndex(localSize).range() but without constructing an extra intermediate list of offsets

Parameters
commcommunicator

Definition at line 60 of file globalIndex.C.

References UPstream::allGatherValues(), Foam::BitOps::count(), UPstream::is_parallel(), UPstream::myProcNo(), UList< T >::size(), and IntRange< IntType >::start().

Here is the call graph for this function:

◆ calcOffset()

Foam::label calcOffset ( const label  localSize,
const label  comm = UPstream::worldComm,
const bool  checkOverflow = false 
)
static

Calculate globally-consistent local start offset based on the local input size(s).

Effectively the same as globalIndex(localSize).localStart() but without constructing an extra intermediate list of offsets

Parameters
commcommunicator

Definition at line 125 of file globalIndex.C.

References UPstream::allGatherValues(), Foam::BitOps::count(), UPstream::is_parallel(), UPstream::myProcNo(), and UList< T >::size().

Here is the call graph for this function:

◆ calcOffsets() [1/3]

Foam::labelList calcOffsets ( const labelUList counts,
const bool  checkOverflow = false 
)
static

Calculate offsets from a list of local sizes, with optional check for label overflow.

Definition at line 189 of file globalIndex.C.

References Foam::BitOps::count(), UList< T >::size(), and Foam::HashTableOps::values().

Here is the call graph for this function:

◆ calcOffsets() [2/3]

static labelList calcOffsets ( const IndirectListBase< label, Addr > &  counts,
const bool  checkOverflow = false 
)
static

Calculate offsets from an indirect list of local sizes, with optional check for label overflow.

◆ calcListOffsets() [1/2]

static labelList calcListOffsets ( const List< SubListType > &  lists,
const bool  checkOverflow = false 
)
static

Calculate offsets from list of lists, with optional check for label overflow.

◆ calcRanges()

Foam::List< Foam::labelRange > calcRanges ( const labelUList counts,
const bool  checkOverflow = false 
)
static

Calculate ranges (offset/size) from a list of local sizes, with optional check for label overflow.

Definition at line 223 of file globalIndex.C.

References Foam::BitOps::count(), UList< T >::size(), and Foam::HashTableOps::values().

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

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

Handles contiguous/non-contiguous data.

Parameters
commcommunicator
tagoutput field (master only)

Definition at line 100 of file globalIndexTemplates.C.

References List< T >::clear(), Foam::blockMeshTools::read(), List< T >::resize_nocopy(), and Foam::vtk::write().

Here is the call 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 186 of file globalIndexTemplates.C.

References UList< T >::back(), UList< T >::data_bytes(), UList< T >::empty(), fld, Foam::blockMeshTools::read(), List< T >::resize_nocopy(), UList< T >::size_bytes(), and Foam::vtk::write().

Referenced by faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), globalIndex::gather(), PatchTools::gatherAndMerge(), surfaceWriter::mergeFieldTemplate(), surfaceNoise::surfaceAverage(), and surfaceNoise::writeSurfaceData().

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 ProcIDsContainer &  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 288 of file globalIndexTemplates.C.

References UList< T >::back(), UList< T >::empty(), fld, Foam::PstreamDetail::gather(), and List< T >::resize_nocopy().

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 816 of file globalIndex.H.

References fld, globalIndex::gather(), UPstream::myProcNo(), and globalIndex::offsets().

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 842 of file globalIndex.H.

References fld, and globalIndex::gather().

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 862 of file globalIndex.H.

References fld, and globalIndex::gather().

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 388 of file globalIndexTemplates.C.

References List< T >::clear(), and Foam::PstreamDetail::gather().

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 424 of file globalIndexTemplates.C.

References List< T >::clear(), and Foam::PstreamDetail::gather().

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 460 of file globalIndexTemplates.C.

References Foam::PstreamDetail::gather().

Here is the call graph for this function:

◆ 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 475 of file globalIndexTemplates.C.

References Foam::PstreamDetail::gather().

Here is the call graph for this function:

◆ 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 490 of file globalIndexTemplates.C.

References fld, and Foam::PstreamDetail::gather().

Referenced by particleTracksSampler::gatherInplace(), and SprayCloud< Foam::DSMCCloud >::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 517 of file globalIndexTemplates.C.

References UList< T >::cdata(), UList< T >::cdata_bytes(), Foam::PstreamDetail::gather(), globalIndex::localSize(), globalIndex::localStart(), globalIndex::nProcs(), globalIndex::range(), List< T >::resize(), UList< T >::size(), UList< T >::size_bytes(), and globalIndex::totalSize().

Here is the call 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 681 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 697 of file globalIndexTemplates.C.

References fld.

◆ 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 725 of file globalIndexTemplates.C.

References 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 750 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 766 of file globalIndexTemplates.C.

References fld.

◆ 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 794 of file globalIndexTemplates.C.

References Foam::PstreamDetail::gather(), and UList< T >::size().

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

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 818 of file globalIndexTemplates.C.

References Foam::PstreamDetail::gather(), 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 842 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 857 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 872 of file globalIndexTemplates.C.

References fld, and Foam::PstreamDetail::gather().

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 891 of file globalIndexTemplates.C.

References UList< T >::cdata_bytes(), UList< T >::empty(), fld, Foam::blockMeshTools::read(), UList< T >::size_bytes(), and Foam::vtk::write().

Referenced by surfaceNoise::readSurfaceData(), 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 1201 of file globalIndex.H.

References fld, and globalIndex::scatter().

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 995 of file globalIndexTemplates.C.

References UList< T >::deepCopy(), and Foam::PstreamDetail::scatter().

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 1027 of file globalIndexTemplates.C.

References Foam::BitOps::count(), and Foam::PstreamDetail::scatter().

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 1059 of file globalIndexTemplates.C.

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

Here is the call graph for this function:

◆ operator==()

bool operator== ( const globalIndex rhs) const
inline

Compare for equality - uses the offsets.

Definition at line 1272 of file globalIndex.H.

References globalIndex::offsets().

Here is the call graph for this function:

◆ operator!=()

bool operator!= ( const globalIndex rhs) const
inline

Compare for inequality - uses the offsets.

Definition at line 1280 of file globalIndex.H.

◆ operator<()

bool operator< ( const globalIndex rhs) const
inline

Compare for less-than - uses the offsets.

Definition at line 1288 of file globalIndex.H.

References globalIndex::offsets().

Here is the call graph for this function:

◆ reset() [7/7]

void reset ( const label  localSize,
const int  tag,
const label  comm,
const bool  parallel 
)
inline

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

Definition at line 1324 of file globalIndex.H.

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

Here is the call graph for this function:

◆ offset()

label offset ( const label  proci) const
inline

Prefer localStart() to avoid confusing with offsets()

Definition at line 1338 of file globalIndex.H.

References globalIndex::localStart().

Here is the call graph for this function:

◆ calcOffsets() [3/3]

Foam::labelList calcOffsets ( const IndirectListBase< label, Addr > &  counts,
const bool  checkOverflow 
)

Definition at line 29 of file globalIndexTemplates.C.

References Foam::BitOps::count(), IndirectListBase< T, Addr >::size(), and Foam::HashTableOps::values().

Here is the call graph for this function:

◆ calcListOffsets() [2/2]

Foam::labelList calcListOffsets ( const List< SubListType > &  lists,
const bool  checkOverflow 
)

Definition at line 65 of file globalIndexTemplates.C.

References Foam::BitOps::count(), UList< T >::size(), and Foam::HashTableOps::values().

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

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