36 void Foam::labelRanges::insertBefore
39 const labelRange& range
47 Info<<
"before insert " 48 << nElem <<
" elements, insert at " << insert <<
nl 56 Info<<
"copy between " << nElem <<
" and " << insert <<
nl;
63 Info<<
"copy from " << (i) <<
" to " << (i+1) <<
nl;
72 Info<<
"finally insert the range at " << insert <<
nl;
78 void Foam::labelRanges::purgeEmpty()
102 const labelRange& range
111 os << range <<
" = " << range.first() <<
":" << range.last();
133 else if (this->
empty())
150 for (; elemI < this->
size()-1; ++elemI)
155 currRange += nextRange;
169 else if (range < currRange)
171 insertBefore(elemI, range);
199 if (range.
last() < currRange.
last())
205 Info<<
"Fragment removal ";
206 printRange(
Info, range) <<
" from ";
207 printRange(
Info, currRange) <<
endl;
214 labelRange fragment(lower, upper - lower + 1);
217 lower = range.
last() + 1;
218 upper = currRange.
last();
220 currRange =
labelRange(lower, upper - lower + 1);
222 insertBefore(elemI, fragment);
229 printRange(
Info, currRange) <<
endl;
236 else if (range.
first() <= currRange.
last())
242 Info<<
"RHS removal ";
243 printRange(
Info, range) <<
" from ";
244 printRange(
Info, currRange) <<
endl;
250 currRange =
labelRange(lower, upper - lower + 1);
256 printRange(
Info, currRange) <<
endl;
268 Info<<
"LHS removal ";
269 printRange(
Info, range) <<
" from ";
270 printRange(
Info, currRange) <<
endl;
276 currRange =
labelRange(lower, upper - lower + 1);
282 printRange(
Info, currRange) <<
endl;
305 os << static_cast<const labelRanges::ParentType&>(ranges);
#define forAll(list, i)
Loop across all elements in list.
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
Return true if the UList is empty (ie, size() is zero)
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.
bool add(const labelRange &)
Add the range to the list.
label first() const
The (inclusive) lower value of the range.
Various functions to operate on Lists.
void setSize(const label)
Alter the addressed list size.
Istream & operator>>(Istream &, directionInfo &)
bool intersects(const labelRange &, const bool touches=false) const
Return true if the ranges intersect.
timeIndices insert(timeIndex, timeDirs[timeI].value())
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 size() const
Return the number of elements in the UList.
labelRange remove()
Remove and return the top element.
bool empty() const
Is the range empty?
Ostream & operator<<(Ostream &, const ensightPart &)
label last() const
The (inclusive) upper value of the range.
friend Ostream & operator(Ostream &, const DynamicList< labelRange, 0, 2, 1 > &)