Go to the documentation of this file.
38 const bool checkOverflow
43 const label len = localSizes.
size();
50 for (label i = 0; i < len; ++i)
53 start += localSizes[i];
55 if (checkOverflow && start <
values[i])
58 <<
"Overflow : sum of sizes exceeds labelMax ("
59 <<
labelMax <<
") after index " << i <<
" of "
61 <<
"Please recompile with larger datatype for label." <<
nl
76 const bool checkOverflow
81 const label len = localSizes.
size();
88 for (label i = 0; i < len; ++i)
90 values[i].reset(start, localSizes[i]);
91 start += localSizes[i];
93 if (checkOverflow && start <
values[i].start())
96 <<
"Overflow : sum of sizes exceeds labelMax ("
97 <<
labelMax <<
") after index " << i <<
" of "
99 <<
"Please recompile with larger datatype for label." <<
nl
119 void Foam::globalIndex::bin
138 if (globalIds.
size())
140 const label
id = bins.
m()[0];
146 for (label i = 1; i < order.size(); i++)
148 const label
id = bins.
m()[i];
150 if (
id < offsets[proci+1])
157 label oldProci = proci;
161 for (label j = oldProci+1; j < proci; ++j)
163 binOffsets[j] = binOffsets[oldProci]+binSize;
165 binOffsets[proci] = i;
171 for (label j = proci+1; j < binOffsets.size(); ++j)
173 binOffsets[j] = binOffsets[proci]+binSize;
181 const label localSize,
201 reset(localSizes,
true);
213 const bool checkOverflow
216 const label len = localSizes.
size();
220 offsets_.resize_nocopy(len+1);
223 for (label i = 0; i < len; ++i)
226 start += localSizes[i];
228 if (checkOverflow && start < offsets_[i])
231 <<
"Overflow : sum of sizes exceeds labelMax ("
232 <<
labelMax <<
") after index " << i <<
" of "
234 <<
"Please recompile with larger datatype for label." <<
nl
238 offsets_[len] = start;
249 if (proci >= 0 && proci+1 < offsets_.size() && len >= 0)
251 const label
delta = (len - (offsets_[proci+1] - offsets_[proci]));
256 for (label i = proci+1; i < offsets_.size(); ++i)
258 offsets_[i] +=
delta;
269 const label len = (offsets_.size() - 1);
278 for (label proci=0; proci < len; ++proci)
280 values[proci] = offsets_[proci+1] - offsets_[proci];
292 const label len = (offsets_.size() - 1);
301 for (label proci=0; proci < len; ++proci)
306 (offsets_[proci+1] - offsets_[proci])
316 const label len = (offsets_.size() - 1);
325 for (label i=0; i < len; ++i)
329 const label localLen = (offsets_[i+1] - offsets_[i]);
330 maxLen =
max(maxLen, localLen);
342 return is >> gi.offsets_;
348 return os << gi.offsets_;
const List< label > & offsets() const
Return the offset table (= size()+1)
const List< T > & m() const
Return the packed matrix of data.
static constexpr const zero Zero
Global zero (0)
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
A packed storage unstructured matrix of objects of type <T> using an offset table for access.
labelList sizes() const
The local sizes.
Istream & operator>>(Istream &, directionInfo &)
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
label findLower(const ListType &input, const T &val, const label start, const ComparePredicate &comp)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
static List< labelRange > calcRanges(const labelUList &localSizes, const bool checkOverflow=false)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
OBJstream os(runTime.globalPath()/outputName)
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
void reset(const label localSize)
Reset from local size.
errorManipArg< error, int > exit(error &err, const int errNo=1)
meshPtr reset(new Foam::fvMesh(Foam::IOobject(regionName, runTime.timeName(), runTime, Foam::IOobject::MUST_READ), false))
List< labelRange > ranges() const
Return start/size ranges for all data.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
void setLocalSize(const label proci, const label len)
Alter local size for given processor.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label maxNonLocalSize() const
The max of localSizes, excluding current processor.
globalIndex()=default
Default construct.
A List with indirect addressing.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
void size(const label n)
Older name for setAddressableSize.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static labelList calcOffsets(const labelUList &localSizes, const bool checkOverflow=false)
static label nProcs(const label communicator=worldComm)
Number of processes in parallel run, and 1 for serial run.