34void Foam::globalIndex::reportOverflowAndExit
37 const labelUList& localLens
41 <<
"Overflow : sum of sizes exceeds labelMax ("
42 <<
labelMax <<
") after index " << idx;
44 if (!localLens.empty())
51 <<
"Please recompile with larger datatype for label." <<
nl
57Foam::globalIndex::calcOffsets
60 const bool checkOverflow
65 const label len = localLens.size();
72 for (label i = 0; i < len; ++i)
75 start += localLens[i];
77 if (checkOverflow && start < values[i])
79 reportOverflowAndExit(i, localLens);
90Foam::globalIndex::calcRanges
93 const bool checkOverflow
98 const label len = localLens.size();
105 for (label i = 0; i < len; ++i)
107 values[i].reset(start, localLens[i]);
108 start += localLens[i];
110 if (checkOverflow && start < values[i].start())
112 reportOverflowAndExit(i, localLens);
132Foam::globalIndex::bin
145 if (globalIds.
size())
153 const label
id = binValues[0];
159 for (label i = 1; i < order.
size(); i++)
161 const label
id = binValues[i];
163 if (
id < offsets[proci+1])
170 label oldProci = proci;
174 for (label j = oldProci+1; j < proci; ++j)
176 binOffsets[j] = binOffsets[oldProci]+binSize;
178 binOffsets[proci] = i;
184 for (label j = proci+1; j < binOffsets.
size(); ++j)
186 binOffsets[j] = binOffsets[proci]+binSize;
196 const label localSize,
208 const label localSize,
232 reset(localLens,
true);
245 const bool checkOverflow
248 const label len = localLens.
size();
252 offsets_.resize_nocopy(len+1);
255 for (label i = 0; i < len; ++i)
258 start += localLens[i];
260 if (checkOverflow && start < offsets_[i])
262 reportOverflowAndExit(i, localLens);
265 offsets_[len] = start;
276 if (proci >= 0 && proci+1 < offsets_.size() && len >= 0)
278 const label
delta = (len - (offsets_[proci+1] - offsets_[proci]));
283 for (label i = proci+1; i < offsets_.size(); ++i)
285 offsets_[i] +=
delta;
296 const label len = (offsets_.size() - 1);
305 for (label proci=0; proci < len; ++proci)
307 values[proci] = offsets_[proci+1] - offsets_[proci];
319 const label len = (offsets_.size() - 1);
328 for (label proci=0; proci < len; ++proci)
333 (offsets_[proci+1] - offsets_[proci])
343 const label len = (offsets_.size() - 1);
352 for (label i=0; i < len; ++i)
356 const label localLen = (offsets_[i+1] - offsets_[i]);
357 maxLen =
max(maxLen, localLen);
369 return is >> gi.offsets_;
375 return os << gi.offsets_;
A packed storage unstructured matrix of objects of type <T> using an offset table for access.
const List< T > & values() const noexcept
Return the packed matrix of values.
const labelList & offsets() const noexcept
Return the offset table (= size()+1)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void append(const T &val)
Copy append an element to the end of this list.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void resize(const label len)
Adjust allocated size of list.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
A List with indirect addressing. Like IndirectList but does not store addressing.
void size(const label n)
Older name for setAddressableSize.
static List< T > listGatherValues(const T &localValue, const label communicator=worldComm)
Gather individual values into list locations.
static bool & parRun() noexcept
Test if this a parallel run.
void reset()
Reset to defaults.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
globalIndex()=default
Default construct.
List< labelRange > ranges() const
Return start/size ranges for all data.
label maxNonLocalSize() const
The max of localSizes, excluding current processor.
void setLocalSize(const label proci, const label len)
Alter local size for given processor.
labelList localSizes() const
The local sizes.
int myProcNo() const noexcept
Return processor number.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< label > labelList
A List of labels.
label findLower(const ListType &input, const T &val, const label start, const ComparePredicate &comp)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Istream & operator>>(Istream &, directionInfo &)
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
static constexpr const zero Zero
Global zero (0)
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a)