30inline Foam::label Foam::bitSet::first_not_block()
const
46 for (label blocki=0; blocki < nblocks; ++blocki)
56 for (label blocki=0; blocki < nblocks-1; ++blocki)
141 std::initializer_list<label> locations
146 setMany(locations.begin(), locations.end());
190 const unsigned int mask = (
max_value << shift_);
207 const unsigned int val
255 pos_ = set_->find_next(pos_);
265 return (iter.pos_ == pos_);
274 return (iter.pos_ != pos_);
320 for (label blocki = 0; blocki < nblocks; ++blocki)
326 unsigned int blockval =
blocks_[blocki];
345 const label blocki = first_not_block();
358 unsigned int blockval = ~(
blocks_[blocki]);
381 unsigned int blockval =
blocks_[blocki];
404 if (pos < 0 || pos >=
size())
415 unsigned int blockval = (
blocks_[blocki] >> off);
430 for (++blocki; blocki < nblocks; ++blocki)
436 unsigned int blockval =
blocks_[blocki];
457 return NullObjectRef<bitSet>();
463 if (
empty())
return true;
465 return -1 == first_not_block();
475 for (label blocki=0; blocki < nblocks; ++blocki)
502 unsigned int total = 0;
506 for (label blocki = 0; blocki < nblocks; ++blocki)
514 return (
unsigned(
size()) - total);
576 const unsigned int blockval = (val ? ~0u : 0u);
578 for (label blocki=0; blocki < nblocks; ++blocki)
640 for (label blocki=0; blocki < nblocks; ++blocki)
651 if (i >= 0 && i <
size())
660 if (maxSize <
size())
677 if (
size() < minSize)
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
iterator end()
Return an iterator at end of list.
iterator begin()
Return an iterator at begin of list.
virtual char fill() const =0
Get padding character.
A dynamic list of packed unsigned integers, with the number of bits per item specified by the <Width>...
void swap(PackedList< Width > &rhs)
Swap contents with argument.
void checkIndex(const label i) const
Check index is within valid range [0,size)
static constexpr block_type mask_lower(unsigned elementOffset)
Masking for all bits below the element offset.
block_container blocks_
The blocks of raw data.
bool empty() const noexcept
True if the list is empty (ie, size() is zero).
void resize(const label numElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
static constexpr block_type max_value
void clear_trailing_bits()
Clear any partial rubbish in the last addressable block.
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.
void operator=(const PackedList< Width > &lst)
Copy assignment.
static constexpr unsigned elem_per_block
The number of elements stored per data block.
static constexpr label num_blocks(label numElem) noexcept
void clear()
Clear the list, i.e. set addressable size to zero.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
iterator begin() noexcept
Return an iterator to begin traversing the UList.
iterator end() noexcept
Return an iterator to end traversing the UList.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A const_iterator for iterating across on values.
const_iterator & operator++()
Move to the next on position.
label operator*() const noexcept
Return the current on position.
A reference supporting read/write access to an entry.
void flip()
Flip the bit at the position, no range-checking.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void fill(const bool val)
Assign all entries to the given value.
const_iterator cbegin() const
Iterator set to the position of the first on bit.
void flip()
Invert all bits in the addressable region.
label find_last() const
Locate the last bit set.
labelList sortedToc() const
The indices of the on bits as a sorted labelList.
static const bitSet & null()
Return a null bitSet reference.
const_iterator end() const noexcept
Iterator beyond the end of the bitSet.
void set(const bitSet &bitset)
Set specified bits from another bitset.
bitSet & operator-=(const bitSet &other)
Remove entries from this list - identical to the unset() method.
bitSet & operator|=(const bitSet &other)
Bitwise-OR operator - similar to the set() method.
void transfer(bitSet &bitset)
bool none() const
True if no bits in this bitset are set.
autoPtr< bitSet > clone() const
Clone.
bool test(const label pos) const
Test value at specified position, never auto-vivify entries.
bitSet & bound(const label maxSize)
Ensure the addressable range does not exceed maxSize.
label find_first_not() const
Locate the first bit that is unset.
bitSet & xorEq(const bitSet &other)
The set logical XOR.
bool all() const
True if all bits in this bitset are set or if the set is empty.
labelList toc() const
The indices of the on bits as a sorted labelList.
const_iterator begin() const
Iterator set to the position of the first on bit.
void assign(const UList< bool > &bools)
Copy assign all entries from a list of bools.
bitSet & operator&=(const bitSet &other)
Bitwise-AND all the bits in other with the bits in this bitset.
bool uniform() const
True if all entries have identical values, and the set is non-empty.
void resize_last()
Resize to include the last on bit only.
bitSet() noexcept
Default construct an empty, zero-sized bitSet.
bitSet & andEq(const bitSet &other)
The set logical AND.
bitSet & orEq(const bitSet &other)
The set logical OR.
bitSet & operator^=(const bitSet &other)
Bitwise-XOR operator - retains unique entries.
bitSet & unset(const bitSet &other)
void swap(bitSet &bitset)
Swap contents.
label setMany(InputIter first, InputIter last)
const_iterator cend() const noexcept
Iterator beyond the end of the bitSet.
label find_next(label pos) const
Locate the next bit set, starting one beyond the specified position.
bitSet & minusEq(const bitSet &other)
The set difference.
bool any() const
True if any bits in this bitset are set.
bitSet & extend(const label minSize)
Ensure that minSize is covered by the bitSet.
unsigned int operator[](const label i) const
Identical to get() - get value at index.
label find_first() const
Locate the first bit that is set.
bitSet & operator=(const bitSet &bitset)
Copy assignment.
Ostream & operator()() const
Output stream (master only).
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
Computes a field whose values are offset to a reference value obtained by from a Function1.
transferModelList & transfer()
Transfer.
bool set() const
Are all the vector set.
unsigned int bit_count(UIntType x)
Count arbitrary number of bits (of an integral type)
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Unary negation.
bitSet operator~(const bitSet &bitset)
Bitset complement, returns a copy of the bitset with all its bits flipped.
dimensionedScalar pos(const dimensionedScalar &ds)
bitSet operator|(const bitSet &a, const bitSet &b)
Bitwise-OR of two bitsets.
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
bitSet operator^(const bitSet &a, const bitSet &b)
Bitwise-XOR of two bitsets to form a unique bit-set.