Public Member Functions | Static Public Member Functions | Friends | List of all members
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 (const Xfer< labelList > &offsets)
 Construct 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::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::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::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::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::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::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 ( )
inline

Construct null.

Definition at line 30 of file globalIndexI.H.

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 ( 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 ( const labelList offsets)

Construct from components.

Definition at line 97 of file globalIndex.C.

globalIndex ( const Xfer< labelList > &  offsets)
inline

Construct from components.

Definition at line 34 of file globalIndexI.H.

globalIndex ( Istream is)

Construct from Istream.

Definition at line 103 of file globalIndex.C.

Member Function Documentation

Foam::labelList & offsets ( )
inline

Change after construction.

Definition at line 42 of file globalIndexI.H.

Foam::label localSize ( ) const
inline

My local size.

Definition at line 60 of file globalIndexI.H.

References UPstream::myProcNo().

Referenced by createShellMesh::calcPointRegions(), mapDistributeBase::exchangeAddressing(), globalIndex::globalIndex(), regionSplit::nLocalRegions(), minEqOp< labelPair >::operator()(), and SprayCloud< CloudType >::penetration().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::label toGlobal ( const label  i) const
inline
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(), mapDistributeBase::calcCompactAddressing(), addPatchCellLayer::calcSidePatch(), and mapDistributeBase::renumber().

Here is the call graph for this function:

Here is the caller graph for this function:

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(), mapDistributeBase::calcCompactAddressing(), NamedEnum< Enum, nEnum >::names(), minEqOp< labelPair >::operator()(), and mapDistributeBase::renumber().

Here is the call graph for this function:

Here is the caller graph for this function:

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(), minEqOp< labelPair >::operator()(), SprayCloud< CloudType >::penetration(), and globalIndex::whichProcID().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Size of proci data.

Definition at line 54 of file globalIndexI.H.

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.

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.

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:

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 mapDistributeBase::calcCompactAddressing(), addPatchCellLayer::calcSidePatch(), NamedEnum< Enum, nEnum >::names(), minEqOp< labelPair >::operator()(), and mapDistributeBase::renumber().

Here is the call graph for this function:

Here is the caller graph for this function:

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< CloudType >::penetration().

Here is the caller graph for this function:

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::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::read(), List< T >::setSize(), List< T >::size(), UList< T >::size(), and write().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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::nonBlocking 
) const
inline

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

Needs offsets only on master.

Definition at line 170 of file globalIndex.H.

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

Here is the call graph for this function:

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

Inplace collect data in processor order on master.

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

Definition at line 176 of file globalIndexTemplates.C.

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

Here is the call graph for this function:

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

Inplace collect data in processor order on master.

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

Definition at line 199 of file globalIndex.H.

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

Here is the call graph for this function:

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::nonBlocking 
)
static

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

Definition at line 198 of file globalIndexTemplates.C.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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::nonBlocking 
) const
inline

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

Definition at line 226 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

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

Referenced by globalIndex::scatter().

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

Referenced by globalIndex::scatter().


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