mapDistributeBase Class Reference

Class containing processor-to-processor mapping information. More...

Inheritance diagram for mapDistributeBase:
[legend]

Public Member Functions

 ClassName ("mapDistributeBase")
 
 mapDistributeBase ()
 Default construct (uses worldComm) More...
 
 mapDistributeBase (const label comm)
 Default construct with specified communicator. More...
 
 mapDistributeBase (const mapDistributeBase &map)
 Copy construct. More...
 
 mapDistributeBase (mapDistributeBase &&map)
 Move construct. More...
 
 mapDistributeBase (const dictionary &dict, const label comm=UPstream::worldComm)
 Read construct from dictionary. More...
 
 mapDistributeBase (const label constructSize, labelListList &&subMap, labelListList &&constructMap, const bool subHasFlip=false, const bool constructHasFlip=false, const label comm=UPstream::worldComm)
 Move construct from components. More...
 
 mapDistributeBase (const labelUList &sendProcs, const labelUList &recvProcs, const label comm=UPstream::worldComm)
 
 mapDistributeBase (const globalIndex &, labelList &elements, List< Map< label > > &compactMap, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
 
 mapDistributeBase (const globalIndex &, labelListList &cellCells, List< Map< label > > &compactMap, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
 
 mapDistributeBase (labelListList &&subMap, const bool subHasFlip=false, const bool constructHasFlip=false, const label comm=UPstream::worldComm)
 Construct from my elements to send. More...
 
 mapDistributeBase (Istream &is)
 Construct from Istream. More...
 
label constructSize () const noexcept
 Constructed data size. More...
 
label & constructSize () noexcept
 Constructed data size. More...
 
const labelListListsubMap () const noexcept
 From subsetted data back to original data. More...
 
labelListListsubMap () noexcept
 From subsetted data back to original data. More...
 
const labelListListconstructMap () const noexcept
 From subsetted data to new reconstructed data. More...
 
labelListListconstructMap () noexcept
 From subsetted data to new reconstructed data. More...
 
bool subHasFlip () const noexcept
 Does subMap include a sign. More...
 
boolsubHasFlip () noexcept
 Does subMap include a sign. More...
 
bool constructHasFlip () const noexcept
 Does constructMap include a sign. More...
 
boolconstructHasFlip () noexcept
 Does constructMap include a sign. More...
 
label comm () const noexcept
 The communicator used. More...
 
label nMaps () const noexcept
 The number of sub-lists within the maps. More...
 
labelList subMapSizes () const
 The sizes of the subMap lists. More...
 
labelList constructMapSizes () const
 The sizes of the constructMap lists. More...
 
const List< labelPair > & schedule () const
 Return a schedule. Demand driven. See above. More...
 
const List< labelPair > & whichSchedule (const UPstream::commsTypes commsType) const
 
void clear ()
 Reset to zero size, only retaining communicator. More...
 
void transfer (mapDistributeBase &rhs)
 Transfer the contents of the argument and annul the argument. More...
 
void compactLocalData (const bitSet &allowedLocalElems, const int tag=UPstream::msgType(), const bool doRenumber=false)
 
void compactRemoteData (const bitSet &allowedRemoteElems, const int tag=UPstream::msgType(), const bool doRenumber=false)
 
void compactLocalData (const bitSet &allowedLocalElems, labelList &oldToNewSub, labelList &oldToNewConstruct, const label localSize=-1, const int tag=UPstream::msgType())
 
void compactRemoteData (const bitSet &allowedRemoteElems, labelList &oldToNewSub, labelList &oldToNewConstruct, const label localSize=-1, const int tag=UPstream::msgType())
 
void compactData (const labelUList &localElements, const labelUList &remoteElements, labelList &oldToNewSub, labelList &oldToNewConstruct, const label localSize=-1, const int tag=UPstream::msgType())
 
void compactLocalData (const labelUList &localElements, labelList &oldToNewSub, labelList &oldToNewConstruct, const label localSize=-1, const int tag=UPstream::msgType())
 
void compactRemoteData (const labelUList &remoteElements, labelList &oldToNewSub, labelList &oldToNewConstruct, const label localSize=-1, const int tag=UPstream::msgType())
 
template<class T >
void distribute (List< T > &values, const int tag=UPstream::msgType()) const
 
template<class T >
void distribute (DynamicList< T > &values, const int tag=UPstream::msgType()) const
 
template<class T , class NegateOp >
void distribute (List< T > &values, const NegateOp &negOp, const int tag=UPstream::msgType()) const
 
template<class T , class NegateOp >
void distribute (const Pstream::commsTypes commsType, List< T > &values, const NegateOp &negOp, const int tag=UPstream::msgType()) const
 
template<class T , class NegateOp >
void distribute (const Pstream::commsTypes commsType, const T &nullValue, List< T > &values, const NegateOp &negOp, const int tag=UPstream::msgType()) const
 
template<class T >
void reverseDistribute (const label constructSize, List< T > &values, const int tag=UPstream::msgType()) const
 
template<class T >
void reverseDistribute (const label constructSize, const T &nullValue, List< T > &values, const int tag=UPstream::msgType()) const
 
template<class T >
void reverseDistribute (const Pstream::commsTypes commsType, const label constructSize, List< T > &values, const int tag=UPstream::msgType()) const
 
template<class T , class NegateOp >
void reverseDistribute (const Pstream::commsTypes commsType, const label constructSize, List< T > &values, const NegateOp &negOp, const int tag=UPstream::msgType()) const
 
template<class T >
void reverseDistribute (const Pstream::commsTypes commsType, const label constructSize, const T &nullValue, List< T > &values, const int tag=UPstream::msgType()) const
 
template<class T >
void send (PstreamBuffers &pBufs, const List< T > &field) const
 Do all sends using PstreamBuffers. More...
 
template<class T >
void receive (PstreamBuffers &pBufs, List< T > &field) const
 Do all receives using PstreamBuffers. More...
 
void printLayout (Ostream &os) const
 Debug: print layout. Can only be used on maps with sorted. More...
 
void operator= (const mapDistributeBase &rhs)
 Copy assignment. More...
 
void operator= (mapDistributeBase &&rhs)
 Move assignment. More...
 
InfoProxy< mapDistributeBaseinfo () const
 Info proxy to print summary information to a stream. More...
 
void readDict (const dictionary &dict)
 Read entries from dictionary format. More...
 
void writeEntries (Ostream &os) const
 Write entries in dictionary format. More...
 
void updateMesh (const mapPolyMesh &)
 No correction for topo change. More...
 
void compact (const boolList &remoteElemUsed, const int tag=UPstream::msgType())
 
void compact (const boolList &remoteElemUsed, const label localSize, labelList &oldToNewSub, labelList &oldToNewConstruct, const int tag=UPstream::msgType())
 
template<class T , class NegateOp >
Foam::List< TaccessAndFlip (const UList< T > &values, const labelUList &indices, const bool hasFlip, const NegateOp &negOp)
 

Static Public Member Functions

static bool hasFlipAddressing (const labelUList &map)
 
static bool hasFlipAddressing (const labelListList &maps)
 
static label countUnmapped (const labelUList &elements, const labelListList &maps, const bool hasFlip)
 Count the number of unmapped elements. More...
 
static List< labelPairschedule (const labelListList &subMap, const labelListList &constructMap, const int tag, const label comm=UPstream::worldComm)
 Calculate a communication schedule. See above. More...
 
static label renumber (const globalIndex &, const List< Map< label > > &compactMap, const label globalElement)
 Helper for construct from globalIndex. Renumbers element. More...
 
static label renumberMap (labelListList &mapElements, const labelUList &oldToNew, const bool hasFlip)
 
template<class T , class NegateOp >
static void distribute (const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, List< T > &field, const NegateOp &negOp, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
 Distribute data with specified negate operator (for flips). More...
 
template<class T , class CombineOp , class NegateOp >
static void distribute (const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, List< T > &field, const T &nullValue, const CombineOp &cop, const NegateOp &negOp, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
 Distribute data with specified combine operation. More...
 

Protected Member Functions

void calcCompactAddressing (const globalIndex &globalNumbering, const labelUList &elements, List< Map< label > > &compactMap) const
 Construct per processor compact addressing of the global elements. More...
 
void calcCompactAddressing (const globalIndex &globalNumbering, const labelListList &elements, List< Map< label > > &compactMap) const
 
void exchangeAddressing (const int tag, const globalIndex &globalNumbering, labelList &elements, List< Map< label > > &compactMap, labelList &compactStart)
 
void exchangeAddressing (const int tag, const globalIndex &globalNumbering, labelListList &elements, List< Map< label > > &compactMap, labelList &compactStart)
 

Static Protected Member Functions

static void checkReceivedSize (const label proci, const label expectedSize, const label receivedSize)
 Fatal if expected and received size are not equal. More...
 
static label getMappedSize (const labelListList &maps, const bool hasFlip)
 Scan the maps for the max addressed index. More...
 
static void exchangeMasks (const UList< bitSet > &sendMasks, UList< bitSet > &recvMasks, const int tag, const label comm)
 Synchronize send/recv mask buffers as a 'copy' operation. More...
 
static void unionCombineMasks (UList< bitSet > &sendMasks, UList< bitSet > &recvMasks, const int tag, const label comm)
 
template<class T , class CombineOp , class NegateOp >
static void flipAndCombine (const labelUList &map, const bool hasFlip, const UList< T > &rhs, const CombineOp &cop, const NegateOp &negOp, List< T > &lhs)
 
template<class T , class NegateOp >
static T accessAndFlip (const UList< T > &values, const label index, const bool hasFlip, const NegateOp &negOp)
 
template<class T , class NegateOp >
static List< TaccessAndFlip (const UList< T > &values, const labelUList &indices, const bool hasFlip, const NegateOp &negOp)
 

Friends

Istreamoperator>> (Istream &, mapDistributeBase &)
 Read plain content (not dictionary) from Istream. More...
 
Ostreamoperator<< (Ostream &, const mapDistributeBase &)
 Write plain content (not dictionary) to Ostream. More...
 

Detailed Description

Class containing processor-to-processor mapping information.

We store mapping from the bits-to-send to the complete starting list (subXXXMap) and from the received bits to their location in the new list (constructXXXMap).

Note: Schedule is a list of processor pairs (one send, one receive. One of them will be myself) which forms a scheduled (i.e. non-buffered) exchange. See distribute on how to use it. Note2: number of items sent on one processor have to equal the number of items received on the other processor.

To aid constructing these maps there are the constructors from global numbering, either with or without transforms.

Constructors using compact numbering: layout is

  • all my own elements first (whether used or not)
  • followed by used-only remote elements sorted by remote processor. So e.g 4 procs and on proc 1 the compact table will first have all globalIndex.localSize() elements from proc1 followed by used-only elements of proc0, proc2, proc3. The constructed mapDistributeBase sends the local elements from and receives the remote elements into their compact position. compactMap[proci] is the position of elements from proci in the compact map. compactMap[myProcNo()] is empty since trivial addressing.

It rewrites the input global indices into indices into the constructed data.

When constructing from components optionally a 'flip' on the maps can be specified. This will interpret the map values as index+flip, similar to e.g. faceProcAddressing. The flip will only be applied to fieldTypes (scalar, vector, .. triad)

Source files

Definition at line 105 of file mapDistributeBase.H.

Constructor & Destructor Documentation

◆ mapDistributeBase() [1/11]

Default construct (uses worldComm)

Definition at line 654 of file mapDistributeBase.C.

◆ mapDistributeBase() [2/11]

mapDistributeBase ( const label  comm)
explicit

Default construct with specified communicator.

Definition at line 660 of file mapDistributeBase.C.

◆ mapDistributeBase() [3/11]

Copy construct.

Definition at line 672 of file mapDistributeBase.C.

◆ mapDistributeBase() [4/11]

Move construct.

Definition at line 684 of file mapDistributeBase.C.

References mapDistributeBase::transfer().

Here is the call graph for this function:

◆ mapDistributeBase() [5/11]

mapDistributeBase ( const dictionary dict,
const label  comm = UPstream::worldComm 
)
explicit

Read construct from dictionary.

Definition at line 80 of file mapDistributeBaseIO.C.

References dict.

◆ mapDistributeBase() [6/11]

mapDistributeBase ( const label  constructSize,
labelListList &&  subMap,
labelListList &&  constructMap,
const bool  subHasFlip = false,
const bool  constructHasFlip = false,
const label  comm = UPstream::worldComm 
)

Move construct from components.

Definition at line 692 of file mapDistributeBase.C.

◆ mapDistributeBase() [7/11]

mapDistributeBase ( const labelUList sendProcs,
const labelUList recvProcs,
const label  comm = UPstream::worldComm 
)

Construct from reverse addressing: per data item the send processor and the receive processor.

Note
data is not sorted per processor - cannot use printLayout!

Definition at line 712 of file mapDistributeBase.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, processorFaPatch::myProcNo(), PstreamBuffers::nProcs(), List< T >::setSize(), UList< T >::size(), and Foam::Zero.

Here is the call graph for this function:

◆ mapDistributeBase() [8/11]

mapDistributeBase ( const globalIndex globalNumbering,
labelList elements,
List< Map< label > > &  compactMap,
const int  tag = Pstream::msgType(),
const label  comm = UPstream::worldComm 
)

Construct from list of (possibly) remote elements in globalIndex numbering (or -1).

Determines compact numbering (see above) and distribute map to get data into this ordering and renumbers the elements to be in compact numbering.

Definition at line 797 of file mapDistributeBase.C.

References mapDistributeBase::calcCompactAddressing(), mapDistributeBase::exchangeAddressing(), Foam::Pout, and mapDistributeBase::printLayout().

Here is the call graph for this function:

◆ mapDistributeBase() [9/11]

mapDistributeBase ( const globalIndex globalNumbering,
labelListList cellCells,
List< Map< label > > &  compactMap,
const int  tag = Pstream::msgType(),
const label  comm = UPstream::worldComm 
)

Special variant that works with the info sorted into bins according to local indices.

E.g. think cellCells where cellCells[localCellI] is a list of global cells

Definition at line 860 of file mapDistributeBase.C.

References mapDistributeBase::calcCompactAddressing(), mapDistributeBase::exchangeAddressing(), Foam::Pout, and mapDistributeBase::printLayout().

Here is the call graph for this function:

◆ mapDistributeBase() [10/11]

mapDistributeBase ( labelListList &&  subMap,
const bool  subHasFlip = false,
const bool  constructHasFlip = false,
const label  comm = UPstream::worldComm 
)
explicit

Construct from my elements to send.

Assumes layout is my elements first followed by elements from all other processors in consecutive order.

Definition at line 923 of file mapDistributeBase.C.

References Pstream::exchangeSizes(), forAll, Foam::identity(), processorFaPatch::myProcNo(), PstreamBuffers::nProcs(), and List< T >::resize().

Here is the call graph for this function:

◆ mapDistributeBase() [11/11]

mapDistributeBase ( Istream is)
explicit

Construct from Istream.

Definition at line 92 of file mapDistributeBaseIO.C.

Member Function Documentation

◆ checkReceivedSize()

void checkReceivedSize ( const label  proci,
const label  expectedSize,
const label  receivedSize 
)
staticprotected

Fatal if expected and received size are not equal.

Definition at line 166 of file mapDistributeBase.C.

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

Here is the call graph for this function:

◆ getMappedSize()

Foam::label getMappedSize ( const labelListList maps,
const bool  hasFlip 
)
staticprotected

Scan the maps for the max addressed index.

Parameters
mapsThe maps to scan
hasFlipTrue if maps has flip addressing
Returns
max-size needed for addressing (eg, constructSize)

Definition at line 89 of file mapDistributeBase.C.

References Foam::mag(), and Foam::max().

Here is the call graph for this function:

◆ calcCompactAddressing() [1/2]

void calcCompactAddressing ( const globalIndex globalNumbering,
const labelUList elements,
List< Map< label > > &  compactMap 
) const
protected

Construct per processor compact addressing of the global elements.

needed. The ones from the local processor are not included since these are always all needed.

Definition at line 387 of file mapDistributeBase.C.

References processorFaPatch::myProcNo(), and PstreamBuffers::nProcs().

Referenced by mapDistribute::mapDistribute(), and mapDistributeBase::mapDistributeBase().

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

◆ calcCompactAddressing() [2/2]

void calcCompactAddressing ( const globalIndex globalNumbering,
const labelListList elements,
List< Map< label > > &  compactMap 
) const
protected

Definition at line 435 of file mapDistributeBase.C.

References forAll, globalIndex::isLocal(), processorFaPatch::myProcNo(), PstreamBuffers::nProcs(), List< T >::resize_nocopy(), globalIndex::toLocal(), and Foam::Zero.

Here is the call graph for this function:

◆ exchangeAddressing() [1/2]

void exchangeAddressing ( const int  tag,
const globalIndex globalNumbering,
labelList elements,
List< Map< label > > &  compactMap,
labelList compactStart 
)
protected

Definition at line 489 of file mapDistributeBase.C.

References forAll, forAllIters, Foam::identity(), globalIndex::localSize(), processorFaPatch::myProcNo(), PstreamBuffers::nProcs(), Foam::renumber(), List< T >::setSize(), and UList< T >::size().

Referenced by mapDistribute::mapDistribute(), and mapDistributeBase::mapDistributeBase().

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

◆ exchangeAddressing() [2/2]

void exchangeAddressing ( const int  tag,
const globalIndex globalNumbering,
labelListList elements,
List< Map< label > > &  compactMap,
labelList compactStart 
)
protected

Definition at line 569 of file mapDistributeBase.C.

References forAll, forAllIters, Foam::identity(), globalIndex::localSize(), processorFaPatch::myProcNo(), PstreamBuffers::nProcs(), Foam::renumber(), List< T >::setSize(), and UList< T >::size().

Here is the call graph for this function:

◆ exchangeMasks()

void exchangeMasks ( const UList< bitSet > &  sendMasks,
UList< bitSet > &  recvMasks,
const int  tag,
const label  comm 
)
staticprotected

Synchronize send/recv mask buffers as a 'copy' operation.

Somewhat similar to Pstream::exchangeContainer

The masks must be properly sized by the caller, which avoids a needless all-to-all for the sizes and the sizing is already given by the maps.

Definition at line 119 of file mapDistributeBaseSubset.C.

References Foam::abort(), mapDistributeBase::comm(), Foam::FatalError, FatalErrorInFunction, forAll, processorFaPatch::myProcNo(), Foam::nl, UPstream::nonBlocking, PstreamBuffers::nProcs(), UPstream::nRequests(), UPstream::parRun(), kEpsilonLopesdaCosta< BasicTurbulenceModel >::read(), UList< T >::size(), UPstream::waitRequests(), and ObukhovLength::write().

Here is the call graph for this function:

◆ unionCombineMasks()

void unionCombineMasks ( UList< bitSet > &  sendMasks,
UList< bitSet > &  recvMasks,
const int  tag,
const label  comm 
)
staticprotected

Bi-direction sync of send/recv buffers using bitwise '&=' combine operation.

The masks must be properly sized by the caller, which avoids a needless all-to-all for the sizes and the sizing is already given by the maps.

Definition at line 198 of file mapDistributeBaseSubset.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, processorFaPatch::myProcNo(), Foam::nl, UPstream::parRun(), List< T >::resize(), and UList< T >::size().

Here is the call graph for this function:

◆ flipAndCombine()

void flipAndCombine ( const labelUList map,
const bool  hasFlip,
const UList< T > &  rhs,
const CombineOp &  cop,
const NegateOp &  negOp,
List< T > &  lhs 
)
staticprotected

Definition at line 36 of file mapDistributeBaseTemplates.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, and UList< T >::size().

Here is the call graph for this function:

◆ accessAndFlip() [1/3]

T accessAndFlip ( const UList< T > &  values,
const label  index,
const bool  hasFlip,
const NegateOp &  negOp 
)
staticprotected

Lookup a field value at specified index and return its value after any flip negation operations

Definition at line 81 of file mapDistributeBaseTemplates.C.

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

Here is the call graph for this function:

◆ accessAndFlip() [2/3]

static List< T > accessAndFlip ( const UList< T > &  values,
const labelUList indices,
const bool  hasFlip,
const NegateOp &  negOp 
)
staticprotected

Lookup field values at specified indices and return after any flip negation operations

◆ ClassName()

ClassName ( "mapDistributeBase"  )

◆ hasFlipAddressing() [1/2]

bool hasFlipAddressing ( const labelUList map)
static

Test for flip addressing, where flips are encoded as negative indices and non-flips are encoded as positive non-zero indices.

Exits early on the first detected zero or negative, which makes this more efficient than testing min(map) < 0.

Note
may return a false negative (ie, no flips detected) even when flip addressing is used, but the local map does not contain any flipped elements

Definition at line 46 of file mapDistributeBase.C.

◆ hasFlipAddressing() [2/2]

bool hasFlipAddressing ( const labelListList maps)
static

Test for flip addressing, where flips are encoded as negative indices and non-flips are encoded as positive non-zero indices.

See notes above.

Definition at line 66 of file mapDistributeBase.C.

◆ countUnmapped()

Foam::label countUnmapped ( const labelUList elements,
const labelListList maps,
const bool  hasFlip 
)
static

Count the number of unmapped elements.

Parameters
elementsThe elements that are expected to be mapped
mapsThe maps to scan
hasFlipTrue if maps has flip addressing
Returns
number of unmapped elements

Definition at line 114 of file mapDistributeBase.C.

References bitSet::count(), UList< T >::empty(), Foam::mag(), and bitSet::unset().

Here is the call graph for this function:

◆ constructSize() [1/2]

◆ constructSize() [2/2]

label & constructSize ( )
inlinenoexcept

Constructed data size.

Definition at line 491 of file mapDistributeBase.H.

◆ subMap() [1/2]

const labelListList & subMap ( ) const
inlinenoexcept

From subsetted data back to original data.

Definition at line 497 of file mapDistributeBase.H.

Referenced by AMIInterpolation::agglomerate(), faMeshDistributor::distribute(), refinementHistory::distribute(), mappedPatchFieldBase< Type >::distribute(), distributedTriSurfaceMesh::findNearest(), distributedTriSurfaceMesh::getVolumeType(), extendedCellToFaceStencil::writeStencilStats(), and streamLineBase::writeToFile().

Here is the caller graph for this function:

◆ subMap() [2/2]

labelListList & subMap ( )
inlinenoexcept

From subsetted data back to original data.

Definition at line 503 of file mapDistributeBase.H.

◆ constructMap() [1/2]

const labelListList & constructMap ( ) const
inlinenoexcept

From subsetted data to new reconstructed data.

Definition at line 509 of file mapDistributeBase.H.

Referenced by AMIInterpolation::agglomerate(), faMeshDistributor::distribute(), refinementHistory::distribute(), mappedPatchFieldBase< Type >::distribute(), distributedTriSurfaceMesh::findNearest(), distributedTriSurfaceMesh::getVolumeType(), mappedPatchFieldBase< Type >::mappedPatchFieldBase(), and streamLineBase::writeToFile().

Here is the caller graph for this function:

◆ constructMap() [2/2]

labelListList & constructMap ( )
inlinenoexcept

From subsetted data to new reconstructed data.

Definition at line 515 of file mapDistributeBase.H.

◆ subHasFlip() [1/2]

bool subHasFlip ( ) const
inlinenoexcept

Does subMap include a sign.

Definition at line 521 of file mapDistributeBase.H.

Referenced by faMeshDistributor::distribute(), distributedTriSurfaceMesh::findNearest(), distributedTriSurfaceMesh::getVolumeType(), and fvMeshTools::writeProcAddressing().

Here is the caller graph for this function:

◆ subHasFlip() [2/2]

bool & subHasFlip ( )
inlinenoexcept

Does subMap include a sign.

Definition at line 527 of file mapDistributeBase.H.

◆ constructHasFlip() [1/2]

bool constructHasFlip ( ) const
inlinenoexcept

Does constructMap include a sign.

Definition at line 533 of file mapDistributeBase.H.

Referenced by faMeshDistributor::distribute(), distributedTriSurfaceMesh::findNearest(), distributedTriSurfaceMesh::getVolumeType(), and fvMeshTools::writeProcAddressing().

Here is the caller graph for this function:

◆ constructHasFlip() [2/2]

bool & constructHasFlip ( )
inlinenoexcept

Does constructMap include a sign.

Definition at line 539 of file mapDistributeBase.H.

◆ comm()

label comm ( ) const
inlinenoexcept

The communicator used.

Definition at line 545 of file mapDistributeBase.H.

Referenced by faMeshDistributor::distribute(), mapDistributeBase::exchangeMasks(), distributedTriSurfaceMesh::findNearest(), distributedTriSurfaceMesh::getVolumeType(), and mapDistribute::mapDistribute().

Here is the caller graph for this function:

◆ nMaps()

label nMaps ( ) const
inlinenoexcept

The number of sub-lists within the maps.

Definition at line 551 of file mapDistributeBase.H.

References UList< T >::size().

Here is the call graph for this function:

◆ subMapSizes()

Foam::labelList subMapSizes ( ) const

The sizes of the subMap lists.

Definition at line 975 of file mapDistributeBase.C.

References forAll, and UList< T >::size().

Here is the call graph for this function:

◆ constructMapSizes()

Foam::labelList constructMapSizes ( ) const

The sizes of the constructMap lists.

Definition at line 987 of file mapDistributeBase.C.

References forAll, and UList< T >::size().

Here is the call graph for this function:

◆ schedule() [1/2]

Foam::List< Foam::labelPair > schedule ( const labelListList subMap,
const labelListList constructMap,
const int  tag,
const label  comm = UPstream::worldComm 
)
static

Calculate a communication schedule. See above.

Definition at line 186 of file mapDistributeBase.C.

References List< T >::appendUniq(), Pstream::broadcast(), forAll, HashSet< Key, Hash >::insert(), splitCell::master(), UPstream::masterNo(), processorFaPatch::myProcNo(), PstreamBuffers::nProcs(), UPstream::parRun(), UPstream::scheduled, PstreamBuffers::subProcs(), and HashTable< T, Key, Hash >::toc().

Referenced by streamLineBase::writeToFile().

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

◆ schedule() [2/2]

const Foam::List< Foam::labelPair > & schedule ( ) const

Return a schedule. Demand driven. See above.

Definition at line 280 of file mapDistributeBase.C.

References UPstream::msgType().

Here is the call graph for this function:

◆ whichSchedule()

const Foam::List< Foam::labelPair > & whichSchedule ( const UPstream::commsTypes  commsType) const

Return real or dummy schedule depending on the communication type

Definition at line 297 of file mapDistributeBase.C.

References List< T >::null(), and UPstream::scheduled.

Here is the call graph for this function:

◆ clear()

void clear ( )

Reset to zero size, only retaining communicator.

Definition at line 999 of file mapDistributeBase.C.

Referenced by mapDistribute::clear().

Here is the caller graph for this function:

◆ transfer()

void transfer ( mapDistributeBase rhs)

Transfer the contents of the argument and annul the argument.

Definition at line 1011 of file mapDistributeBase.C.

Referenced by mapDistributeBase::mapDistributeBase().

Here is the caller graph for this function:

◆ renumber()

Foam::label renumber ( const globalIndex globalNumbering,
const List< Map< label > > &  compactMap,
const label  globalElement 
)
static

Helper for construct from globalIndex. Renumbers element.

(in globalIndex numbering) into compact indices.

Definition at line 1033 of file mapDistributeBase.C.

References globalIndex::isLocal(), mapDistributeBase::renumber(), and globalIndex::toLocal().

Referenced by mapDistributeBase::renumber().

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

◆ renumberMap()

Foam::label renumberMap ( labelListList mapElements,
const labelUList oldToNew,
const bool  hasFlip 
)
static

Helper for renumbering the (compacted) map elements using the supplied old-to-new mapping.

Only compacts the maps, does not change the local layout.

Parameters
[in,out]mapElementsThe map to be renumbered
oldToNewThe old-to-new mapping
hasFlipTrue if map has flip addressing
Returns
max-size needed for new addressing (eg, constructSize)

Definition at line 280 of file mapDistributeBaseSubset.C.

References Foam::mag(), and Foam::max().

Referenced by faMeshDistributor::distribute().

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

◆ compactLocalData() [1/3]

void compactLocalData ( const bitSet allowedLocalElems,
const int  tag = UPstream::msgType(),
const bool  doRenumber = false 
)

Compact send/receive maps based on selection of originating local (send) elements.

Determines and removes the correspondingly unneeded elements in the send/receive maps. Only compacts the maps, does not change the local layout.

Parameters
allowedLocalElemsPermissible local mapped elements (true/false). Can be longer/shorter than actual number of mapped elements.
tagThe message tag
doRenumberApply oldToNew internally to renumber entries (uses renumberMap) and adjust the constructSize
Note
generally preferable to compact based on remote data (ie, the actual receiver)

Definition at line 801 of file mapDistributeBaseSubset.C.

Referenced by faMeshDistributor::distribute().

Here is the caller graph for this function:

◆ compactRemoteData() [1/3]

void compactRemoteData ( const bitSet allowedRemoteElems,
const int  tag = UPstream::msgType(),
const bool  doRenumber = false 
)

Compact send/receive maps based on selection of remote (receive) elements.

Determines and removes the correspondingly unneeded elements in the send/receive maps. Only compacts the maps, does not change the local layout.

Parameters
allowedRemoteElemsPermissible remote mapped elements (true/false). Can be longer/shorter than actual number of mapped elements.
tagThe message tag
doRenumberApply oldToNew internally to renumber entries (uses renumberMap) and adjust the constructSize

Definition at line 823 of file mapDistributeBaseSubset.C.

◆ compactLocalData() [2/3]

void compactLocalData ( const bitSet allowedLocalElems,
labelList oldToNewSub,
labelList oldToNewConstruct,
const label  localSize = -1,
const int  tag = UPstream::msgType() 
)

Compact send/receive maps based on selection of originating local (send) elements. Returns compaction mappings for subMap and constructMap.

Parameters
allowedLocalElemsPermissible local mapped elements (true/false). Can be longer/shorter than actual number of mapped elements.
[out]oldToNewSubOld-to-new mapping: subMap Disabled if labelList::null(),
[out]oldToNewConstructOld-to-new mapping: constructMap Disabled if labelList::null(),
localSizeThe max index for subMap (-1: auto-detect)
tagThe message tag
Note
Applies oldToNew to renumber entries (uses renumberMap) and adjust constructSize
generally preferable to compact based on remote data (ie, the actual receiver)

Definition at line 845 of file mapDistributeBaseSubset.C.

◆ compactRemoteData() [2/3]

void compactRemoteData ( const bitSet allowedRemoteElems,
labelList oldToNewSub,
labelList oldToNewConstruct,
const label  localSize = -1,
const int  tag = UPstream::msgType() 
)

Compact send/receive maps based on selection of remote (receive) elements. Returns compaction mappings for subMap and constructMap.

Parameters
allowedRemoteElemsPermissible remote mapped elements (true/false). Can be longer/shorter than actual number of mapped elements.
[out]oldToNewSubOld-to-new mapping: subMap Disabled if labelList::null(),
[out]oldToNewConstructOld-to-new mapping: constructMap Disabled if labelList::null(),
localSizeThe max index for subMap (-1: auto-detect)
tagThe message tag
Note
Applies oldToNew to renumber entries (uses renumberMap) and adjust constructSize

Definition at line 876 of file mapDistributeBaseSubset.C.

◆ compactData()

void compactData ( const labelUList localElements,
const labelUList remoteElements,
labelList oldToNewSub,
labelList oldToNewConstruct,
const label  localSize = -1,
const int  tag = UPstream::msgType() 
)

Compact send/receive maps based on selection of originating local (send) and remote (receive) elements.

The resulting compact numbering:

  • subMap (and oldToNewSub) : will follow the original ordering of localElements.
  • constructMap (and oldToNewConstruct) : will follow the original ordering of remoteElements.
Warning
ill-defined behaviour if localElements or remoteElements contains duplicates.

Definition at line 629 of file mapDistributeBaseSubset.C.

◆ compactLocalData() [3/3]

void compactLocalData ( const labelUList localElements,
labelList oldToNewSub,
labelList oldToNewConstruct,
const label  localSize = -1,
const int  tag = UPstream::msgType() 
)

Compact send/receive maps based on selection of originating local (send) elements.

The resulting compact numbering:

  • subMap (and oldToNewSub) : will follow the original ordering of localElements.
  • constructMap (and oldToNewConstruct) : numbered in simple ascending order.
Warning
ill-defined behaviour if localElements contains duplicates.
Note
generally preferable to compact based on remote data (ie, the actual receiver)

Definition at line 681 of file mapDistributeBaseSubset.C.

◆ compactRemoteData() [3/3]

void compactRemoteData ( const labelUList remoteElements,
labelList oldToNewSub,
labelList oldToNewConstruct,
const label  localSize = -1,
const int  tag = UPstream::msgType() 
)

Compact send/receive maps based on selection of remote (receive) elements.

The resulting compact numbering:

  • subMap (and oldToNewSub) : numbered in simple ascending order.
  • constructMap (and oldToNewConstruct) : will follow the original ordering of remoteElements.
Warning
ill-defined behaviour if remoteElements contains duplicates.

Definition at line 723 of file mapDistributeBaseSubset.C.

◆ distribute() [1/7]

void distribute ( const Pstream::commsTypes  commsType,
const List< labelPair > &  schedule,
const label  constructSize,
const labelListList subMap,
const bool  subHasFlip,
const labelListList constructMap,
const bool  constructHasFlip,
List< T > &  field,
const NegateOp &  negOp,
const int  tag = UPstream::msgType(),
const label  comm = UPstream::worldComm 
)
static

Distribute data with specified negate operator (for flips).

Note
schedule currently only used for Pstream::commsTypes::scheduled, all others just use send-to-all, receive-from-all.

Definition at line 164 of file mapDistributeBaseTemplates.C.

References Foam::abort(), PstreamBuffers::allProcs(), UPstream::blocking, mapDistributeBase::distribute(), Foam::FatalError, FatalErrorInFunction, field(), PstreamBuffers::finishedSends(), processorFaPatch::myProcNo(), UPstream::nonBlocking, PstreamBuffers::nProcs(), UPstream::nRequests(), UPstream::parRun(), kEpsilonLopesdaCosta< BasicTurbulenceModel >::read(), List< T >::resize(), UPstream::scheduled, UList< T >::size(), UPstream::waitRequests(), and ObukhovLength::write().

Referenced by mapDistributeBase::distribute(), Field< T >::negate(), and Field< T >::operator=().

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

◆ distribute() [2/7]

void distribute ( const Pstream::commsTypes  commsType,
const List< labelPair > &  schedule,
const label  constructSize,
const labelListList subMap,
const bool  subHasFlip,
const labelListList constructMap,
const bool  constructHasFlip,
List< T > &  field,
const T nullValue,
const CombineOp &  cop,
const NegateOp &  negOp,
const int  tag = UPstream::msgType(),
const label  comm = UPstream::worldComm 
)
static

Distribute data with specified combine operation.

If multiple processors writing to same position adds contributions using cop.

Definition at line 629 of file mapDistributeBaseTemplates.C.

References Foam::abort(), PstreamBuffers::allProcs(), UPstream::blocking, mapDistributeBase::distribute(), Foam::FatalError, FatalErrorInFunction, field(), PstreamBuffers::finishedSends(), processorFaPatch::myProcNo(), UPstream::nonBlocking, PstreamBuffers::nProcs(), UPstream::nRequests(), UPstream::parRun(), kEpsilonLopesdaCosta< BasicTurbulenceModel >::read(), UPstream::scheduled, List< T >::setSize(), UList< T >::size(), UPstream::waitRequests(), and ObukhovLength::write().

Here is the call graph for this function:

◆ distribute() [3/7]

void distribute ( List< T > &  values,
const int  tag = UPstream::msgType() 
) const

Distribute data using default commsType and the default flip/negate operator.

Definition at line 1227 of file mapDistributeBaseTemplates.C.

References mapDistributeBase::distribute().

Here is the call graph for this function:

◆ distribute() [4/7]

void distribute ( DynamicList< T > &  values,
const int  tag = UPstream::msgType() 
) const

Distribute data using default commsType and the default flip/negate operator.

Definition at line 1238 of file mapDistributeBaseTemplates.C.

References mapDistributeBase::distribute(), and UList< T >::size().

Here is the call graph for this function:

◆ distribute() [5/7]

void distribute ( List< T > &  values,
const NegateOp &  negOp,
const int  tag = UPstream::msgType() 
) const

Distribute data using default commsType and the specified negate operator (for flips).

Definition at line 1212 of file mapDistributeBaseTemplates.C.

References UPstream::defaultCommsType, and mapDistributeBase::distribute().

Here is the call graph for this function:

◆ distribute() [6/7]

void distribute ( const Pstream::commsTypes  commsType,
List< T > &  values,
const NegateOp &  negOp,
const int  tag = UPstream::msgType() 
) const

Distribute data using specified commsType and the specified negate operator (for flips).

Accepts a nullValue to initialize unmapped elements (ie, when the constructSize is larger than the number of mapped elements).

Definition at line 1157 of file mapDistributeBaseTemplates.C.

References mapDistributeBase::distribute().

Here is the call graph for this function:

◆ distribute() [7/7]

void distribute ( const Pstream::commsTypes  commsType,
const T nullValue,
List< T > &  values,
const NegateOp &  negOp,
const int  tag = UPstream::msgType() 
) const

Distribute data using specified commsType and the specified negate operator (for flips).

Accepts a nullValue to initialize unmapped elements (ie, when the constructSize is larger than the number of mapped elements).

Definition at line 1183 of file mapDistributeBaseTemplates.C.

References mapDistributeBase::distribute().

Here is the call graph for this function:

◆ reverseDistribute() [1/5]

void reverseDistribute ( const label  constructSize,
List< T > &  values,
const int  tag = UPstream::msgType() 
) const

Reverse distribute data using default commsType and the default flip/negate operator

Definition at line 1333 of file mapDistributeBaseTemplates.C.

References UPstream::defaultCommsType.

Referenced by faMeshDistributor::distribute(), and mapDistribute::reverseDistribute().

Here is the caller graph for this function:

◆ reverseDistribute() [2/5]

void reverseDistribute ( const label  constructSize,
const T nullValue,
List< T > &  values,
const int  tag = UPstream::msgType() 
) const

Reverse distribute data using default commsType and the default flip/negate operator.

Accepts a nullValue to initialize unmapped elements (ie, when the constructSize is larger than the subMap).

Definition at line 1351 of file mapDistributeBaseTemplates.C.

References UPstream::defaultCommsType.

◆ reverseDistribute() [3/5]

void reverseDistribute ( const Pstream::commsTypes  commsType,
const label  constructSize,
List< T > &  values,
const int  tag = UPstream::msgType() 
) const

Reverse distribute data using specified commsType and the default flip/negate operator

Definition at line 1255 of file mapDistributeBaseTemplates.C.

◆ reverseDistribute() [4/5]

void reverseDistribute ( const Pstream::commsTypes  commsType,
const label  constructSize,
List< T > &  values,
const NegateOp &  negOp,
const int  tag = UPstream::msgType() 
) const

Reverse distribute data using specified commsType and the specified flip/negate operator.

Definition at line 1275 of file mapDistributeBaseTemplates.C.

◆ reverseDistribute() [5/5]

void reverseDistribute ( const Pstream::commsTypes  commsType,
const label  constructSize,
const T nullValue,
List< T > &  values,
const int  tag = UPstream::msgType() 
) const

Reverse distribute data using specified commsType and the default flip/negate operator.

Accepts a nullValue to initialize unmapped elements (ie, when the constructSize is larger than the subMap).

Definition at line 1302 of file mapDistributeBaseTemplates.C.

◆ send()

void send ( PstreamBuffers pBufs,
const List< T > &  field 
) const

Do all sends using PstreamBuffers.

Definition at line 1090 of file mapDistributeBaseTemplates.C.

References PstreamBuffers::allProcs(), field(), PstreamBuffers::finishedSends(), and UList< T >::size().

Here is the call graph for this function:

◆ receive()

void receive ( PstreamBuffers pBufs,
List< T > &  field 
) const

Do all receives using PstreamBuffers.

Definition at line 1118 of file mapDistributeBaseTemplates.C.

References Foam::abort(), PstreamBuffers::allProcs(), Foam::FatalError, FatalErrorInFunction, field(), and UList< T >::size().

Here is the call graph for this function:

◆ printLayout()

void printLayout ( Ostream os) const

Debug: print layout. Can only be used on maps with sorted.

storage (local data first, then non-local data)

Definition at line 311 of file mapDistributeBase.C.

References Foam::endl(), forAll, Foam::labelMax, Foam::labelMin, Foam::mag(), Foam::max(), Foam::min(), processorFaPatch::myProcNo(), Foam::nl, PstreamBuffers::nProcs(), and os().

Referenced by mapDistributeBase::mapDistributeBase(), and mapDistribute::printLayout().

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

◆ operator=() [1/2]

void operator= ( const mapDistributeBase rhs)

Copy assignment.

Definition at line 1059 of file mapDistributeBase.C.

Referenced by mapDistribute::operator=().

Here is the caller graph for this function:

◆ operator=() [2/2]

void operator= ( mapDistributeBase &&  rhs)

Move assignment.

Definition at line 1076 of file mapDistributeBase.C.

◆ info()

InfoProxy< mapDistributeBase > info ( ) const
inline

Info proxy to print summary information to a stream.

Definition at line 973 of file mapDistributeBase.H.

◆ readDict()

void readDict ( const dictionary dict)

Read entries from dictionary format.

Definition at line 100 of file mapDistributeBaseIO.C.

References dict, dictionary::get(), mapDistributeBase::readDict(), dictionary::readEntry(), and dictionary::subDict().

Referenced by mapDistributeBase::readDict().

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

◆ writeEntries()

void writeEntries ( Ostream os) const

Write entries in dictionary format.

Definition at line 122 of file mapDistributeBaseIO.C.

References Ostream::beginBlock(), Ostream::endBlock(), Foam::nl, os(), Ostream::writeEntry(), and Foam::writeMaps().

Referenced by mapDistribute::writeEntries().

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

◆ updateMesh()

void updateMesh ( const mapPolyMesh )
inline

No correction for topo change.

Definition at line 994 of file mapDistributeBase.H.

References NotImplemented.

◆ compact() [1/2]

void compact ( const boolList remoteElemUsed,
const int  tag = UPstream::msgType() 
)

OpenFOAM-v2112 and earlier naming for compactRemoteData() using boolList.

Definition at line 909 of file mapDistributeBaseSubset.C.

◆ compact() [2/2]

void compact ( const boolList remoteElemUsed,
const label  localSize,
labelList oldToNewSub,
labelList oldToNewConstruct,
const int  tag = UPstream::msgType() 
)

OpenFOAM-v2112 and earlier naming for compactRemoteData(). using boolList.

Definition at line 920 of file mapDistributeBaseSubset.C.

◆ accessAndFlip() [3/3]

Foam::List< T > accessAndFlip ( const UList< T > &  values,
const labelUList indices,
const bool  hasFlip,
const NegateOp &  negOp 
)

Definition at line 114 of file mapDistributeBaseTemplates.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::output(), and UList< T >::size().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator>>

Istream & operator>> ( Istream ,
mapDistributeBase  
)
friend

Read plain content (not dictionary) from Istream.

◆ operator<<

Ostream & operator<< ( Ostream ,
const mapDistributeBase  
)
friend

Write plain content (not dictionary) to Ostream.


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