57 void Foam::labelRanges::insertBefore
60 const labelRange&
range 63 auto& list =
static_cast<StorageContainer&
>(*this);
66 label nElem = list.
size();
70 Info<<
"before insert " 71 << nElem <<
" elements, insert at " <<
insert <<
nl 79 Info<<
"copy between " << nElem <<
" and " <<
insert <<
nl;
82 for (label i = nElem-1; i >=
insert; --i)
86 Info<<
"copy from " << (i) <<
" to " << (i+1) <<
nl;
102 void Foam::labelRanges::purgeEmpty()
104 auto& list =
static_cast<StorageContainer&
>(*this);
111 if (!list[elemi].empty())
115 list[nElem] = list[elemi];
142 else if (this->empty())
144 this->push_back(
range);
148 auto& list =
static_cast<StorageContainer&
>(*this);
153 labelRange& currRange = list[elemi];
155 if (currRange.overlaps(
range,
true))
158 currRange.join(
range);
161 for (; elemi < this->size()-1; ++elemi)
163 labelRange& nextRange = list[elemi+1];
164 if (currRange.overlaps(nextRange,
true))
166 currRange.join(nextRange);
180 else if (
range < currRange)
182 insertBefore(elemi,
range);
190 this->push_back(
range);
199 if (
range.empty() || this->empty())
204 auto& list =
static_cast<StorageContainer&
>(*this);
208 labelRange& currRange = list[elemi];
210 if (
range.min() > currRange.min())
212 if (
range.max() < currRange.max())
218 Info<<
"Fragment removal ";
224 label
lower = currRange.min();
231 upper = currRange.max();
234 currRange.clampSize();
236 insertBefore(elemi, fragment);
250 else if (
range.min() <= currRange.max())
256 Info<<
"RHS removal ";
261 const label
lower = currRange.min();
265 currRange.clampSize();
275 else if (
range.min() <= currRange.min())
277 if (
range.max() >= currRange.min())
283 Info<<
"LHS removal ";
289 const label
upper = currRange.max();
292 currRange.clampSize();
321 os << static_cast<const labelRanges::StorageContainer&>(ranges);
labelRanges()=default
Default construct.
void size(const label n)
Older name for setAddressableSize.
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
A range or interval of labels defined by a start and a size.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
static int debug
Debugging.
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
bool add(const labelRange &range)
Add the range to the list.
Istream & operator>>(Istream &, directionInfo &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static Ostream & printRange(Ostream &os, const labelRange &range)
OBJstream os(runTime.globalPath()/outputName)
Foam::labelRange remove()
Remove and return the last element. Fatal on an empty list.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
messageStream Info
Information stream (stdout output on master, null elsewhere)