Loading...
Searching...
No Matches
globalIndex Class Reference

Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from different MPI ranks. These offsets can be used to define a unique (global) indexing number. More...

#include <globalIndex.H>

Classes

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

Public Types

typedef label value_type
 Type of values contained.
typedef label size_type
 The type that can represent the size.

Public Member Functions

 globalIndex () noexcept=default
 Default construct (empty).
 globalIndex (const labelUList &listOffsets)
 Copy construct from a list of offsets. No communication required.
 globalIndex (labelList &&listOffsets)
 Move construct from a list of offsets. No communication required.
 globalIndex (globalIndex::gatherNone, const labelUList &localSizes)
 Construct from a list of sizes and calculate the offsets. No communication required.
 globalIndex (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.
 globalIndex (globalIndex::gatherNone, label localSize, int communicator=-1)
 Construct with a single (local size) entry, no communication.
 globalIndex (globalIndex::gatherOnly, 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.
 globalIndex (globalIndex::gatherNonLocal, 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.
 globalIndex (Istream &is)
 Construct from Istream. No communication required.
bool empty () const noexcept
 Check for default constructed or total-size == 0.
label length () const noexcept
 The number of items covered by the offsets.
label size () const noexcept
 Global sum of localSizes. Same as totalSize().
label span () const noexcept
 The span size covered by the offsets, zero if empty.
label totalSize () const noexcept
 The total addressed size, which corresponds to the end offset and also the sum of all localSizes.
labelList sizes () const
 The local sizes. Same as localSizes().
const labelUList localStarts () const
 The local starts.
labelList localSizes () const
 The local sizes.
List< labelRangeranges () const
 Return start/size ranges for all data.
label maxSize () const
 Global max of localSizes.
const labelListoffsets () const noexcept
 Const-access to the offsets.
labelListoffsets () noexcept
 Write-access to the offsets, for changing after construction.
bool single () const noexcept
 True if local-only content (ie, nProcs == 1). Such content is often created with gatherNone.
label nProcs () const noexcept
 The number of processors covered by the offsets, same as the primary length().
labelRange allProcs () const noexcept
 Range of process indices for all addressed offsets (processes).
labelRange subProcs () const noexcept
 Range of process indices for addressed sub-offsets (processes).
label begin_value () const noexcept
 The value corresponding to the first offset.
label end_value () const noexcept
 The value corresponding to the last offset (end offset), which is 1 beyond the end of the range.
labelRange front () const
 The first offset range. It is (0,0) if globalIndex is empty.
labelRange back () const
 The last offset range. It is (0,0) if globalIndex is empty.
void clear ()
 Reset to be empty (no offsets).
void resize (const label n)
 Change the number of entries (nProcs) in the offsets table. Extending will fill with empty local sizes.
void reset (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.
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.
void reset (globalIndex::gatherNone, label localSize, int communicator=-1)
 Reset to a single (local size) entry, no communication.
void reset (globalIndex::gatherOnly, 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.
void reset (globalIndex::gatherNonLocal, 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.
void reset (const globalIndex &gi)
 Reset the globalIndex. Same as copy assignment.
void setLocalSize (const label proci, const label len)
 Alter local size for given processor.
bool contains (const label i) const noexcept
 True if contained within the offsets range.
label localStart (const label proci) const
 Start of proci data.
label localEnd (const label proci) const
 End of proci data.
label localSize (const label proci) const
 Size of proci data.
label maxNonLocalSize (const label proci) const
 The max of localSizes, excluding the specified processor.
labelRange range (label proci) const noexcept
 Return start/size range of proci data.
OffsetRange< label > slice (label proci) const noexcept
 Return start/size/total slab addressing for proci data.
bool isLocal (const label proci, const label i) const
 Is on processor proci.
label toGlobal (const label proci, const label i) const
 From local to global on proci.
labelList toGlobal (const label proci, const labelUList &labels) const
 From local to global on proci.
void inplaceToGlobal (const label proci, labelUList &labels) const
 From local to global index on proci (inplace).
label toLocal (const label proci, const label i) const
 From global to local on proci.
label findProc (const label proci, const label i) const
 Find processor with specified global id. Check proci first, followed by binary search.
label findProcAbove (const label proci, const label i) const
 Find processor above proci with specified global id - binary search.
label findProcBelow (const label proci, const label i) const
 Find processor below proci with specified global id - binary search.
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.
label localStart () const
 Local start on myProcNo().
label localEnd () const
 Local end on myProcNo().
label localSize () const
 Local size on myProcNo().
label maxNonLocalSize () const
 The max of localSizes, excluding current (myProcNo) rank.
labelRange range () const
 Return start/size range of local (myProcNo) data.
OffsetRange< label > slice () const
 Return start/size/total slab addressing for local (myProcNo) data.
bool isLocal (const label i) const
 Is on local processor.
label toGlobal (const label i) const
 From local to global index.
labelList toGlobal (const labelUList &labels) const
 From local to global index.
void inplaceToGlobal (labelUList &labels) const
 From local to global index (inplace).
label toLocal (const label i) const
 From global to local on current processor.
label whichProcID (const label i) const
 Which processor does global id come from?
const_iterator cbegin () const noexcept
 A const_iterator set to the beginning.
const const_iterator cend () const noexcept
 A const_iterator set to beyond the end.
const_iterator begin () const noexcept
 A const_iterator set to the beginning.
const const_iterator end () const noexcept
 A const_iterator set to beyond the end.
const_iterator cbegin (const label proci) const noexcept
 Return const_iterator at offset proci from begin, clamped to [0,nProcs] range.
const_iterator begin (const label proci) const noexcept
 Return const_iterator at offset proci from begin, clamped to [0,nProcs] range.
bool splitNodeOffsets (labelList &interNodeOffsets, labelList &localNodeOffsets, const label communicator=UPstream::worldComm, const bool absoluteLocalNodeOffsets=false) const
 Split the top-level offsets into inter-node and local-node components suitable to a two-stage hierarchy.
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(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking) const
 Collect data in processor order on master (== procIDs[0]).
template<class ProcIDsContainer, class Type>
void gatherInplace (const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking) const
 Inplace collect in processor order on master (== procIDs[0]).
template<class Type>
void gather (const UList< Type > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), 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).
template<class Type, class Addr>
void gather (const IndirectListBase< Type, Addr > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), 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).
template<class Type, class OutputContainer = List<Type>>
OutputContainer gather (const UList< Type > &sendData, const int tag=UPstream::msgType(), 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).
template<class Type, class Addr, class OutputContainer = List<Type>>
OutputContainer gather (const IndirectListBase< Type, Addr > &sendData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
 Collect data indirectly in processor order on master.
template<class Type>
void gatherInplace (List< Type > &fld, const int tag=UPstream::msgType(), 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).
template<class Type, class OutputContainer = List<Type>>
void mpiGather (const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, 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).
template<class Type, class OutputContainer = List<Type>>
OutputContainer mpiGather (const UList< Type > &sendData, const label comm=UPstream::worldComm, 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).
template<class Type>
void mpiGatherInplace (List< Type > &fld, const label comm=UPstream::worldComm, 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).
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(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking) const
 Distribute data in processor order.
template<class Type>
void scatter (const UList< Type > &allData, UList< Type > &localData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
 Distribute data in processor order.
template<class Type, class OutputContainer = List<Type>>
OutputContainer scatter (const UList< Type > &allData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
 Distribute data in processor order (in serial: performs a simple copy).
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.
bool operator== (const globalIndex &rhs) const
 Compare for equality - uses the offsets.
bool operator!= (const globalIndex &rhs) const
 Compare for inequality - uses the offsets.
bool operator< (const globalIndex &rhs) const
 Compare for less-than - uses the offsets.
 globalIndex (label localSize, const int tag, const label comm, const bool parallel)
 Construct from local size, using gather/broadcast with default/specified communicator if parallel.
void reset (label localSize, const int tag, const label comm, const bool parallel)
 Reset from local size, using gather/broadcast with default/specified communicator if parallel.
label offset (const label proci) const
 Prefer localStart() to avoid confusing with offsets().

Static Public Member Functions

static const globalIndexnull () noexcept
 Return a null globalIndex (reference to a nullObject). Behaves like an empty globalIndex.
template<class IntType>
static IntType calcOffset (IntType localSize, const label comm=UPstream::worldComm)
 Based on the local input size(s), calculate a globally-consistent local start offset.
template<class IntType>
static IntType calcOffset (IntType localSize, const label comm, const bool checkOverflow)
 Based on the local input size(s), calculate a globally-consistent local start offset.
template<class IntType>
static std::enable_if_t< std::is_integral_v< IntType >, IntRange< IntType > > calcRange (IntType localSize, const label comm=UPstream::worldComm)
 Based on the local input size(s), calculate a globally-consistent range (offset/size).
template<class IntType>
static std::enable_if_t< std::is_integral_v< IntType >, IntRange< IntType > > calcRange (IntType localSize, const label comm, const bool checkOverflow)
 Based on the local input size(s), calculate a globally-consistent range (offset/size). With optional overflow checking.
template<class IntType>
static List< IntType > calcRecvSizes (IntType localSize, const label comm=UPstream::worldComm)
 Get the receive sizes. On master the length == nProcs and element [0] corresponds to the max of all other receive sizes. On non-master, the list is zero-sized.
static labelList calcOffsets (const labelUList &counts, const bool checkOverflow=false)
 Calculate offsets from a list of local sizes, with optional check for label overflow.
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.
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.
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.
template<class ProcIDsContainer, class Type>
static List< Type > listGatherValues (const label comm, const ProcIDsContainer &procIDs, const Type &localValue, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
 Collect single values in processor order on master (== procIDs[0]).
template<class ProcIDsContainer, class Type>
static void gather (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, UList< Type > &allFld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
 Collect data in processor order on master (== procIDs[0]).
template<class ProcIDsContainer, class Type, class Addr>
static void gather (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const IndirectListBase< Type, Addr > &fld, UList< Type > &allFld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
 Collect indirect data in processor order on master.
template<class ProcIDsContainer, class Type>
static void gatherInplace (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
 Inplace collect in processor order on master (== procIDs[0]).
template<class Type, class OutputContainer = List<Type>>
static void mpiGatherOp (const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType())
 Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy).
template<class Type, class OutputContainer = List<Type>>
static OutputContainer mpiGatherOp (const UList< Type > &sendData, const label comm=UPstream::worldComm, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType())
 Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy).
template<class Type>
static void mpiGatherInplaceOp (List< Type > &fld, const label comm=UPstream::worldComm, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType())
 Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op).
template<class Type>
static void gatherOp (const UList< Type > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
 Collect data in processor order on master (in serial: performs a simple copy).
template<class Type, class Addr>
static void gatherOp (const IndirectListBase< Type, Addr > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
 Collect data in processor order on master (in serial: performs a simple copy).
template<class Type, class OutputContainer = List<Type>>
static OutputContainer gatherOp (const UList< Type > &sendData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
 Collect and return data in processor order on master (in serial: performs a simple copy).
template<class Type, class Addr, class OutputContainer = List<Type>>
static OutputContainer gatherOp (const IndirectListBase< Type, Addr > &sendData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
 Collect and return data in processor order on master (in serial: performs a simple copy).
template<class Type>
static void gatherInplaceOp (List< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
 Inplace collect data in processor order on master (in serial: a no-op).
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(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
 Distribute data in processor order.

Friends

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

Detailed Description

Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from different MPI ranks. These offsets can be used to define a unique (global) indexing number.

For example,

    globalIndex globalFaces(mesh.nFaces());
    label globalFacei = globalFaces.toGlobal(facei);
Note
The globalIndex is generally used when the ranks need information about each other's position, whereas GlobalOffset and OffsetRange are used when only the local addressing information (and total Size) is needed without additional information about other ranks.
Warning
The unique integer is a Foam::label, so may be subject to overflow problems (2G max) with a 32-bit label compilation.
Source files

Definition at line 76 of file globalIndex.H.

Member Typedef Documentation

◆ value_type

typedef label value_type

Type of values contained.

Definition at line 138 of file globalIndex.H.

◆ size_type

typedef label size_type

The type that can represent the size.

Definition at line 143 of file globalIndex.H.

Constructor & Destructor Documentation

◆ globalIndex() [1/10]

globalIndex ( )
defaultnoexcept

Default construct (empty).

References globalIndex(), localSize(), localSizes(), and Foam::noexcept.

Referenced by globalIndex::const_iterator::const_iterator(), globalIndex(), globalIndex(), globalIndex(), null(), operator!=(), operator<(), operator<<, operator==(), operator>>, reset(), and reset().

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

◆ globalIndex() [2/10]

globalIndex ( const labelUList & listOffsets)
inlineexplicit

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

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

◆ globalIndex() [4/10]

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

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

Definition at line 111 of file globalIndexI.H.

References localSizes(), and reset().

Here is the call graph for this function:

◆ globalIndex() [5/10]

globalIndex ( 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 121 of file globalIndexI.H.

References localSize(), and reset().

Here is the call graph for this function:

◆ globalIndex() [6/10]

globalIndex ( globalIndex::gatherNone ,
label localSize,
int communicator = -1 )
inline

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

Parameters
communicator(unused) no communicator needed

Definition at line 132 of file globalIndexI.H.

References localSize().

Here is the call graph for this function:

◆ globalIndex() [7/10]

globalIndex ( globalIndex::gatherOnly ,
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 146 of file globalIndexI.H.

References UPstream::listGatherValues(), localSize(), and reset().

Here is the call graph for this function:

◆ globalIndex() [8/10]

globalIndex ( globalIndex::gatherNonLocal ,
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 158 of file globalIndexI.H.

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

Here is the call graph for this function:

◆ globalIndex() [9/10]

globalIndex ( Istream & is)
explicit

Construct from Istream. No communication required.

References empty(), FOAM_DEPRECATED_STRICT, globalIndex(), length(), and Foam::noexcept.

Here is the call graph for this function:

◆ globalIndex() [10/10]

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

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

Here is the call graph for this function:

Member Function Documentation

◆ null()

const globalIndex & null ( )
inlinestaticnoexcept

Return a null globalIndex (reference to a nullObject). Behaves like an empty globalIndex.

Definition at line 175 of file globalIndex.H.

References globalIndex(), Foam::noexcept, and Foam::NullObjectRef().

Here is the call graph for this function:

◆ empty()

bool empty ( ) const
inlinenoexcept

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

Definition at line 173 of file globalIndexI.H.

References Foam::noexcept.

Referenced by globalIndex().

Here is the caller graph for this function:

◆ length()

Foam::label length ( ) const
inlinenoexcept

The number of items covered by the offsets.

Definition at line 186 of file globalIndexI.H.

References Foam::noexcept.

Referenced by cbegin(), cend(), end(), globalIndex(), and nProcs().

Here is the caller graph for this function:

◆ size()

label size ( ) const
inlinenoexcept

Global sum of localSizes. Same as totalSize().

Definition at line 285 of file globalIndex.H.

References Foam::noexcept, size(), and totalSize().

Referenced by size().

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

◆ span()

Foam::label span ( ) const
inlinenoexcept

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

Definition at line 193 of file globalIndexI.H.

References begin_value(), end_value(), and Foam::noexcept.

Here is the call graph for this function:

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

References end_value(), and Foam::noexcept.

Referenced by nearWallFields::calcAddressing(), cyclicAMIGAMGInterface::cyclicAMIGAMGInterface(), cyclicAMIGAMGInterface::cyclicAMIGAMGInterface(), metisLikeDecomp::decomposeGeneral(), distributedTriSurfaceMesh::globalSize(), regionSplit::nRegions(), SprayCloud< CloudType >::penetration(), size(), and streamLineBase::writeToFile().

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

◆ sizes()

Foam::labelList sizes ( ) const
inline

The local sizes. Same as localSizes().

Definition at line 224 of file globalIndexI.H.

References localSizes().

Here is the call graph for this function:

◆ localStarts()

const Foam::labelUList localStarts ( ) const
inline

The local starts.

Definition at line 270 of file globalIndexI.H.

References UList< label >::null().

Here is the call graph for this function:

◆ localSizes()

labelList localSizes ( ) const

The local sizes.

References localSizes().

Referenced by globalIndex(), globalIndex(), localSizes(), and sizes().

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

◆ ranges()

List< labelRange > ranges ( ) const

Return start/size ranges for all data.

References allProcs(), begin_value(), end_value(), maxSize(), Foam::noexcept, nProcs(), offsets(), ranges(), single(), and subProcs().

Referenced by ranges().

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

◆ maxSize()

Foam::label maxSize ( ) const
inline

Global max of localSizes.

Definition at line 319 of file globalIndexI.H.

References maxNonLocalSize().

Referenced by ranges().

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

◆ offsets() [1/2]

const Foam::labelList & offsets ( ) const
inlinenoexcept

Const-access to the offsets.

Definition at line 252 of file globalIndexI.H.

References Foam::noexcept.

Referenced by surfaceNoise::calculate(), gather(), gather(), gatherInplace(), operator<(), operator==(), ranges(), and scatter().

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

References Foam::noexcept.

◆ single()

bool single ( ) const
inlinenoexcept

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

Definition at line 180 of file globalIndexI.H.

References Foam::noexcept.

Referenced by ranges().

Here is the caller graph for this function:

◆ nProcs()

Foam::label nProcs ( ) const
inlinenoexcept

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

Definition at line 230 of file globalIndexI.H.

References length(), and Foam::noexcept.

Referenced by ranges().

Here is the call graph for this function:
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 236 of file globalIndexI.H.

References Foam::noexcept.

Referenced by ranges().

Here is the caller graph for this function:

◆ subProcs()

Foam::labelRange subProcs ( ) const
inlinenoexcept

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

Definition at line 244 of file globalIndexI.H.

References Foam::noexcept.

Referenced by ZoneMesh< ZoneType, MeshType >::checkParallelSync(), metisLikeDecomp::decomposeGeneral(), PatchTools::gatherAndMerge(), and ranges().

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

References Foam::noexcept.

Referenced by contains(), ranges(), and span().

Here is the caller graph for this function:

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

References Foam::noexcept.

Referenced by contains(), ranges(), span(), and totalSize().

Here is the caller graph for this function:

◆ front()

labelRange front ( ) const

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

References front().

Referenced by front().

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

◆ back()

labelRange back ( ) const

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

References back(), and clear().

Referenced by back().

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

◆ clear()

void clear ( )
inline

Reset to be empty (no offsets).

Definition at line 264 of file globalIndexI.H.

Referenced by back().

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.

References n, and resize().

Referenced by resize().

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

◆ reset() [1/7]

void reset ( 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

References localSize(), and reset().

Referenced by snappyLayerDriver::addLayers(), surfaceNoise::calculate(), PatchTools::gatherAndMerge(), globalIndex(), reset(), reset(), and reset().

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.

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

Here is the call graph for this function:

◆ reset() [3/7]

void reset ( globalIndex::gatherNone ,
label localSize,
int communicator = -1 )
inline

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

Parameters
communicator(unused) no communicator needed

Definition at line 573 of file globalIndexI.H.

References localSize().

Here is the call graph for this function:

◆ reset() [4/7]

void reset ( globalIndex::gatherOnly ,
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 586 of file globalIndexI.H.

References UPstream::listGatherValues(), localSize(), and reset().

Here is the call graph for this function:

◆ reset() [5/7]

void reset ( globalIndex::gatherNonLocal ,
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 598 of file globalIndexI.H.

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

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

References globalIndex(), and Foam::rhs().

Here is the call graph for this function:

◆ setLocalSize()

void setLocalSize ( const label proci,
const label len )

Alter local size for given processor.

References contains(), localEnd(), localSize(), localStart(), Foam::noexcept, and setLocalSize().

Referenced by setLocalSize().

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

◆ contains()

bool contains ( const label i) const
inlinenoexcept

True if contained within the offsets range.

Definition at line 212 of file globalIndexI.H.

References begin_value(), and end_value().

Referenced by setLocalSize().

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

◆ localStart() [1/2]

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

Start of proci data.

Definition at line 283 of file globalIndexI.H.

Referenced by Foam::calcCellCellsImpl(), viewFactor::calculate(), lduPrimitiveMesh::globalCellCells(), localStart(), maxNonLocalSize(), and setLocalSize().

Here is the caller graph for this function:

◆ localEnd() [1/2]

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

End of proci data.

Definition at line 295 of file globalIndexI.H.

Referenced by localEnd(), maxNonLocalSize(), and setLocalSize().

Here is the caller graph for this function:

◆ localSize() [1/2]

◆ maxNonLocalSize() [1/2]

label maxNonLocalSize ( const label proci) const

The max of localSizes, excluding the specified processor.

References findProc(), findProcAbove(), findProcBelow(), inplaceToGlobal(), isLocal(), localEnd(), localSize(), localStart(), maxNonLocalSize(), Foam::noexcept, range(), slice(), toGlobal(), toLocal(), and whichProcID().

Referenced by maxNonLocalSize(), maxNonLocalSize(), and maxSize().

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

◆ range() [1/2]

◆ slice() [1/2]

Foam::OffsetRange< Foam::label > slice ( label proci) const
inlinenoexcept

Return start/size/total slab addressing for proci data.

Definition at line 345 of file globalIndexI.H.

Referenced by findProc(), findProcBelow(), and maxNonLocalSize().

Here is the caller graph for this function:

◆ isLocal() [1/2]

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

References inplaceToGlobal().

Here is the call graph for this function:

◆ inplaceToGlobal() [1/2]

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

◆ toLocal() [1/2]

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

References Foam::findLower(), isLocal(), and slice().

Referenced by maxNonLocalSize(), and whichProcID().

Here is the call graph for this function:
Here is the caller 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 497 of file globalIndexI.H.

References Foam::findLower().

Referenced by maxNonLocalSize().

Here is the call graph for this function:
Here is the caller 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 520 of file globalIndexI.H.

References Foam::findLower(), and slice().

Referenced by maxNonLocalSize().

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

◆ whichProcID() [1/2]

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

◆ localStart() [2/2]

Foam::label localStart ( ) const
inline

Local start on myProcNo().

Definition at line 289 of file globalIndexI.H.

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

Referenced by 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 301 of file globalIndexI.H.

References localEnd(), 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 313 of file globalIndexI.H.

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

Here is the call graph for this function:

◆ maxNonLocalSize() [2/2]

Foam::label maxNonLocalSize ( ) const
inline

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

Definition at line 326 of file globalIndexI.H.

References maxNonLocalSize(), 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 338 of file globalIndexI.H.

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

Here is the call graph for this function:

◆ slice() [2/2]

Foam::OffsetRange< Foam::label > slice ( ) const
inline

Return start/size/total slab addressing for local (myProcNo) data.

Definition at line 352 of file globalIndexI.H.

References UPstream::myProcNo(), 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 365 of file globalIndexI.H.

References isLocal(), 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 381 of file globalIndexI.H.

References UPstream::myProcNo(), toGlobal(), 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 405 of file globalIndexI.H.

References UPstream::myProcNo(), toGlobal(), 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 430 of file globalIndexI.H.

References inplaceToGlobal(), 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 452 of file globalIndexI.H.

References UPstream::myProcNo(), toLocal(), 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 564 of file globalIndexI.H.

References UPstream::myProcNo(), whichProcID(), 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 733 of file globalIndexI.H.

References Foam::noexcept.

Referenced by begin().

Here is the caller graph for this function:

◆ cend()

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

A const_iterator set to beyond the end.

Definition at line 740 of file globalIndexI.H.

References length(), and Foam::noexcept.

Here is the call graph for this function:

◆ begin() [1/2]

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

A const_iterator set to the beginning.

Definition at line 747 of file globalIndexI.H.

References Foam::noexcept.

◆ end()

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

A const_iterator set to beyond the end.

Definition at line 754 of file globalIndexI.H.

References length(), and Foam::noexcept.

Here is the call graph for this function:

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

References length().

Here is the call graph for this function:

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

References cbegin().

Here is the call graph for this function:

◆ calcOffset() [1/2]

template<class IntType>
IntType calcOffset ( IntType localSize,
const label comm = UPstream::worldComm )
static

Based on the local input size(s), calculate a globally-consistent local start offset.

No overflow checks.

Note
Restricted to integral types.
Parameters
commcommunicator

References calcOffset(), and localSize().

Referenced by calcOffset(), calcOffset(), calcRange(), calcRange(), regionSplit2D::regionSplit2D(), and topOVariablesBase::writeFluidSolidInterface().

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

◆ calcOffset() [2/2]

template<class IntType>
IntType calcOffset ( IntType localSize,
const label comm,
const bool checkOverflow )
inlinestatic

Based on the local input size(s), calculate a globally-consistent local start offset.

With optional overflow checking.

Note
Restricted to integral types.
Parameters
commcommunicator

Definition at line 779 of file globalIndex.H.

References calcOffset(), UPstream::is_parallel(), localSize(), and UPstream::myProcNo().

Here is the call graph for this function:

◆ calcRange() [1/2]

template<class IntType>
std::enable_if_t< std::is_integral_v< IntType >, IntRange< IntType > > calcRange ( IntType localSize,
const label comm = UPstream::worldComm )
inlinestatic

Based on the local input size(s), calculate a globally-consistent range (offset/size).

No overflow checks.

Note
Restricted to integral types.
Parameters
commcommunicator

Definition at line 810 of file globalIndex.H.

References calcOffset(), localSize(), and UPstream::worldComm.

Here is the call graph for this function:

◆ calcRange() [2/2]

template<class IntType>
std::enable_if_t< std::is_integral_v< IntType >, IntRange< IntType > > calcRange ( IntType localSize,
const label comm,
const bool checkOverflow )
inlinestatic

Based on the local input size(s), calculate a globally-consistent range (offset/size). With optional overflow checking.

Note
Restricted to integral types.
Parameters
commcommunicator

Definition at line 829 of file globalIndex.H.

References calcOffset(), and localSize().

Here is the call graph for this function:

◆ calcRecvSizes()

template<class IntType>
List< IntType > calcRecvSizes ( IntType localSize,
const label comm = UPstream::worldComm )
static

Get the receive sizes. On master the length == nProcs and element [0] corresponds to the max of all other receive sizes. On non-master, the list is zero-sized.

Note
Restricted to integral types.
Parameters
commcommunicator

References localSize(), and UPstream::worldComm.

Here is the call graph for this function:

◆ calcOffsets() [1/2]

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

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

◆ calcOffsets() [2/2]

template<class Addr>
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()

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

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

◆ calcRanges()

List< 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.

◆ splitNodeOffsets()

bool splitNodeOffsets ( labelList & interNodeOffsets,
labelList & localNodeOffsets,
const label communicator = UPstream::worldComm,
const bool absoluteLocalNodeOffsets = false ) const

Split the top-level offsets into inter-node and local-node components suitable to a two-stage hierarchy.

Parameters
[out]interNodeOffsetsOffsets between nodes (only non-empty on node leaders)
[out]localNodeOffsetsOffsets within a node (only non-empty on node leaders)
communicatorThe communicator. Must resolve to const world-comm
absoluteLocalNodeOffsetsRetain absolute values for the localNode offsets

References UPstream::worldComm.

◆ listGatherValues()

template<class ProcIDsContainer, class Type>
List< Type > listGatherValues ( const label comm,
const ProcIDsContainer & procIDs,
const Type & localValue,
const int tag = UPstream::msgType(),
UPstream::commsTypes commsType = UPstream::commsTypes::nonBlocking )
staticnodiscard

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

Handles contiguous/non-contiguous data. non-zero output field (master only)

Parameters
commcommunicator

References UPstream::msgType(), and UPstream::nonBlocking.

Referenced by GAMGAgglomeration::procAgglomerateRestrictAddressing().

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

◆ gather() [1/7]

template<class ProcIDsContainer, class Type>
void gather ( const labelUList & offsets,
const label comm,
const ProcIDsContainer & procIDs,
const UList< Type > & fld,
UList< Type > & allFld,
const int tag = UPstream::msgType(),
UPstream::commsTypes commsType = 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
[in]fldall ranks
[out]allFldresult (master only). Must be adequately sized!

References fld(), UPstream::msgType(), UPstream::nonBlocking, and offsets().

Referenced by ZoneMesh< ZoneType, MeshType >::checkParallelSync(), simpleGeomDecomp::decompose(), metisLikeDecomp::decomposeGeneral(), PatchTools::gatherAndMerge(), surfaceWriter::mergeFieldTemplate(), GAMGAgglomeration::procAgglomerateRestrictAddressing(), surfaceNoise::surfaceAverage(), and surfaceNoise::writeSurfaceData().

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

◆ gather() [2/7]

template<class ProcIDsContainer, class Type, class Addr>
void gather ( const labelUList & offsets,
const label comm,
const ProcIDsContainer & procIDs,
const IndirectListBase< Type, Addr > & fld,
UList< Type > & allFld,
const int tag = UPstream::msgType(),
UPstream::commsTypes commsType = 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
[in]fldall ranks
[out]allFldresult (master only). Must be adequately sized!

References fld(), UPstream::msgType(), UPstream::nonBlocking, and offsets().

Here is the call graph for this function:

◆ gatherInplace() [1/3]

template<class ProcIDsContainer, class Type>
void gatherInplace ( const labelUList & offsets,
const label comm,
const ProcIDsContainer & procIDs,
List< Type > & fld,
const int tag = UPstream::msgType(),
UPstream::commsTypes commsType = UPstream::commsTypes::nonBlocking )
static

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

Parameters
offsetsoffsets (master only)
commcommunicator
[in,out]fld

References fld(), UPstream::msgType(), UPstream::nonBlocking, and offsets().

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

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

◆ gather() [3/7]

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(),
UPstream::commsTypes commsType = UPstream::commsTypes::nonBlocking ) const

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

Note
the globalIndex offsets needed on master only.
Parameters
commcommunicator
[in]fldinput field
[out]allFldresized to have results on master, empty elsewhere.

References fld(), UPstream::msgType(), and UPstream::nonBlocking.

Here is the call graph for this function:

◆ gatherInplace() [2/3]

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

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

Note
the globalIndex offsets needed on master only.
Parameters
commcommunicator
[in,out]fld

Definition at line 1007 of file globalIndex.H.

References fld(), gatherInplace(), UPstream::msgType(), and UPstream::nonBlocking.

Here is the call graph for this function:

◆ gather() [4/7]

template<class Type>
void gather ( const UList< Type > & sendData,
List< Type > & allData,
const int tag = UPstream::msgType(),
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
[in]sendDatainput on all ranks
[out]allDataresized to have results on master, empty elsewhere.
commcommunicator

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ gather() [5/7]

template<class Type, class Addr>
void gather ( const IndirectListBase< Type, Addr > & sendData,
List< Type > & allData,
const int tag = UPstream::msgType(),
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
[in]sendDatainput on all ranks
[out]allDataresized to have results on master, empty elsewhere.
commcommunicator

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ gather() [6/7]

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

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
[in]sendDataall ranks
commcommunicator

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ gather() [7/7]

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

Collect data indirectly in processor order on master.

Communication with default/specified communicator, message tag.

Returns
output (master), zero-sized on non-master
Parameters
[in]sendDataall ranks
commcommunicator

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ gatherInplace() [3/3]

template<class Type>
void gatherInplace ( List< Type > & fld,
const int tag = UPstream::msgType(),
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 non-master.

Parameters
[in,out]fld
commcommunicator

References fld(), UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ mpiGather() [1/2]

template<class Type, class OutputContainer = List<Type>>
void mpiGather ( const UList< Type > & sendData,
OutputContainer & allData,
const label comm = UPstream::worldComm,
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!!
Parameters
[out]allDataoutput on master, zero-sized on non-master
commcommunicator

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Referenced by surfaceWriter::mergeFieldTemplate().

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

◆ mpiGather() [2/2]

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

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

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ mpiGatherInplace()

template<class Type>
void mpiGatherInplace ( List< Type > & fld,
const label comm = UPstream::worldComm,
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
[in,out]fld
commcommunicator

References fld(), UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ mpiGatherOp() [1/2]

template<class Type, class OutputContainer = List<Type>>
void mpiGatherOp ( const UList< Type > & sendData,
OutputContainer & allData,
const label comm = UPstream::worldComm,
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

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ mpiGatherOp() [2/2]

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

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

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ mpiGatherInplaceOp()

template<class Type>
void mpiGatherInplaceOp ( List< Type > & fld,
const label comm = UPstream::worldComm,
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
[in,out]fld
commcommunicator

References fld(), UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ gatherOp() [1/4]

template<class Type>
void gatherOp ( const UList< Type > & sendData,
List< Type > & allData,
const int tag = UPstream::msgType(),
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.

Parameters
[out]allDataoutput on master, zero-sized on non-master
commcommunicator

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

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]

template<class Type, class Addr>
void gatherOp ( const IndirectListBase< Type, Addr > & sendData,
List< Type > & allData,
const int tag = UPstream::msgType(),
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.

Parameters
[out]allDataoutput on master, zero-sized on non-master
commcommunicator

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ gatherOp() [3/4]

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

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

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ gatherOp() [4/4]

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

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

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ gatherInplaceOp()

template<class Type>
void gatherInplaceOp ( List< Type > & fld,
const int tag = UPstream::msgType(),
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 non-master.

Parameters
[in,out]fld
commcommunicator

References fld(), UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ scatter() [1/4]

template<class ProcIDsContainer, class Type>
void scatter ( const labelUList & offsets,
const label comm,
const ProcIDsContainer & procIDs,
const UList< Type > & allFld,
UList< Type > & fld,
const int tag = UPstream::msgType(),
UPstream::commsTypes commsType = 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

References fld(), UPstream::msgType(), UPstream::nonBlocking, and offsets().

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

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

◆ scatter() [2/4]

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(),
UPstream::commsTypes commsType = 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 1356 of file globalIndex.H.

References fld(), UPstream::msgType(), UPstream::nonBlocking, and scatter().

Here is the call graph for this function:

◆ scatter() [3/4]

template<class Type>
void scatter ( const UList< Type > & allData,
UList< Type > & localData,
const int tag = UPstream::msgType(),
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

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ scatter() [4/4]

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

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

References UPstream::msgType(), UPstream::nonBlocking, and UPstream::worldComm.

Here is the call graph for this function:

◆ get()

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.

Communication with default/specified communicator, message tag.

Parameters
commcommunicator

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

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

References globalIndex(), offsets(), and Foam::rhs().

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

References globalIndex(), and Foam::rhs().

Here is the call graph for this function:

◆ operator<()

bool operator< ( const globalIndex & rhs) const
inline

Compare for less-than - uses the offsets.

Definition at line 1444 of file globalIndex.H.

References globalIndex(), offsets(), and Foam::rhs().

Here is the call graph for this function:

◆ reset() [7/7]

void reset ( 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 1479 of file globalIndex.H.

References localSize(), and 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 1494 of file globalIndex.H.

References localStart(), and offset().

Referenced by offset().

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

◆ operator>>

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

References globalIndex().

◆ operator<<

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

References globalIndex(), and os().


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