Go to the documentation of this file.
39 if (listOffsets.
size() > 1)
41 offsets_ = listOffsets;
51 if (listOffsets.
size() > 1)
53 offsets_.transfer(listOffsets);
68 if (accType == accessType::SIZES)
70 reset(offsetsOrSizes);
72 else if (offsetsOrSizes.
size() > 1)
75 offsets_ = offsetsOrSizes;
88 const label localSize,
94 reset(localSize, tag, comm, parallel);
102 return offsets_.empty() || offsets_.last() == 0;
108 const label len = (offsets_.size() - 1);
109 return (len < 1) ?
static_cast<label
>(0) : len;
116 const label len = (offsets_.size() - 1);
124 const label len = (offsets_.size() - 2);
143 const label len = (offsets_.size() - 1);
153 return offsets_.empty() ?
static_cast<label
>(0) : offsets_.last();
165 return offsets_[proci];
171 return offsets_[proci];
183 return offsets_[proci+1] - offsets_[proci];
196 return maxNonLocalSize(-1);
208 return labelRange(offsets_[proci], offsets_[proci+1] - offsets_[proci]);
220 return i >= offsets_[proci] && i < offsets_[proci+1];
236 return i + offsets_[proci];
253 inplaceToGlobal(proci, result);
274 const label off = offsets_[proci];
276 for (label& val : labels)
292 const label locali = i - offsets_[proci];
294 if (locali < 0 || i >= offsets_[proci+1])
297 <<
"Global " << i <<
" does not belong on processor "
298 << proci <<
nl <<
"Offsets:" << offsets_
313 if (i < 0 || i >= size())
316 <<
"Global " << i <<
" does not belong on any processor."
317 <<
" Offsets:" << offsets_
349 return (*parent_).localStart(proci_);
356 return (*parent_).localSize(proci_);
363 return (*parent_).range(proci_);
370 return this->
range();
413 Foam::globalIndex::const_iterator::
419 return (proci_ == iter.proci_);
424 Foam::globalIndex::const_iterator::
430 return (proci_ != iter.proci_);
label start() const
The local start.
labelRange allProcs() const noexcept
Range of process indices for all addressed offsets (processes)
label localStart() const
My local start.
labelRange range() const
Return start/size range of local processor data.
labelRange operator*() const
The local range.
label localSize() const
My local size.
bool isLocal(const label i) const
Is on local processor.
void inplaceToGlobal(labelList &labels) const
From local to global index (inplace)
bool empty() const
Check for default constructed or global sum == 0.
label maxSize() const
Global max of localSizes.
Forward input iterator with const access.
const_iterator(const globalIndex *globalIdx, const label proci=0) noexcept
Construct from globalIndex list at given index.
label findLower(const ListType &input, const T &val, const label start, const ComparePredicate &comp)
accessType
Disambiguation tag (list construction dispatch)
const const_iterator end() const noexcept
A const_iterator set to beyond the end.
A range or interval of labels defined by a start and a size.
SubList< T > subList
Declare type of subList.
label size() const
The local size.
const labelUList localStarts() const
The local starts.
errorManip< error > abort(error &err)
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.
labelRange subProcs() const noexcept
Range of process indices for addressed sub-offsets (processes)
meshPtr reset(new Foam::fvMesh(Foam::IOobject(regionName, runTime.timeName(), runTime, Foam::IOobject::MUST_READ), false))
const const_iterator cend() const noexcept
A const_iterator set to beyond the end.
const_iterator & operator--()
label toLocal(const label i) const
From global to local on current processor.
labelRange range() const
The local range.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static int & msgType() noexcept
Message tag of standard messages.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
label size() const
Global sum of localSizes.
label proci() const noexcept
The associated local proc.
label nProcs() const noexcept
The number of processors covered by the offsets.
static label worldComm
Default communicator (all processors)
const labelList & offsets() const noexcept
Const-access to the offsets.
label maxNonLocalSize() const
The max of localSizes, excluding current processor.
label whichProcID(const label i) const
Which processor does global come from? Binary search.
const_iterator cbegin() const noexcept
A const_iterator set to the beginning.
globalIndex()=default
Default construct.
label offset(const label proci) const
Start of proci data.
const_iterator begin() const noexcept
A const_iterator set to the beginning.
Various functions to operate on Lists.
void size(const label n)
Older name for setAddressableSize.
static const UList< T > & null()
Return a UList reference to a nullObject.
const_iterator & operator++()
label toGlobal(const label i) const
From local to global index.