74 #ifndef Foam_mapDistributeBase_H 75 #define Foam_mapDistributeBase_H 95 class mapDistributeBase;
97 Istream&
operator>>(Istream&, mapDistributeBase&);
98 Ostream&
operator<<(Ostream&,
const mapDistributeBase&);
101 Ostream& operator<<(Ostream&, const InfoProxy<mapDistributeBase>&);
113 label constructSize_;
125 bool constructHasFlip_;
142 const label expectedSize,
143 const label receivedSize
220 template<
class T,
class CombineOp,
class NegateOp>
226 const CombineOp& cop,
227 const NegateOp& negOp,
233 template<
class T,
class NegateOp>
239 const NegateOp& negOp
244 template<
class T,
class NegateOp>
250 const NegateOp& negOp
271 void calcCompactDataRequirements
273 const bitSet& allowedLocalElems,
274 const bitSet& allowedRemoteElems,
290 void calcCompactLocalDataRequirements
292 const bitSet& allowedLocalElems,
307 void calcCompactRemoteDataRequirements
309 const bitSet& allowedRemoteElems,
326 const label localSize = -1
336 const bool doRenumber
348 static void renumberVisitOrder
490 return constructSize_;
496 return constructSize_;
514 return constructMap_;
520 return constructMap_;
538 return constructHasFlip_;
544 return constructHasFlip_;
556 return constructMap_.
size();
602 const label globalElement
641 const bitSet& allowedLocalElems,
643 const bool doRenumber =
false 660 const bitSet& allowedRemoteElems,
662 const bool doRenumber =
false 687 const bitSet& allowedLocalElems,
690 const label localSize = -1,
712 const bitSet& allowedRemoteElems,
715 const label localSize = -1,
737 const label localSize = -1,
760 const label localSize = -1,
780 const label localSize = -1,
792 template<
class T,
class NegateOp>
803 const NegateOp& negOp,
812 template<
class T,
class CombineOp,
class NegateOp>
824 const CombineOp& cop,
825 const NegateOp& negOp,
851 template<
class T,
class NegateOp>
855 const NegateOp& negOp,
864 template<
class T,
class NegateOp>
869 const NegateOp& negOp,
878 template<
class T,
class NegateOp>
884 const NegateOp& negOp,
925 template<
class T,
class NegateOp>
931 const NegateOp& negOp,
963 template<
class T,
class negateOp>
974 const negateOp& negOp,
991 template<
class T,
class CombineOp,
class negateOp>
1001 const CombineOp& cop,
1002 const negateOp& negOp,
1078 const label localSize,
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
Communications types.
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.
void send(PstreamBuffers &pBufs, const List< T > &field) const
Do all sends using PstreamBuffers.
A range or interval of labels defined by a start and a size.
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
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
InfoProxy< mapDistributeBase > info() const noexcept
Return info proxy, used to print summary information to a stream.
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.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
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.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
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...