50 <<
"Perform -= on self: clears all bits" <<
nl;
65 const auto& rhs = other.
blocks_;
67 for (label blocki = 0; blocki < nblocks; ++blocki)
69 blocks_[blocki] &= ~rhs[blocki];
86 <<
"Perform &= on self: ignore" <<
nl;
96 else if (other.
none())
104 const label origSize(size());
105 const label otherSize(other.
size());
107 if (origSize > otherSize)
116 const label nblocks = num_blocks(std::min(origSize, otherSize));
117 const auto& rhs = other.
blocks_;
119 for (label blocki = 0; blocki < nblocks; ++blocki)
121 blocks_[blocki] &= rhs[blocki];
138 <<
"Perform |= on self: ignore" <<
nl;
143 else if (other.
none())
153 if (otherMax >= size())
161 const label nblocks = num_blocks(std::min(size(), other.
size()));
162 const auto& rhs = other.
blocks_;
164 for (label blocki = 0; blocki < nblocks; ++blocki)
166 blocks_[blocki] |= rhs[blocki];
183 <<
"Perform ^= on self: clears all bits" <<
nl;
189 else if (other.
none())
199 if (otherMax >= size())
207 const label nblocks = num_blocks(std::min(size(), other.
size()));
208 const auto& rhs = other.
blocks_;
210 for (label blocki = 0; blocki < nblocks; ++blocki)
212 blocks_[blocki] ^= rhs[blocki];
234 const label len = addr.
size();
236 for (label i = 0; i < len; ++i)
238 set(i, bitset.
get(addr[i]));
248 const label len =
range.size();
250 for (label i = 0; i < len; ++i)
276 const label len = bools.
size();
284 for (label i = 0; i < len; ++i)
296 if (size() && other.
size())
298 const label nblocks = num_blocks(std::min(size(), other.
size()));
299 const auto& rhs = other.
blocks_;
301 for (label blocki = 0; blocki < nblocks; ++blocki)
303 if (
bool(blocks_[blocki] & rhs[blocki]))
331 if (slice.
after() >= size())
333 reserve(slice.
after());
346 unsigned int bblock = slice.
first() / elem_per_block;
347 unsigned int bmask = slice.
first() % elem_per_block;
350 unsigned int eblock = slice.
after() / elem_per_block;
351 unsigned int emask = slice.
after() % elem_per_block;
354 if (bmask) bmask = mask_lower(bmask);
355 if (emask) emask = mask_lower(emask);
357 if (bblock == eblock)
365 blocks_[bblock] |= (emask^bmask);
373 blocks_[bblock] |= (~bmask);
378 for (
unsigned blocki = bblock; blocki < eblock; ++blocki)
380 blocks_[blocki] = (~0u);
387 blocks_[eblock] |= (emask);
408 if (slice.
after() >= size())
411 const label orig = size();
426 unsigned int bblock = slice.
first() / elem_per_block;
427 unsigned int bmask = slice.
first() % elem_per_block;
430 unsigned int eblock = slice.
after() / elem_per_block;
431 unsigned int emask = slice.
after() % elem_per_block;
434 if (bmask) bmask = mask_lower(bmask);
435 if (emask) emask = mask_lower(emask);
437 if (bblock == eblock)
446 blocks_[bblock] &= (~(emask^bmask));
454 blocks_[bblock] &= (bmask);
459 for (
unsigned blocki = bblock; blocki < eblock; ++blocki)
461 blocks_[blocki] = (0u);
468 blocks_[eblock] &= (~emask);
477 const label total = any() ? count() : 0;
489 const label nblocks = num_blocks(size());
490 for (label blocki = 0; blocki < nblocks; ++blocki)
492 unsigned int blockval = blocks_[blocki];
496 for (label
pos = (blocki * elem_per_block); blockval; ++
pos)
505 if (nItem == total)
break;
519 const label nblocks = num_blocks(size());
520 for (label blocki = 0; blocki < nblocks; ++blocki)
522 label
pos = (blocki * elem_per_block);
526 unsigned int blockval = blocks_[blocki];
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
bool empty() const noexcept
True if range is empty (zero-sized)
IntType start() const noexcept
The (inclusive) lower value of the range.
IntType first() const noexcept
The (inclusive) lower value of the range. Same as start()
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A dynamic list of packed unsigned integers, with the number of bits per item specified by the <Width>...
block_container blocks_
The blocks of raw data.
label size() const noexcept
Number of entries.
unsigned int get(const label i) const
Get value at index i or 0 for out-of-range.
static constexpr label num_blocks(label numElem) noexcept
void reset()
Clear all bits but do not adjust the addressable size.
void size(const label n)
Older name for setAddressableSize.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
label find_last() const
Locate the last bit set.
void set(const bitSet &bitset)
Set specified bits from another bitset.
bool none() const
True if no bits in this bitset are set.
bitSet & xorEq(const bitSet &other)
The set logical XOR.
labelList toc() const
The indices of the on bits as a sorted labelList.
void assign(const UList< bool > &bools)
Copy assign all entries from a list of bools.
bitSet() noexcept
Default construct an empty, zero-sized bitSet.
List< bool > values() const
Return the bitset values as a boolList.
bitSet & andEq(const bitSet &other)
The set logical AND.
bitSet & orEq(const bitSet &other)
The set logical OR.
bool intersects(const bitSet &other) const
True if any bits in the other bitset intersect (are the same).
bitSet & minusEq(const bitSet &other)
The set difference.
A range or interval of labels defined by a start and a size.
void adjust() noexcept
Adjust the start to avoid negative indices.
label after() const noexcept
The value after the last element in the range.
bool set() const
Are all the vector set.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
patchWriters resize(patchIds.size())
#define InfoInFunction
Report an information message using Foam::Info.
dimensionedScalar pos(const dimensionedScalar &ds)
List< label > labelList
A List of labels.
static Ostream & output(Ostream &os, const IntRange< T > &range)
constexpr char nl
The newline '\n' character (0x0a)