37 void Foam::labelRanges::insertBefore
40 const labelRange& range
48 Info<<
"before insert " 49 << nElem <<
" elements, insert at " << insert <<
nl 57 Info<<
"copy between " << nElem <<
" and " << insert <<
nl;
64 Info<<
"copy from " << (i) <<
" to " << (i+1) <<
nl;
73 Info<<
"finally insert the range at " << insert <<
nl;
79 void Foam::labelRanges::purgeEmpty()
103 const labelRange& range
112 os << range <<
" = " << range.first() <<
":" << range.last();
134 else if (this->
empty())
151 for (; elemI < this->
size()-1; ++elemI)
156 currRange += nextRange;
170 else if (range < currRange)
172 insertBefore(elemI, range);
200 if (range.
last() < currRange.
last())
206 Info<<
"Fragment removal ";
207 printRange(
Info, range) <<
" from ";
208 printRange(
Info, currRange) <<
endl;
215 labelRange fragment(lower, upper - lower + 1);
218 lower = range.
last() + 1;
219 upper = currRange.
last();
221 currRange =
labelRange(lower, upper - lower + 1);
223 insertBefore(elemI, fragment);
230 printRange(
Info, currRange) <<
endl;
237 else if (range.
first() <= currRange.
last())
243 Info<<
"RHS removal ";
244 printRange(
Info, range) <<
" from ";
245 printRange(
Info, currRange) <<
endl;
251 currRange =
labelRange(lower, upper - lower + 1);
257 printRange(
Info, currRange) <<
endl;
269 Info<<
"LHS removal ";
270 printRange(
Info, range) <<
" from ";
271 printRange(
Info, currRange) <<
endl;
277 currRange =
labelRange(lower, upper - lower + 1);
283 printRange(
Info, currRange) <<
endl;
306 os << static_cast<const labelRanges::ParentType&>(ranges);
#define forAll(list, i)
Loop across all elements in list.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
T & operator[](const label)
Return element of UList.
bool empty() const
Is the range empty?
void clear()
Reset to zero size.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
labelRanges()
Construct null.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void insert(const scalar, DynamicList< floatScalar > &)
Append scalar to given DynamicList.
bool add(const labelRange &)
Add the range to the list.
Various functions to operate on Lists.
void setSize(const label)
Alter the addressed list size.
Istream & operator>>(Istream &, directionInfo &)
DynamicList< labelRange, 0, 2, 1 > & append(const labelRange &)
Append an element at the end of the list.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
label last() const
The (inclusive) upper value of the range.
labelRange remove()
Remove and return the top element.
Ostream & operator<<(Ostream &, const ensightPart &)
label size() const
Return the number of elements in the UList.
bool intersects(const labelRange &, const bool touches=false) const
Return true if the ranges intersect.
friend Ostream & operator(Ostream &, const DynamicList< labelRange, 0, 2, 1 > &)
label first() const
The (inclusive) lower value of the range.