146 inline explicit
bitSet(const label
n);
149 inline
bitSet(const label
n, const
bool val);
206 inline
bitSet(const label
n, std::initializer_list<label> locations);
238 inline
bool all() const;
246 inline
bool none() const;
252 inline
unsigned int count(const
bool on=true) const;
263 bool test(const label
pos)
const {
return this->
get(pos); }
314 inline void fill(
const bool val);
342 bool test_set(
const label i,
const bool val =
true);
375 inline void flip(
const label
pos);
421 template<
class InputIter>
422 label
setMany(InputIter first, InputIter last);
448 template<
class InputIter>
449 label
unset(InputIter first, InputIter last);
497 inline
void operator=(const
reference& other);
500 inline
void operator=(const
unsigned int val);
503 inline operator
unsigned int () const;
532 inline label operator*() const
noexcept;
567 inline
bool operator()(const label
pos) const;
571 inline
unsigned int operator[](const label i) const;
575 inline
reference operator[](const label i);
584 inline
bitSet& operator=(const
bool val);
638 int communicator = -1,
640 bool syncSizes =
true
647 std::pair<int,int> communicator_root,
649 bool syncSizes =
true
656 int communicator = -1,
658 bool syncSizes =
true
665 int communicator = -1,
667 bool syncSizes =
true
681 int communicator = -1
692 int communicator = -1
703 void assign(
const unsigned int val) { this->
fill(val); }
710template<>
struct Hash<bitSet> : bitSet::hasher {};
719Ostream&
operator<<(Ostream&
os,
const InfoProxy<bitSet>& iproxy);
753 #include "bitSet.txx"
A 1D vector of objects of type <T> with a fixed length <N>.
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
A helper class for outputting values to Ostream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A dynamic list of packed unsigned integers, with the number of bits per item specified by the <Width>...
friend Ostream & operator<<(Ostream &os, const InfoProxy< PackedList< Width > > &info)
unsigned int get(const label i) const
constexpr PackedList() noexcept
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A const_iterator for iterating across on values.
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.
reference(reference &&) noexcept=default
Move construct.
reference(const reference &) noexcept=default
Copy construct.
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.
void reduceAnd(int communicator=-1, bool syncSizes=true)
Inplace bit_and parallel reduction.
const_iterator cbegin() const
Iterator set to the position of the first on bit.
unsigned int const_reference
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.
ClassName("bitSet")
Declare type-name (with debug switch).
static bitSet gatherValues(bool localValue, int communicator=-1)
Gather individual values into bitSet locations.
void broadcast(int communicator=-1, bool syncSizes=true)
Broadcast the contents.
const_iterator end() const noexcept
Iterator beyond the end of the bitSet.
label set(const IndirectListBase< label, Addr > &locations)
Set the listed locations to 1.
void set(const bitSet &bitset)
Set specified bits from another bitset.
bool contains(const label pos) const
Test for True value at specified position, never auto-vivify entries.
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.
void assign(const unsigned int val)
Deprecated(2020-11) use fill().
label find_first_not() const
Locate the first bit that is unset.
Istream & readListToc(Istream &is)
Read contents in "compact" format, which is the listing of the 'on' bits (toc).
bitSet & xorEq(const bitSet &other)
The set logical XOR.
label unset(InputIter first, InputIter last)
Unset the locations listed by the iterator range, never auto-vivify entries.
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 reduceOr(int communicator=-1, bool syncSizes=true)
Inplace bit_or parallel reduction.
void assign(const UList< bool > &bools)
Copy assign all entries from a list of bools.
label unset(const FixedList< label, N > &locations)
Unset the listed locations, never auto-vivifies.
InfoProxy< bitSet > info() const noexcept
Return info proxy, used to print information to a stream.
void resize_last()
Resize to include the last on bit only.
bool found(const label pos) const
Same as contains().
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.
static bitSet allGather(bool localValue, int communicator=-1)
Allgather individual values into bitSet locations.
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.
Ostream & writeListToc(Ostream &os, label shortLen=0) const
Write contents in "compact" format, which is the listing of the 'on' bits (toc), with line-breaks in ...
label set(const FixedList< label, N > &locations)
Set the listed locations to 1.
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.
bool intersects(const bitSet &other) const
True if any bits in the other bitset intersect (are the same).
label find_next(label pos) const
Locate the next bit set, starting one beyond the specified position.
bool value_type
A bitSet acts like a packed boolList.
bitSet & minusEq(const bitSet &other)
The set difference.
bool any() const
True if any bits in this bitset are set.
static const bitSet & null() noexcept
Return a null bitSet (reference to a nullObject).
bitSet & extend(const label minSize)
Ensure that minSize is covered by the bitSet.
label unset(const IndirectListBase< label, Addr > &locations)
Unset the listed locations, never auto-vivifies.
label find_first() const
Locate the first bit that is set.
A range or interval of labels defined by a start and a size.
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
OBJstream os(runTime.globalPath()/outputName)
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.
const T & NullObjectRef() noexcept
Const reference (of type T) to the nullObject.
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.
UList< label > labelUList
A UList of labels.
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...
const Vector< label > N(dict.get< Vector< label > >("N"))