74 #ifndef Foam_mapDistributeBase_H 75 #define Foam_mapDistributeBase_H 96 class mapDistributeBase;
98 Istream&
operator>>(Istream&, mapDistributeBase&);
99 Ostream&
operator<<(Ostream&,
const mapDistributeBase&);
111 label constructSize_;
123 bool constructHasFlip_;
140 const label expectedSize,
141 const label receivedSize
218 template<
class T,
class CombineOp,
class NegateOp>
224 const CombineOp& cop,
225 const NegateOp& negOp,
231 template<
class T,
class NegateOp>
237 const NegateOp& negOp
242 template<
class T,
class NegateOp>
248 const NegateOp& negOp
269 void calcCompactDataRequirements
271 const bitSet& allowedLocalElems,
272 const bitSet& allowedRemoteElems,
288 void calcCompactLocalDataRequirements
290 const bitSet& allowedLocalElems,
305 void calcCompactRemoteDataRequirements
307 const bitSet& allowedRemoteElems,
324 const label localSize = -1
334 const bool doRenumber
346 static void renumberVisitOrder
488 return constructSize_;
494 return constructSize_;
512 return constructMap_;
518 return constructMap_;
536 return constructHasFlip_;
542 return constructHasFlip_;
554 return constructMap_.
size();
600 const label globalElement
639 const bitSet& allowedLocalElems,
641 const bool doRenumber =
false 658 const bitSet& allowedRemoteElems,
660 const bool doRenumber =
false 685 const bitSet& allowedLocalElems,
688 const label localSize = -1,
710 const bitSet& allowedRemoteElems,
713 const label localSize = -1,
735 const label localSize = -1,
758 const label localSize = -1,
778 const label localSize = -1,
790 template<
class T,
class NegateOp>
801 const NegateOp& negOp,
810 template<
class T,
class CombineOp,
class NegateOp>
822 const CombineOp& cop,
823 const NegateOp& negOp,
849 template<
class T,
class NegateOp>
853 const NegateOp& negOp,
862 template<
class T,
class NegateOp>
867 const NegateOp& negOp,
876 template<
class T,
class NegateOp>
882 const NegateOp& negOp,
923 template<
class T,
class NegateOp>
929 const NegateOp& negOp,
1013 const label localSize,
1024 Ostream& operator<<(Ostream& os, const InfoProxy<mapDistributeBase>& ip);
void calcCompactAddressing(const globalIndex &globalNumbering, const labelUList &elements, List< Map< label >> &compactMap) const
Construct per processor compact addressing of the global elements.
void size(const label n)
Older name for setAddressableSize.
static label countUnmapped(const labelUList &elements, const labelListList &maps, const bool hasFlip)
Count the number of unmapped elements.
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.
static label renumber(const globalIndex &, const List< Map< label >> &compactMap, const label globalElement)
Helper for construct from globalIndex. Renumbers element.
commsTypes
Types of communications.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const List< labelPair > & schedule() const
Return a schedule. Demand driven. See above.
InfoProxy< mapDistributeBase > info() const
Info proxy to print summary information to a stream.
void send(PstreamBuffers &pBufs, const List< T > &field) const
Do all sends using PstreamBuffers.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
friend Ostream & operator<<(Ostream &, const mapDistributeBase &)
Write plain content (not dictionary) to Ostream.
label constructSize() const noexcept
Constructed data size.
label comm() const noexcept
The communicator used.
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.
label nMaps() const noexcept
The number of sub-lists within the maps.
static int & msgType() noexcept
Message tag of standard messages.
static label worldComm
Default world communicator (all processors). May differ from globalComm if local worlds are in use...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
mapDistributeBase()
Default construct (uses worldComm)
static void flipAndCombine(const labelUList &map, const bool hasFlip, const UList< T > &rhs, const CombineOp &cop, const NegateOp &negOp, List< T > &lhs)
friend Istream & operator>>(Istream &, mapDistributeBase &)
Read plain content (not dictionary) from Istream.
bool subHasFlip() const noexcept
Does subMap include a sign.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
static T accessAndFlip(const UList< T > &values, const label index, const bool hasFlip, const NegateOp &negOp)
Lookup a field value at specified index and return its value after any flip negation operations...
const List< labelPair > & whichSchedule(const UPstream::commsTypes commsType) const
Return real or dummy schedule depending on the communication type.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
static bool hasFlipAddressing(const labelUList &map)
Test for flip addressing, where flips are encoded as negative indices and non-flips are encoded as po...
void readDict(const dictionary &dict)
Read entries from dictionary format.
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.
void compact(const boolList &remoteElemUsed, const int tag=UPstream::msgType())
OpenFOAM-v2112 and earlier naming for compactRemoteData() using boolList.
Istream & operator>>(Istream &, directionInfo &)
void printLayout(Ostream &os) const
Debug: print layout. Can only be used on maps with sorted.
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.
void transfer(mapDistributeBase &rhs)
Transfer the contents of the argument and annul the argument.
void updateMesh(const mapPolyMesh &)
No correction for topo change.
void operator=(const mapDistributeBase &rhs)
Copy assignment.
Class containing processor-to-processor mapping information.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
bool constructHasFlip() const noexcept
Does constructMap include a sign.
OBJstream os(runTime.globalPath()/outputName)
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void receive(PstreamBuffers &pBufs, List< T > &field) const
Do all receives using PstreamBuffers.
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.
const labelListList & constructMap() const noexcept
From subsetted data to new reconstructed data.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
A helper class for outputting values to Ostream.
void exchangeAddressing(const int tag, const globalIndex &globalNumbering, labelList &elements, List< Map< label >> &compactMap, labelList &compactStart)
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
labelList subMapSizes() const
The sizes of the subMap lists.
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, List< T > &field, const NegateOp &negOp, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Distribute data with specified negate operator (for flips).
void clear()
Reset to zero size, only retaining communicator.
ClassName("mapDistributeBase")
static void checkReceivedSize(const label proci, const label expectedSize, const label receivedSize)
Fatal if expected and received size are not equal.
static label getMappedSize(const labelListList &maps, const bool hasFlip)
Scan the maps for the max addressed index.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
List< label > labelList
A List of labels.
const labelListList & subMap() const noexcept
From subsetted data back to original data.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
List< bool > boolList
A List of bools.
labelList constructMapSizes() const
The sizes of the constructMap lists.
void writeEntries(Ostream &os) const
Write entries in dictionary format.
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...