mapDistribute Class Reference

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

Inheritance diagram for mapDistribute:
Collaboration diagram for mapDistribute:

Classes

class  transform
 Default transformation behaviour. More...
 
class  transformPosition
 Default transformation behaviour for position. More...
 

Public Member Functions

 ClassName ("mapDistribute")
 
 mapDistribute () noexcept
 Default construct - uses worldComm. More...
 
 mapDistribute (const label comm) noexcept
 Default construct with specified communicator. More...
 
 mapDistribute (mapDistributeBase &&map)
 Move construct from base, no transforms. More...
 
 mapDistribute (const mapDistribute &map)
 Copy construct. More...
 
 mapDistribute (mapDistribute &&map)
 Move construct. More...
 
 mapDistribute (const dictionary &dict, const label comm=UPstream::worldComm)
 Read construct from dictionary. More...
 
 mapDistribute (const label constructSize, labelListList &&subMap, labelListList &&constructMap, labelListList &&transformElements, labelList &&transformStart, const bool subHasFlip=false, const bool constructHasFlip=false, const label comm=UPstream::worldComm)
 Move construct from components. More...
 
 mapDistribute (const globalIndex &, labelList &untransformedElements, const globalIndexAndTransform &, const labelPairList &transformedElements, labelList &transformedIndices, List< Map< label >> &compactMap, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
 Construct from list of (possibly remote) untransformed elements in globalIndex numbering (or -1) and (possibly remote) transformed elements in globalIndexAndTransform numbering. More...
 
 mapDistribute (const globalIndex &, labelListList &cellCells, const globalIndexAndTransform &, const List< labelPairList > &transformedElements, labelListList &transformedIndices, List< Map< label >> &compactMap, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
 As above but with ListLists. More...
 
 mapDistribute (const UPtrList< const mapDistribute > &maps, const labelList &localRanks, const label newComm, const labelListList &newToOldRanks, labelList &startOfLocal, List< Map< label >> &compactMaps)
 Construct from multiple maps and processor collation. More...
 
 mapDistribute (Istream &is)
 Construct from Istream. More...
 
autoPtr< mapDistributeclone () const
 Clone. More...
 
virtual ~mapDistribute ()=default
 Destructor. More...
 
const labelListListtransformElements () const noexcept
 For every globalIndexAndTransform::transformPermutations gives the elements that need to be transformed. More...
 
const labelListtransformStart () const noexcept
 Destination in constructMap for transformed elements. More...
 
label whichTransform (const label index) const
 Find transform from transformElements. More...
 
void clear ()
 Reset to zero size, only retaining communicator. More...
 
void transfer (mapDistribute &map)
 Transfer the contents of the argument and annul the argument. More...
 
template<class T >
void distribute (List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Distribute List data using default commsType, default flip/negate operator. More...
 
template<class T >
void distribute (DynamicList< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Distribute DynamicList data using default commsType, default flip/negate operator. More...
 
template<class T >
void distribute (const UPstream::commsTypes commsType, List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Distribute List data using specified commsType, default flip/negate operator. More...
 
template<class T >
void distribute (const UPstream::commsTypes commsType, DynamicList< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Distribute DynamicList data using specified commsType, default flip/negate operator. More...
 
template<class T , class NegateOp >
void distribute (List< T > &fld, const NegateOp &negOp, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Distribute List data using default commsType and the specified negate operator (for flips). More...
 
template<class T , class NegateOp >
void distribute (const UPstream::commsTypes commsType, List< T > &fld, const NegateOp &negOp, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Distribute List data using specified commsType and the specified negate operator (for flips). More...
 
template<class T >
void reverseDistribute (const label constructSize, List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Reverse distribute data using default commsType. More...
 
template<class T >
void reverseDistribute (const UPstream::commsTypes commsType, const label constructSize, List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Reverse distribute data using specified commsType. More...
 
template<class T >
void reverseDistribute (const label constructSize, const T &nullValue, List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Reverse distribute data using default commsType. More...
 
template<class T >
void reverseDistribute (const UPstream::commsTypes commsType, const label constructSize, const T &nullValue, List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
 Reverse distribute data using specified commsType. More...
 
template<class T , class TransformOp >
void distribute (const globalIndexAndTransform &, List< T > &fld, const TransformOp &top, const int tag=UPstream::msgType()) const
 Distribute with transforms. More...
 
template<class T , class TransformOp >
void distribute (const UPstream::commsTypes commsType, const globalIndexAndTransform &, List< T > &fld, const TransformOp &top, const int tag=UPstream::msgType()) const
 Distribute with transforms. More...
 
template<class T , class TransformOp >
void reverseDistribute (const globalIndexAndTransform &, const label constructSize, List< T > &fld, const TransformOp &top, const int tag=UPstream::msgType()) const
 Reverse distribute with transforms. More...
 
template<class T , class TransformOp >
void reverseDistribute (const UPstream::commsTypes commsType, const globalIndexAndTransform &, const label constructSize, List< T > &fld, const TransformOp &top, const int tag=UPstream::msgType()) const
 Reverse distribute with transforms. More...
 
template<class T , class TransformOp >
void reverseDistribute (const globalIndexAndTransform &, const label constructSize, const T &nullValue, List< T > &fld, const TransformOp &top, const int tag=UPstream::msgType()) const
 Reverse distribute with transforms. More...
 
template<class T , class TransformOp >
void reverseDistribute (const UPstream::commsTypes commsType, const globalIndexAndTransform &, const label constructSize, const T &nullValue, List< T > &fld, const TransformOp &top, const int tag=UPstream::msgType()) const
 Reverse distribute with transforms. More...
 
void printLayout (Ostream &os) const
 Debug: print layout. Can only be used on maps with sorted. More...
 
void operator= (const mapDistribute &rhs)
 Copy assignment. More...
 
void operator= (mapDistribute &&rhs)
 Move assignment. 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...
 
 mapDistributeBase () noexcept
 Inherit constructors. More...
 
 mapDistributeBase (const label comm) noexcept
 Inherit constructors. More...
 
 mapDistributeBase (const mapDistributeBase &map)
 Inherit constructors. More...
 
 mapDistributeBase (mapDistributeBase &&map)
 Inherit constructors. More...
 
 mapDistributeBase (const dictionary &dict, const label comm=UPstream::worldComm)
 Inherit constructors. More...
 
 mapDistributeBase (const label constructSize, labelListList &&subMap, labelListList &&constructMap, const bool subHasFlip=false, const bool constructHasFlip=false, const label comm=UPstream::worldComm)
 Inherit constructors. More...
 
 mapDistributeBase (const labelUList &sendProcs, const labelUList &recvProcs, const label comm=UPstream::worldComm)
 Inherit constructors. More...
 
 mapDistributeBase (const globalIndex &, labelList &elements, List< Map< label >> &compactMap, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
 Inherit constructors. More...
 
 mapDistributeBase (const globalIndex &, labelListList &cellCells, List< Map< label >> &compactMap, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
 Inherit constructors. More...
 
 mapDistributeBase (const layoutTypes constructLayout, labelListList &&subMap, const bool subHasFlip=false, const bool constructHasFlip=false, const label comm=UPstream::worldComm)
 Inherit constructors. More...
 
 mapDistributeBase (labelListList &&subMap, const bool subHasFlip=false, const bool constructHasFlip=false, const label comm=UPstream::worldComm)
 Inherit constructors. More...
 
 mapDistributeBase (const UPtrList< const mapDistributeBase > &maps, const labelList &localRanks, const label newComm, const labelListList &newToOldRanks, labelList &startOfLocal, List< Map< label >> &compactMaps)
 Inherit constructors. More...
 
 mapDistributeBase (Istream &is)
 Inherit constructors. More...
 
- Public Member Functions inherited from mapDistributeBase
 ClassName ("mapDistributeBase")
 
 mapDistributeBase () noexcept
 Default construct (uses worldComm) More...
 
 mapDistributeBase (const label comm) noexcept
 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)
 Construct from reverse addressing: per data item the send processor and the receive processor. More...
 
 mapDistributeBase (const globalIndex &, labelList &elements, List< Map< label >> &compactMap, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
 Construct from list of (possibly) remote elements in globalIndex numbering (or -1). More...
 
 mapDistributeBase (const globalIndex &, labelListList &cellCells, List< Map< label >> &compactMap, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
 Special variant that works with the info sorted into bins according to local indices. More...
 
 mapDistributeBase (const layoutTypes constructLayout, labelListList &&subMap, const bool subHasFlip=false, const bool constructHasFlip=false, const label comm=UPstream::worldComm)
 Construct from my elements to send, targetting the specified constructMap layout. More...
 
 mapDistributeBase (labelListList &&subMap, const bool subHasFlip=false, const bool constructHasFlip=false, const label comm=UPstream::worldComm)
 Construct from my elements to send. More...
 
 mapDistributeBase (const UPtrList< const mapDistributeBase > &maps, const labelList &localRanks, const label newComm, const labelListList &newToOldRanks, labelList &startOfLocal, List< Map< label >> &compactMaps)
 Construct from multiple maps and processor collation. 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...
 
bool & subHasFlip () noexcept
 Does subMap include a sign. More...
 
bool constructHasFlip () const noexcept
 Does constructMap include a sign. More...
 
bool & constructHasFlip () 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...
 
label subMapTotalSize () const noexcept
 The sum of the subMap list sizes. More...
 
label constructMapTotalSize () const noexcept
 The sum of the constructMap list sizes. More...
 
const List< labelPair > & schedule () const
 Return a schedule. Demand driven. See above. More...
 
const List< labelPair > & whichSchedule (const UPstream::commsTypes commsType) const
 Return real or dummy schedule depending on the communication type. More...
 
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)
 Compact send/receive maps based on selection of originating local (send) elements. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
template<class T >
void distribute (List< T > &values, const int tag=UPstream::msgType()) const
 Distribute List data using default commsType and the default flip/negate operator. More...
 
template<class T >
void distribute (DynamicList< T > &values, const int tag=UPstream::msgType()) const
 Distribute DynamicList data using default commsType and the default flip/negate operator. More...
 
template<class T >
void distribute (const UPstream::commsTypes commsType, List< T > &values, const int tag=UPstream::msgType()) const
 Distribute List data using specified commsType and the default flip/negate operator. More...
 
template<class T >
void distribute (const UPstream::commsTypes commsType, DynamicList< T > &values, const int tag=UPstream::msgType()) const
 Distribute DynamicList data using specified commsType and the default flip/negate operator. More...
 
template<class T , class NegateOp >
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). More...
 
template<class T , class NegateOp >
void distribute (const UPstream::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). More...
 
template<class T , class NegateOp >
void distribute (const UPstream::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). More...
 
template<class T >
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. More...
 
template<class T >
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. More...
 
template<class T >
void reverseDistribute (const UPstream::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. More...
 
template<class T , class NegateOp >
void reverseDistribute (const UPstream::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. More...
 
template<class T >
void reverseDistribute (const UPstream::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. More...
 
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...
 
template<class T >
void send (const UList< T > &field, labelRange &sendRequests, PtrList< List< T >> &sendFields, labelRange &recvRequests, PtrList< List< T >> &recvFields, const int tag=UPstream::msgType()) const
 Start all sends and receives (always non-blocking) More...
 
template<class T >
void receive (const labelRange &requests, const UPtrList< List< T >> &recvFields, List< T > &field, const int tag=UPstream::msgType()) const
 Wait for (receive) requests to finish and consume. 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 noexcept
 Return info proxy, used 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())
 OpenFOAM-v2112 and earlier naming for compactRemoteData() using boolList. More...
 
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. More...
 
template<class T , class NegateOp >
Foam::List< TaccessAndFlip (const UList< T > &values, const labelUList &map, const bool hasFlip, const NegateOp &negOp)
 

Friends

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

Additional Inherited Members

- Public Types inherited from mapDistributeBase
enum  layoutTypes : char { linear, localFirst }
 The map layout (eg, of the constructMap) More...
 
- Static Public Member Functions inherited from mapDistributeBase
static bool hasFlipAddressing (const labelUList &map)
 Test for flip addressing, where flips are encoded as negative indices and non-flips are encoded as positive non-zero indices. More...
 
static bool hasFlipAddressing (const labelListList &maps)
 Test for flip addressing, where flips are encoded as negative indices and non-flips are encoded as positive non-zero indices. More...
 
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 label comm, 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)
 Helper for renumbering the (compacted) map elements using the supplied old-to-new mapping. More...
 
static label renumberMap (labelList &map, const label localSize, const label offset, const Map< label > &cMap, const bool hasFlip)
 Helper for renumbering the map elements. Assumes local elements are first, followed by any remote. Local elements get offset, remote elements are mapped. More...
 
static label renumberMap (labelListList &mapElements, const label localSize, const label offset, const Map< label > &cMap, const bool hasFlip)
 Helper for a list of maps. Calls above renumberMap for all elements. More...
 
template<class T , class CombineOp , class NegateOp >
static void distribute (const UPstream::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 combine data with specified combine operation and negate operator (for flips). More...
 
template<class T , class NegateOp >
static void distribute (const UPstream::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 assign data with specified negate operator (for flips). Uses assignment for combine operation. More...
 
template<class T , class negateOp >
static void send (const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, const UList< T > &field, labelRange &sendRequests, PtrList< List< T >> &sendFields, labelRange &recvRequests, PtrList< List< T >> &recvFields, const negateOp &negOp, const int tag, const label comm)
 Start all sends and receives (always non-blocking) More...
 
template<class T , class CombineOp , class negateOp >
static void receive (const label constructSize, const labelListList &constructMap, const bool constructHasFlip, const labelRange &requests, const UPtrList< List< T >> &recvFields, List< T > &field, const CombineOp &cop, const negateOp &negOp, const int tag, const label comm)
 Wait for (receive) requests to finish and consume. More...
 
- Protected Member Functions inherited from mapDistributeBase
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 inherited from mapDistributeBase
static void checkReceivedSize (const label proci, const label expectedSize, const label receivedSize)
 Fatal if expected != received size. 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)
 Bi-direction sync of send/recv buffers using bitwise '&=' combine operation. More...
 
template<class T , class CombineOp , class NegateOp >
static void flipAndCombine (List< T > &lhs, const UList< T > &rhs, const labelUList &map, const bool hasFlip, const CombineOp &cop, const NegateOp &negOp)
 Combine field values (after any flip negation operation) into the specified mapped target locations. More...
 
template<class T , class NegateOp >
static void accessAndFlip (List< T > &output, const UList< T > &values, const labelUList &map, const bool hasFlip, const NegateOp &negOp)
 Lookup field values at specified map indices and save after any flip negation operations. More...
 
template<class T , class NegateOp >
static List< TaccessAndFlip (const UList< T > &values, const labelUList &map, const bool hasFlip, const NegateOp &negOp)
 Lookup field values at specified indices and return after any flip negation operations. 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.

  • 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 mapDistribute 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.

  • with transforms: This requires the precalculated set of possible transforms (globalIndexAndTransform). These are given as permutations (+, -, or none) of up to 3 independent transforms. The layout of the data is
  • all my own elements first (whether used or not)
  • followed by used-only remote elements sorted by remote processor.
  • followed by - for each transformation index - the set of local or remote elements with that transformation. The inputs for the constructor are
  • the set of untransformed local or remote indices in globalIndex numbering. These get rewritten to be indices into the layout of the data.
  • the set of transformed local or remote indices in globalIndexAndTransform encoding. These are labelPairs.

Any distribute with transforms is now done as: 1. exchange data with other processors and receive these into the slots for that processor 2. for all transformations transform a subset of the data according to transformElements_[transformI] and store this starting from transformStart_[transformI]

In the same way a reverse distribute will 1. apply the inverse transform to the data starting at transformStart_[transformI] and copy the result back into the transformElements_[transformI]. These might be local or remote slots. 2. the data in the remote slots will now be sent back to the correct location in the originating processor.

E.g. a map to handle

  • mesh points on a mesh with
  • 1 cyclic so 3 permutations (+,-,none) will have layout
  • on e.g. processor 1 out of 2:

    +——+ <- transformStart[2] | | | | <- transform2 applied to data in local or remote slots | | +——+ <- transformStart[1] | | | | <- transform1 applied to data in local or remote slots | | +——+ <- transformStart[1] | | | | <- transform0 applied to data in local or remote slots | | +——+ <- transformStart[0] | | | | <- data from proc2 | | +——+ | | | | <- data from proc0 | | +——+ <- mesh.nPoints() | | | | | | +——+ 0

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 156 of file mapDistribute.H.

Constructor & Destructor Documentation

◆ mapDistribute() [1/11]

mapDistribute ( )
noexcept

Default construct - uses worldComm.

Definition at line 159 of file mapDistribute.C.

◆ mapDistribute() [2/11]

mapDistribute ( const label  comm)
explicitnoexcept

Default construct with specified communicator.

Definition at line 165 of file mapDistribute.C.

◆ mapDistribute() [3/11]

mapDistribute ( mapDistributeBase &&  map)
explicit

Move construct from base, no transforms.

Definition at line 171 of file mapDistribute.C.

◆ mapDistribute() [4/11]

mapDistribute ( const mapDistribute map)
explicit

Copy construct.

Definition at line 177 of file mapDistribute.C.

◆ mapDistribute() [5/11]

mapDistribute ( mapDistribute &&  map)
explicit

Move construct.

Definition at line 185 of file mapDistribute.C.

References mapDistribute::transfer().

Here is the call graph for this function:

◆ mapDistribute() [6/11]

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

Read construct from dictionary.

Definition at line 26 of file mapDistributeIO.C.

References dict, and mapDistribute::readDict().

Here is the call graph for this function:

◆ mapDistribute() [7/11]

mapDistribute ( const label  constructSize,
labelListList &&  subMap,
labelListList &&  constructMap,
labelListList &&  transformElements,
labelList &&  transformStart,
const bool  subHasFlip = false,
const bool  constructHasFlip = false,
const label  comm = UPstream::worldComm 
)

Move construct from components.

Definition at line 194 of file mapDistribute.C.

◆ mapDistribute() [8/11]

mapDistribute ( const globalIndex globalNumbering,
labelList untransformedElements,
const globalIndexAndTransform globalTransforms,
const labelPairList transformedElements,
labelList transformedIndices,
List< Map< label >> &  compactMap,
const int  tag = UPstream::msgType(),
const label  comm = UPstream::worldComm 
)

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

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 220 of file mapDistribute.C.

References Foam::BitOps::count(), Foam::ensightOutput::debug, forAll, globalIndexAndTransform::index(), UPstream::myProcNo(), n, Foam::Pout, globalIndexAndTransform::processor(), List< T >::resize_nocopy(), globalIndexAndTransform::transformIndex(), globalIndexAndTransform::transformPermutations(), and Foam::Zero.

Here is the call graph for this function:

◆ mapDistribute() [9/11]

mapDistribute ( const globalIndex globalNumbering,
labelListList cellCells,
const globalIndexAndTransform globalTransforms,
const List< labelPairList > &  transformedElements,
labelListList transformedIndices,
List< Map< label >> &  compactMap,
const int  tag = UPstream::msgType(),
const label  comm = UPstream::worldComm 
)

◆ mapDistribute() [10/11]

mapDistribute ( const UPtrList< const mapDistribute > &  maps,
const labelList localRanks,
const label  newComm,
const labelListList newToOldRanks,
labelList startOfLocal,
List< Map< label >> &  compactMaps 
)

Construct from multiple maps and processor collation.

Assumes all local data first. Sorts contributions of maps in processor order i.e. constructed map has all local data first. Returns

  • startOfLocal : per input map the start of the local data. Extends one beyond number of maps so overall local size is startOfLocal.last()
  • compactMaps : per input map from slot position in the input map to new slot position. (note there is no information returned about which processor it is from)

Definition at line 445 of file mapDistribute.C.

◆ mapDistribute() [11/11]

mapDistribute ( Istream is)
explicit

Construct from Istream.

Definition at line 34 of file mapDistributeIO.C.

◆ ~mapDistribute()

virtual ~mapDistribute ( )
virtualdefault

Destructor.

Member Function Documentation

◆ ClassName()

ClassName ( "mapDistribute"  )

◆ clone()

Foam::autoPtr< Foam::mapDistribute > clone ( ) const

Clone.

Definition at line 470 of file mapDistribute.C.

References autoPtr< T >::New().

Here is the call graph for this function:

◆ transformElements()

const labelListList& transformElements ( ) const
inlinenoexcept

For every globalIndexAndTransform::transformPermutations gives the elements that need to be transformed.

Definition at line 487 of file mapDistribute.H.

◆ transformStart()

const labelList& transformStart ( ) const
inlinenoexcept

Destination in constructMap for transformed elements.

Definition at line 495 of file mapDistribute.H.

◆ whichTransform()

Foam::label whichTransform ( const label  index) const

Find transform from transformElements.

Definition at line 478 of file mapDistribute.C.

References Foam::findLower().

Here is the call graph for this function:

◆ clear()

void clear ( )

Reset to zero size, only retaining communicator.

Definition at line 484 of file mapDistribute.C.

References mapDistributeBase::clear().

Here is the call graph for this function:

◆ transfer()

void transfer ( mapDistribute map)

Transfer the contents of the argument and annul the argument.

Definition at line 492 of file mapDistribute.C.

References mapDistributeBase::transfer().

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

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

◆ distribute() [1/8]

void distribute ( List< T > &  fld,
const bool  dummyTransform = true,
const int  tag = UPstream::msgType() 
) const

◆ distribute() [2/8]

void distribute ( DynamicList< T > &  fld,
const bool  dummyTransform = true,
const int  tag = UPstream::msgType() 
) const

Distribute DynamicList data using default commsType, default flip/negate operator.

Definition at line 203 of file mapDistributeTemplates.C.

References UPstream::defaultCommsType, and fld.

◆ distribute() [3/8]

void distribute ( const UPstream::commsTypes  commsType,
List< T > &  fld,
const bool  dummyTransform = true,
const int  tag = UPstream::msgType() 
) const

Distribute List data using specified commsType, default flip/negate operator.

Definition at line 159 of file mapDistributeTemplates.C.

References fld.

◆ distribute() [4/8]

void distribute ( const UPstream::commsTypes  commsType,
DynamicList< T > &  fld,
const bool  dummyTransform = true,
const int  tag = UPstream::msgType() 
) const

Distribute DynamicList data using specified commsType, default flip/negate operator.

Definition at line 184 of file mapDistributeTemplates.C.

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

Here is the call graph for this function:

◆ distribute() [5/8]

void distribute ( List< T > &  fld,
const NegateOp &  negOp,
const bool  dummyTransform = true,
const int  tag = UPstream::msgType() 
) const

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

Definition at line 146 of file mapDistributeTemplates.C.

References UPstream::defaultCommsType, and fld.

◆ distribute() [6/8]

void distribute ( const UPstream::commsTypes  commsType,
List< T > &  fld,
const NegateOp &  negOp,
const bool  dummyTransform = true,
const int  tag = UPstream::msgType() 
) const

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

Fill in transformed slots with copies

Definition at line 124 of file mapDistributeTemplates.C.

References mapDistributeBase::distribute(), and fld.

Here is the call graph for this function:

◆ reverseDistribute() [1/8]

◆ reverseDistribute() [2/8]

void reverseDistribute ( const UPstream::commsTypes  commsType,
const label  constructSize,
List< T > &  fld,
const bool  dummyTransform = true,
const int  tag = UPstream::msgType() 
) const

Reverse distribute data using specified commsType.

Definition at line 215 of file mapDistributeTemplates.C.

References fld, and mapDistributeBase::reverseDistribute().

Here is the call graph for this function:

◆ reverseDistribute() [3/8]

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

Reverse distribute data using default commsType.

Since constructSize might be larger than supplied size supply a nullValue

Definition at line 281 of file mapDistributeTemplates.C.

References UPstream::defaultCommsType, and fld.

◆ reverseDistribute() [4/8]

void reverseDistribute ( const UPstream::commsTypes  commsType,
const label  constructSize,
const T nullValue,
List< T > &  fld,
const bool  dummyTransform = true,
const int  tag = UPstream::msgType() 
) const

Reverse distribute data using specified commsType.

Since constructSize might be larger than supplied size supply a nullValue

Definition at line 254 of file mapDistributeTemplates.C.

References fld, and mapDistributeBase::reverseDistribute().

Here is the call graph for this function:

◆ distribute() [7/8]

void distribute ( const globalIndexAndTransform git,
List< T > &  fld,
const TransformOp &  top,
const int  tag = UPstream::msgType() 
) const

Distribute with transforms.

Definition at line 321 of file mapDistributeTemplates.C.

References UPstream::defaultCommsType, and fld.

◆ distribute() [8/8]

void distribute ( const UPstream::commsTypes  commsType,
const globalIndexAndTransform git,
List< T > &  fld,
const TransformOp &  top,
const int  tag = UPstream::msgType() 
) const

Distribute with transforms.

Definition at line 303 of file mapDistributeTemplates.C.

References fld.

◆ reverseDistribute() [5/8]

void reverseDistribute ( const globalIndexAndTransform git,
const label  constructSize,
List< T > &  fld,
const TransformOp &  top,
const int  tag = UPstream::msgType() 
) const

Reverse distribute with transforms.

Definition at line 356 of file mapDistributeTemplates.C.

References fld.

◆ reverseDistribute() [6/8]

void reverseDistribute ( const UPstream::commsTypes  commsType,
const globalIndexAndTransform git,
const label  constructSize,
List< T > &  fld,
const TransformOp &  top,
const int  tag = UPstream::msgType() 
) const

Reverse distribute with transforms.

Definition at line 335 of file mapDistributeTemplates.C.

References fld.

◆ reverseDistribute() [7/8]

void reverseDistribute ( const globalIndexAndTransform git,
const label  constructSize,
const T nullValue,
List< T > &  fld,
const TransformOp &  top,
const int  tag = UPstream::msgType() 
) const

Reverse distribute with transforms.

Definition at line 406 of file mapDistributeTemplates.C.

References UPstream::defaultCommsType, and fld.

◆ reverseDistribute() [8/8]

void reverseDistribute ( const UPstream::commsTypes  commsType,
const globalIndexAndTransform git,
const label  constructSize,
const T nullValue,
List< T > &  fld,
const TransformOp &  top,
const int  tag = UPstream::msgType() 
) const

Reverse distribute with transforms.

Definition at line 376 of file mapDistributeTemplates.C.

References fld.

◆ 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 126 of file mapDistribute.C.

References Foam::endl(), forAll, Foam::nl, os(), mapDistributeBase::printLayout(), and UList< T >::size().

Here is the call graph for this function:

◆ operator=() [1/2]

void operator= ( const mapDistribute rhs)

Copy assignment.

Definition at line 507 of file mapDistribute.C.

References mapDistributeBase::operator=().

Referenced by IOmapDistribute::IOmapDistribute().

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

◆ operator=() [2/2]

void operator= ( mapDistribute &&  rhs)

Move assignment.

Definition at line 520 of file mapDistribute.C.

◆ readDict()

void readDict ( const dictionary dict)

Read entries from dictionary format.

Definition at line 42 of file mapDistributeIO.C.

References dict, dictionary::findDict(), mapDistributeBase::readDict(), and dictionary::readIfPresent().

Referenced by mapDistribute::mapDistribute().

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 62 of file mapDistributeIO.C.

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

Here is the call graph for this function:

◆ updateMesh()

void updateMesh ( const mapPolyMesh )
inline

No correction for topo change.

Definition at line 784 of file mapDistribute.H.

References NotImplemented.

◆ mapDistributeBase() [1/13]

Inherit constructors.

Definition at line 645 of file mapDistributeBase.C.

◆ mapDistributeBase() [2/13]

mapDistributeBase
explicitnoexcept

Inherit constructors.

Definition at line 651 of file mapDistributeBase.C.

◆ mapDistributeBase() [3/13]

Inherit constructors.

Definition at line 663 of file mapDistributeBase.C.

◆ mapDistributeBase() [4/13]

Inherit constructors.

Definition at line 675 of file mapDistributeBase.C.

◆ mapDistributeBase() [5/13]

Inherit constructors.

Definition at line 75 of file mapDistributeBaseIO.C.

◆ mapDistributeBase() [6/13]

Inherit constructors.

Definition at line 684 of file mapDistributeBase.C.

◆ mapDistributeBase() [7/13]

Inherit constructors.

Definition at line 704 of file mapDistributeBase.C.

◆ mapDistributeBase() [8/13]

Inherit constructors.

Definition at line 789 of file mapDistributeBase.C.

◆ mapDistributeBase() [9/13]

Inherit constructors.

Definition at line 852 of file mapDistributeBase.C.

◆ mapDistributeBase() [10/13]

Inherit constructors.

Definition at line 915 of file mapDistributeBase.C.

◆ mapDistributeBase() [11/13]

Inherit constructors.

Definition at line 981 of file mapDistributeBase.C.

◆ mapDistributeBase() [12/13]

Inherit constructors.

Definition at line 1000 of file mapDistributeBase.C.

◆ mapDistributeBase() [13/13]

Inherit constructors.

Definition at line 86 of file mapDistributeBaseIO.C.

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream ,
mapDistribute  
)
friend

Read plain content (not dictionary) from Istream.

◆ operator<<

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

Write plain content (not dictionary) to Ostream.


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