Calculates a unique integer (label so might not have enough room - 2G max) for processor + local index. E.g. More...
Classes | |
struct | gatherNone |
Dispatch tag. More... | |
struct | gatherOnly |
Dispatch tag. More... | |
Public Types | |
enum | accessType : char { OFFSETS , SIZES } |
Disambiguation tag (list construction dispatch) More... | |
Public Member Functions | |
globalIndex ()=default | |
Default construct. More... | |
globalIndex (const labelUList &listOffsets) | |
globalIndex (labelList &&listOffsets) | |
globalIndex (const labelUList &offsetsOrSizes, enum accessType accType) | |
globalIndex (const label localSize, const label comm=UPstream::worldComm, const bool parallel=UPstream::parRun()) | |
globalIndex (const label localSize, const globalIndex::gatherOnly, const label comm=UPstream::worldComm) | |
globalIndex (const label localSize, const globalIndex::gatherNone, const label comm=-1) | |
globalIndex (Istream &is) | |
bool | empty () const |
Check for default constructed or global sum == 0. More... | |
label | size () const |
Global sum of localSizes. Same as totalSize() More... | |
label | totalSize () const |
Global sum of localSizes. More... | |
labelList | sizes () const |
The local sizes. Same as localSizes() More... | |
const labelUList | localStarts () const |
The local starts. More... | |
labelList | localSizes () const |
The local sizes. More... | |
label | maxSize () const |
Global max of localSizes. More... | |
const labelList & | offsets () const noexcept |
Const-access to the offsets. More... | |
label | nProcs () const noexcept |
The number of processors covered by the offsets. More... | |
labelRange | allProcs () const noexcept |
Range of process indices for all addressed offsets (processes) More... | |
labelRange | subProcs () const noexcept |
Range of process indices for addressed sub-offsets (processes) More... | |
labelList & | offsets () noexcept |
Write-access to the offsets, for changing after construction. More... | |
void | reset (const label localSize, const label comm=UPstream::worldComm, const bool parallel=UPstream::parRun()) |
void | reset (const label localSize, const globalIndex::gatherOnly, const label comm=UPstream::worldComm) |
void | reset (const labelUList &localLens, const bool checkOverflow=false) |
void | setLocalSize (const label proci, const label len) |
Alter local size for given processor. More... | |
label | localStart () const |
My local start. More... | |
label | localSize () const |
My local size. More... | |
label | maxNonLocalSize () const |
The max of localSizes, excluding current processor. More... | |
labelRange | range () const |
Return start/size range of local processor data. More... | |
List< labelRange > | ranges () const |
Return start/size ranges for all data. More... | |
bool | isLocal (const label i) const |
Is on local processor. More... | |
label | toGlobal (const label i) const |
From local to global index. More... | |
labelList | toGlobal (const labelUList &labels) const |
From local to global index. More... | |
void | inplaceToGlobal (labelUList &labels) const |
From local to global index (inplace) More... | |
label | toLocal (const label i) const |
From global to local on current processor. More... | |
label | localStart (const label proci) const |
Start of proci data. More... | |
label | localSize (const label proci) const |
Size of proci data. More... | |
label | maxNonLocalSize (const label proci) const |
The max of localSizes, excluding the specified processor. More... | |
labelRange | range (const label proci) const |
Return start/size range of proci data. More... | |
bool | isLocal (const label proci, const label i) const |
Is on processor proci. More... | |
label | toGlobal (const label proci, const label i) const |
From local to global on proci. More... | |
labelList | toGlobal (const label proci, const labelUList &labels) const |
From local to global on proci. More... | |
void | inplaceToGlobal (const label proci, labelUList &labels) const |
From local to global index on proci (inplace) More... | |
label | toLocal (const label proci, const label i) const |
From global to local on proci. More... | |
template<class ProcIDsContainer , class Type > | |
void | gather (const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes ct=UPstream::commsTypes::nonBlocking) const |
Collect data in processor order on master (== procIDs[0]). More... | |
template<class ProcIDsContainer , class Type > | |
void | gather (const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes ct=UPstream::commsTypes::nonBlocking) const |
Inplace collect in processor order on master (== procIDs[0]). More... | |
template<class Type > | |
void | gather (const UList< Type > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Collect data in processor order on master (in serial: performs a simple copy). More... | |
template<class Type , class Addr > | |
void | gather (const IndirectListBase< Type, Addr > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Collect data indirectly in processor order on master (in serial: performs a simple copy). More... | |
template<class Type , class OutputContainer = List<Type>> | |
OutputContainer | gather (const UList< Type > &sendData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Collect data in processor order on master (in serial: performs a simple copy). More... | |
template<class Type , class Addr , class OutputContainer = List<Type>> | |
OutputContainer | gather (const IndirectListBase< Type, Addr > &sendData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Collect data indirectly in processor order on master. More... | |
template<class Type > | |
void | gatherInplace (List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Inplace collect data in processor order on master (in serial: a no-op). More... | |
template<class Type , class OutputContainer = List<Type>> | |
void | mpiGather (const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const |
Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy). More... | |
template<class Type , class OutputContainer = List<Type>> | |
OutputContainer | mpiGather (const UList< Type > &sendData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const |
Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy). More... | |
template<class Type > | |
void | mpiGatherInplace (List< Type > &fld, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const |
Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op). More... | |
template<class ProcIDsContainer , class Type > | |
void | scatter (const label comm, const ProcIDsContainer &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes ct=UPstream::commsTypes::nonBlocking) const |
Distribute data in processor order. More... | |
template<class Type > | |
void | scatter (const UList< Type > &allData, UList< Type > &localData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Distribute data in processor order. More... | |
template<class Type , class OutputContainer = List<Type>> | |
OutputContainer | scatter (const UList< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const |
Distribute data in processor order (in serial: performs a simple copy). More... | |
template<class Type , class CombineOp > | |
void | get (List< Type > &allFld, const labelUList &globalIds, const CombineOp &cop, const label comm=UPstream::worldComm, const int tag=UPstream::msgType()) const |
Get (potentially remote) data. Elements required given as global indices. More... | |
FOAM_DEPRECATED_FOR (2022-03, "construct without message tag") globalIndex(const label localSize | |
Construct from local size, using gather/broadcast with default/specified communicator if parallel. More... | |
FOAM_DEPRECATED_FOR (2022-03, "reset without message tag") void reset(const label localSize | |
Reset from local size, using gather/broadcast with default/specified communicator if parallel. More... | |
FOAM_DEPRECATED_FOR (2022-02, "use localStart()") label offset(const label proci) const | |
Prefer localStart() to avoid confusing with offsets() More... | |
Static Public Member Functions | |
template<class ProcIDsContainer , class Type > | |
static void | gatherValues (const label comm, const ProcIDsContainer &procIDs, const Type &localValue, List< Type > &allValues, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking) |
Which processor does global id come from? More... | |
template<class ProcIDsContainer , class Type > | |
static void | gather (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking) |
Collect data in processor order on master (== procIDs[0]). More... | |
template<class Type , class Addr > | |
static void | gather (const labelUList &offsets, const label comm, const UList< int > &procIDs, const IndirectListBase< Type, Addr > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking) |
Collect indirect data in processor order on master. More... | |
template<class ProcIDsContainer , class Type > | |
static void | gather (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes ct=UPstream::commsTypes::nonBlocking) |
Inplace collect in processor order on master (== procIDs[0]). More... | |
template<class Type , class OutputContainer = List<Type>> | |
static void | mpiGatherOp (const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) |
Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy). More... | |
template<class Type , class OutputContainer = List<Type>> | |
static OutputContainer | mpiGatherOp (const UList< Type > &sendData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) |
Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy). More... | |
template<class Type > | |
static void | mpiGatherInplaceOp (List< Type > &fld, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) |
Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op). More... | |
template<class Type > | |
static void | gatherOp (const UList< Type > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) |
Collect data in processor order on master (in serial: performs a simple copy). More... | |
template<class Type , class Addr > | |
static void | gatherOp (const IndirectListBase< Type, Addr > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) |
Collect data in processor order on master (in serial: performs a simple copy). More... | |
template<class Type , class OutputContainer = List<Type>> | |
static OutputContainer | gatherOp (const UList< Type > &sendData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) |
Collect and return data in processor order on master (in serial: performs a simple copy). More... | |
template<class Type , class Addr , class OutputContainer = List<Type>> | |
static OutputContainer | gatherOp (const IndirectListBase< Type, Addr > &sendData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) |
Collect and return data in processor order on master (in serial: performs a simple copy). More... | |
template<class Type > | |
static void | gatherInplaceOp (List< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) |
Inplace collect data in processor order on master (in serial: a no-op). More... | |
template<class ProcIDsContainer , class Type > | |
static void | scatter (const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking) |
Distribute data in processor order. More... | |
Public Attributes | |
const int | tag |
const int const label | comm |
const int const label const bool | parallel |
Friends | |
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 67 of file globalIndex.H.
enum accessType : char |
Disambiguation tag (list construction dispatch)
Enumerator | |
---|---|
OFFSETS | |
SIZES |
Definition at line 99 of file globalIndex.H.
|
default |
Default construct.
|
inlineexplicit |
Copy construct from a list of offsets. No communication required
Definition at line 34 of file globalIndexI.H.
References UList< T >::size().
|
inlineexplicit |
Move construct from a list of offsets. No communication required
Definition at line 46 of file globalIndexI.H.
|
inline |
Copy construct from a list of offsets or sizes. No communication required
Definition at line 62 of file globalIndexI.H.
References UList< T >::size().
|
inlineexplicit |
Construct from local size, using gather/broadcast with default/specified communicator if parallel.
comm | communicator |
parallel | use parallel comms |
Definition at line 80 of file globalIndexI.H.
|
inline |
Construct by gathering local sizes without rescattering. This 'one-sided' globalIndex will be empty on non-master processes.
comm | communicator |
Definition at line 91 of file globalIndexI.H.
References UPstream::listGatherValues().
|
inline |
Construct with a single size entry. No communication required
comm | no communicator needed |
Definition at line 103 of file globalIndexI.H.
References globalIndex::localSize().
|
explicit |
Construct from Istream. No communication required
Definition at line 123 of file globalIndex.C.
|
inline |
Check for default constructed or global sum == 0.
Definition at line 119 of file globalIndexI.H.
|
inline |
Global sum of localSizes. Same as totalSize()
Definition at line 132 of file globalIndexI.H.
|
inline |
Global sum of localSizes.
Definition at line 125 of file globalIndexI.H.
Referenced by nearWallFields::calcAddressing(), metisLikeDecomp::decomposeGeneral(), distributedTriSurfaceMesh::globalSize(), globalIndex::mpiGather(), particleTracksSampler::nParticle(), regionSplit::nRegions(), SprayCloud< CloudType >::penetration(), and streamLineBase::writeToFile().
|
inline |
The local sizes. Same as localSizes()
Definition at line 138 of file globalIndexI.H.
|
inline |
The local starts.
Definition at line 179 of file globalIndexI.H.
References UList< label >::null().
Foam::labelList localSizes | ( | ) | const |
The local sizes.
Definition at line 292 of file globalIndex.C.
|
inline |
Global max of localSizes.
Definition at line 213 of file globalIndexI.H.
|
inlinenoexcept |
Const-access to the offsets.
Definition at line 167 of file globalIndexI.H.
|
inlinenoexcept |
The number of processors covered by the offsets.
Definition at line 144 of file globalIndexI.H.
Referenced by globalIndex::mpiGather().
|
inlinenoexcept |
Range of process indices for all addressed offsets (processes)
Definition at line 151 of file globalIndexI.H.
|
inlinenoexcept |
Range of process indices for addressed sub-offsets (processes)
Definition at line 159 of file globalIndexI.H.
Referenced by faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), metisLikeDecomp::decomposeGeneral(), PatchTools::gatherAndMerge(), and Foam::vtk::writeListsParallel().
|
inlinenoexcept |
Write-access to the offsets, for changing after construction.
Definition at line 173 of file globalIndexI.H.
Referenced by globalIndex::gather().
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 206 of file globalIndex.C.
References Pstream::broadcast(), UPstream::listGatherValues(), processorFaPatch::myProcNo(), PstreamBuffers::nProcs(), UPstream::parRun(), List< T >::resize(), and Foam::Zero.
Referenced by snappyLayerDriver::addLayers(), globalIndex::FOAM_DEPRECATED_FOR(), globalMeshData::globalEdgeNumbering(), globalMeshData::globalPointNumbering(), distributedTriSurfaceMesh::globalTris(), particleTracksSampler::reset(), and particleTracksSampler::resetCloud().
void reset | ( | const label | localSize, |
const globalIndex::gatherOnly | , | ||
const label | comm = UPstream::worldComm |
||
) |
Reset by gathering local sizes without rescattering. This 'one-sided' globalIndex will be empty on non-master processes.
comm | communicator |
Definition at line 194 of file globalIndex.C.
References UPstream::listGatherValues().
void reset | ( | const labelUList & | localLens, |
const bool | checkOverflow = false |
||
) |
Reset from list of local sizes, with optional check for label overflow. No communication required
Definition at line 242 of file globalIndex.C.
References UList< T >::size().
void setLocalSize | ( | const label | proci, |
const label | len | ||
) |
Alter local size for given processor.
Definition at line 274 of file globalIndex.C.
References delta.
|
inline |
My local start.
Definition at line 195 of file globalIndexI.H.
References processorFaPatch::myProcNo().
Referenced by viewFactor::calculate(), globalIndex::FOAM_DEPRECATED_FOR(), meshRefinement::getMasterEdges(), cellCellStencil::globalCellCells(), GAMGProcAgglomeration::globalCellCells(), lduPrimitiveMesh::globalCellCells(), globalIndex::mpiGather(), Foam::vtk::writeCellSetFaces(), Foam::vtk::writeFaceSet(), internalMeshWriter::writeGeometry(), patchMeshWriter::writeGeometry(), polyWriter::writeLineGeometry(), Foam::vtk::writeListParallel(), internalMeshWriter::writePointIDs(), polyWriter::writePolyGeometry(), and patchMeshWriter::writePolys().
|
inline |
My local size.
Definition at line 207 of file globalIndexI.H.
References processorFaPatch::myProcNo().
Referenced by holeToFace::calcClosure(), createShellMesh::calcPointRegions(), viewFactor::calculate(), metisLikeDecomp::decomposeGeneral(), mapDistributeBase::exchangeAddressing(), globalIndex::FOAM_DEPRECATED_FOR(), meshRefinement::getMasterEdges(), cellCellStencil::globalCellCells(), GAMGProcAgglomeration::globalCellCells(), globalIndex::globalIndex(), globalIndex::mpiGather(), regionSplit::nLocalRegions(), Foam::vtk::writeListsParallel(), and streamLineBase::writeToFile().
|
inline |
The max of localSizes, excluding current processor.
Definition at line 220 of file globalIndexI.H.
References processorFaPatch::myProcNo().
Referenced by Foam::vtk::writeListsParallel().
|
inline |
Return start/size range of local processor data.
Definition at line 232 of file globalIndexI.H.
References processorFaPatch::myProcNo(), and range.
Referenced by faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), metisLikeDecomp::decomposeGeneral(), PatchTools::gatherAndMerge(), and globalIndex::mpiGather().
Foam::List< Foam::labelRange > ranges | ( | ) | const |
Return start/size ranges for all data.
Definition at line 315 of file globalIndex.C.
|
inline |
Is on local processor.
Definition at line 244 of file globalIndexI.H.
References processorFaPatch::myProcNo().
Referenced by decompositionMethod::calcCellCells(), mapDistributeBase::calcCompactAddressing(), addPatchCellLayer::calcExtrudeInfo(), refinementParameters::findCells(), fluxSummary::initialiseCellZoneAndDirection(), mapDistribute::mapDistributeBase(), regionSplit2D::regionSplit2D(), and mapDistributeBase::renumber().
|
inline |
From local to global index.
Definition at line 260 of file globalIndexI.H.
References processorFaPatch::myProcNo().
Referenced by nearWallFields::calcAddressing(), decompositionMethod::calcCellCells(), holeToFace::calcClosure(), createShellMesh::calcPointRegions(), viewFactor::calculate(), faMeshDistributor::distribute(), refinementParameters::findCells(), meshRefinement::getMasterEdges(), cellCellStencil::globalCellCells(), addPatchCellLayer::globalEdgeFaces(), viewFactor::initialise(), fluxSummary::initialiseCellZoneAndDirection(), viewFactor::insertMatrixElements(), inverseDistance::markDonors(), globalMeshData::mergePoints(), MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration(), regionSplit2D::regionSplit2D(), structuredRenumber::renumber(), zoltanRenumber::renumber(), faMeshBoundaryHalo::reset(), addPatchCellLayer::setRefinement(), cellVolumeWeight::update(), and dynamicOversetFvMesh::updateAddressing().
|
inline |
From local to global index.
Definition at line 279 of file globalIndexI.H.
References processorFaPatch::myProcNo().
|
inline |
From local to global index (inplace)
Definition at line 303 of file globalIndexI.H.
References processorFaPatch::myProcNo().
Referenced by faceAreaWeightAMI::calculate(), faceAreaWeightAMI2D::calculate(), metisLikeDecomp::decomposeGeneral(), PatchTools::gatherAndMerge(), and cyclicAMIPolyPatch::setAMIFaces().
|
inline |
From global to local on current processor.
FatalError if not on local processor.
Definition at line 325 of file globalIndexI.H.
References processorFaPatch::myProcNo().
Referenced by fvMeshPrimitiveLduAddressing::addAddressing(), decompositionMethod::calcCellCells(), mapDistributeBase::calcCompactAddressing(), addPatchCellLayer::calcExtrudeInfo(), viewFactor::calculate(), refinementParameters::findCells(), viewFactor::initialise(), fluxSummary::initialiseCellZoneAndDirection(), distributedTriSurfaceMesh::localQueries(), mapDistribute::mapDistributeBase(), mapDistributeBase::renumber(), and dynamicOversetFvMesh::updateAddressing().
|
inline |
Start of proci data.
Definition at line 189 of file globalIndexI.H.
|
inline |
Size of proci data.
Definition at line 201 of file globalIndexI.H.
Foam::label maxNonLocalSize | ( | const label | proci | ) | const |
The max of localSizes, excluding the specified processor.
Definition at line 341 of file globalIndex.C.
References Foam::max().
|
inline |
Return start/size range of proci data.
Definition at line 226 of file globalIndexI.H.
|
inline |
Is on processor proci.
Definition at line 238 of file globalIndexI.H.
|
inline |
From local to global on proci.
Definition at line 250 of file globalIndexI.H.
|
inline |
From local to global on proci.
Definition at line 266 of file globalIndexI.H.
|
inline |
From local to global index on proci (inplace)
Definition at line 288 of file globalIndexI.H.
|
inline |
From global to local on proci.
Definition at line 310 of file globalIndexI.H.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.
|
static |
Which processor does global id come from?
Does an initial check for isLocal first (assumed to occur reasonably frequently) followed by a binary search. ! Fatal for out of range ids (eg, negative or >= totalSize() inline label whichProcID(const label i) const;
Iteration
! Forward input iterator with const access class const_iterator { ! The parent class for which this is an iterator const globalIndex* parent_;
! The index into the parent label proci_;
public:
Constructors
! Construct from globalIndex list at given index explicit const_iterator ( const globalIndex* globalIdx, const label proci = 0 ) noexcept;
Member Operators
! The associated local proc inline label proci() const noexcept;
! The local start inline label start() const;
! The local size inline label size() const;
! The local range inline labelRange range() const;
! The local range inline labelRange operator*() const;
inline const_iterator& operator++(); inline const_iterator operator++(int);
inline const_iterator& operator–(); inline const_iterator operator–(int);
inline bool operator==(const const_iterator& iter) const noexcept; inline bool operator!=(const const_iterator& iter) const noexcept; };
! A const_iterator set to the beginning inline const_iterator cbegin() const noexcept;
! A const_iterator set to beyond the end inline const const_iterator cend() const noexcept;
! A const_iterator set to the beginning inline const_iterator begin() const noexcept;
! A const_iterator set to beyond the end inline const const_iterator end() const noexcept;
Helper Functions
! Calculate offsets from a list of local sizes, ! with optional check for label overflow static labelList calcOffsets ( const labelUList& localLens, const bool checkOverflow = false );
! Calculate offsets from list of lists, ! with optional check for label overflow template<class SubListType> static labelList calcListOffsets ( const List<SubListType>& lists, const bool checkOverflow = false );
! Calculate ranges (offset/size) from a list of local sizes, ! with optional check for label overflow static List<labelRange> calcRanges ( const labelUList& localLens, const bool checkOverflow = false );
! Collect single values in processor order on master (== procIDs[0]). /*! Handles contiguous/non-contiguous data.
comm | communicator |
tag | output field (master only) |
Definition at line 68 of file globalIndexTemplates.C.
References List< T >::clear(), processorFaPatch::myProcNo(), UPstream::nonBlocking, UPstream::nRequests(), kEpsilonLopesdaCosta< BasicTurbulenceModel >::read(), List< T >::resize_nocopy(), UPstream::scheduled, UPstream::waitRequests(), and ObukhovLength::write().
Referenced by GAMGAgglomeration::procAgglomerateRestrictAddressing().
|
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 152 of file globalIndexTemplates.C.
References UList< T >::data_bytes(), UList< T >::empty(), fld(), UList< T >::last(), processorFaPatch::myProcNo(), UPstream::nonBlocking, UPstream::nRequests(), kEpsilonLopesdaCosta< BasicTurbulenceModel >::read(), List< T >::resize_nocopy(), UPstream::scheduled, UList< T >::size_bytes(), UPstream::waitRequests(), and ObukhovLength::write().
Referenced by faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), simpleGeomDecomp::decompose(), metisLikeDecomp::decomposeGeneral(), globalIndex::gather(), PatchTools::gatherAndMerge(), globalIndex::gatherInplaceOp(), globalIndex::gatherOp(), globalIndex::mpiGather(), GAMGAgglomeration::procAgglomerateRestrictAddressing(), and GAMGAgglomeration::restrictField().
|
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 252 of file globalIndexTemplates.C.
References UList< T >::empty(), fld(), UList< T >::last(), processorFaPatch::myProcNo(), UPstream::nonBlocking, UPstream::nRequests(), List< T >::resize_nocopy(), UPstream::scheduled, UList< T >::size(), and UPstream::waitRequests().
|
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 460 of file globalIndex.H.
References globalIndex::comm, fld(), globalIndex::gather(), processorFaPatch::myProcNo(), globalIndex::offsets(), and globalIndex::tag.
|
inline |
Collect data in processor order on master (== procIDs[0]).
comm | communicator |
fld | input field |
tag | output field (master only) |
Definition at line 481 of file globalIndex.H.
References globalIndex::comm, fld(), globalIndex::gather(), and globalIndex::tag.
|
inline |
Inplace collect in processor order on master (== procIDs[0]).
comm | communicator |
fld | in/out field |
Definition at line 498 of file globalIndex.H.
References globalIndex::comm, fld(), globalIndex::gather(), and globalIndex::tag.
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 350 of file globalIndexTemplates.C.
References List< T >::clear(), globalIndex::gather(), splitCell::master(), and UPstream::parRun().
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 386 of file globalIndexTemplates.C.
References List< T >::clear(), globalIndex::gather(), splitCell::master(), and UPstream::parRun().
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 422 of file globalIndexTemplates.C.
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 437 of file globalIndexTemplates.C.
void gatherInplace | ( | List< Type > & | fld, |
const int | tag = UPstream::msgType() , |
||
const UPstream::commsTypes | commsType = UPstream::commsTypes::nonBlocking , |
||
const label | comm = UPstream::worldComm |
||
) | const |
Inplace collect data in processor order on master (in serial: a no-op).
Communication with default/specified communicator, message tag. After the gather, the field is zero-sized on the slaves.
comm | communicator |
Definition at line 452 of file globalIndexTemplates.C.
References fld(), splitCell::master(), and UPstream::parRun().
Referenced by particleTracksSampler::gatherInplace(), and SprayCloud< CloudType >::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.
The allData is output (master), zero-sized on non-master
comm | communicator |
Definition at line 479 of file globalIndexTemplates.C.
References UPstream::broadcast(), UList< T >::cdata(), UList< T >::cdata_bytes(), UPstream::gather(), globalIndex::gather(), globalIndex::localSize(), globalIndex::localStart(), splitCell::master(), globalIndex::nProcs(), UPstream::parRun(), globalIndex::range(), List< T >::resize(), UList< T >::size(), UList< T >::size_bytes(), and globalIndex::totalSize().
Referenced by globalIndex::mpiGatherOp().
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 643 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.
comm | communicator |
Definition at line 659 of file globalIndexTemplates.C.
References fld(), splitCell::master(), and UPstream::parRun().
|
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 687 of file globalIndexTemplates.C.
References globalIndex::mpiGather(), UPstream::parRun(), and 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 712 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.
comm | communicator |
Definition at line 728 of file globalIndexTemplates.C.
References fld(), splitCell::master(), and UPstream::parRun().
|
static |
Collect data in processor order on master (in serial: performs a simple copy).
Communication with default/specified communicator, message tag.
The allFld is output (master), zero-sized on non-master
comm | communicator |
Definition at line 756 of file globalIndexTemplates.C.
References globalIndex::gather(), UPstream::parRun(), and UList< T >::size().
Referenced by coordSet::gatherSort(), mergedSurf::merge(), and surfaceWriter::mergeFieldTemplate().
|
static |
Collect data in processor order on master (in serial: performs a simple copy).
Communication with default/specified communicator, message tag.
The allFld is output (master), zero-sized on non-master
comm | communicator |
Definition at line 780 of file globalIndexTemplates.C.
References globalIndex::gather(), UPstream::parRun(), 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 804 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 819 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 the slaves.
comm | communicator |
Definition at line 834 of file globalIndexTemplates.C.
References fld(), globalIndex::gather(), and UPstream::parRun().
|
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 853 of file globalIndexTemplates.C.
References UList< T >::cdata_bytes(), UList< T >::empty(), fld(), processorFaPatch::myProcNo(), UPstream::nonBlocking, UPstream::nRequests(), kEpsilonLopesdaCosta< BasicTurbulenceModel >::read(), UPstream::scheduled, UList< T >::size_bytes(), UPstream::waitRequests(), and ObukhovLength::write().
Referenced by simpleGeomDecomp::decompose(), metisLikeDecomp::decomposeGeneral(), GAMGAgglomeration::prolongField(), and globalIndex::scatter().
|
inline |
Distribute data in processor order.
Requires fld to be correctly sized! Communication with default/specified communicator, message tag.
comm | communicator |
Definition at line 783 of file globalIndex.H.
References globalIndex::comm, fld(), globalIndex::scatter(), and globalIndex::tag.
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 955 of file globalIndexTemplates.C.
References UList< T >::deepCopy(), and UPstream::parRun().
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 987 of file globalIndexTemplates.C.
References UPstream::parRun().
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 1019 of file globalIndexTemplates.C.
References PstreamBuffers::allProcs(), PstreamBuffers::finishedSends(), fld(), UPstream::nonBlocking, PstreamBuffers::nProcs(), CompactListList< T >::offsets(), os(), PstreamBuffers::recvDataCount(), List< T >::resize_nocopy(), and UList< T >::size().
FOAM_DEPRECATED_FOR | ( | 2022- | 03, |
"construct without message tag" | |||
) | const |
Construct from local size, using gather/broadcast with default/specified communicator if parallel.
FOAM_DEPRECATED_FOR | ( | 2022- | 03, |
"reset without message tag" | |||
) | const |
Reset from local size, using gather/broadcast with default/specified communicator if parallel.
References globalIndex::comm, globalIndex::localSize(), globalIndex::parallel, and globalIndex::reset().
|
inline |
Prefer localStart() to avoid confusing with offsets()
Definition at line 878 of file globalIndex.H.
References globalIndex::localStart().
|
friend |
|
friend |
const int tag |
Definition at line 855 of file globalIndex.H.
Referenced by globalIndex::gather(), and globalIndex::scatter().
const int const label comm |
Definition at line 856 of file globalIndex.H.
Referenced by globalIndex::FOAM_DEPRECATED_FOR(), globalIndex::gather(), and globalIndex::scatter().
const int const label const bool parallel |
Definition at line 857 of file globalIndex.H.
Referenced by globalIndex::FOAM_DEPRECATED_FOR().