Calculates a unique integer (label so might not have enough room - 2G max) for processor + local index. E.g. More...
Public Member Functions | |
globalIndex ()=default | |
Construct null. More... | |
globalIndex (const label localSize) | |
Construct from local max size. More... | |
globalIndex (const label localSize, const int tag, const label comm, const bool parallel) | |
Construct from local max size. More... | |
globalIndex (const labelUList &offsets) | |
Copy construct from list of labels. More... | |
globalIndex (labelList &&offsets) | |
Move construct from list of labels. More... | |
globalIndex (Istream &is) | |
Construct from Istream. More... | |
bool | empty () const |
Check for null constructed or global sum == 0. More... | |
const labelList & | offsets () const |
Const-access to the offsets. More... | |
label | size () const |
Global sum of localSizes. More... | |
labelList | sizes () const |
The local sizes. More... | |
labelList & | offsets () |
Write-access to the offsets, for changing after construction. More... | |
void | reset (const label localSize) |
Reset from local size. More... | |
void | reset (const label localSize, const int tag, const label comm, const bool parallel) |
Reset from local size. More... | |
label | localStart () const |
My local start. More... | |
label | localSize () const |
My local size. More... | |
labelRange | range () const |
Return start/size range of local processor 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 (labelList &labels) const |
From local to global index (inplace) More... | |
label | toLocal (const label i) const |
From global to local on current processor. More... | |
label | offset (const label proci) const |
Start of proci data. More... | |
label | localStart (const label proci) const |
Start of proci data. More... | |
label | localSize (const label proci) const |
Size of proci data. 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, labelList &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 | whichProcID (const label i) const |
Which processor does global come from? Binary search. More... | |
template<class Container , class Type > | |
void | gather (const label comm, const Container &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking) const |
Collect data in processor order on master (== procIDs[0]). More... | |
template<class Type > | |
void | gather (const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking) const |
Collect data in processor order on master. More... | |
template<class Container , class Type > | |
void | gather (const label comm, const Container &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking) const |
template<class Type > | |
void | gather (List< Type > &fld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking) const |
Inplace collect data in processor order on master. More... | |
template<class Container , class Type > | |
void | scatter (const label comm, const Container &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking) const |
Distribute data in processor order. Requires fld to be sized! More... | |
template<class Type > | |
void | scatter (const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking) const |
Distribute data in processor order. Requires fld to be sized! More... | |
template<class Type , class CombineOp > | |
void | get (List< Type > &allFld, const labelUList &globalIds, const CombineOp &cop, const label comm=Pstream::worldComm, const int tag=UPstream::msgType()) const |
Get (potentially remote) data. Elements required given as. More... | |
Static Public Member Functions | |
template<class Container , class Type > | |
static void | gather (const labelUList &offsets, const label comm, const Container &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking) |
Collect data in processor order on master (== procIDs[0]). More... | |
template<class Type > | |
static void | gatherOp (const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking) |
Collect data in processor order on master. More... | |
template<class Container , class Type > | |
static void | gather (const labelUList &offsets, const label comm, const Container &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking) |
template<class Type > | |
static void | gatherOp (List< Type > &fld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking) |
Inplace collect data in processor order on master. More... | |
template<class Container , class Type > | |
static void | scatter (const labelUList &offsets, const label comm, const Container &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking) |
Distribute data in processor order. Requires fld to be sized! 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 68 of file globalIndex.H.
|
default |
Construct null.
|
inlineexplicit |
Construct from local max size.
Does communication with default communicator and message tag.
Definition at line 34 of file globalIndexI.H.
References globalIndex::localSize(), and globalIndex::reset().
|
inline |
Construct from local max size.
Does communication with given communicator and message tag
tag | message tag |
comm | communicator |
parallel | use parallel comms |
Definition at line 43 of file globalIndexI.H.
|
inlineexplicit |
Copy construct from list of labels.
Definition at line 56 of file globalIndexI.H.
|
inlineexplicit |
Move construct from list of labels.
Definition at line 62 of file globalIndexI.H.
|
explicit |
Construct from Istream.
Definition at line 33 of file globalIndex.C.
|
inline |
Check for null constructed or global sum == 0.
Definition at line 70 of file globalIndexI.H.
|
inline |
Const-access to the offsets.
Definition at line 76 of file globalIndexI.H.
|
inline |
Global sum of localSizes.
Definition at line 88 of file globalIndexI.H.
Referenced by nearWallFields::calcAddressing(), distributedTriSurfaceMesh::globalSize(), regionSplit::nRegions(), SprayCloud< Foam::DSMCCloud >::penetration(), and internalMeshWriter::writeProcIDs().
Foam::labelList sizes | ( | ) | const |
The local sizes.
Definition at line 140 of file globalIndex.C.
References Foam::HashTableOps::values().
|
inline |
Write-access to the offsets, for changing after construction.
Definition at line 82 of file globalIndexI.H.
|
inline |
Reset from local size.
Does communication with default communicator and message tag.
Definition at line 94 of file globalIndexI.H.
References UPstream::msgType().
Referenced by globalMeshData::globalEdgeNumbering(), globalIndex::globalIndex(), globalMeshData::globalPointNumbering(), and distributedTriSurfaceMesh::globalTris().
void reset | ( | const label | localSize, |
const int | tag, | ||
const label | comm, | ||
const bool | parallel | ||
) |
Reset from local size.
Does communication with given communicator and message tag
tag | message tag |
comm | communicator |
parallel | use parallel comms |
Definition at line 102 of file globalIndex.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Pstream::gatherList(), Foam::labelMax, UPstream::myProcNo(), UPstream::nProcs(), Pstream::scatterList(), and Foam::Zero.
|
inline |
My local start.
Definition at line 112 of file globalIndexI.H.
References UPstream::myProcNo().
Referenced by viewFactor::calculate(), cellCellStencil::globalCellCells(), indirectPatchWriter::writeGeometry(), surfaceWriter::writeGeometry(), patchMeshWriter::writeGeometry(), and patchMeshWriter::writePolys().
|
inline |
My local size.
Definition at line 124 of file globalIndexI.H.
References UPstream::myProcNo().
Referenced by createShellMesh::calcPointRegions(), viewFactor::calculate(), mapDistributeBase::exchangeAddressing(), cellCellStencil::globalCellCells(), globalIndex::globalIndex(), regionSplit::nLocalRegions(), SprayCloud< Foam::DSMCCloud >::penetration(), and patchMeshWriter::writeProcIDs().
|
inline |
Return start/size range of local processor data.
Definition at line 136 of file globalIndexI.H.
References UPstream::myProcNo(), and range.
|
inline |
Is on local processor.
Definition at line 148 of file globalIndexI.H.
References UPstream::myProcNo().
Referenced by decompositionMethod::calcCellCells(), mapDistributeBase::calcCompactAddressing(), addPatchCellLayer::calcExtrudeInfo(), regionSplit::reduceRegions(), and mapDistributeBase::renumber().
|
inline |
From local to global index.
Definition at line 164 of file globalIndexI.H.
References UPstream::myProcNo().
Referenced by nearWallFields::calcAddressing(), decompositionMethod::calcCellCells(), createShellMesh::calcPointRegions(), viewFactor::calculate(), cellCellStencil::globalCellCells(), addPatchCellLayer::globalEdgeFaces(), viewFactor::insertMatrixElements(), inverseDistance::markDonors(), globalMeshData::mergePoints(), MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration(), regionSplit::reduceRegions(), regionSplit2D::regionSplit2D(), addPatchCellLayer::setRefinement(), and cellVolumeWeight::update().
|
inline |
From local to global index.
Definition at line 184 of file globalIndexI.H.
References UPstream::myProcNo().
|
inline |
From local to global index (inplace)
Definition at line 207 of file globalIndexI.H.
References UPstream::myProcNo().
Referenced by faceAreaWeightAMI::calculate().
|
inline |
From global to local on current processor.
FatalError if not on local processor.
Definition at line 229 of file globalIndexI.H.
References UPstream::myProcNo().
Referenced by fvMeshPrimitiveLduAddressing::addAddressing(), decompositionMethod::calcCellCells(), mapDistributeBase::calcCompactAddressing(), distributedTriSurfaceMesh::localQueries(), and mapDistributeBase::renumber().
|
inline |
Start of proci data.
Definition at line 100 of file globalIndexI.H.
Referenced by SprayCloud< Foam::DSMCCloud >::penetration(), and Foam::vtk::writeListParallel().
|
inline |
Start of proci data.
Definition at line 106 of file globalIndexI.H.
|
inline |
Size of proci data.
Definition at line 118 of file globalIndexI.H.
|
inline |
Return start/size range of proci data.
Definition at line 130 of file globalIndexI.H.
|
inline |
Is on processor proci.
Definition at line 142 of file globalIndexI.H.
|
inline |
From local to global on proci.
Definition at line 155 of file globalIndexI.H.
|
inline |
From local to global on proci.
Definition at line 171 of file globalIndexI.H.
|
inline |
From local to global index on proci (inplace)
Definition at line 193 of file globalIndexI.H.
|
inline |
From global to local on proci.
Definition at line 214 of file globalIndexI.H.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.
|
inline |
Which processor does global come from? Binary search.
Definition at line 235 of file globalIndexI.H.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and Foam::findLower().
Referenced by fvMeshPrimitiveLduAddressing::addAddressing(), mapDistributeBase::calcCompactAddressing(), addPatchCellLayer::calcExtrudeInfo(), distributedTriSurfaceMesh::findNearest(), distributedTriSurfaceMesh::localQueries(), regionSplit::reduceRegions(), and mapDistributeBase::renumber().
|
static |
Collect data in processor order on master (== procIDs[0]).
Needs offsets only on master.
Definition at line 35 of file globalIndexTemplates.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld, UList< T >::last(), Foam::blockMeshTools::read(), List< T >::setSize(), and Foam::vtk::write().
Referenced by globalIndex::gather(), PatchTools::gatherAndMerge(), and GAMGAgglomeration::procAgglomerateRestrictAddressing().
|
inline |
Collect data in processor order on master (== procIDs[0]).
Needs offsets only on master.
Definition at line 246 of file globalIndex.H.
References fld, and globalIndex::gather().
void gather | ( | const UList< Type > & | fld, |
List< Type > & | allFld, | ||
const int | tag = UPstream::msgType() , |
||
const Pstream::commsTypes | commsType = Pstream::commsTypes::nonBlocking |
||
) | const |
Collect data in processor order on master.
Does communication with default communicator and message tag.
Definition at line 187 of file globalIndexTemplates.C.
References fld.
|
static |
Collect data in processor order on master.
Does communication with default communicator and message tag.
Definition at line 208 of file globalIndexTemplates.C.
References fld.
Referenced by sampledSet::gather(), mergedSurf::merge(), and surfaceWriter::mergeFieldTemplate().
|
static |
Inplace collect in processor order on master (== procIDs[0]). Needs offsets only on master.
Definition at line 221 of file globalIndexTemplates.C.
References fld.
|
inline |
Inplace collect in processor order on master (== procIDs[0]). Needs offsets only on master.
Definition at line 302 of file globalIndex.H.
References fld, and globalIndex::gather().
void gather | ( | List< Type > & | fld, |
const int | tag = UPstream::msgType() , |
||
const Pstream::commsTypes | commsType = Pstream::commsTypes::nonBlocking |
||
) | const |
Inplace collect data in processor order on master.
Does communication with default communicator and message tag. After the gather, the field is zero-sized on the slaves.
Definition at line 243 of file globalIndexTemplates.C.
References fld.
|
static |
Inplace collect data in processor order on master.
Does communication with default communicator and message tag. After the gather, the field is zero-sized on the slaves.
Definition at line 274 of file globalIndexTemplates.C.
References fld.
|
static |
Distribute data in processor order. Requires fld to be sized!
Definition at line 286 of file globalIndexTemplates.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld, Foam::blockMeshTools::read(), and Foam::vtk::write().
Referenced by globalIndex::scatter().
|
inline |
Distribute data in processor order. Requires fld to be sized!
Definition at line 356 of file globalIndex.H.
References fld, and globalIndex::scatter().
void scatter | ( | const UList< Type > & | allFld, |
UList< Type > & | fld, | ||
const int | tag = UPstream::msgType() , |
||
const Pstream::commsTypes | commsType = Pstream::commsTypes::nonBlocking |
||
) | const |
Distribute data in processor order. Requires fld to be sized!
Does communication with default communicator and message tag.
Definition at line 445 of file globalIndexTemplates.C.
References fld.
void get | ( | List< Type > & | allFld, |
const labelUList & | globalIds, | ||
const CombineOp & | cop, | ||
const label | comm = Pstream::worldComm , |
||
const int | tag = UPstream::msgType() |
||
) | const |
Get (potentially remote) data. Elements required given as.
global indices
Definition at line 467 of file globalIndexTemplates.C.
References PstreamBuffers::finishedSends(), fld, forAll, CompactListList< T, Container >::offsets(), List< T >::setSize(), and UList< T >::size().
|
friend |
|
friend |