94 std::initializer_list<label> locations
99 setMany(locations.begin(), locations.end());
148inline void Foam::bitSet::reference::operator=
158inline void Foam::bitSet::reference::operator=
160 const unsigned int val
167inline Foam::bitSet::reference::operator
unsigned int ()
const
175inline Foam::bitSet::const_iterator::const_iterator()
noexcept
182inline Foam::bitSet::const_iterator::const_iterator(
const bitSet* parent)
189inline Foam::bitSet::const_iterator::const_iterator
208 pos_ = set_->find_next(pos_);
213inline bool Foam::bitSet::const_iterator::operator==
215 const const_iterator& iter
218 return (iter.pos_ == pos_);
222inline bool Foam::bitSet::const_iterator::operator!=
227 return (iter.pos_ != pos_);
279 unsigned int blockval =
blocks_[blocki];
311 unsigned int blockval = ~(
blocks_[blocki]);
334 unsigned int blockval =
blocks_[blocki];
368 unsigned int blockval = (
blocks_[blocki] >> off);
383 for (++blocki; blocki < nblocks; ++blocki)
389 unsigned int blockval =
blocks_[blocki];
410 if (
empty())
return true;
429 unsigned int total = 0;
433 for (label blocki = 0; blocki < nblocks; ++blocki)
441 return (
unsigned(
size()) - total);
559 for (label blocki=0; blocki < nblocks; ++blocki)
579 if (maxSize <
size())
596 if (
size() < minSize)
607 return extend(other.size());
694 result.resize_last();
704 result.resize_last();
714 result.resize_last();
724 result.resize_last();
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.
unsigned shift_
The bit shift to access the given sub-portion.
block_type & ref_
Reference to the block.
label first_block() const
void swap(PackedList< Width > &rhs)
Swap contents with argument.
void checkIndex(const label i) const
bool empty() const noexcept
void resize(const label numElem, const unsigned int val=0u)
static constexpr block_type max_value
void clear_trailing_bits()
void operator=(const PackedList< Width > &list)
Copy assignment.
bool set(const label i, unsigned int val=~0u)
Set value at index i, default value set is the max_value.
unsigned int get(const label i) const
constexpr PackedList() noexcept
static constexpr unsigned elem_per_block
void transfer(PackedList< Width > &rhs)
Transfer the contents of the argument list into this list and annul the argument list.
static constexpr label num_blocks(label numElem) noexcept
label size() const noexcept
label first_not_block() const
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.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A const_iterator for iterating across on values.
label operator*() const noexcept
Return the current on position.
const_iterator & operator++()
Move to the next on position.
A reference supporting read/write access to an entry.
reference(bitSet *parent, const label index)
Construct by taking reference of block from within the list and the specified index.
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...
unsigned int count(const bool on=true) const
Count number of bits set.
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.
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)
Transfer the contents of the argument list into this list and annul the argument list.
bool none() const
True if no bits in this bitset are set.
autoPtr< bitSet > clone() const
Clone.
constexpr bitSet() noexcept
Default construct an empty, zero-sized bitSet.
bool test(const label pos) const
Test for True 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 test_set(const label i, const bool val=true)
Test for True value at specified position and change the value at that position.
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 operator()(const label pos) const
Test value at specified position, same as test().
void resize_last()
Resize to include the last on bit only.
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)
Unset (subtract) the bits specified in the other bitset, which is a set difference corresponds to the...
void swap(bitSet &bitset)
Swap contents.
label setMany(InputIter first, InputIter last)
Set the locations listed by the iterator range, auto-vivify entries if needed.
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.
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.
List< label > labelList
A List of labels.
bitSet operator^(const bitSet &a, const bitSet &b)
Bitwise-XOR of two bitsets to form a unique bit-set.
tmp< GeometricField< Type, faPatchField, areaMesh > > operator&(const faMatrix< Type > &, const DimensionedField< Type, areaMesh > &)
UList< label > labelUList
A UList of labels.