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>&);
125 label constructSize_;
137 bool constructHasFlip_;
154 const label expectedSize,
155 const label receivedSize
234 template<
class T,
class CombineOp,
class NegateOp>
246 const CombineOp& cop,
248 const NegateOp& negOp
253 template<
class T,
class NegateOp>
265 const NegateOp& negOp
270 template<
class T,
class NegateOp>
280 const NegateOp& negOp
301 void calcCompactDataRequirements
303 const bitSet& allowedLocalElems,
304 const bitSet& allowedRemoteElems,
320 void calcCompactLocalDataRequirements
322 const bitSet& allowedLocalElems,
337 void calcCompactRemoteDataRequirements
339 const bitSet& allowedRemoteElems,
356 const label localSize = -1
366 const bool doRenumber
378 static void renumberVisitOrder
447 const
int tag =
UPstream::msgType(),
461 const
int tag =
UPstream::msgType(),
552 return constructSize_;
558 return constructSize_;
576 return constructMap_;
582 return constructMap_;
600 return constructHasFlip_;
606 return constructHasFlip_;
618 return constructMap_.
size();
652 const
UPstream::commsTypes commsType
670 const
List<
Map<label>>& compactMap,
671 const label globalElement
704 const label localSize,
706 const
Map<label>& cMap,
714 const label localSize,
716 const
Map<label>& cMap,
740 const
bitSet& allowedLocalElems,
741 const
int tag =
UPstream::msgType(),
742 const
bool doRenumber = false
759 const
bitSet& allowedRemoteElems,
760 const
int tag =
UPstream::msgType(),
761 const
bool doRenumber = false
786 const
bitSet& allowedLocalElems,
789 const label localSize = -1,
811 const
bitSet& allowedRemoteElems,
814 const label localSize = -1,
836 const label localSize = -1,
859 const label localSize = -1,
879 const label localSize = -1,
894 template<class
T, class CombineOp, class NegateOp>
897 const
UPstream::commsTypes commsType,
906 const CombineOp& cop,
907 const NegateOp& negOp,
908 const
int tag =
UPstream::msgType(),
917 template<class
T, class NegateOp>
920 const
UPstream::commsTypes commsType,
928 const NegateOp& negOp,
929 const
int tag =
UPstream::msgType(),
959 const
UPstream::commsTypes commsType,
969 const
UPstream::commsTypes commsType,
976 template<class
T, class NegateOp>
980 const NegateOp& negOp,
989 template<class
T, class NegateOp>
992 const
UPstream::commsTypes commsType,
994 const NegateOp& negOp,
1003 template<class
T, class NegateOp>
1006 const
UPstream::commsTypes commsType,
1009 const NegateOp& negOp,
1010 const
int tag =
UPstream::msgType()
1023 const
int tag =
UPstream::msgType()
1036 const
int tag =
UPstream::msgType()
1044 const
UPstream::commsTypes commsType,
1047 const
int tag =
UPstream::msgType()
1052 template<class
T, class NegateOp>
1055 const
UPstream::commsTypes commsType,
1058 const NegateOp& negOp,
1059 const
int tag =
UPstream::msgType()
1069 const
UPstream::commsTypes commsType,
1073 const
int tag =
UPstream::msgType()
1092 template<class
T, class negateOp>
1104 const negateOp& negOp,
1118 const
int tag =
UPstream::msgType()
1122 template<class
T, class CombineOp, class negateOp>
1131 const CombineOp& cop,
1132 const negateOp& negOp,
1144 const
int tag =
UPstream::msgType()
1207 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.
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.
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.
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.
InfoProxy< mapDistributeBase > info() const noexcept
Return info proxy, used to print summary information to a stream.
List< labelList > labelListList
List of labelList.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
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...
layoutTypes
The map layout (eg, of the constructMap)
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.
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.
Pair< label > labelPair
A pair of labels.
OBJstream os(runTime.globalPath()/outputName)
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
label subMapTotalSize() const noexcept
The sum of the subMap list sizes.
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.
static label renumber(const globalIndex &, const label comm, const List< Map< label >> &compactMap, const label globalElement)
Helper for construct from globalIndex. Renumbers element.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
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...
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.
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 != received size.
static label getMappedSize(const labelListList &maps, const bool hasFlip)
Scan the maps for the max addressed index.
static Ostream & output(Ostream &os, const IntRange< T > &range)
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
label constructMapTotalSize() const noexcept
The sum of the constructMap list sizes.
List< label > labelList
A List of labels.
mapDistributeBase() noexcept
Default construct (uses worldComm)
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.
Inter-processor communications stream.
void writeEntries(Ostream &os) const
Write entries in dictionary format.
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)...
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...
Local processor first, others in linear order.