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... | |
template<class ProcIDsContainer , class Type > | |
void | gather (const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes ct=UPstream::commsTypes::nonBlocking) const |
Collect data in processor order on master (== procIDs[0]). More... | |
template<class ProcIDsContainer , class Type > | |
void | gather (const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes ct=UPstream::commsTypes::nonBlocking) const |
Inplace collect in processor order on master (== procIDs[0]). More... | |
template<class Type > | |
void | gather (const UList< Type > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Collect data in processor order on master (in serial: performs a simple copy). More... | |
template<class Type , class Addr > | |
void | gather (const IndirectListBase< Type, Addr > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Collect data indirectly in processor order on master (in serial: performs a simple copy). More... | |
template<class Type , class OutputContainer = List<Type>> | |
OutputContainer | gather (const UList< Type > &sendData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Collect data in processor order on master (in serial: performs a simple copy). More... | |
template<class Type , class Addr , class OutputContainer = List<Type>> | |
OutputContainer | gather (const IndirectListBase< Type, Addr > &sendData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Collect data indirectly in processor order on master. More... | |
template<class Type > | |
void | gatherInplace (List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Inplace collect data in processor order on master (in serial: a no-op). More... | |
template<class Type , class OutputContainer = List<Type>> | |
void | mpiGather (const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const |
Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy). More... | |
template<class Type , class OutputContainer = List<Type>> | |
OutputContainer | mpiGather (const UList< Type > &sendData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const |
Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy). More... | |
template<class Type > | |
void | mpiGatherInplace (List< Type > &fld, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const |
Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op). More... | |
template<class ProcIDsContainer , class Type > | |
void | scatter (const label comm, const ProcIDsContainer &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes ct=UPstream::commsTypes::nonBlocking) const |
Distribute data in processor order. More... | |
template<class Type > | |
void | scatter (const UList< Type > &allData, UList< Type > &localData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Distribute data in processor order. More... | |
template<class Type , class OutputContainer = List<Type>> | |
OutputContainer | scatter (const UList< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Distribute data in processor order (in serial: performs a simple copy). More... | |
template<class Type , class CombineOp > | |
void | get (List< Type > &allFld, const labelUList &globalIds, const CombineOp &cop, const label comm=UPstream::worldComm, const int tag=UPstream::msgType()) const |
Get (potentially remote) data. Elements required given as global indices. More... | |
bool | operator== (const globalIndex &rhs) const |
Compare for equality - uses the offsets. More... | |
bool | operator!= (const globalIndex &rhs) const |
Compare for inequality - uses the offsets. More... | |
bool | operator< (const globalIndex &rhs) const |
Compare for less-than - uses the offsets. More... | |
globalIndex (const label localSize, const int tag, const label comm, const bool parallel) | |
Construct from local size, using gather/broadcast with default/specified communicator if parallel. More... | |
void | reset (const label localSize, const int tag, const label comm, const bool parallel) |
Reset from local size, using gather/broadcast with default/specified communicator if parallel. More... | |
label | offset (const label proci) const |
Prefer localStart() to avoid confusing with offsets() More... | |
template<class Addr > | |
Foam::labelList | calcOffsets (const IndirectListBase< label, Addr > &counts, const bool checkOverflow) |
template<class SubListType > | |
Foam::labelList | calcListOffsets (const List< SubListType > &lists, const bool checkOverflow) |
Static Public Member Functions | |
static 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 void | gatherValues (const label comm, const ProcIDsContainer &procIDs, const Type &localValue, List< Type > &allValues, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking) |
Collect single values in processor order on master (== procIDs[0]). More... | |
template<class ProcIDsContainer , class Type > | |
static void | gather (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking) |
Collect data in processor order on master (== procIDs[0]). More... | |
template<class ProcIDsContainer , class Type , class Addr > | |
static void | gather (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const IndirectListBase< Type, Addr > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking) |
Collect indirect data in processor order on master. More... | |
template<class ProcIDsContainer , class Type > | |
static void | gather (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes ct=UPstream::commsTypes::nonBlocking) |
Inplace collect in processor order on master (== procIDs[0]). More... | |
template<class Type , class OutputContainer = List<Type>> | |
static void | mpiGatherOp (const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) |
Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy). More... | |
template<class Type , class OutputContainer = List<Type>> | |
static OutputContainer | mpiGatherOp (const UList< Type > &sendData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) |
Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy). More... | |
template<class Type > | |
static void | mpiGatherInplaceOp (List< Type > &fld, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) |
Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op). More... | |
template<class Type > | |
static void | gatherOp (const UList< Type > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) |
Collect data in processor order on master (in serial: performs a simple copy). More... | |
template<class Type , class Addr > | |
static void | gatherOp (const IndirectListBase< Type, Addr > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) |
Collect data in processor order on master (in serial: performs a simple copy). More... | |
template<class Type , class OutputContainer = List<Type>> | |
static OutputContainer | gatherOp (const UList< Type > &sendData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) |
Collect and return data in processor order on master (in serial: performs a simple copy). More... | |
template<class Type , class Addr , class OutputContainer = List<Type>> | |
static OutputContainer | gatherOp (const IndirectListBase< Type, Addr > &sendData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) |
Collect and return data in processor order on master (in serial: performs a simple copy). More... | |
template<class Type > | |
static void | gatherInplaceOp (List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) |
Inplace collect data in processor order on master (in serial: a no-op). More... | |
template<class ProcIDsContainer , class Type > | |
static void | scatter (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking) |
Distribute data in processor order. More... | |
Friends | |
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.
|
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.
|
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.
|
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.
|
explicit |
Construct from Istream. No communication required.
Definition at line 261 of file globalIndex.C.
|
inline |
Construct from local size, using gather/broadcast with default/specified communicator if parallel.
Definition at line 1329 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 134 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(), globalIndex::mpiGather(), 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 433 of file globalIndex.C.
References Foam::HashTableOps::values().
Foam::List< Foam::labelRange > ranges | ( | ) | const |
Return start/size ranges for all data.
Definition at line 456 of file globalIndex.C.
References Foam::HashTableOps::values().
|
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::gather(), 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.
Referenced by globalIndex::mpiGather().
|
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 506 of file globalIndex.C.
Foam::labelRange back | ( | ) | const |
The last offset range. It is (0,0) if globalIndex is empty.
Definition at line 517 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 332 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 346 of file globalIndex.C.
References UPstream::allGatherValues(), UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), and List< T >::resize().
Referenced by surfaceNoise::calculate(), PatchTools::gatherAndMerge(), globalMeshData::globalEdgeNumbering(), globalIndex::globalIndex(), globalMeshData::globalPointNumbering(), 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 383 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().
|
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(), and UPstream::master().
|
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 415 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(), globalIndex::mpiGather(), 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(), globalIndex::mpiGather(), regionSplit::nLocalRegions(), and surfaceNoise::readSurfaceData().
Foam::label maxNonLocalSize | ( | const label | proci | ) | const |
The max of localSizes, excluding the specified processor.
Definition at line 482 of file globalIndex.C.
References Foam::BitOps::count(), and Foam::max().
|
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(), globalIndex::mpiGather(), 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.
References stdFoam::cbegin().
|
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().
|
static |
Collect single values in processor order on master (== procIDs[0]).
Handles contiguous/non-contiguous data.
comm | communicator |
tag | output field (master only) |
Definition at line 119 of file globalIndexTemplates.C.
References List< T >::clear(), Foam::blockMeshTools::read(), List< T >::resize_nocopy(), and Foam::vtk::write().
|
static |
Collect data in processor order on master (== procIDs[0]).
Handles contiguous/non-contiguous data, skips empty fields.
offsets | offsets (master only) |
comm | communicator |
tag | output field (master only) |
Definition at line 202 of file globalIndexTemplates.C.
References UList< T >::back(), UList< T >::data_bytes(), UList< T >::empty(), fld, Foam::blockMeshTools::read(), List< T >::resize_nocopy(), UList< T >::size_bytes(), and Foam::vtk::write().
Referenced by faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), globalIndex::gather(), PatchTools::gatherAndMerge(), surfaceWriter::mergeFieldTemplate(), surfaceNoise::surfaceAverage(), and surfaceNoise::writeSurfaceData().
|
static |
Collect indirect data in processor order on master.
Handles contiguous/non-contiguous data, skips empty fields.
offsets | offsets (master only) |
comm | communicator |
tag | output field (master only) |
Definition at line 301 of file globalIndexTemplates.C.
References UList< T >::back(), UList< T >::empty(), fld, Foam::PstreamDetail::gather(), and List< T >::resize_nocopy().
|
inlinestatic |
Inplace collect in processor order on master (== procIDs[0]).
Note: adjust naming?
offsets | offsets (master only) |
comm | communicator |
fld | in/out field |
Definition at line 836 of file globalIndex.H.
References fld, globalIndex::gather(), UPstream::myProcNo(), and globalIndex::offsets().
|
inline |
Collect data in processor order on master (== procIDs[0]).
comm | communicator |
fld | input field |
tag | output field (master only) |
Definition at line 862 of file globalIndex.H.
References fld, and globalIndex::gather().
|
inline |
Inplace collect in processor order on master (== procIDs[0]).
comm | communicator |
fld | in/out field |
Definition at line 882 of file globalIndex.H.
References fld, and globalIndex::gather().
void gather | ( | const UList< Type > & | sendData, |
List< Type > & | allData, | ||
const int | tag = UPstream::msgType() , |
||
const UPstream::commsTypes | commsType = UPstream::commsTypes::nonBlocking , |
||
const label | comm = UPstream::worldComm |
||
) | const |
Collect data in processor order on master (in serial: performs a simple copy).
Communication with default/specified communicator, message tag.
comm | communicator |
Definition at line 398 of file globalIndexTemplates.C.
References List< T >::clear(), and Foam::PstreamDetail::gather().
void gather | ( | const IndirectListBase< Type, Addr > & | sendData, |
List< Type > & | allData, | ||
const int | tag = UPstream::msgType() , |
||
const UPstream::commsTypes | commsType = UPstream::commsTypes::nonBlocking , |
||
const label | comm = UPstream::worldComm |
||
) | const |
Collect data indirectly in processor order on master (in serial: performs a simple copy).
Communication with default/specified communicator, message tag.
comm | communicator |
Definition at line 434 of file globalIndexTemplates.C.
References List< T >::clear(), and Foam::PstreamDetail::gather().
OutputContainer gather | ( | const UList< Type > & | sendData, |
const int | tag = UPstream::msgType() , |
||
const UPstream::commsTypes | commsType = UPstream::commsTypes::nonBlocking , |
||
const label | comm = UPstream::worldComm |
||
) | const |
Collect data in processor order on master (in serial: performs a simple copy).
Communication with default/specified communicator, message tag.
comm | communicator |
Definition at line 470 of file globalIndexTemplates.C.
References Foam::PstreamDetail::gather().
OutputContainer gather | ( | const IndirectListBase< Type, Addr > & | sendData, |
const int | tag = UPstream::msgType() , |
||
const UPstream::commsTypes | commsType = UPstream::commsTypes::nonBlocking , |
||
const label | comm = UPstream::worldComm |
||
) | const |
Collect data indirectly in processor order on master.
Communication with default/specified communicator, message tag.
comm | communicator |
Definition at line 485 of file globalIndexTemplates.C.
References Foam::PstreamDetail::gather().
void gatherInplace | ( | List< Type > & | fld, |
const int | tag = UPstream::msgType() , |
||
const UPstream::commsTypes | commsType = UPstream::commsTypes::nonBlocking , |
||
const label | comm = UPstream::worldComm |
||
) | const |
Inplace collect data in processor order on master (in serial: a no-op).
Communication with default/specified communicator, message tag. After the gather, the field is zero-sized on non-master.
[in,out] | fld | |
comm | communicator |
Definition at line 500 of file globalIndexTemplates.C.
References fld, and Foam::PstreamDetail::gather().
Referenced by particleTracksSampler::gatherInplace(), and SprayCloud< Foam::DSMCCloud >::penetration().
void mpiGather | ( | const UList< Type > & | sendData, |
OutputContainer & | allData, | ||
const label | comm = UPstream::worldComm , |
||
const UPstream::commsTypes | commsType = UPstream::commsTypes::nonBlocking , |
||
const int | tag = UPstream::msgType() |
||
) | const |
Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy).
Communication with default/specified communicator.
[out] | allData | output on master, zero-sized on non-master |
comm | communicator |
Definition at line 527 of file globalIndexTemplates.C.
References UList< T >::cdata(), UList< T >::cdata_bytes(), Foam::PstreamDetail::gather(), globalIndex::localSize(), globalIndex::localStart(), globalIndex::nProcs(), globalIndex::range(), List< T >::resize(), UList< T >::size(), UList< T >::size_bytes(), and globalIndex::totalSize().
OutputContainer mpiGather | ( | const UList< Type > & | sendData, |
const label | comm = UPstream::worldComm , |
||
const UPstream::commsTypes | commsType = UPstream::commsTypes::nonBlocking , |
||
const int | tag = UPstream::msgType() |
||
) | const |
Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy).
Communication with default/specified communicator.
comm | communicator |
Definition at line 691 of file globalIndexTemplates.C.
void mpiGatherInplace | ( | List< Type > & | fld, |
const label | comm = UPstream::worldComm , |
||
const UPstream::commsTypes | commsType = UPstream::commsTypes::nonBlocking , |
||
const int | tag = UPstream::msgType() |
||
) | const |
Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op).
Communication with default/specified communicator.
After the gather, the field is zero-sized on non-master.
[in,out] | fld | |
comm | communicator |
Definition at line 707 of file globalIndexTemplates.C.
References fld.
|
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 |
Definition at line 735 of file globalIndexTemplates.C.
References UList< T >::size().
|
static |
Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy).
Communication with default/specified communicator.
comm | communicator |
Definition at line 760 of file globalIndexTemplates.C.
|
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 |
Definition at line 776 of file globalIndexTemplates.C.
References fld.
|
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 |
Definition at line 804 of file globalIndexTemplates.C.
References Foam::PstreamDetail::gather(), and UList< T >::size().
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 |
Definition at line 828 of file globalIndexTemplates.C.
References Foam::PstreamDetail::gather(), and IndirectListBase< T, Addr >::size().
|
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 |
Definition at line 852 of file globalIndexTemplates.C.
|
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 |
Definition at line 867 of file globalIndexTemplates.C.
|
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 |
Definition at line 882 of file globalIndexTemplates.C.
References fld, and Foam::PstreamDetail::gather().
|
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 |
Definition at line 901 of file globalIndexTemplates.C.
References UList< T >::cdata_bytes(), UList< T >::empty(), fld, Foam::blockMeshTools::read(), UList< T >::size_bytes(), and Foam::vtk::write().
Referenced by surfaceNoise::readSurfaceData(), and globalIndex::scatter().
|
inline |
Distribute data in processor order.
Requires fld to be correctly sized! Communication with default/specified communicator, message tag.
comm | communicator |
Definition at line 1222 of file globalIndex.H.
References fld, and globalIndex::scatter().
void scatter | ( | const UList< Type > & | allData, |
UList< Type > & | localData, | ||
const int | tag = UPstream::msgType() , |
||
const UPstream::commsTypes | commsType = UPstream::commsTypes::nonBlocking , |
||
const label | comm = UPstream::worldComm |
||
) | const |
Distribute data in processor order.
Requires fld to be correctly sized! Communication with default/specified communicator, message tag.
comm | communicator |
Definition at line 1002 of file globalIndexTemplates.C.
References UList< T >::deepCopy(), and Foam::PstreamDetail::scatter().
OutputContainer scatter | ( | const UList< Type > & | allData, |
const int | tag = UPstream::msgType() , |
||
const UPstream::commsTypes | commsType = UPstream::commsTypes::nonBlocking , |
||
const label | comm = UPstream::worldComm |
||
) | const |
Distribute data in processor order (in serial: performs a simple copy).
Communication with default/specified communicator, message tag.
comm | communicator |
Definition at line 1034 of file globalIndexTemplates.C.
References Foam::BitOps::count(), and Foam::PstreamDetail::scatter().
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 |
Definition at line 1066 of file globalIndexTemplates.C.
References PstreamBuffers::allProcs(), PstreamBuffers::finishedSends(), fld, CompactListList< T >::offsets(), os(), PstreamBuffers::recvDataCount(), List< T >::resize_nocopy(), and UList< T >::size().
|
inline |
Compare for equality - uses the offsets.
Definition at line 1293 of file globalIndex.H.
References globalIndex::offsets().
|
inline |
Compare for inequality - uses the offsets.
Definition at line 1301 of file globalIndex.H.
|
inline |
Compare for less-than - uses the offsets.
Definition at line 1309 of file globalIndex.H.
References globalIndex::offsets().
|
inline |
Reset from local size, using gather/broadcast with default/specified communicator if parallel.
Definition at line 1345 of file globalIndex.H.
References globalIndex::localSize(), and globalIndex::reset().
|
inline |
Prefer localStart() to avoid confusing with offsets()
Definition at line 1359 of file globalIndex.H.
References globalIndex::localStart().
Foam::labelList calcOffsets | ( | const IndirectListBase< label, Addr > & | counts, |
const bool | checkOverflow | ||
) |
Definition at line 48 of file globalIndexTemplates.C.
References Foam::BitOps::count(), IndirectListBase< T, Addr >::size(), and Foam::HashTableOps::values().
Foam::labelList calcListOffsets | ( | const List< SubListType > & | lists, |
const bool | checkOverflow | ||
) |
Definition at line 84 of file globalIndexTemplates.C.
References Foam::BitOps::count(), UList< T >::size(), and Foam::HashTableOps::values().
|
friend |
|
friend |