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< labelRange > | ranges () const |
| Return start/size ranges for all data. More... | |
| label | maxSize () const |
| Global max of localSizes. More... | |
| const labelList & | offsets () const noexcept |
| Const-access to the offsets. More... | |
| labelList & | offsets () 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... | |
| 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. 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(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking) const |
| Collect data in processor order on master (== procIDs[0]). More... | |
| 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]). More... | |
| 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). More... | |
| 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). More... | |
| 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). More... | |
| 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. More... | |
| 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). More... | |
| 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). More... | |
| 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). More... | |
| 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). 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(), UPstream::commsTypes commsType=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(), UPstream::commsTypes commsType=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(), UPstream::commsTypes commsType=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... | |
Static Public Member Functions | |
| static const globalIndex & | null () noexcept |
| Return a null globalIndex (reference to a nullObject). Behaves like an empty globalIndex. More... | |
| 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< labelRange > | calcRanges (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 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]). More... | |
| 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]). 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, UList< Type > &allFld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking) |
| Collect indirect data in processor order on master. More... | |
| 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]). More... | |
| 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). More... | |
| 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). More... | |
| 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). More... | |
| 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). More... | |
| 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). More... | |
| 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). More... | |
| 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). More... | |
| 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). 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(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking) |
| Distribute data in processor order. More... | |
Friends | |
| Istream & | operator>> (Istream &is, globalIndex &gi) |
| Ostream & | operator<< (Ostream &os, const globalIndex &gi) |
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);
Definition at line 61 of file globalIndex.H.
|
defaultnoexcept |
Default construct (empty)
|
inlineexplicit |
Copy construct from a list of offsets. No communication required.
Definition at line 27 of file globalIndexI.H.
References UList< T >::size().

|
inlineexplicit |
Move construct from a list of offsets. No communication required.
Definition at line 39 of file globalIndexI.H.
|
inline |
Construct from a list of sizes and calculate the offsets. No communication required.
Definition at line 53 of file globalIndexI.H.
References reset().

|
inlineexplicit |
Construct from local size, using gather/broadcast with default/specified communicator if parallel.
| comm | communicator |
| parallel | use parallel comms |
Definition at line 63 of file globalIndexI.H.
References reset().

|
inline |
Construct with a single (local size) entry, no communication.
| comm | no communicator needed |
Definition at line 74 of file globalIndexI.H.
|
inline |
Construct 'one-sided' from local sizes. Uses UPstream::listGatherValues, but no broadcast. Will be empty on non-master processes.
| comm | communicator |
Definition at line 88 of file globalIndexI.H.
References reset().

|
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.
| comm | communicator |
Definition at line 100 of file globalIndexI.H.
References reset().

|
explicit |
Construct from Istream. No communication required.
Definition at line 367 of file globalIndex.C.
|
inline |
Construct from local size, using gather/broadcast with default/specified communicator if parallel.
Definition at line 1341 of file globalIndex.H.
References globalIndex::localSize(), and globalIndex::reset().

|
inlinestaticnoexcept |
Return a null globalIndex (reference to a nullObject). Behaves like an empty globalIndex.
Definition at line 133 of file globalIndex.H.
|
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().

|
inlinenoexcept |
The number of items covered by the offsets.
Definition at line 133 of file globalIndexI.H.
|
inline |
Global sum of localSizes. Same as totalSize()
Definition at line 171 of file globalIndexI.H.
|
inlinenoexcept |
The span size covered by the offsets, zero if empty.
Definition at line 140 of file globalIndexI.H.
|
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(), particleTracksSampler::nParticle(), regionSplit::nRegions(), globalMeshData::nTotalCells(), globalMeshData::nTotalFaces(), globalMeshData::nTotalPoints(), SprayCloud< Foam::DSMCCloud >::penetration(), and particleTracksSampler::setSampleRate().

|
inline |
The local sizes. Same as localSizes()
Definition at line 177 of file globalIndexI.H.
|
inline |
The local starts.
Definition at line 223 of file globalIndexI.H.
References UList< label >::null().

| Foam::labelList localSizes | ( | ) | const |
The local sizes.
Definition at line 539 of file globalIndex.C.
References Foam::HashTableOps::values().

| Foam::List< Foam::labelRange > ranges | ( | ) | const |
Return start/size ranges for all data.
Definition at line 562 of file globalIndex.C.
References Foam::HashTableOps::values().

|
inline |
Global max of localSizes.
Definition at line 269 of file globalIndexI.H.
|
inlinenoexcept |
Const-access to the offsets.
Definition at line 205 of file globalIndexI.H.
Referenced by surfaceNoise::calculate(), globalIndex::operator<(), Foam::operator<<(), globalIndex::operator==(), and Foam::operator>>().

|
inlinenoexcept |
Write-access to the offsets, for changing after construction.
Definition at line 211 of file globalIndexI.H.
|
inlinenoexcept |
True if local-only content (ie, nProcs == 1). Such content is often created with gatherNone.
Definition at line 127 of file globalIndexI.H.
|
inlinenoexcept |
The number of processors covered by the offsets, same as the primary length()
Definition at line 183 of file globalIndexI.H.
|
inlinenoexcept |
Range of process indices for all addressed offsets (processes)
Definition at line 189 of file globalIndexI.H.
|
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().

|
inlinenoexcept |
The value corresponding to the first offset.
Definition at line 146 of file globalIndexI.H.
|
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.
| Foam::labelRange front | ( | ) | const |
The first offset range. It is (0,0) if globalIndex is empty.
Definition at line 612 of file globalIndex.C.
| Foam::labelRange back | ( | ) | const |
The last offset range. It is (0,0) if globalIndex is empty.
Definition at line 623 of file globalIndex.C.
|
inline |
Reset to be empty (no offsets)
Definition at line 217 of file globalIndexI.H.
Referenced by mergedSurf::clear().

| 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 438 of file globalIndex.C.
References n.
| 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.
| comm | communicator |
| parallel | use parallel comms |
Definition at line 452 of file globalIndex.C.
References UPstream::allGatherValues(), UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), reset(), and List< T >::resize().
Referenced by surfaceNoise::calculate(), PatchTools::gatherAndMerge(), globalIndex::globalIndex(), distributedTriSurfaceMesh::globalTris(), particleTracksSampler::reset(), globalIndex::reset(), and particleTracksSampler::resetCloud().


| 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 489 of file globalIndex.C.
References Foam::BitOps::count(), and UList< T >::size().

|
inline |
Reset to a single (local size) entry, no communication.
| comm | no communicator needed |
Definition at line 514 of file globalIndexI.H.
|
inline |
Reset as 'one-sided' from local sizes. Uses UPstream::listGatherValues, but no broadcast. Will be empty on non-master processes.
| comm | communicator |
Definition at line 527 of file globalIndexI.H.
References UPstream::listGatherValues(), and reset().

|
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.
| comm | communicator |
Definition at line 539 of file globalIndexI.H.
References UPstream::listGatherValues(), UPstream::master(), and reset().

|
inline |
Reset the globalIndex. Same as copy assignment.
Definition at line 557 of file globalIndexI.H.
| void setLocalSize | ( | const label | proci, |
| const label | len | ||
| ) |
Alter local size for given processor.
Definition at line 521 of file globalIndex.C.
References delta.
|
inlinenoexcept |
True if contained within the offsets range.
Definition at line 159 of file globalIndexI.H.
|
inline |
Start of proci data.
Definition at line 233 of file globalIndexI.H.
Referenced by Foam::calcCellCellsImpl(), viewFactor::calculate(), lduPrimitiveMesh::globalCellCells(), zoltanRenumber::renumber(), and Foam::vtk::writeListParallel().

|
inline |
End of proci data.
Definition at line 245 of file globalIndexI.H.
|
inline |
Size of proci data.
Definition at line 257 of file globalIndexI.H.
Referenced by holeToFace::calcClosure(), createShellMesh::calcPointRegions(), viewFactor::calculate(), mapDistributeBase::exchangeAddressing(), regionSplit::nLocalRegions(), and surfaceNoise::readSurfaceData().

| Foam::label maxNonLocalSize | ( | const label | proci | ) | const |
The max of localSizes, excluding the specified processor.
Definition at line 588 of file globalIndex.C.
References Foam::BitOps::count(), and Foam::max().

|
inline |
Return start/size range of proci data.
Definition at line 282 of file globalIndexI.H.
Referenced by faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), PatchTools::gatherAndMerge(), cellCellStencil::globalCellCells(), and surfaceNoise::readSurfaceData().

|
inline |
Is on processor proci.
Definition at line 294 of file globalIndexI.H.
Referenced by Foam::calcCellCellsImpl(), mapDistributeBase::calcCompactAddressing(), addPatchCellLayer::calcExtrudeInfo(), and mapDistributeBase::renumber().

|
inline |
From local to global on proci.
Definition at line 308 of file globalIndexI.H.
Referenced by MGridGenGAMGAgglomeration::agglomerate(), nearWallFields::calcAddressing(), Foam::calcCellCellsImpl(), holeToFace::calcClosure(), createShellMesh::calcPointRegions(), viewFactor::calculate(), cellCellStencil::globalCellCells(), addPatchCellLayer::globalEdgeFaces(), inverseDistance::holeExtrapolationStencil(), viewFactor::initialise(), viewFactor::insertMatrixElements(), inverseDistance::markDonors(), globalMeshData::mergePoints(), regionSplit2D::regionSplit2D(), addPatchCellLayer::setRefinement(), and cellVolumeWeight::update().

|
inline |
From local to global on proci.
Definition at line 324 of file globalIndexI.H.
|
inline |
From local to global index on proci (inplace)
Definition at line 351 of file globalIndexI.H.
Referenced by faceAreaWeightAMI2D::calculate(), faceAreaWeightAMI::calculate(), PatchTools::gatherAndMerge(), and inverseDistance::holeExtrapolationStencil().

|
inline |
From global to local on proci.
Definition at line 377 of file globalIndexI.H.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.
Referenced by fvMeshPrimitiveLduAddressing::addAddressing(), Foam::calcCellCellsImpl(), mapDistributeBase::calcCompactAddressing(), addPatchCellLayer::calcExtrudeInfo(), viewFactor::calculate(), viewFactor::initialise(), distributedTriSurfaceMesh::localQueries(), and mapDistributeBase::renumber().


|
inline |
Find processor with specified global id. Check proci first, followed by binary search.
Definition at line 399 of file globalIndexI.H.
References Foam::findLower().

|
inline |
Find processor above proci with specified global id - binary search.
Definition at line 438 of file globalIndexI.H.
References Foam::findLower().

|
inline |
Find processor below proci with specified global id - binary search.
Binary search.
Definition at line 461 of file globalIndexI.H.
References Foam::findLower().

|
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().


|
inline |
Local start on myProcNo()
Definition at line 239 of file globalIndexI.H.
References UPstream::myProcNo(), and UPstream::worldComm.
Referenced by globalIndex::offset().


|
inline |
Local end on myProcNo()
Definition at line 251 of file globalIndexI.H.
References UPstream::myProcNo(), and UPstream::worldComm.

|
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().


|
inline |
The max of localSizes, excluding current (myProcNo) rank.
Definition at line 276 of file globalIndexI.H.
References UPstream::myProcNo(), and UPstream::worldComm.

|
inline |
Return start/size range of local (myProcNo) data.
Definition at line 288 of file globalIndexI.H.
References UPstream::myProcNo(), range, and UPstream::worldComm.

|
inline |
Is on local processor.
Definition at line 301 of file globalIndexI.H.
References UPstream::myProcNo(), and UPstream::worldComm.

|
inline |
From local to global index.
Definition at line 317 of file globalIndexI.H.
References UPstream::myProcNo(), and UPstream::worldComm.

|
inline |
From local to global index.
Definition at line 342 of file globalIndexI.H.
References UPstream::myProcNo(), and UPstream::worldComm.

|
inline |
From local to global index (inplace)
Definition at line 370 of file globalIndexI.H.
References UPstream::myProcNo(), and UPstream::worldComm.

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

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

|
inlinenoexcept |
A const_iterator set to the beginning.
Definition at line 679 of file globalIndexI.H.
|
inlinenoexcept |
A const_iterator set to beyond the end.
Definition at line 686 of file globalIndexI.H.
|
inlinenoexcept |
A const_iterator set to the beginning.
Definition at line 693 of file globalIndexI.H.
|
inlinenoexcept |
A const_iterator set to beyond the end.
Definition at line 700 of file globalIndexI.H.
|
inlinenoexcept |
Return const_iterator at offset proci from begin, clamped to [0,nProcs] range.
Definition at line 707 of file globalIndexI.H.
|
inlinenoexcept |
Return const_iterator at offset proci from begin, clamped to [0,nProcs] range.
Definition at line 715 of file globalIndexI.H.
|
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
| comm | communicator |
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().

|
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
| comm | communicator |
Definition at line 125 of file globalIndex.C.
References UPstream::allGatherValues(), Foam::BitOps::count(), UPstream::is_parallel(), UPstream::myProcNo(), and UList< T >::size().
Referenced by internalMeshWriter::writeGeometry(), patchMeshWriter::writeGeometry(), polyWriter::writeLineGeometry(), internalMeshWriter::writePointIDs(), polyWriter::writePolyGeometry(), and patchMeshWriter::writePolys().


|
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().

|
static |
Calculate offsets from an indirect list of local sizes, with optional check for label overflow.
|
static |
Calculate offsets from list of lists, with optional check for label overflow.
|
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().

| 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.
| [out] | interNodeOffsets | Offsets between nodes (only non-empty on node leaders) |
| [out] | localNodeOffsets | Offsets within a node (only non-empty on node leaders) |
| communicator | The communicator. Must resolve to const world-comm | |
| absoluteLocalNodeOffsets | Retain absolute values for the localNode offsets |
Definition at line 260 of file globalIndex.C.
References UList< T >::back(), UPstream::broadcast(), List< T >::clear(), UPstream::commConstWorld(), UPstream::commInterNode(), UList< T >::data(), UList< T >::empty(), FOAM_UNLIKELY, forAll, UList< T >::front(), UPstream::is_rank(), UPstream::master(), UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), UPstream::procID(), List< T >::resize_nocopy(), UList< T >::size(), and UList< T >::slice().

|
static |
Collect single values in processor order on master (== procIDs[0]).
Handles contiguous/non-contiguous data. non-zero output field (master only)
| comm | communicator |
|
static |
Collect data in processor order on master (== procIDs[0]).
Handles contiguous/non-contiguous data, skips empty fields.
| offsets | offsets (master only) | |
| comm | communicator | |
| [in] | fld | all ranks |
| [out] | allFld | result (master only). Must be adequately sized! |
Referenced by faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), PatchTools::gatherAndMerge(), surfaceWriter::mergeFieldTemplate(), surfaceNoise::surfaceAverage(), and surfaceNoise::writeSurfaceData().

|
static |
Collect indirect data in processor order on master.
Handles contiguous/non-contiguous data, skips empty fields.
| offsets | offsets (master only) | |
| comm | communicator | |
| [in] | fld | all ranks |
| [out] | allFld | result (master only). Must be adequately sized! |
|
static |
Inplace collect in processor order on master (== procIDs[0]).
| offsets | offsets (master only) | |
| comm | communicator | |
| [in,out] | fld |
Referenced by particleTracksSampler::gatherInplace(), globalIndex::gatherInplace(), and SprayCloud< Foam::DSMCCloud >::penetration().

| 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]).
| comm | communicator | |
| [in] | fld | input field |
| [out] | allFld | resized to have results on master, empty elsewhere. |
|
inline |
Inplace collect in processor order on master (== procIDs[0]).
| comm | communicator | |
| [in,out] | fld |
Definition at line 885 of file globalIndex.H.
References fld, and globalIndex::gatherInplace().

| 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.
| [in] | sendData | input on all ranks |
| [out] | allData | resized to have results on master, empty elsewhere. |
| comm | communicator |
| 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.
| [in] | sendData | input on all ranks |
| [out] | allData | resized to have results on master, empty elsewhere. |
| comm | communicator |
| 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).
Communication with default/specified communicator, message tag.
| [in] | sendData | all ranks |
| comm | communicator |
| 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.
Communication with default/specified communicator, message tag.
| [in] | sendData | all ranks |
| comm | communicator |
| 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.
| [in,out] | fld | |
| comm | communicator |
| 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.
| [out] | allData | output on master, zero-sized on non-master |
| comm | communicator |
| 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).
Communication with default/specified communicator.
| comm | communicator |
| 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.
After the gather, the field is zero-sized on non-master.
| [in,out] | fld | |
| comm | communicator |
|
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
| comm | communicator |
|
static |
Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy).
Communication with default/specified communicator.
| comm | communicator |
|
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.
| [in,out] | fld | |
| comm | communicator |
|
static |
Collect data in processor order on master (in serial: performs a simple copy).
Communication with default/specified communicator, message tag.
| [out] | allData | output on master, zero-sized on non-master |
| comm | communicator |
Referenced by coordSet::gatherSort(), and mergedSurf::merge().

|
static |
Collect data in processor order on master (in serial: performs a simple copy).
Communication with default/specified communicator, message tag.
| [out] | allData | output on master, zero-sized on non-master |
| comm | communicator |
|
static |
Collect and return data in processor order on master (in serial: performs a simple copy).
Communication with default/specified communicator, message tag.
| comm | communicator |
|
static |
Collect and return data in processor order on master (in serial: performs a simple copy).
Communication with default/specified communicator, message tag.
| comm | communicator |
|
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.
| [in,out] | fld | |
| comm | communicator |
|
static |
Distribute data in processor order.
Requires fld to be correctly sized! Communication with default/specified communicator, message tag.
| offsets | offsets (master only) |
| comm | communicator |
Referenced by surfaceNoise::readSurfaceData(), and globalIndex::scatter().

|
inline |
Distribute data in processor order.
Requires fld to be correctly sized! Communication with default/specified communicator, message tag.
| comm | communicator |
Definition at line 1234 of file globalIndex.H.
References fld, and globalIndex::scatter().

| 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.
| comm | communicator |
| 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).
Communication with default/specified communicator, message tag.
| comm | communicator |
| 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.
| comm | communicator |
|
inline |
Compare for equality - uses the offsets.
Definition at line 1305 of file globalIndex.H.
References globalIndex::offsets().

|
inline |
Compare for inequality - uses the offsets.
Definition at line 1313 of file globalIndex.H.
|
inline |
Compare for less-than - uses the offsets.
Definition at line 1321 of file globalIndex.H.
References globalIndex::offsets().

|
inline |
Reset from local size, using gather/broadcast with default/specified communicator if parallel.
Definition at line 1357 of file globalIndex.H.
References globalIndex::localSize(), and globalIndex::reset().

|
inline |
Prefer localStart() to avoid confusing with offsets()
Definition at line 1371 of file globalIndex.H.
References globalIndex::localStart().

|
friend |
|
friend |