Class containing processor-to-processor mapping information. More...
Public Types | |
enum | layoutTypes : char { linear, localFirst } |
The map layout (eg, of the constructMap) More... | |
Public Member Functions | |
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 labelListList & | subMap () const noexcept |
From subsetted data back to original data. More... | |
labelListList & | subMap () noexcept |
From subsetted data back to original data. More... | |
const labelListList & | constructMap () const noexcept |
From subsetted data to new reconstructed data. More... | |
labelListList & | constructMap () 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< mapDistributeBase > | info () 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< T > | accessAndFlip (const UList< T > &values, const labelUList &map, const bool hasFlip, const NegateOp &negOp) |
Static Public Member Functions | |
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< labelPair > | schedule (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 | |
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 != 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< T > | accessAndFlip (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... | |
Friends | |
Istream & | operator>> (Istream &, mapDistributeBase &) |
Read plain content (not dictionary) from Istream. More... | |
Ostream & | operator<< (Ostream &, const mapDistributeBase &) |
Write plain content (not dictionary) to Ostream. More... | |
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
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)
Definition at line 103 of file mapDistributeBase.H.
|
strong |
The map layout (eg, of the constructMap)
Enumerator | |
---|---|
linear | In processor-order. |
localFirst | Local processor first, others in linear order. |
Definition at line 110 of file mapDistributeBase.H.
|
noexcept |
Default construct (uses worldComm)
Definition at line 630 of file mapDistributeBase.C.
|
explicitnoexcept |
Default construct with specified communicator.
Definition at line 636 of file mapDistributeBase.C.
mapDistributeBase | ( | const mapDistributeBase & | map | ) |
Copy construct.
Definition at line 648 of file mapDistributeBase.C.
mapDistributeBase | ( | mapDistributeBase && | map | ) |
Move construct.
Definition at line 660 of file mapDistributeBase.C.
References mapDistributeBase::transfer().
|
explicit |
Read construct from dictionary.
Definition at line 75 of file mapDistributeBaseIO.C.
References dict.
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 669 of file mapDistributeBase.C.
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.
Definition at line 689 of file mapDistributeBase.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, UPstream::myProcNo(), UPstream::nProcs(), List< T >::setSize(), UList< T >::size(), and Foam::Zero.
mapDistributeBase | ( | const globalIndex & | globalNumbering, |
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).
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 774 of file mapDistributeBase.C.
References Foam::ensightOutput::debug, and Foam::Pout.
mapDistributeBase | ( | const globalIndex & | globalNumbering, |
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.
E.g. think cellCells where cellCells[localCellI] is a list of global cells
Definition at line 837 of file mapDistributeBase.C.
References Foam::ensightOutput::debug, and Foam::Pout.
|
explicit |
Construct from my elements to send, targetting the specified constructMap layout.
Definition at line 900 of file mapDistributeBase.C.
References Pstream::exchangeSizes(), forAll, Foam::identity(), UPstream::myProcNo(), and UPstream::nProcs().
|
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 966 of file mapDistributeBase.C.
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.
Assumes all local data first. Sorts contributions of maps in processor order i.e. constructed map has all local data first. Returns
Definition at line 985 of file mapDistributeBase.C.
References UPtrList< T >::empty(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, UList< T >::find(), Foam::flatOutput(), forAll, Foam::labelMax, UList< T >::last(), Foam::mag(), Foam::min(), UPstream::myProcNo(), UPstream::nProcs(), List< T >::resize_nocopy(), List< T >::setSize(), UList< T >::size(), and UPtrList< T >::size().
|
explicit |
Construct from Istream.
Definition at line 86 of file mapDistributeBaseIO.C.
|
staticprotected |
Fatal if expected != received size.
Definition at line 160 of file mapDistributeBase.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.
|
staticprotected |
Scan the maps for the max addressed index.
maps | The maps to scan |
hasFlip | True if maps has flip addressing |
Definition at line 83 of file mapDistributeBase.C.
References Foam::mag(), and Foam::max().
|
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 366 of file mapDistributeBase.C.
References forAll, globalIndex::isLocal(), UPstream::myProcNo(), UPstream::nProcs(), List< T >::resize_nocopy(), globalIndex::toLocal(), globalIndex::whichProcID(), and Foam::Zero.
|
protected |
Definition at line 413 of file mapDistributeBase.C.
References forAll, globalIndex::isLocal(), UPstream::myProcNo(), UPstream::nProcs(), List< T >::resize_nocopy(), globalIndex::toLocal(), globalIndex::whichProcID(), and Foam::Zero.
|
protected |
Definition at line 466 of file mapDistributeBase.C.
References forAll, forAllIters, Foam::identity(), globalIndex::localSize(), UPstream::myProcNo(), UPstream::nProcs(), Foam::renumber(), List< T >::setSize(), and UList< T >::size().
|
protected |
Definition at line 546 of file mapDistributeBase.C.
References forAll, forAllIters, Foam::identity(), globalIndex::localSize(), UPstream::myProcNo(), UPstream::nProcs(), Foam::renumber(), List< T >::setSize(), and UList< T >::size().
|
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 113 of file mapDistributeBaseSubset.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::nl, Foam::blockMeshTools::read(), UList< T >::size(), and Foam::vtk::write().
|
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 192 of file mapDistributeBaseSubset.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::nl, and UList< T >::size().
|
staticprotected |
Combine field values (after any flip negation operation) into the specified mapped target locations.
[in,out] | lhs | The left of binary combine operation |
rhs | The right of binary combine operation | |
map | The mapping indices | |
hasFlip | Mapping indices include flip encoding | |
cop | Binary combine operation | |
negOp | Unary negation operation (for flipped indices) |
Definition at line 30 of file mapDistributeBaseTemplates.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::nl, and UList< T >::size().
|
staticprotected |
Lookup field values at specified map indices and save after any flip negation operations.
[out] | output | The result values |
[out] | values | The input values |
map | The mapping indices | |
hasFlip | Mapping indices include flip encoding | |
negOp | Unary negation operation (for flipped indices) |
Definition at line 77 of file mapDistributeBaseTemplates.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::nl, Foam::output(), UList< T >::size(), and Foam::HashTableOps::values().
|
staticprotected |
Lookup field values at specified indices and return after any flip negation operations.
[out] | values | The input values |
map | The mapping indices | |
hasFlip | Mapping indices include flip encoding | |
negOp | Unary negation operation (for flipped indices) |
ClassName | ( | "mapDistributeBase" | ) |
|
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.
Definition at line 39 of file mapDistributeBase.C.
|
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 59 of file mapDistributeBase.C.
|
static |
Count the number of unmapped elements.
elements | The elements that are expected to be mapped |
maps | The maps to scan |
hasFlip | True if maps has flip addressing |
Definition at line 108 of file mapDistributeBase.C.
References bitSet::count(), UList< T >::empty(), Foam::mag(), and bitSet::unset().
|
inlinenoexcept |
Constructed data size.
Definition at line 641 of file mapDistributeBase.H.
Referenced by AMIInterpolation::agglomerate(), extendedFaceToCellStencil::collectData(), extendedCellToFaceStencil::collectData(), meshRefinement::countEdgeFaces(), mappedPatchFieldBase< scalar >::distribute(), PatchTools::edgeNormals(), globalIndexAndTransform::globalIndexAndTransform(), globalMeshData::mergePoints(), PatchTools::pointNormals(), volPointInterpolationAdjoint::pushUntransformedData(), DistributedFieldMapper< DirectFieldMapperType >::size(), distributedWeightedFvPatchFieldMapper::size(), syncTools::syncEdgeList(), syncTools::syncPointList(), pointConstraints::syncUntransformedData(), and faMeshTools::writeProcAddressing().
|
inlinenoexcept |
Constructed data size.
Definition at line 649 of file mapDistributeBase.H.
|
inlinenoexcept |
From subsetted data back to original data.
Definition at line 657 of file mapDistributeBase.H.
Referenced by AMIInterpolation::agglomerate(), faMeshDistributor::distribute(), mappedPatchFieldBase< scalar >::distribute(), refinementHistory::distribute(), distributedTriSurfaceMesh::findNearest(), distributedTriSurfaceMesh::getVolumeType(), and extendedCellToFaceStencil::writeStencilStats().
|
inlinenoexcept |
From subsetted data back to original data.
Definition at line 665 of file mapDistributeBase.H.
|
inlinenoexcept |
From subsetted data to new reconstructed data.
Definition at line 673 of file mapDistributeBase.H.
Referenced by AMIInterpolation::agglomerate(), mappedPatchFieldBase< scalar >::distribute(), refinementHistory::distribute(), distributedTriSurfaceMesh::findNearest(), and distributedTriSurfaceMesh::getVolumeType().
|
inlinenoexcept |
From subsetted data to new reconstructed data.
Definition at line 681 of file mapDistributeBase.H.
|
inlinenoexcept |
Does subMap include a sign.
Definition at line 689 of file mapDistributeBase.H.
Referenced by distributedTriSurfaceMesh::findNearest(), distributedTriSurfaceMesh::getVolumeType(), and fvMeshTools::writeProcAddressing().
|
inlinenoexcept |
Does subMap include a sign.
Definition at line 697 of file mapDistributeBase.H.
|
inlinenoexcept |
Does constructMap include a sign.
Definition at line 705 of file mapDistributeBase.H.
Referenced by distributedTriSurfaceMesh::findNearest(), distributedTriSurfaceMesh::getVolumeType(), and fvMeshTools::writeProcAddressing().
|
inlinenoexcept |
Does constructMap include a sign.
Definition at line 713 of file mapDistributeBase.H.
|
inlinenoexcept |
The communicator used.
Definition at line 721 of file mapDistributeBase.H.
Referenced by distributedTriSurfaceMesh::findNearest(), and distributedTriSurfaceMesh::getVolumeType().
|
inlinenoexcept |
The number of sub-lists within the maps.
Definition at line 729 of file mapDistributeBase.H.
References UList< T >::size().
Foam::labelList subMapSizes | ( | ) | const |
The sizes of the subMap lists.
Definition at line 1432 of file mapDistributeBase.C.
References forAll.
Foam::labelList constructMapSizes | ( | ) | const |
The sizes of the constructMap lists.
Definition at line 1443 of file mapDistributeBase.C.
References forAll.
|
noexcept |
The sum of the subMap list sizes.
Definition at line 1454 of file mapDistributeBase.C.
|
noexcept |
The sum of the constructMap list sizes.
Definition at line 1465 of file mapDistributeBase.C.
|
static |
Calculate a communication schedule. See above.
Definition at line 180 of file mapDistributeBase.C.
References Pstream::broadcast(), forAll, HashSet< Key, Hash >::insert(), UPstream::master(), UPstream::masterNo(), UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), List< T >::push_uniq(), IPstream::recv(), UOPstream::send(), UPstream::subProcs(), and HashTable< T, Key, Hash >::toc().
const Foam::List< Foam::labelPair > & schedule | ( | ) | const |
Return a schedule. Demand driven. See above.
Definition at line 258 of file mapDistributeBase.C.
References UPstream::msgType().
const Foam::List< Foam::labelPair > & whichSchedule | ( | const UPstream::commsTypes | commsType | ) | const |
Return real or dummy schedule depending on the communication type.
Definition at line 276 of file mapDistributeBase.C.
References List< T >::null(), and UPstream::scheduled.
void clear | ( | ) |
Reset to zero size, only retaining communicator.
Definition at line 1476 of file mapDistributeBase.C.
Referenced by mapDistribute::clear().
void transfer | ( | mapDistributeBase & | rhs | ) |
Transfer the contents of the argument and annul the argument.
Definition at line 1488 of file mapDistributeBase.C.
Referenced by mapDistributeBase::mapDistributeBase(), and mapDistribute::transfer().
|
static |
Helper for construct from globalIndex. Renumbers element.
(in globalIndex numbering) into compact indices.
Definition at line 1511 of file mapDistributeBase.C.
References globalIndex::isLocal(), UPstream::myProcNo(), globalIndex::toLocal(), and globalIndex::whichProcID().
|
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.
[in,out] | mapElements | The map to be renumbered |
oldToNew | The old-to-new mapping | |
hasFlip | True if map has flip addressing |
Definition at line 274 of file mapDistributeBaseSubset.C.
References Foam::mag(), and Foam::max().
|
static |
Helper for renumbering the map elements. Assumes local elements are first, followed by any remote. Local elements get offset, remote elements are mapped.
[in,out] | map | The map to be renumbered |
localSize | elements < localSize are offset | |
offset | offset | |
cMap | map for non-local elements | |
hasFlip | True if map has flip addressing |
Definition at line 326 of file mapDistributeBaseSubset.C.
References Foam::mag(), and Foam::max().
|
static |
Helper for a list of maps. Calls above renumberMap for all elements.
Definition at line 392 of file mapDistributeBaseSubset.C.
References Foam::max().
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.
allowedLocalElems | Permissible local mapped elements (true/false). Can be longer/shorter than actual number of mapped elements. |
tag | The message tag |
doRenumber | Apply oldToNew internally to renumber entries (uses renumberMap) and adjust the constructSize |
Definition at line 893 of file mapDistributeBaseSubset.C.
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.
allowedRemoteElems | Permissible remote mapped elements (true/false). Can be longer/shorter than actual number of mapped elements. |
tag | The message tag |
doRenumber | Apply oldToNew internally to renumber entries (uses renumberMap) and adjust the constructSize |
Definition at line 915 of file mapDistributeBaseSubset.C.
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.
allowedLocalElems | Permissible local mapped elements (true/false). Can be longer/shorter than actual number of mapped elements. | |
[out] | oldToNewSub | Old-to-new mapping: subMap Disabled if labelList::null(), |
[out] | oldToNewConstruct | Old-to-new mapping: constructMap Disabled if labelList::null(), |
localSize | The max index for subMap (-1: auto-detect) | |
tag | The message tag |
Definition at line 937 of file mapDistributeBaseSubset.C.
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.
allowedRemoteElems | Permissible remote mapped elements (true/false). Can be longer/shorter than actual number of mapped elements. | |
[out] | oldToNewSub | Old-to-new mapping: subMap Disabled if labelList::null(), |
[out] | oldToNewConstruct | Old-to-new mapping: constructMap Disabled if labelList::null(), |
localSize | The max index for subMap (-1: auto-detect) | |
tag | The message tag |
Definition at line 968 of file mapDistributeBaseSubset.C.
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
.localElements
or remoteElements
contains duplicates. Definition at line 721 of file mapDistributeBaseSubset.C.
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.localElements
contains duplicates.Definition at line 773 of file mapDistributeBaseSubset.C.
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
.remoteElements
contains duplicates. Definition at line 815 of file mapDistributeBaseSubset.C.
|
static |
Distribute combine data with specified combine operation and negate operator (for flips).
If multiple processors write to same position, contributions are added using the combine cop.
Definition at line 442 of file mapDistributeBaseTemplates.C.
References Foam::abort(), UList< T >::cdata_bytes(), UList< T >::data_bytes(), Foam::FatalError, FatalErrorInFunction, field(), PstreamBuffers::finishedSends(), os(), DynamicList< T, SizeMin >::push_back(), Foam::blockMeshTools::read(), List< T >::resize_nocopy(), UList< T >::size(), UList< T >::size_bytes(), and Foam::vtk::write().
Referenced by Field< Foam::vector >::autoMap(), faceAreaWeightAMI::calculate(), mapDistribute::distribute(), mappedPatchBase::distribute(), distributedTriSurfaceMesh::findNearest(), distributedTriSurfaceMesh::getVolumeType(), Field< Foam::vector >::map(), mappedPatchBase::reverseDistribute(), and streamLineBase::writeToFile().
|
static |
Distribute assign data with specified negate operator (for flips). Uses assignment for combine operation.
Definition at line 890 of file mapDistributeBaseTemplates.C.
References Foam::abort(), UList< T >::cdata_bytes(), UList< T >::data_bytes(), Foam::FatalError, FatalErrorInFunction, field(), PstreamBuffers::finishedSends(), os(), DynamicList< T, SizeMin >::push_back(), Foam::blockMeshTools::read(), List< T >::resize_nocopy(), UList< T >::size(), UList< T >::size_bytes(), and Foam::vtk::write().
void distribute | ( | List< T > & | values, |
const int | tag = UPstream::msgType() |
||
) | const |
Distribute List data using default commsType and the default flip/negate operator.
Definition at line 1493 of file mapDistributeBaseTemplates.C.
References Foam::HashTableOps::values().
void distribute | ( | DynamicList< T > & | values, |
const int | tag = UPstream::msgType() |
||
) | const |
Distribute DynamicList data using default commsType and the default flip/negate operator.
Definition at line 1504 of file mapDistributeBaseTemplates.C.
References Foam::HashTableOps::values().
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.
Definition at line 1463 of file mapDistributeBaseTemplates.C.
References Foam::HashTableOps::values().
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.
Definition at line 1475 of file mapDistributeBaseTemplates.C.
References UList< T >::size(), and Foam::HashTableOps::values().
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 1448 of file mapDistributeBaseTemplates.C.
References Foam::HashTableOps::values().
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).
Accepts a nullValue to initialize unmapped elements (ie, when the constructSize is larger than the number of mapped elements).
Definition at line 1393 of file mapDistributeBaseTemplates.C.
References Foam::HashTableOps::values().
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).
Accepts a nullValue to initialize unmapped elements (ie, when the constructSize is larger than the number of mapped elements).
Definition at line 1419 of file mapDistributeBaseTemplates.C.
References Foam::HashTableOps::values().
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 1593 of file mapDistributeBaseTemplates.C.
References Foam::HashTableOps::values().
Referenced by mapDistribute::reverseDistribute().
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 1611 of file mapDistributeBaseTemplates.C.
References Foam::HashTableOps::values().
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.
Definition at line 1515 of file mapDistributeBaseTemplates.C.
References Foam::HashTableOps::values().
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.
Definition at line 1535 of file mapDistributeBaseTemplates.C.
References Foam::HashTableOps::values().
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.
Accepts a nullValue to initialize unmapped elements (ie, when the constructSize is larger than the subMap).
Definition at line 1562 of file mapDistributeBaseTemplates.C.
References Foam::HashTableOps::values().
void send | ( | PstreamBuffers & | pBufs, |
const List< T > & | field | ||
) | const |
Do all sends using PstreamBuffers.
Definition at line 1329 of file mapDistributeBaseTemplates.C.
References field(), PstreamBuffers::finishedSends(), os(), and UList< T >::size().
void receive | ( | PstreamBuffers & | pBufs, |
List< T > & | field | ||
) | const |
Do all receives using PstreamBuffers.
Definition at line 1358 of file mapDistributeBaseTemplates.C.
References field(), and UList< T >::size().
|
static |
Start all sends and receives (always non-blocking)
sendRequests | The send requests range |
sendFields | The send fields storage |
recvRequests | The recv requests range |
recvFields | The recv fields storage |
Definition at line 140 of file mapDistributeBaseTemplates.C.
References UList< T >::cdata_bytes(), UList< T >::data_bytes(), UList< T >::empty(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, field(), Foam::blockMeshTools::read(), List< T >::resize_nocopy(), UList< T >::size(), IntRange< IntType >::size(), UList< T >::size_bytes(), IntRange< IntType >::start(), and Foam::vtk::write().
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)
sendRequests | The send requests range |
sendFields | The send fields storage |
recvRequests | The recv requests range |
recvFields | The recv fields storage |
Definition at line 274 of file mapDistributeBaseTemplates.C.
References field().
|
static |
Wait for (receive) requests to finish and consume.
Definition at line 301 of file mapDistributeBaseTemplates.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, field(), Foam::nl, DynamicList< T, SizeMin >::push_back(), UList< T >::size(), IntRange< IntType >::size(), and IntRange< IntType >::start().
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.
Definition at line 417 of file mapDistributeBaseTemplates.C.
References field().
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 289 of file mapDistributeBase.C.
References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::labelMax, Foam::labelMin, Foam::mag(), Foam::max(), Foam::min(), UPstream::myProcNo(), Foam::nl, UPstream::nProcs(), and os().
Referenced by mapDistribute::printLayout().
void operator= | ( | const mapDistributeBase & | rhs | ) |
Copy assignment.
Definition at line 1539 of file mapDistributeBase.C.
Referenced by mapDistribute::operator=().
void operator= | ( | mapDistributeBase && | rhs | ) |
Move assignment.
Definition at line 1556 of file mapDistributeBase.C.
|
inlinenoexcept |
Return info proxy, used to print summary information to a stream.
Definition at line 1386 of file mapDistributeBase.H.
void readDict | ( | const dictionary & | dict | ) |
Read entries from dictionary format.
Definition at line 94 of file mapDistributeBaseIO.C.
References dict, dictionary::get(), dictionary::readEntry(), and dictionary::subDict().
Referenced by mapDistribute::readDict().
void writeEntries | ( | Ostream & | os | ) | const |
Write entries in dictionary format.
Definition at line 116 of file mapDistributeBaseIO.C.
References Ostream::beginBlock(), Ostream::endBlock(), Foam::nl, os(), Ostream::writeEntry(), and Foam::writeMaps().
Referenced by mapDistribute::writeEntries().
|
inline |
No correction for topo change.
Definition at line 1417 of file mapDistributeBase.H.
References NotImplemented.
void compact | ( | const boolList & | remoteElemUsed, |
const int | tag = UPstream::msgType() |
||
) |
OpenFOAM-v2112 and earlier naming for compactRemoteData() using boolList.
Definition at line 1001 of file mapDistributeBaseSubset.C.
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 1012 of file mapDistributeBaseSubset.C.
Foam::List<T> accessAndFlip | ( | const UList< T > & | values, |
const labelUList & | map, | ||
const bool | hasFlip, | ||
const NegateOp & | negOp | ||
) |
Definition at line 125 of file mapDistributeBaseTemplates.C.
References Foam::output(), UList< T >::size(), and Foam::HashTableOps::values().
|
friend |
Read plain content (not dictionary) from Istream.
|
friend |
Write plain content (not dictionary) to Ostream.