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;
79 void Foam::labelRanges::purgeEmpty()
85 if (!ParentType::operator[](elemI).empty())
89 ParentType::operator[](nElem) = ParentType::operator[](elemI);
103 const labelRange&
range
134 else if (this->empty())
143 labelRange& currRange = ParentType::operator[](elemI);
151 for (; elemI < this->size()-1; ++elemI)
153 labelRange& nextRange = ParentType::operator[](elemI+1);
156 currRange += nextRange;
170 else if (
range < currRange)
172 insertBefore(elemI,
range);
189 if (
range.empty() || this->empty())
196 labelRange& currRange = ParentType::operator[](elemI);
206 Info<<
"Fragment removal ";
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 ";
245 printRange(
Info, currRange) <<
endl;
251 currRange =
labelRange(lower, upper - lower + 1);
257 printRange(
Info, currRange) <<
endl;
269 Info<<
"LHS removal ";
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);
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
labelRange remove()
Remove and return the top element.
void setSize(const label)
Alter the addressed list size.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
label size() const
Return the number of elements in the UList.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
T & operator[](const label)
Return element of UList.
bool intersects(const labelRange &, const bool touches=false) const
Return true if the ranges intersect.
label first() const
The (inclusive) lower value of the range.
label last() const
The (inclusive) upper value of the range.
void clear()
Reset to zero size.
bool add(const labelRange &)
Add the range to the list.
labelRanges()
Construct null.
void insert(const scalar, DynamicList< floatScalar > &)
Append scalar to given DynamicList.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Istream & operator>>(Istream &, pistonPointEdgeData &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
points setSize(newPointi)