43 if (oldId >= map.
size())
46 <<
"Illegal content " << oldId <<
" of set:" <<
name()
47 <<
" of type " <<
type() <<
nl 48 <<
"Value should be between [0," << map.
size() <<
')' 58 for (
const label oldId : labels)
60 const label newId = map[oldId];
78 const label len = map.
size();
82 for (
const label oldId : labels)
84 const label newId = map[oldId];
88 labels.transfer(newLabels);
94 const bitSet& labels = selected_;
96 const label oldId = labels.find_last();
101 <<
"Illegal content " << oldId <<
" of set:" <<
name()
102 <<
" of type " <<
type() <<
nl 103 <<
"Value should be between [0," << maxSize <<
')' 114 const polyMesh&
mesh,
123 mesh.time().constant(),
127 IOobject::NO_REGISTER
136 const polyMesh&
mesh,
144 selected_.
resize(size, val);
182 return selected_.test(
id);
188 return selected_.test(
id);
194 return selected_.set(
id);
200 return selected_.unset(
id);
206 selected_.set(labels);
212 selected_.unset(labels);
218 selected_.resize(maxLen);
227 const auto* topoBitsPtr = isA<topoBitSet>(
set);
231 selected_ &= topoBitsPtr->selected_;
233 else if (
set.empty())
239 for (
const label
id : selected_)
253 bitSet newLabels(selected_.size());
255 for (
const label
id : elems)
257 if (selected_.test(
id))
262 selected_.transfer(newLabels);
269 const auto* topoBitsPtr = isA<topoBitSet>(
set);
273 selected_ |= topoBitsPtr->selected_;
277 for (
const label
id :
set)
287 selected_.set(elems);
294 const auto* topoBitsPtr = isA<topoBitSet>(
set);
298 selected_ -= topoBitsPtr->selected_;
302 for (
const label
id :
set)
312 selected_.unset(elems);
void size(const label n)
Older name for setAddressableSize.
void set(const bitSet &bitset)
Set specified bits from another bitset.
virtual void subtractSet(const labelUList &elems)
Subtract given elements from the set.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
virtual void updateLabels(const labelUList &map)
Update map from map.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const word & name() const noexcept
Return the object name.
label find_last() const
Locate the last bit set.
constexpr char nl
The newline '\n' character (0x0a)
Base for a special purpose topoSet using labels stored as a bitSet.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool found(const label id) const
Has the given index?
UList< label > labelUList
A UList of labels.
void resize(const label numElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
label size() const noexcept
The number of elements in table.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
virtual void invert(const label maxLen)
Invert contents.
virtual void subset(const labelUList &elems)
Subset contents. Only elements present in both sets remain.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
errorManip< error > abort(error &err)
virtual void check(const label maxSize)
Check limits on addressable range.
void resize(label newCapacity)
Rehash the hash table with new number of buckets. Currently identical to setCapacity() ...
General set of labels of mesh quantity (points, cells, faces).
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
topoBitSet(const polyMesh &mesh, const word &setName)
Construct (no-read) with empty selection.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Mesh consisting of general polyhedral cells.
virtual bool unset(const label id)
Unset an index.
virtual bool contains(const label id) const
Has the given index?
virtual bool set(const label id)
Set an index.
virtual void addSet(const labelUList &elems)
Add given elements to the set.