Go to the documentation of this file.
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())
161 for (; elemi < this->size()-1; ++elemi)
164 if (currRange.
overlaps(nextRange,
true))
166 currRange.
join(nextRange);
180 else if (
range < currRange)
182 insertBefore(elemi,
range);
199 if (
range.empty() || this->empty())
218 Info<<
"Fragment removal ";
236 insertBefore(elemi, fragment);
250 else if (
range.first() <= currRange.
last())
256 Info<<
"RHS removal ";
283 Info<<
"LHS removal ";
321 os << static_cast<const labelRanges::StorageContainer&>(ranges);
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
labelRanges()=default
Default construct.
labelRange join(const labelRange &range) const
Return a joined range, squashing any gaps in between.
bool add(const labelRange &range)
Add the range to the list.
void clear() noexcept
Reset to zero start and zero size.
Istream & operator>>(Istream &, directionInfo &)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void reset(const label beg, const label end, const bool adjustStart) noexcept
Reset start and length, enforces non-negative size.
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
#define forAll(list, i)
Loop across all elements in list.
bool overlaps(const labelRange &range, bool touches=false) const
Return true if the ranges overlap.
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.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
messageStream Info
Information stream (stdout output on master, null elsewhere)
static Ostream & printRange(Ostream &os, const labelRange &range)
A range or interval of labels defined by a start and a size.
OBJstream os(runTime.globalPath()/outputName)
static int debug
Debugging.
IntType first() const noexcept
The (inclusive) lower value of the range. Same as start()
Foam::labelRange remove()
Remove and return the last element. Fatal on an empty list.
Various functions to operate on Lists.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
void clampSize() noexcept
Enforce non-negative size.
IntType last() const noexcept
The (inclusive) upper value of the range.