Loading...
Searching...
No Matches
globalIndex.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2018-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::globalIndex
29
30Description
31 Calculates a non-overlapping list of offsets based on an input size
32 (eg, number of cells) from different MPI ranks.
33 These offsets can be used to define a unique (global) indexing
34 number.
35
36 For example,
37 \verbatim
38 globalIndex globalFaces(mesh.nFaces());
39 label globalFacei = globalFaces.toGlobal(facei);
40 \endverbatim
41
42Note
43 The globalIndex is generally used when the ranks need information
44 about each other's position, whereas GlobalOffset and OffsetRange
45 are used when only the local addressing information (and total Size)
46 is needed without additional information about other ranks.
47
48Warning
49 The unique integer is a Foam::label, so may be subject to overflow
50 problems (2G max) with a 32-bit label compilation.
51
52SourceFiles
53 globalIndex.cxx
54 globalIndex.txx
55 globalIndexI.H
56
57\*---------------------------------------------------------------------------*/
58
59#ifndef Foam_globalIndex_H
60#define Foam_globalIndex_H
61
62#include "Pstream.H"
63#include "CompactListList.H"
64#include "DynamicList.H"
65
66// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67
68namespace Foam
71// Forward Declarations
72class globalIndex;
73
77/*---------------------------------------------------------------------------*\
78 Class globalIndex Declaration
79\*---------------------------------------------------------------------------*/
80
81class globalIndex
82{
83 // Private Data
84
85 //- Offset (addressing) table - like CompactListList
86 labelList offsets_;
87
88
89 // Private Member Functions
90
91 //- Sort and bin. validBins contains bins with non-zero size.
93 bin
94 (
95 const labelUList& offsets,
96 const labelUList& globalIds,
97 labelList& order,
98 DynamicList<label>& validBins
99 );
100
101 //- Report overflow at specified (non-negative) index
102 static void reportOverflowAndExit
103 (
104 const label idx,
105 const label prevOffset = -1, // The last valid offset value
106 const label count = 0 // The count to add to prevOffset
107 );
108
109 //- Check for overflow and calls reportOverflowAndExit...
110 static inline void checkOverflowAndExit
111 (
112 const label idx,
113 const label prevOffset, // The last valid offset value
114 const label count // The count to add to prevOffset
115 );
116
117 //- Return start/size range addressing for proci data
118 inline labelRange range_impl(label proci) const noexcept;
119
120 //- Return start/size/total slab addressing for proci data
121 inline OffsetRange<label> slice_impl(label proci) const noexcept;
122
123
124public:
125
126 // STL type definitions
127
128 //- Type of values contained
129 typedef label value_type;
130
131 //- The type that can represent the size
132 typedef label size_type;
133
134
135 // Public Data Types
136
137 //- Dispatch tag:
138 //- Construct with a single (local size) entry, no communication.
139 struct gatherNone{};
140
141 //- Dispatch tag:
142 //- Construct 'one-sided' from local sizes,
143 //- using gather but no broadcast.
144 struct gatherOnly{};
145
146 //- Dispatch tag:
147 //- Construct 'one-sided' from the non-master local sizes
148 //- using gather but no broadcast.
149 struct gatherNonLocal{};
150
151
152 // Static Member Functions
153
154 //- Return a null globalIndex (reference to a nullObject).
155 //- Behaves like an empty globalIndex
156 static const globalIndex& null() noexcept
157 {
160
161
162 // Constructors
163
164 //- Default construct (empty)
165 globalIndex() noexcept = default;
167 //- Copy construct from a list of offsets.
168 //- No communication required
169 inline explicit globalIndex(const labelUList& listOffsets);
170
171 //- Move construct from a list of offsets.
172 //- No communication required
173 inline explicit globalIndex(labelList&& listOffsets);
174
175 //- Construct from a list of sizes and calculate the offsets.
176 //- No communication required
177 inline globalIndex
178 (
181 );
182
183 //- Construct from local size, using gather/broadcast
184 //- with default/specified communicator if parallel.
185 inline explicit globalIndex
187 label localSize,
188 const label comm = UPstream::worldComm,
189 const bool parallel = UPstream::parRun()
190 );
191
192 //- Construct with a single (local size) entry, no communication
193 inline globalIndex
194 (
196 label localSize,
197 int communicator = -1
198 );
199
200 //- Construct 'one-sided' from local sizes.
201 //- Uses UPstream::listGatherValues, but no broadcast.
202 //- Will be empty on non-master processes.
203 //
204 // \note can be used when Pstream::parRun() is false.
205 inline globalIndex
206 (
208 label localSize,
209 const label comm = UPstream::worldComm
210 );
211
212 //- Construct 'one-sided' from the non-master local sizes
213 //- (ie, master size is treated as 0).
214 //- Uses UPstream::listGatherValues, but no broadcast.
215 //- Will be empty on non-master processes.
216 //
217 // \note can be used when Pstream::parRun() is false.
218 inline globalIndex
219 (
221 label localSize,
222 const label comm = UPstream::worldComm
223 );
224
225 //- Construct from Istream.
226 //- No communication required
227 explicit globalIndex(Istream& is);
228
229
230 // Member Functions
231
232 //- Check for default constructed or total-size == 0
233 inline bool empty() const noexcept;
234
235 //- The number of items covered by the offsets
236 inline label length() const noexcept;
237
238 //- Global sum of localSizes. Same as totalSize()
239 FOAM_DEPRECATED_STRICT(2022-10, "totalSize() - unambiguous")
240 label size() const noexcept { return totalSize(); }
241
242 //- The span size covered by the offsets, zero if empty
243 inline label span() const noexcept;
244
245 //- The total addressed size, which corresponds to the
246 //- end offset and also the sum of all localSizes.
247 inline label totalSize() const noexcept;
248
249 //- The local sizes. Same as localSizes()
250 inline labelList sizes() const;
251
252 //- The local starts
253 inline const labelUList localStarts() const;
254
255 //- The local sizes
256 labelList localSizes() const;
257
258 //- Return start/size ranges for all data
259 List<labelRange> ranges() const;
260
261 //- Global max of localSizes
262 inline label maxSize() const;
263
264
265 // Access
267 //- Const-access to the offsets
268 inline const labelList& offsets() const noexcept;
269
270 //- Write-access to the offsets, for changing after construction
271 inline labelList& offsets() noexcept;
272
273
274 // Dimensions
275
276 //- True if local-only content (ie, nProcs == 1).
277 //- Such content is often created with gatherNone.
278 inline bool single() const noexcept;
279
280 //- The number of processors covered by the offsets,
281 //- same as the primary length()
282 inline label nProcs() const noexcept;
283
284 //- Range of process indices for all addressed offsets (processes)
286
287 //- Range of process indices for addressed sub-offsets (processes)
288 inline labelRange subProcs() const noexcept;
289
290 //- The value corresponding to the first offset
291 inline label begin_value() const noexcept;
292
293 //- The value corresponding to the last offset (end offset),
294 //- which is 1 beyond the end of the range.
295 inline label end_value() const noexcept;
296
297 //- The first offset range. It is (0,0) if globalIndex is empty
298 labelRange front() const;
299
300 //- The last offset range. It is (0,0) if globalIndex is empty
301 labelRange back() const;
302
303
304 // Edit
305
306 //- Reset to be empty (no offsets)
307 inline void clear();
308
309 //- Change the number of entries (nProcs) in the offsets table.
310 //- Extending will fill with empty local sizes.
311 void resize(const label n);
312
313 //- Reset from local size, using gather/broadcast
314 //- with default/specified communicator if parallel.
315 void reset
317 label localSize,
318 const label comm = UPstream::worldComm,
319 const bool parallel = UPstream::parRun()
320 );
321
322 //- Reset offsets from a list of local sizes,
323 //- with optional check for label overflow.
324 //- No communication required
325 void reset
326 (
327 const labelUList& counts,
328 const bool checkOverflow = false
329 );
330
331 //- Reset to a single (local size) entry, no communication
332 inline void reset
333 (
335 label localSize,
336 int communicator = -1
337 );
338
339 //- Reset as 'one-sided' from local sizes.
340 //- Uses UPstream::listGatherValues, but no broadcast.
341 //- Will be empty on non-master processes.
342 //
343 // \note can be used when Pstream::parRun() is false.
344 inline void reset
345 (
347 label localSize,
348 const label comm = UPstream::worldComm
349 );
350
351 //- Reset as 'one-sided' from the non-master local sizes
352 //- (ie, master size is treated as 0).
353 //- Uses UPstream::listGatherValues, but no broadcast.
354 //- Will be empty on non-master processes.
355 //
356 // \note can be used when Pstream::parRun() is false.
357 inline void reset
358 (
360 label localSize,
361 const label comm = UPstream::worldComm
362 );
363
364 //- Reset the globalIndex. Same as copy assignment.
365 inline void reset(const globalIndex& gi);
366
367 //- Alter local size for given processor
368 void setLocalSize(const label proci, const label len);
369
370
371 // Queries and renumbering
372
373 //- True if contained within the offsets range
374 inline bool contains(const label i) const noexcept;
376 //- Start of proci data
377 inline label localStart(const label proci) const;
378
379 //- End of proci data
380 inline label localEnd(const label proci) const;
381
382 //- Size of proci data
383 inline label localSize(const label proci) const;
384
385 //- The max of localSizes, excluding the specified processor
386 label maxNonLocalSize(const label proci) const;
387
388 //- Return start/size range of proci data
389 inline labelRange range(label proci) const noexcept;
390
391 //- Return start/size/total slab addressing for proci data
392 inline OffsetRange<label> slice(label proci) const noexcept;
393
394 //- Is on processor proci
395 inline bool isLocal(const label proci, const label i) const;
396
397 //- From local to global on proci
398 inline label toGlobal(const label proci, const label i) const;
399
400 //- From local to global on proci
401 inline labelList toGlobal
402 (
403 const label proci,
404 const labelUList& labels
405 ) const;
406
407 //- From local to global index on proci (inplace)
408 inline void inplaceToGlobal
409 (
410 const label proci,
411 labelUList& labels
412 ) const;
413
414
415 //- From global to local on proci
416 inline label toLocal(const label proci, const label i) const;
417
418 //- Find processor with specified global id.
419 //- Check proci first, followed by binary search.
420 // \return the processor number or -1 (not found)
421 inline label findProc(const label proci, const label i) const;
422
423 //- Find processor above proci with specified global id - binary search.
424 // \return the processor above proci or -1 otherwise
425 // (including for out-of-range indices)
426 inline label findProcAbove(const label proci, const label i) const;
427
428 //- Find processor below proci with specified global id - binary search.
429 // Binary search.
430 // \return the processor below proci or -1 otherwise
431 // (including for out-of-range indices)
432 inline label findProcBelow(const label proci, const label i) const;
433
434 //- Which processor does global id come from?
435 //- Checks proci first (assumed to occur reasonably frequently)
436 //- followed by a binary search.
437 //- Fatal for out-of-range indices
438 inline label whichProcID(const label proci, const label i) const;
439
440
441 // Queries relating to myProcNo (Caution: uses UPstream::worldComm)
442
443 //- Local start on myProcNo()
444 inline label localStart() const;
445
446 //- Local end on myProcNo()
447 inline label localEnd() const;
448
449 //- Local size on myProcNo()
450 inline label localSize() const;
451
452 //- The max of localSizes, excluding current (myProcNo) rank
453 inline label maxNonLocalSize() const;
454
455 //- Return start/size range of local (myProcNo) data
456 inline labelRange range() const;
457
458 //- Return start/size/total slab addressing for local (myProcNo) data
459 inline OffsetRange<label> slice() const;
460
461 //- Is on local processor
462 inline bool isLocal(const label i) const;
463
464 //- From local to global index
465 inline label toGlobal(const label i) const;
466
467 //- From local to global index
468 inline labelList toGlobal(const labelUList& labels) const;
469
470 //- From local to global index (inplace)
471 inline void inplaceToGlobal(labelUList& labels) const;
472
473 //- From global to local on current processor.
474 // FatalError if not on local processor.
475 inline label toLocal(const label i) const;
476
477 //- Which processor does global id come from?
478 // Uses myProcNo for the initial local check.
479 inline label whichProcID(const label i) const;
480
481
482 // Iteration
483
484 //- Forward input iterator with const access that is used to
485 //- iterate across the globalIndex offsets() table.
486 // The de-referenced value is the range() with (start, size),
487 // but it also provides separate index, start, size information.
488 class const_iterator
489 {
490 //- The parent class for which this is an iterator
491 const globalIndex* parent_;
492
493 //- The index into the parent
494 label index_;
496 public:
497
498 // Constructors
499
500 //- Construct from globalIndex list at given index
501 explicit const_iterator
502 (
503 const globalIndex* globalIdx,
504 const label i = 0
505 ) noexcept;
506
507
508 // Member Operators
509
510 //- The index into the arrays
511 inline label index() const noexcept;
512
513 //- The local start
514 inline label start() const;
515
516 //- The local size
517 inline label size() const;
518
519 //- The local range
520 inline labelRange range() const;
521
522 //- The local range
523 inline labelRange operator*() const;
524
525 inline const_iterator& operator++();
526 inline const_iterator operator++(int);
527
528 inline const_iterator& operator--();
529 inline const_iterator operator--(int);
530
531 inline bool operator==(const const_iterator& iter) const noexcept;
532 inline bool operator!=(const const_iterator& iter) const noexcept;
533 };
534
535
536 //- A const_iterator set to the beginning
537 inline const_iterator cbegin() const noexcept;
538
539 //- A const_iterator set to beyond the end
540 inline const const_iterator cend() const noexcept;
541
542 //- A const_iterator set to the beginning
543 inline const_iterator begin() const noexcept;
544
545 //- A const_iterator set to beyond the end
546 inline const const_iterator end() const noexcept;
547
548 //- Return const_iterator at offset proci from begin,
549 //- clamped to [0,nProcs] range
550 inline const_iterator cbegin(const label proci) const noexcept;
551
552 //- Return const_iterator at offset proci from begin,
553 //- clamped to [0,nProcs] range
554 inline const_iterator begin(const label proci) const noexcept;
555
556 // FUTURE?
557 // //- Return start/size range of proci data
558 // labelRange operator[](const label proci) const
559 // {
560 // return this->range(proci);
561 // }
562
563
564 // Helper Functions
565
566 //- Based on the local input size(s),
567 //- calculate a globally-consistent local start offset.
568 // No overflow checks.
569 // \note Restricted to integral types.
570 template<class IntType>
571 static IntType calcOffset
572 (
573 IntType localSize,
574 const label comm = UPstream::worldComm
575 );
576
577 //- Based on the local input size(s),
578 //- calculate a globally-consistent local start offset.
579 // With optional overflow checking.
580 // \note Restricted to integral types.
581 template<class IntType>
582 static IntType calcOffset
583 (
584 IntType localSize,
585 const label comm,
586 [[maybe_unused]] const bool checkOverflow
587 )
588 {
589 IntType start = globalIndex::calcOffset(localSize, comm);
590 // Assume no overflow for large integrals
591 if constexpr (sizeof(IntType) < sizeof(int64_t))
592 {
593 if (checkOverflow && UPstream::is_parallel(comm))
594 {
595 checkOverflowAndExit
596 (
597 UPstream::myProcNo(comm), start, localSize
598 );
599 }
600 }
601 return start;
602 }
603
604 //- Based on the local input size(s),
605 //- calculate a globally-consistent range (offset/size).
606 // No overflow checks.
607 // \note Restricted to integral types.
608 template<class IntType>
609 std::enable_if_t<std::is_integral_v<IntType>, IntRange<IntType>>
610 static calcRange
611 (
612 IntType localSize,
613 const label comm = UPstream::worldComm
614 )
615 {
616 IntType start = globalIndex::calcOffset(localSize, comm);
617 return IntRange<IntType>(start, localSize);
618 }
619
620 //- Based on the local input size(s),
621 //- calculate a globally-consistent range (offset/size).
622 //- With optional overflow checking.
623 // \note Restricted to integral types.
624 template<class IntType>
625 std::enable_if_t<std::is_integral_v<IntType>, IntRange<IntType>>
626 static calcRange
627 (
628 IntType localSize,
629 const label comm,
630 const bool checkOverflow
631 )
632 {
633 IntType start =
634 globalIndex::calcOffset(localSize, comm, checkOverflow);
635 return IntRange<IntType>(start, localSize);
636 }
637
638 //- Get the receive sizes.
639 //- On master the length == nProcs and element [0] corresponds
640 //- to the max of all other receive sizes.
641 //- On non-master, the list is zero-sized.
642 // \note Restricted to integral types.
643 template<class IntType>
644 static List<IntType> calcRecvSizes
645 (
646 IntType localSize,
647 const label comm = UPstream::worldComm
648 );
649
650 //- Calculate offsets from a list of local sizes,
651 //- with optional check for label overflow
653 (
654 const labelUList& counts,
655 const bool checkOverflow = false
656 );
657
658 //- Calculate offsets from an indirect list of local sizes,
659 //- with optional check for label overflow
660 template<class Addr>
662 (
663 const IndirectListBase<label, Addr>& counts,
664 const bool checkOverflow = false
665 );
666
667 //- Calculate offsets from list of lists,
668 //- with optional check for label overflow
669 template<class SubListType>
671 (
672 const List<SubListType>& lists,
673 const bool checkOverflow = false
674 );
675
676 //- Calculate ranges (offset/size) from a list of local sizes,
677 //- with optional check for label overflow
679 (
680 const labelUList& counts,
681 const bool checkOverflow = false
682 );
683
684 //- Split the top-level offsets into inter-node and local-node
685 //- components suitable to a two-stage hierarchy.
687 (
689 labelList& interNodeOffsets,
691 labelList& localNodeOffsets,
693 const label communicator = UPstream::worldComm,
695 const bool absoluteLocalNodeOffsets = false
696 ) const;
697
698
699 // Misc low-level gather routines
700
701 //- Collect single values in processor order on master (== procIDs[0]).
702 // Handles contiguous/non-contiguous data.
703 // non-zero output field (master only)
704 template<class ProcIDsContainer, class Type>
705 [[nodiscard]]
707 (
708 const label comm,
709 const ProcIDsContainer& procIDs,
710 const Type& localValue,
711 const int tag = UPstream::msgType(),
713 );
714
715 //- Collect data in processor order on master (== procIDs[0]).
716 // Handles contiguous/non-contiguous data, skips empty fields.
717 template<class ProcIDsContainer, class Type>
718 static void gather
719 (
720 const labelUList& offsets,
721 const label comm,
722 const ProcIDsContainer& procIDs,
723 const UList<Type>& fld,
725 UList<Type>& allFld,
726 const int tag = UPstream::msgType(),
728 );
729
730 //- Collect indirect data in processor order on master
731 // Handles contiguous/non-contiguous data, skips empty fields.
732 template<class ProcIDsContainer, class Type, class Addr>
733 static void gather
734 (
735 const labelUList& offsets,
736 const label comm,
737 const ProcIDsContainer& procIDs,
740 UList<Type>& allFld,
741 const int tag = UPstream::msgType(),
743 );
744
745 //- Inplace collect in processor order on master (== procIDs[0]).
746 template<class ProcIDsContainer, class Type>
747 static void gatherInplace
748 (
749 const labelUList& offsets,
750 const label comm,
751 const ProcIDsContainer& procIDs,
752 List<Type>& fld,
753 const int tag = UPstream::msgType(),
755 );
756
757 //- Collect data in processor order on master (== procIDs[0]).
758 // \note the globalIndex offsets needed on master only.
759 template<class ProcIDsContainer, class Type>
760 void gather
761 (
762 const label comm,
763 const ProcIDsContainer& procIDs,
764 const UList<Type>& fld,
766 List<Type>& allFld,
767 const int tag = UPstream::msgType(),
769 ) const;
770
771 //- Inplace collect in processor order on master (== procIDs[0]).
772 // \note the globalIndex offsets needed on master only.
773 template<class ProcIDsContainer, class Type>
774 void gatherInplace
775 (
776 const label comm,
777 const ProcIDsContainer& procIDs,
778 List<Type>& fld,
779 const int tag = UPstream::msgType(),
781 ) const
782 {
783 gatherInplace(offsets_, comm, procIDs, fld, tag, commsType);
784 }
785
786
787 // Gather
788
789 //- Collect data in processor order on master
790 //- (in serial: performs a simple copy).
791 // Communication with default/specified communicator, message tag.
792 template<class Type>
793 void gather
794 (
796 const UList<Type>& sendData,
798 List<Type>& allData,
799 const int tag = UPstream::msgType(),
801 const label comm = UPstream::worldComm
802 ) const;
803
804 //- Collect data indirectly in processor order on master
805 //- (in serial: performs a simple copy).
806 // Communication with default/specified communicator, message tag.
807 template<class Type, class Addr>
808 void gather
809 (
810 //! [in] input on all ranks
811 const IndirectListBase<Type, Addr>& sendData,
813 List<Type>& allData,
814 const int tag = UPstream::msgType(),
816 const label comm = UPstream::worldComm
817 ) const;
818
819 //- Collect data in processor order on master
820 //- (in serial: performs a simple copy).
821 // Communication with default/specified communicator, message tag.
822 //
823 // \return output (master), zero-sized on non-master
824 template<class Type, class OutputContainer = List<Type>>
825 [[nodiscard]]
826 OutputContainer gather
827 (
828 const UList<Type>& sendData,
829 const int tag = UPstream::msgType(),
831 const label comm = UPstream::worldComm
832 ) const;
833
834 //- Collect data indirectly in processor order on master.
835 // Communication with default/specified communicator, message tag.
836 //
837 // \return output (master), zero-sized on non-master
838 template<class Type, class Addr, class OutputContainer = List<Type>>
839 [[nodiscard]]
840 OutputContainer gather
841 (
842 const IndirectListBase<Type, Addr>& sendData,
843 const int tag = UPstream::msgType(),
845 const label comm = UPstream::worldComm
846 ) const;
847
848 //- Inplace collect data in processor order on master
849 //- (in serial: a no-op).
850 // Communication with default/specified communicator, message tag.
851 // After the gather, the field is zero-sized on non-master.
852 template<class Type>
853 void gatherInplace
854 (
855 List<Type>& fld,
856 const int tag = UPstream::msgType(),
858 const label comm = UPstream::worldComm
859 ) const;
861 //- Use MPI_Gatherv call for contiguous data when possible
862 //- (in serial: performs a simple copy).
863 // Communication with default/specified communicator.
864 // \attention The nProcs for globalIndex and communicator
865 // must match!!
866 template<class Type, class OutputContainer = List<Type>>
867 void mpiGather
868 (
869 const UList<Type>& sendData,
871 OutputContainer& allData,
872 const label comm = UPstream::worldComm,
873
874 // For fallback routines:
876 const int tag = UPstream::msgType()
877 ) const;
878
879 //- Use MPI_Gatherv call for contiguous data when possible
880 //- (in serial: performs a simple copy).
881 // Communication with default/specified communicator.
882 // \attention The nProcs for globalIndex and communicator
883 // must match!!
884 //
885 // \return output (master), zero-sized on non-master
886 template<class Type, class OutputContainer = List<Type>>
887 [[nodiscard]]
888 OutputContainer mpiGather
889 (
890 const UList<Type>& sendData,
891 const label comm = UPstream::worldComm,
893 // For fallback routines:
895 const int tag = UPstream::msgType()
896 ) const;
897
898 //- Use MPI_Gatherv call to inplace collect contiguous data
899 //- when possible.
900 //- (in serial: a no-op).
901 // Communication with default/specified communicator.
902 // \attention The nProcs for globalIndex and communicator
903 // must match!!
904 //
905 // After the gather, the field is zero-sized on non-master.
906 template<class Type>
908 (
911 const label comm = UPstream::worldComm,
912
913 // For fallback routines:
915 const int tag = UPstream::msgType()
916 ) const;
917
918
919 // Gather Operations
920
921 //- Use MPI_Gatherv call to collect contiguous data when possible
922 //- (in serial: performs a simple copy).
923 // Communication with default/specified communicator.
924 //
925 // The allData is output (master), zero-sized on non-master
926 template<class Type, class OutputContainer = List<Type>>
927 static void mpiGatherOp
928 (
929 const UList<Type>& sendData,
930 OutputContainer& allData,
931 const label comm = UPstream::worldComm,
932
933 // For fallback routines:
935 const int tag = UPstream::msgType()
936 );
937
938 //- Use MPI_Gatherv call to collect contiguous data when possible
939 //- (in serial: performs a simple copy).
940 // Communication with default/specified communicator.
941 //
942 // \return output (master), zero-sized on non-master
943 template<class Type, class OutputContainer = List<Type>>
944 [[nodiscard]]
945 static OutputContainer mpiGatherOp
946 (
947 const UList<Type>& sendData,
948 const label comm = UPstream::worldComm,
949
950 // For fallback routines:
952 const int tag = UPstream::msgType()
953 );
954
955 //- Use MPI_Gatherv call to inplace collect contiguous data
956 //- when possible.
957 //- (in serial: a no-op).
958 // Communication with default/specified communicator.
959 //
960 // After the gather, the field is zero-sized on non-master.
961 template<class Type>
962 static void mpiGatherInplaceOp
963 (
966 const label comm = UPstream::worldComm,
967
968 // For fallback routines:
970 const int tag = UPstream::msgType()
971 );
972
973 //- Collect data in processor order on master
974 //- (in serial: performs a simple copy).
975 // Communication with default/specified communicator, message tag.
976 template<class Type>
977 static void gatherOp
978 (
979 const UList<Type>& sendData,
981 List<Type>& allData,
982 const int tag = UPstream::msgType(),
984 const label comm = UPstream::worldComm
985 );
986
987 //- Collect data in processor order on master
988 //- (in serial: performs a simple copy).
989 // Communication with default/specified communicator, message tag.
990 template<class Type, class Addr>
991 static void gatherOp
992 (
993 const IndirectListBase<Type, Addr>& sendData,
995 List<Type>& allData,
996 const int tag = UPstream::msgType(),
998 const label comm = UPstream::worldComm
999 );
1000
1001 //- Collect and return data in processor order on master
1002 //- (in serial: performs a simple copy).
1003 // Communication with default/specified communicator, message tag.
1004 //
1005 // \return output (master), zero-sized on non-master
1006 template<class Type, class OutputContainer = List<Type>>
1007 [[nodiscard]]
1008 static OutputContainer gatherOp
1009 (
1010 const UList<Type>& sendData,
1011 const int tag = UPstream::msgType(),
1013 const label comm = UPstream::worldComm
1014 );
1015
1016 //- Collect and return data in processor order on master
1017 //- (in serial: performs a simple copy).
1018 // Communication with default/specified communicator, message tag.
1019 //
1020 // \return output (master), zero-sized on non-master
1021 template<class Type, class Addr, class OutputContainer = List<Type>>
1022 [[nodiscard]]
1023 static OutputContainer gatherOp
1024 (
1025 const IndirectListBase<Type, Addr>& sendData,
1026 const int tag = UPstream::msgType(),
1028 const label comm = UPstream::worldComm
1030
1031 //- Inplace collect data in processor order on master
1032 //- (in serial: a no-op).
1033 // Communication with default/specified communicator, message tag.
1034 //
1035 // After the gather, the field is zero-sized on non-master.
1036 template<class Type>
1037 static void gatherInplaceOp
1038 (
1040 List<Type>& fld,
1041 const int tag = UPstream::msgType(),
1043 const label comm = UPstream::worldComm
1044 );
1045
1046
1047 // Scatter
1048
1049 //- Distribute data in processor order.
1050 // Requires fld to be correctly sized!
1051 // Communication with default/specified communicator, message tag.
1052 template<class ProcIDsContainer, class Type>
1053 static void scatter
1054 (
1055 const labelUList& offsets,
1056 const label comm,
1057 const ProcIDsContainer& procIDs,
1058 const UList<Type>& allFld,
1060 const int tag = UPstream::msgType(),
1062 );
1063
1064 //- Distribute data in processor order.
1065 // Requires fld to be correctly sized!
1066 // Communication with default/specified communicator, message tag.
1067 // \note the globalIndex offsets needed on master only.
1068 template<class ProcIDsContainer, class Type>
1069 void scatter
1070 (
1071 const label comm,
1072 const ProcIDsContainer& procIDs,
1073 const UList<Type>& allFld,
1075 const int tag = UPstream::msgType(),
1077 ) const
1078 {
1079 scatter(offsets_, comm, procIDs, allFld, fld, tag, commsType);
1080 }
1081
1082 //- Distribute data in processor order.
1083 // Requires fld to be correctly sized!
1084 // Communication with default/specified communicator, message tag.
1085 // \note the globalIndex offsets needed on master only.
1086 template<class Type>
1087 void scatter
1088 (
1089 const UList<Type>& allData,
1090 UList<Type>& localData,
1091 const int tag = UPstream::msgType(),
1093 const label comm = UPstream::worldComm
1094 ) const;
1095
1096 //- Distribute data in processor order
1097 //- (in serial: performs a simple copy).
1098 // Communication with default/specified communicator, message tag.
1099 // \note the globalIndex offsets needed on master only.
1100 template<class Type, class OutputContainer = List<Type>>
1101 [[nodiscard]]
1102 OutputContainer scatter
1103 (
1104 const UList<Type>& allData,
1105 const int tag = UPstream::msgType(),
1107 const label comm = UPstream::worldComm
1108 ) const;
1109
1110
1111 // Scatter
1112
1113 //- Get (potentially remote) data.
1114 //- Elements required given as global indices
1115 // Communication with default/specified communicator, message tag.
1116 template<class Type, class CombineOp>
1117 void get
1119 List<Type>& allFld,
1120 const labelUList& globalIds,
1121 const CombineOp& cop,
1122 const label comm = UPstream::worldComm,
1123 const int tag = UPstream::msgType()
1124 ) const;
1125
1126
1127 // Member Operators
1128
1129 //- Compare for equality - uses the offsets
1130 bool operator==(const globalIndex& rhs) const
1131 {
1132 return (this->offsets() == rhs.offsets());
1133 }
1134
1135 //- Compare for inequality - uses the offsets
1136 bool operator!=(const globalIndex& rhs) const
1137 {
1138 return !(*this == rhs);
1139 }
1140
1141 //- Compare for less-than - uses the offsets
1142 bool operator<(const globalIndex& rhs) const
1143 {
1144 return (this->offsets() < rhs.offsets());
1145 }
1146
1147
1148 // IOstream Operators
1149
1150 friend Istream& operator>>(Istream& is, globalIndex& gi);
1151 friend Ostream& operator<<(Ostream& os, const globalIndex& gi);
1152
1153
1154 // Housekeeping
1155
1156 //- Construct from local size, using gather/broadcast
1157 //- with default/specified communicator if parallel.
1158 FOAM_DEPRECATED_FOR(2022-03, "construct without message tag")
1160 (
1161 label localSize,
1162 const int tag, // message tag (unused)
1163 const label comm, // communicator
1164 const bool parallel // use parallel comms
1165 )
1166 {
1167 reset(localSize, comm, parallel);
1168 }
1169
1170 //- Reset from local size, using gather/broadcast
1171 //- with default/specified communicator if parallel.
1172 FOAM_DEPRECATED_FOR(2022-03, "reset without message tag")
1173 void reset
1174 (
1175 label localSize,
1176 const int tag, // message tag (unused)
1177 const label comm, // communicator
1178 const bool parallel // use parallel comms
1179 )
1180 {
1181 reset(localSize, comm, parallel);
1182 }
1183
1184 //- Prefer localStart() to avoid confusing with offsets()
1185 FOAM_DEPRECATED_FOR(2022-02, "use localStart()")
1186 label offset(const label proci) const { return localStart(proci); }
1188
1189
1190// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1191
1192} // End namespace Foam
1193
1194// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1195
1196#include "globalIndexI.H"
1197
1198// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1199
1200#ifdef NoRepository
1201 #include "globalIndex.txx"
1202#endif
1203
1204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1205
1206#endif
1207
1208// ************************************************************************* //
label n
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
A packed storage of objects of type <T> using an offset table for access.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
An interval of (signed) integers defined by a start and a size.
Definition IntRange.H:69
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A tuple of integers comprising start, size, total.
Definition OffsetRange.H:82
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
Inter-processor communications stream.
Definition UPstream.H:69
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
Definition UPstream.H:1706
commsTypes
Communications types.
Definition UPstream.H:81
@ nonBlocking
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
Definition UPstream.H:84
static int & msgType() noexcept
Message tag of standard messages.
Definition UPstream.H:1926
static bool is_parallel(const label communicator=worldComm)
True if parallel algorithm or exchange is required.
Definition UPstream.H:1743
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
Definition UPstream.H:1069
Forward input iterator with const access that is used to iterate across the globalIndex offsets() tab...
label index() const noexcept
The index into the arrays.
const_iterator(const globalIndex *globalIdx, const label i=0) noexcept
Construct from globalIndex list at given index.
label start() const
The local start.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
Definition globalIndex.H:77
globalIndex() noexcept=default
Default construct (empty).
label size_type
The type that can represent the size.
bool single() const noexcept
True if local-only content (ie, nProcs == 1). Such content is often created with gatherNone.
label localEnd(const label proci) const
End of proci data.
const const_iterator end() const noexcept
A const_iterator set to beyond the end.
void gatherInplace(List< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
Inplace collect data in processor order on master (in serial: a no-op).
bool operator<(const globalIndex &rhs) const
Compare for less-than - uses the offsets.
label maxSize() const
Global max of localSizes.
void scatter(const label comm, const ProcIDsContainer &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking) const
Distribute data in processor order.
static void gather(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const IndirectListBase< Type, Addr > &fld, UList< Type > &allFld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
Collect indirect data in processor order on master.
static labelList calcOffsets(const labelUList &counts, const bool checkOverflow=false)
Calculate offsets from a list of local sizes, with optional check for label overflow.
label totalSize() const noexcept
The total addressed size, which corresponds to the end offset and also the sum of all localSizes.
static void gatherInplaceOp(List< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
Inplace collect data in processor order on master (in serial: a no-op).
void gather(const UList< Type > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
Collect data in processor order on master (in serial: performs a simple copy).
label localSize() const
Local size on myProcNo().
const_iterator cbegin() const noexcept
A const_iterator set to the beginning.
static void gather(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, UList< Type > &allFld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
Collect data in processor order on master (== procIDs[0]).
static OutputContainer gatherOp(const UList< Type > &sendData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
Collect and return data in processor order on master (in serial: performs a simple copy).
static void mpiGatherOp(const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType())
Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy).
const const_iterator cend() const noexcept
A const_iterator set to beyond the end.
static IntType calcOffset(IntType localSize, const label comm=UPstream::worldComm)
Based on the local input size(s), calculate a globally-consistent local start offset.
void get(List< Type > &allFld, const labelUList &globalIds, const CombineOp &cop, const label comm=UPstream::worldComm, const int tag=UPstream::msgType()) const
Get (potentially remote) data. Elements required given as global indices.
bool empty() const noexcept
Check for default constructed or total-size == 0.
static List< IntType > calcRecvSizes(IntType localSize, const label comm=UPstream::worldComm)
Get the receive sizes. On master the length == nProcs and element [0] corresponds to the max of all o...
friend Ostream & operator<<(Ostream &os, const globalIndex &gi)
labelRange range() const
Return start/size range of local (myProcNo) data.
static OutputContainer mpiGatherOp(const UList< Type > &sendData, const label comm=UPstream::worldComm, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType())
Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy).
List< labelRange > ranges() const
Return start/size ranges for all data.
static const globalIndex & null() noexcept
Return a null globalIndex (reference to a nullObject). Behaves like an empty globalIndex.
label findProcBelow(const label proci, const label i) const
Find processor below proci with specified global id - binary search.
label toLocal(const label proci, const label i) const
From global to local on proci.
label maxNonLocalSize(const label proci) const
The max of localSizes, excluding the specified processor.
OffsetRange< label > slice(label proci) const noexcept
Return start/size/total slab addressing for proci data.
label span() const noexcept
The span size covered by the offsets, zero if empty.
label localStart() const
Local start on myProcNo().
label findProc(const label proci, const label i) const
Find processor with specified global id. Check proci first, followed by binary search.
label nProcs() const noexcept
The number of processors covered by the offsets, same as the primary length().
void inplaceToGlobal(const label proci, labelUList &labels) const
From local to global index on proci (inplace).
labelList localSizes() const
The local sizes.
const labelUList localStarts() const
The local starts.
static labelList calcOffsets(const IndirectListBase< label, Addr > &counts, const bool checkOverflow=false)
Calculate offsets from an indirect list of local sizes, with optional check for label overflow.
void resize(const label n)
Change the number of entries (nProcs) in the offsets table. Extending will fill with empty local size...
static void gatherOp(const UList< Type > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
Collect data in processor order on master (in serial: performs a simple copy).
labelRange range(label proci) const noexcept
Return start/size range of proci data.
label end_value() const noexcept
The value corresponding to the last offset (end offset), which is 1 beyond the end of the range.
label length() const noexcept
The number of items covered by the offsets.
label offset(const label proci) const
Prefer localStart() to avoid confusing with offsets().
labelRange subProcs() const noexcept
Range of process indices for addressed sub-offsets (processes).
void mpiGather(const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const
Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy).
void gather(const IndirectListBase< Type, Addr > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
Collect data indirectly in processor order on master (in serial: performs a simple copy).
static void scatter(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
Distribute data in processor order.
void gather(const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking) const
Collect data in processor order on master (== procIDs[0]).
OutputContainer mpiGather(const UList< Type > &sendData, const label comm=UPstream::worldComm, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const
Use MPI_Gatherv call for contiguous data when possible (in serial: performs a simple copy).
void setLocalSize(const label proci, const label len)
Alter local size for given processor.
bool splitNodeOffsets(labelList &interNodeOffsets, labelList &localNodeOffsets, const label communicator=UPstream::worldComm, const bool absoluteLocalNodeOffsets=false) const
Split the top-level offsets into inter-node and local-node components suitable to a two-stage hierarc...
static std::enable_if_t< std::is_integral_v< IntType >, IntRange< IntType > > calcRange(IntType localSize, const label comm=UPstream::worldComm)
Based on the local input size(s), calculate a globally-consistent range (offset/size).
label whichProcID(const label proci, const label i) const
Which processor does global id come from? Checks proci first (assumed to occur reasonably frequently)...
bool isLocal(const label proci, const label i) const
Is on processor proci.
bool contains(const label i) const noexcept
True if contained within the offsets range.
labelList sizes() const
The local sizes. Same as localSizes().
static void gatherInplace(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
Inplace collect in processor order on master (== procIDs[0]).
labelRange front() const
The first offset range. It is (0,0) if globalIndex is empty.
label value_type
Type of values contained.
label toGlobal(const label proci, const label i) const
From local to global on proci.
static void mpiGatherInplaceOp(List< Type > &fld, const label comm=UPstream::worldComm, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType())
Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op).
label localStart(const label proci) const
Start of proci data.
static labelList calcListOffsets(const List< SubListType > &lists, const bool checkOverflow=false)
Calculate offsets from list of lists, with optional check for label overflow.
label size() const noexcept
Global sum of localSizes. Same as totalSize().
labelRange back() const
The last offset range. It is (0,0) if globalIndex is empty.
labelRange allProcs() const noexcept
Range of process indices for all addressed offsets (processes).
void clear()
Reset to be empty (no offsets).
void scatter(const UList< Type > &allData, UList< Type > &localData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
Distribute data in processor order.
void gatherInplace(const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking) const
Inplace collect in processor order on master (== procIDs[0]).
OutputContainer gather(const UList< Type > &sendData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
Collect data in processor order on master (in serial: performs a simple copy).
static std::enable_if_t< std::is_integral_v< IntType >, IntRange< IntType > > calcRange(IntType localSize, const label comm, const bool checkOverflow)
Based on the local input size(s), calculate a globally-consistent range (offset/size)....
const_iterator begin() const noexcept
A const_iterator set to the beginning.
void reset(label localSize, const label comm=UPstream::worldComm, const bool parallel=UPstream::parRun())
Reset from local size, using gather/broadcast with default/specified communicator if parallel.
label localSize(const label proci) const
Size of proci data.
label begin_value() const noexcept
The value corresponding to the first offset.
void mpiGatherInplace(List< Type > &fld, const label comm=UPstream::worldComm, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType()) const
Use MPI_Gatherv call to inplace collect contiguous data when possible. (in serial: a no-op).
friend Istream & operator>>(Istream &is, globalIndex &gi)
const labelList & offsets() const noexcept
Const-access to the offsets.
OutputContainer scatter(const UList< Type > &allData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
Distribute data in processor order (in serial: performs a simple copy).
static List< labelRange > calcRanges(const labelUList &counts, const bool checkOverflow=false)
Calculate ranges (offset/size) from a list of local sizes, with optional check for label overflow.
bool operator!=(const globalIndex &rhs) const
Compare for inequality - uses the offsets.
label findProcAbove(const label proci, const label i) const
Find processor above proci with specified global id - binary search.
static void gatherOp(const IndirectListBase< Type, Addr > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
Collect data in processor order on master (in serial: performs a simple copy).
static List< Type > listGatherValues(const label comm, const ProcIDsContainer &procIDs, const Type &localValue, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
Collect single values in processor order on master (== procIDs[0]).
OutputContainer gather(const IndirectListBase< Type, Addr > &sendData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm) const
Collect data indirectly in processor order on master.
static OutputContainer gatherOp(const IndirectListBase< Type, Addr > &sendData, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
Collect and return data in processor order on master (in serial: performs a simple copy).
bool operator==(const globalIndex &rhs) const
Compare for equality - uses the offsets.
A range or interval of labels defined by a start and a size.
Definition labelRange.H:66
limits reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL))
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
const T & NullObjectRef() noexcept
Const reference (of type T) to the nullObject.
Definition nullObject.H:228
List< label > labelList
A List of labels.
Definition List.H:62
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
const direction noexcept
Definition scalarImpl.H:265
UList< label > labelUList
A UList of labels.
Definition UList.H:75
#define FOAM_DEPRECATED_FOR(since, replacement)
Definition stdFoam.H:43
#define FOAM_DEPRECATED_STRICT(since, replacement)
Definition stdFoam.H:53
Dispatch tag: Construct 'one-sided' from the non-master local sizes using gather but no broadcast.
Dispatch tag: Construct with a single (local size) entry, no communication.
Dispatch tag: Construct 'one-sided' from local sizes, using gather but no broadcast.