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())
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);
199 if (
range.empty() || this->empty())
204 auto& list =
static_cast<StorageContainer&
>(*this);
208 labelRange& currRange = list[elemi];
210 if (
range.first() > currRange.first())
212 if (
range.last() < currRange.last())
218 Info<<
"Fragment removal ";
224 label
lower = currRange.first();
231 upper = currRange.last();
234 currRange.clampSize();
236 insertBefore(elemi, fragment);
250 else if (
range.first() <= currRange.last())
256 Info<<
"RHS removal ";
261 const label
lower = currRange.first();
265 currRange.clampSize();
275 else if (
range.first() <= currRange.first())
277 if (
range.last() >= currRange.first())
283 Info<<
"LHS removal ";
289 const label
upper = currRange.last();
292 currRange.clampSize();
321 os << static_cast<const labelRanges::StorageContainer&>(ranges);
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
labelRange join(const labelRange &range) const
bool add(const labelRange &range)
Istream & operator>>(Istream &, directionInfo &)
Ostream & endl(Ostream &os)
void reset(const label beg, const label end, const bool adjustStart) noexcept
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
bool overlaps(const labelRange &range, bool touches=false) const
Ostream & operator<<(Ostream &, const boundaryPatch &p)
string lower(const std::string &s)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
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)
IntType first() const noexcept
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)
void clampSize() noexcept
IntType last() const noexcept