globalIndex Class Reference

Calculates a unique integer (label so might not have enough room - 2G max) for processor + local index. E.g. More...

Public Member Functions

 globalIndex ()
 Construct null. More...
 
 globalIndex (const label localSize)
 Construct from local max size. Does communication with default. More...
 
 globalIndex (const label localSize, const int tag, const label comm, const bool parallel)
 Construct from local max size. Does communication with given. More...
 
 globalIndex (const labelList &offsets)
 Construct from components. More...
 
 globalIndex (labelList &&offsets)
 Move constructor from components. More...
 
 globalIndex (Istream &is)
 Construct from Istream. More...
 
labelListoffsets ()
 Change after construction. More...
 
label localSize () const
 My local size. More...
 
label toGlobal (const label i) const
 From local to global. More...
 
bool isLocal (const label i) const
 Is on local processor. More...
 
label toLocal (const label i) const
 From global to local on current processor. More...
 
label size () const
 Global sum of localSizes. More...
 
label localSize (const label proci) const
 Size of proci data. More...
 
label toGlobal (const label proci, const label i) const
 From local to global on proci. More...
 
bool isLocal (const label proci, const label i) const
 Is on processor proci. 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...
 
label offset (const label proci) const
 Start of proci data. More...
 
template<class Type >
void gather (const label comm, const labelList &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 label comm, const labelList &procIDs, 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 Type >
void scatter (const label comm, const labelList &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...
 

Static Public Member Functions

template<class Type >
static void gather (const labelUList &offsets, const label comm, const labelList &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 gather (const labelUList &offsets, const label comm, const labelList &procIDs, 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 Type >
static void scatter (const labelUList &offsets, const label comm, const labelList &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

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

Detailed Description

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);

Source files

Definition at line 63 of file globalIndex.H.

Constructor & Destructor Documentation

◆ globalIndex() [1/6]

globalIndex ( )
inline

Construct null.

Definition at line 30 of file globalIndexI.H.

◆ globalIndex() [2/6]

globalIndex ( const label  localSize)

Construct from local max size. Does communication with default.

communicator and message tag.

Definition at line 68 of file globalIndex.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Pstream::gatherList(), Foam::labelMax, globalIndex::localSize(), UPstream::msgType(), UPstream::myProcNo(), UPstream::nProcs(), globalIndex::offset(), and Pstream::scatterList().

Here is the call graph for this function:

◆ globalIndex() [3/6]

globalIndex ( const label  localSize,
const int  tag,
const label  comm,
const bool  parallel 
)

Construct from local max size. Does communication with given.

communicator and message tag

Definition at line 31 of file globalIndex.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and Foam::labelMax.

Here is the call graph for this function:

◆ globalIndex() [4/6]

globalIndex ( const labelList offsets)

Construct from components.

Definition at line 97 of file globalIndex.C.

◆ globalIndex() [5/6]

globalIndex ( labelList &&  offsets)
inline

Move constructor from components.

Definition at line 34 of file globalIndexI.H.

◆ globalIndex() [6/6]

globalIndex ( Istream is)

Construct from Istream.

Definition at line 103 of file globalIndex.C.

Member Function Documentation

◆ offsets()

Foam::labelList & offsets ( )
inline

Change after construction.

Definition at line 42 of file globalIndexI.H.

◆ localSize() [1/2]

Foam::label localSize ( ) const
inline

My local size.

Definition at line 60 of file globalIndexI.H.

References UPstream::myProcNo().

Referenced by createShellMesh::calcPointRegions(), distributionMapBase::exchangeAddressing(), globalIndex::globalIndex(), regionSplit::nLocalRegions(), and SprayCloud< Foam::DSMCCloud >::penetration().

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

◆ toGlobal() [1/2]

◆ isLocal() [1/2]

bool isLocal ( const label  i) const
inline

Is on local processor.

Definition at line 95 of file globalIndexI.H.

References UPstream::myProcNo().

Referenced by decompositionMethod::calcCellCells(), distributionMapBase::calcCompactAddressing(), addPatchCellLayer::calcSidePatch(), and distributionMapBase::renumber().

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

◆ toLocal() [1/2]

Foam::label toLocal ( const label  i) const
inline

From global to local on current processor.

FatalError if not on local processor.

Definition at line 117 of file globalIndexI.H.

References UPstream::myProcNo().

Referenced by decompositionMethod::calcCellCells(), distributionMapBase::calcCompactAddressing(), NamedEnum< compressibleField, 8 >::names(), and distributionMapBase::renumber().

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

◆ size()

Foam::label size ( ) const
inline

Global sum of localSizes.

Definition at line 66 of file globalIndexI.H.

References UList< T >::last(), and globalIndex::toGlobal().

Referenced by nearWallFields::calcAddressing(), distributedTriSurfaceMesh::globalSize(), regionSplit::nRegions(), SprayCloud< Foam::DSMCCloud >::penetration(), and globalIndex::whichProcID().

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

◆ localSize() [2/2]

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

Size of proci data.

Definition at line 54 of file globalIndexI.H.

◆ toGlobal() [2/2]

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

From local to global on proci.

Definition at line 73 of file globalIndexI.H.

◆ isLocal() [2/2]

bool isLocal ( const label  proci,
const label  i 
) const
inline

Is on processor proci.

Is on local processor.

Definition at line 89 of file globalIndexI.H.

◆ toLocal() [2/2]

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

From global to local on proci.

Definition at line 101 of file globalIndexI.H.

References Foam::abort(), Foam::endl(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ whichProcID()

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

Which processor does global come from? Binary search.

Definition at line 123 of file globalIndexI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::findLower(), and globalIndex::size().

Referenced by distributionMapBase::calcCompactAddressing(), addPatchCellLayer::calcSidePatch(), NamedEnum< compressibleField, 8 >::names(), and distributionMapBase::renumber().

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

◆ offset()

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

Start of proci data.

Definition at line 48 of file globalIndexI.H.

Referenced by globalIndex::globalIndex(), and SprayCloud< Foam::DSMCCloud >::penetration().

Here is the caller graph for this function:

◆ gather() [1/4]

void gather ( const labelUList offsets,
const label  comm,
const labelList procIDs,
const UList< Type > &  fld,
List< Type > &  allFld,
const int  tag = UPstream::msgType(),
const Pstream::commsTypes  commsType = Pstream::commsTypes::nonBlocking 
)
static

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

Needs offsets only on master.

Definition at line 32 of file globalIndexTemplates.C.

References UList< T >::begin(), UList< T >::byteSize(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld(), UList< T >::last(), Foam::blockMeshTools::read(), List< T >::setSize(), List< T >::size(), UList< T >::size(), and Foam::vtkWriteOps::write().

Referenced by globalIndex::gather(), and GAMGAgglomeration::procAgglomerateRestrictAddressing().

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

◆ gather() [2/4]

void gather ( const label  comm,
const labelList procIDs,
const UList< Type > &  fld,
List< Type > &  allFld,
const int  tag = UPstream::msgType(),
const Pstream::commsTypes  commsType = Pstream::commsTypes::nonBlocking 
) const
inline

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

Needs offsets only on master.

Definition at line 171 of file globalIndex.H.

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

Here is the call graph for this function:

◆ gather() [3/4]

void gather ( const labelUList offsets,
const label  comm,
const labelList procIDs,
List< Type > &  fld,
const int  tag = UPstream::msgType(),
const Pstream::commsTypes  commsType = Pstream::commsTypes::nonBlocking 
)
static

Inplace collect data in processor order on master.

(== procIDs[0]). Needs offsets only on master.

Definition at line 184 of file globalIndexTemplates.C.

References globalIndex::scatter(), and List< T >::transfer().

Here is the call graph for this function:

◆ gather() [4/4]

void gather ( const label  comm,
const labelList procIDs,
List< Type > &  fld,
const int  tag = UPstream::msgType(),
const Pstream::commsTypes  commsType = Pstream::commsTypes::nonBlocking 
) const
inline

Inplace collect data in processor order on master.

(== procIDs[0]). Needs offsets only on master.

Definition at line 202 of file globalIndex.H.

References globalIndex::gather(), UPstream::msgType(), UPstream::nonBlocking, and globalIndex::scatter().

Here is the call graph for this function:

◆ scatter() [1/2]

void scatter ( const labelUList offsets,
const label  comm,
const labelList procIDs,
const UList< Type > &  allFld,
UList< Type > &  fld,
const int  tag = UPstream::msgType(),
const Pstream::commsTypes  commsType = Pstream::commsTypes::nonBlocking 
)
static

Distribute data in processor order. Requires fld to be sized!

Definition at line 206 of file globalIndexTemplates.C.

References UList< T >::begin(), UList< T >::byteSize(), UList< T >::deepCopy(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld(), Foam::blockMeshTools::read(), List< T >::size(), and Foam::vtkWriteOps::write().

Referenced by globalIndex::gather(), and globalIndex::scatter().

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

◆ scatter() [2/2]

void scatter ( const label  comm,
const labelList procIDs,
const UList< Type > &  allFld,
UList< Type > &  fld,
const int  tag = UPstream::msgType(),
const Pstream::commsTypes  commsType = Pstream::commsTypes::nonBlocking 
) const
inline

Distribute data in processor order. Requires fld to be sized!

Definition at line 231 of file globalIndex.H.

References globalIndex::operator<<, globalIndex::operator>>, and globalIndex::scatter().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator>>

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

Referenced by globalIndex::scatter().

◆ operator<<

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

Referenced by globalIndex::scatter().


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