A bitSet stores bits (elements with only two states) in packed internal format and supports a variety of bit-set operations. Its behaviour is largely list-like, with some HashSet features. More...
Classes | |
class | const_iterator |
A const_iterator for iterating across on values. More... | |
class | reference |
A reference supporting read/write access to an entry. More... | |
Public Types | |
typedef unsigned int | const_reference |
Public Types inherited from PackedList< 1 > | |
typedef unsigned int | block_type |
The storage block type for bit elements. More... | |
typedef unsigned int | const_reference |
Public Member Functions | |
ClassName ("bitSet") | |
Declare type-name (with debug switch) More... | |
constexpr | bitSet () noexcept |
Default construct an empty, zero-sized bitSet. More... | |
bitSet (Istream &is) | |
Construct from Istream. More... | |
bitSet (const label n) | |
Construct with given size, with all bits set to 0. More... | |
bitSet (const label n, const bool val) | |
Construct with given size and value for all elements. More... | |
bitSet (const bitSet &bitset) | |
Copy construct. More... | |
bitSet (bitSet &&bitset) | |
Move construct. More... | |
bitSet (const bitSet &bitset, const labelUList &addr) | |
Construct a new bitSet by extracting the specified (unique) locations of an existing bitSet. More... | |
template<class Addr > | |
bitSet (const bitSet &bitset, const IndirectListBase< label, Addr > &addr) | |
Construct a new set by extracting the specified (unique) locations of an existing bitSet. More... | |
bitSet (const bitSet &bitset, const labelRange &range) | |
Construct a new bitSet by extracting the specified range locations of an existing bitSet. More... | |
bitSet (const UList< bool > &bools) | |
Construct from a list of bools. More... | |
bitSet (const label n, const labelRange &range) | |
Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed. More... | |
bitSet (const label n, const labelUList &locations) | |
Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed. More... | |
template<class Addr > | |
bitSet (const label n, const IndirectListBase< label, Addr > &locations) | |
Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed. More... | |
template<unsigned N> | |
bitSet (const label n, const FixedList< label, N > &locations) | |
Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed. More... | |
bitSet (const label n, std::initializer_list< label > locations) | |
Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed. More... | |
bitSet (const labelRange &range) | |
Construct with automatic sizing (filled with 0), and set the specified locations as 1. More... | |
bitSet (const labelUList &locations) | |
Construct with automatic sizing (filled with 0), and set the specified locations as 1. More... | |
template<class Addr > | |
bitSet (const IndirectListBase< label, Addr > &locations) | |
Construct with automatic sizing (filled with 0), and set the specified locations as 1. More... | |
template<unsigned N> | |
bitSet (const FixedList< label, N > &locations) | |
Construct with automatic sizing (filled with 0), and set the specified locations as 1. More... | |
autoPtr< bitSet > | clone () const |
Clone. More... | |
bool | all () const |
True if all bits in this bitset are set or if the set is empty. More... | |
bool | any () const |
True if any bits in this bitset are set. More... | |
bool | none () const |
True if no bits in this bitset are set. More... | |
unsigned int | count (const bool on=true) const |
Count number of bits set. More... | |
bool | intersects (const bitSet &other) const |
True if any bits in the other bitset intersect (are the same). More... | |
bool | test (const label pos) const |
Test for True value at specified position, never auto-vivify entries. More... | |
bool | contains (const label pos) const |
Test for True value at specified position, never auto-vivify entries. More... | |
label | find_first () const |
Locate the first bit that is set. More... | |
label | find_first_not () const |
Locate the first bit that is unset. More... | |
label | find_last () const |
Locate the last bit set. More... | |
label | find_next (label pos) const |
Locate the next bit set, starting one beyond the specified position. More... | |
labelList | toc () const |
The indices of the on bits as a sorted labelList. More... | |
labelList | sortedToc () const |
The indices of the on bits as a sorted labelList. More... | |
List< bool > | values () const |
Return the bitset values as a boolList. More... | |
void | fill (const bool val) |
Assign all entries to the given value. More... | |
void | assign (const UList< bool > &bools) |
Copy assign all entries from a list of bools. More... | |
void | set (const bitSet &bitset) |
Set specified bits from another bitset. More... | |
void | set (const labelRange &range) |
Set the specified range of bits. More... | |
bitSet & | unset (const bitSet &other) |
Unset (subtract) the bits specified in the other bitset, which is a set difference corresponds to the logical operation. More... | |
void | unset (const labelRange &range) |
Unset the specified range of bits specified, never auto-vivifies. More... | |
void | flip () |
Invert all bits in the addressable region. More... | |
void | flip (const label pos) |
Invert bit at the specified position. More... | |
void | resize_last () |
Resize to include the last on bit only. More... | |
void | swap (bitSet &bitset) |
Swap contents. More... | |
void | transfer (bitSet &bitset) |
Transfer the contents of the argument list into this list and annul the argument list. More... | |
bitSet & | bound (const label maxSize) |
Ensure the addressable range does not exceed maxSize. More... | |
bitSet & | bound (const bitSet &other) |
Ensure the addressable range does not exceed that of other. More... | |
bitSet & | extend (const label minSize) |
Ensure that minSize is covered by the bitSet. More... | |
bitSet & | extend (const bitSet &other) |
Ensure the bitset is addressable throughout the range of other. More... | |
template<class InputIter > | |
label | setMany (InputIter first, InputIter last) |
Set the locations listed by the iterator range, auto-vivify entries if needed. More... | |
label | set (const labelUList &locations) |
Set the listed locations to 1. More... | |
template<class Addr > | |
label | set (const IndirectListBase< label, Addr > &locations) |
Set the listed locations to 1. More... | |
template<unsigned N> | |
label | set (const FixedList< label, N > &locations) |
Set the listed locations to 1. More... | |
template<class InputIter > | |
label | unset (InputIter first, InputIter last) |
Unset the locations listed by the iterator range, never auto-vivify entries. More... | |
label | unset (const labelUList &locations) |
Unset the listed locations, never auto-vivifies. More... | |
template<class Addr > | |
label | unset (const IndirectListBase< label, Addr > &locations) |
Unset the listed locations, never auto-vivifies. More... | |
template<unsigned N> | |
label | unset (const FixedList< label, N > &locations) |
Unset the listed locations, never auto-vivifies. More... | |
const_iterator | begin () const |
Iterator set to the position of the first on bit. More... | |
const_iterator | cbegin () const |
Iterator set to the position of the first on bit. More... | |
const_iterator | begin (label pos) const |
Iterator set to the position of the first on bit that occurs at or beyond the given position. More... | |
const_iterator | cbegin (label pos) const |
Iterator set to the position of the first on bit that occurs at or beyond the given position. More... | |
const_iterator | end () const noexcept |
Iterator beyond the end of the bitSet. More... | |
const_iterator | cend () const noexcept |
Iterator beyond the end of the bitSet. More... | |
bool | operator() (const label pos) const |
Test value at specified position, same as test() More... | |
unsigned int | operator[] (const label i) const |
Identical to get() - get value at index. More... | |
reference | operator[] (const label i) |
Non-const access to value at index. More... | |
bitSet & | operator= (const bitSet &bitset) |
Copy assignment. More... | |
bitSet & | operator= (bitSet &&bitset) |
Move assignment. More... | |
bitSet & | operator= (const bool val) |
Assign all entries to the given value. fill() More... | |
bitSet & | operator &= (const bitSet &other) |
Bitwise-AND all the bits in other with the bits in this bitset. More... | |
bitSet & | operator|= (const bitSet &other) |
Bitwise-OR operator - similar to the set() method. More... | |
bitSet & | operator^= (const bitSet &other) |
Bitwise-XOR operator - retains unique entries. More... | |
bitSet & | operator-= (const bitSet &other) |
Remove entries from this list - identical to the unset() method. More... | |
InfoProxy< bitSet > | info () const noexcept |
Return info proxy, used to print information to a stream. More... | |
bool | found (const label pos) const |
Same as contains() More... | |
void | assign (const unsigned int val) |
Deprecated(2020-11) use fill() More... | |
template<class Addr> | |
Foam::label | set (const IndirectListBase< label, Addr > &locations) |
template<class Addr> | |
Foam::label | unset (const IndirectListBase< label, Addr > &locations) |
template<class InputIter > | |
Foam::label | setMany (InputIter first, InputIter last) |
template<class InputIter> | |
Foam::label | unset (InputIter first, InputIter last) |
template<unsigned N> | |
Foam::label | set (const FixedList< label, N > &locations) |
template<unsigned N> | |
Foam::label | unset (const FixedList< label, N > &locations) |
Public Member Functions inherited from PackedList< 1 > | |
void | writeEntry (const word &keyword, Ostream &os) const |
Write as a dictionary entry with keyword. More... | |
constexpr | PackedList () noexcept |
Default construct, zero-sized and no allocation. More... | |
PackedList (const label numElem) | |
Construct for given number of elements, initializes values to 0. More... | |
PackedList (const label numElem, const unsigned int val) | |
Construct for given number of elements, and the specified value for each element. More... | |
PackedList (Istream &is) | |
Construct from Istream. More... | |
PackedList (const PackedList< Width > &list) | |
Copy construct. More... | |
PackedList (PackedList< Width > &&list) | |
Move construct. More... | |
PackedList (const PackedList< Width > &list, const labelUList &addr) | |
Copy construct a subset. More... | |
PackedList (const PackedList< Width > &list, const IndirectListBase< label, Addr > &addr) | |
Copy construct a subset. More... | |
PackedList (const PackedList< Width > &list, const labelRange &range) | |
Copy construct a subset range. More... | |
PackedList (const labelUList &values) | |
Construct from a list of values. More... | |
PackedList (const IndirectListBase< label, Addr > &values) | |
Construct from a indirect list of values. More... | |
autoPtr< PackedList< Width > > | clone () const |
Clone. More... | |
void | checkIndex (const label i) const |
Check index is within valid range [0,size) More... | |
bool | empty () const noexcept |
True if the list is empty (ie, size() is zero). More... | |
label | size () const noexcept |
Number of entries. More... | |
label | capacity () const noexcept |
Number of elements that can be stored without reallocating. More... | |
bool | uniform () const |
True if all entries have identical values (and list is non-empty) More... | |
bool | equal (const PackedList< Width > &other) const |
Test for equality of sizes and the bits set. More... | |
unsigned int | get (const label i) const |
Get value at index i or 0 for out-of-range. More... | |
bool | set (const label i, unsigned int val=~0u) |
Set value at index i, default value set is the max_value. More... | |
bool | unset (const label i) |
Unset the entry at index i. More... | |
labelList | values () const |
Return the values as a list of labels. More... | |
List< IntType > | unpack () const |
Return the values as a list of integral type. More... | |
List< IntType > | unpack (const labelRange &range) const |
Return the range of values as a list of integral type. More... | |
List< IntType > | unpack (const labelUList &locations) const |
Extract the values for the specified locations as a list of integral type. More... | |
Foam::List< IntType > | unpack () const |
Foam::List< IntType > | unpack (const labelRange &range) const |
Foam::List< IntType > | unpack (const labelUList &locations) const |
void | fill (const unsigned int val) |
Assign all entries to the given value. More... | |
bool | trim (label minpos=-1) |
Trim any trailing zero elements, optionally specifying a a minimum position, below which trimming will not occur. More... | |
void | reset () |
Clear all bits but do not adjust the addressable size. More... | |
void | setCapacity (const label numElem) |
Alter the size of the underlying storage. More... | |
void | resize (const label numElem, const unsigned int val=0u) |
Reset addressable list size, does not shrink the allocated size. More... | |
void | resize_nocopy (const label numElem) |
Currently identical to resize. Subject to future change (Oct-2021) More... | |
void | reserve (const label numElem) |
Reserve allocation space for at least this size (uses a size doubling strategy). More... | |
void | clear () |
Clear the list, i.e. set addressable size to zero. More... | |
void | clearStorage () |
Clear the list and delete storage. More... | |
void | shrink () |
Shrink the allocated space to what is actually used. More... | |
void | swap (PackedList< Width > &rhs) |
Swap contents with argument. More... | |
void | transfer (PackedList< Width > &rhs) |
Transfer the contents of the argument list into this list and annul the argument list. More... | |
label | nBlocks () const |
The number of internal storage blocks. More... | |
const List< unsigned int > & | storage () const |
Return the underlying storage blocks. More... | |
List< unsigned int > & | storage () |
Return the underlying storage blocks. More... | |
const unsigned int * | cdata () const noexcept |
A const pointer to the raw storage. More... | |
unsigned int * | data () noexcept |
A pointer to the raw storage. More... | |
const char * | cdata_bytes () const noexcept |
A const pointer to the raw storage, reinterpreted as byte data. More... | |
char * | data_bytes () noexcept |
A pointer to the raw storage, reinterpreted as byte data. More... | |
std::streamsize | size_data () const noexcept |
The number of integer blocks addressed in the raw storage. More... | |
std::streamsize | size_bytes () const noexcept |
The number of bytes used in the raw storage including any unused padding. More... | |
std::streamsize | byteSize () const noexcept |
The number of bytes used in the raw storage including any unused padding. More... | |
Ostream & | printBits (Ostream &os, bool debugOutput=false) const |
Print bit patterns, optionally with extra debug. More... | |
Istream & | readList (Istream &is) |
Clear list and read from stream. More... | |
Ostream & | writeList (Ostream &os, const label shortLen=0) const |
Write List, with line-breaks in ASCII when length exceeds shortLen. More... | |
void | push_back (const unsigned int val) |
Append a value at the end of the list. More... | |
void | pop_back (label n=1) |
Reduce size by 1 or more elements. Can be called on an empty list. More... | |
unsigned int | remove () |
Remove and return the last element. More... | |
unsigned int | operator[] (const label i) const |
Identical to get() - get value at index. More... | |
reference | operator[] (const label i) |
Non-const access to value at index. More... | |
void | operator= (const PackedList< Width > &list) |
Copy assignment. More... | |
void | operator= (PackedList< Width > &&list) |
Move assignment. More... | |
void | operator= (const unsigned int val) |
Assign all entries to the given value. fill() More... | |
InfoProxy< PackedList< Width > > | info () const noexcept |
Return info proxy, used to print information to a stream. More... | |
void | assign (const unsigned int val) |
Deprecated(2020-11) use fill() More... | |
void | assign (const PackedList< Width > &rhs) |
Deprecated(2020-11) use operator=. More... | |
void | setSize (const label n, unsigned int val=0u) |
Alias for resize() More... | |
PackedList< Width > & | append (const unsigned int val) |
Append a value at the end of the list. More... | |
Public Member Functions inherited from PackedListCore | |
ClassNameNoDebug ("PackedList") | |
Define template name. More... | |
Static Public Member Functions | |
static const bitSet & | null () noexcept |
Return a null bitSet (reference to a nullObject). More... | |
Static Public Member Functions inherited from PackedList< 1 > | |
static constexpr label | num_blocks (label numElem) noexcept |
Calculate the number of blocks required to _address_ the requested number of elements. More... | |
static constexpr block_type | mask_lower (unsigned elementOffset) |
Masking for all bits below the element offset. More... | |
Protected Member Functions | |
bitSet & | minusEq (const bitSet &other) |
The set difference. More... | |
bitSet & | andEq (const bitSet &other) |
The set logical AND. More... | |
bitSet & | orEq (const bitSet &other) |
The set logical OR. More... | |
bitSet & | xorEq (const bitSet &other) |
The set logical XOR. More... | |
Protected Member Functions inherited from PackedList< 1 > | |
unsigned int | repeated_value (unsigned val) |
unsigned int | readValue (Istream &is) |
void | setPair (Istream &is) |
Read an index/value pair and set accordingly. More... | |
void | setPair (Istream &is) |
void | writeEntry (Ostream &os) const |
Write as a dictionary entry. More... | |
void | clear_trailing_bits () |
Clear any partial rubbish in the last addressable block. More... | |
void | copyAssign (const PackedList< Width > &rhs) |
Copy assignment. More... | |
label | first_block () const |
Find the first block with a '1' bit. More... | |
label | first_not_block () const |
Find the first block with a '0' bit. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from PackedList< 1 > | |
static constexpr unsigned | bits_per_block |
The number of bits in a single block. More... | |
static constexpr unsigned | element_width |
The width of an individual element (in bits). More... | |
static constexpr unsigned | elem_per_block |
The number of elements stored per data block. More... | |
static constexpr block_type | max_value |
The max value for an element which is also the bit-mask of the individual element. More... | |
Protected Types inherited from PackedList< 1 > | |
typedef List< block_type > | block_container |
The internal container for storing the blocks. More... | |
Static Protected Member Functions inherited from PackedList< 1 > | |
static unsigned int | repeated_value (unsigned val) |
Enforce non-zero Width to fit within the block storage and require at least 2 items per storage block for general efficiency. More... | |
static unsigned int | readValue (Istream &is) |
Read a list entry (allows for specialization) More... | |
Protected Attributes inherited from PackedList< 1 > | |
block_container | blocks_ |
The blocks of raw data. More... | |
label | size_ |
Number of entries used. More... | |
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety of bit-set operations. Its behaviour is largely list-like, with some HashSet features.
typedef unsigned int const_reference |
|
inlinenoexcept |
|
inlineexplicit |
|
inline |
Construct with given size and value for all elements.
Definition at line 35 of file bitSetI.H.
References bitSet::fill().
bitSet | ( | const bitSet & | bitset, |
const labelUList & | addr | ||
) |
Construct a new bitSet by extracting the specified (unique) locations of an existing bitSet.
Definition at line 223 of file bitSet.C.
References Foam::HashSetOps::bitset(), PackedList< Width >::get(), and UList< T >::size().
bitSet | ( | const bitSet & | bitset, |
const IndirectListBase< label, Addr > & | addr | ||
) |
Construct a new set by extracting the specified (unique) locations of an existing bitSet.
Definition at line 47 of file bitSetTemplates.C.
References Foam::HashSetOps::bitset(), PackedList< Width >::get(), and IndirectListBase< T, Addr >::size().
bitSet | ( | const bitSet & | bitset, |
const labelRange & | range | ||
) |
Construct a new bitSet by extracting the specified range locations of an existing bitSet.
Definition at line 236 of file bitSet.C.
References Foam::HashSetOps::bitset(), PackedList< Width >::get(), Foam::pos(), and range.
Construct from a list of bools.
Definition at line 55 of file bitSetI.H.
References bitSet::assign(), and Foam::HashSetOps::bools().
|
explicit |
|
inline |
Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed.
Definition at line 63 of file bitSetI.H.
References UList< T >::begin(), UList< T >::end(), and bitSet::setMany().
|
inline |
Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed.
Definition at line 73 of file bitSetI.H.
References IndirectListBase< T, Addr >::begin(), and IndirectListBase< T, Addr >::end().
Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed.
Definition at line 26 of file bitSetTemplates.C.
References FixedList< T, N >::begin(), FixedList< T, N >::end(), and bitSet::setMany().
|
inline |
|
explicit |
|
inlineexplicit |
Construct with automatic sizing (filled with 0), and set the specified locations as 1.
Definition at line 96 of file bitSetI.H.
References UList< T >::begin(), UList< T >::end(), and bitSet::setMany().
|
inlineexplicit |
Construct with automatic sizing (filled with 0), and set the specified locations as 1.
Definition at line 106 of file bitSetI.H.
References IndirectListBase< T, Addr >::begin(), and IndirectListBase< T, Addr >::end().
Construct with automatic sizing (filled with 0), and set the specified locations as 1.
Definition at line 36 of file bitSetTemplates.C.
References FixedList< T, N >::begin(), FixedList< T, N >::end(), and bitSet::setMany().
|
protected |
The set difference.
A and B can have different sizes. Never changes the original set size. Non-overlapping parts are considered off.
Definition at line 35 of file bitSet.C.
References PackedList< Width >::blocks_, PackedList< 1 >::blocks_, Foam::ensightOutput::debug, InfoInFunction, Foam::min(), Foam::nl, bitSet::none(), PackedList< 1 >::num_blocks(), PackedList< 1 >::reset(), PackedList< Width >::size(), and PackedList< 1 >::size().
Referenced by bitSet::operator-=(), and bitSet::unset().
|
protected |
The set logical AND.
A and B can have different sizes. Never changes the original set size. Non-overlapping parts are considered off.
Definition at line 70 of file bitSet.C.
References PackedList< Width >::blocks_, Foam::ensightOutput::debug, InfoInFunction, Foam::min(), Foam::nl, bitSet::none(), resize(), and PackedList< Width >::size().
|
protected |
The set logical OR.
A and B can have different sizes
The size grows to accommodate new on bits.
Definition at line 122 of file bitSet.C.
References PackedList< Width >::blocks_, Foam::ensightOutput::debug, bitSet::find_last(), InfoInFunction, Foam::min(), Foam::nl, bitSet::none(), resize(), and PackedList< Width >::size().
Referenced by bitSet::operator|=(), and bitSet::set().
|
protected |
The set logical XOR.
A and B can have different sizes.
The size grows to accommodate new on bits.
Definition at line 167 of file bitSet.C.
References PackedList< Width >::blocks_, Foam::ensightOutput::debug, bitSet::find_last(), InfoInFunction, Foam::min(), Foam::nl, bitSet::none(), resize(), and PackedList< Width >::size().
Referenced by bitSet::operator^=().
|
inlinestaticnoexcept |
ClassName | ( | "bitSet" | ) |
Declare type-name (with debug switch)
|
inline |
Clone.
Definition at line 116 of file bitSetI.H.
References autoPtr< T >::New().
|
inline |
True if all bits in this bitset are set or if the set is empty.
Returning true for an empty set may not seem intuitive, but conforms with boost definitions and std::all_of behaviour.
Definition at line 401 of file bitSetI.H.
References PackedList< 1 >::empty(), and PackedList< 1 >::first_not_block().
Referenced by triSurface::checkTriangles(), ensightCase::printTimeset(), NASedgeFormat::read(), and STARCDedgeFormat::read().
|
inline |
True if any bits in this bitset are set.
Definition at line 408 of file bitSetI.H.
References PackedList< 1 >::first_block().
Referenced by ensightMesh::correct(), and cellCellStencil::walkFront().
|
inline |
True if no bits in this bitset are set.
Definition at line 414 of file bitSetI.H.
References PackedList< 1 >::first_block().
Referenced by bitSet::andEq(), ensightMesh::correct(), distanceSurface::createGeometry(), bitSet::minusEq(), bitSet::orEq(), and bitSet::xorEq().
|
inline |
Count number of bits set.
on | can be set to false to count the number of unset bits instead. |
Definition at line 420 of file bitSetI.H.
References Foam::BitOps::bit_count(), PackedList< 1 >::blocks_, PackedList< 1 >::num_blocks(), and PackedList< 1 >::size().
Referenced by AMIInterpolation::calcDistribution(), cellMapper::cellMapper(), mapDistributeBase::countUnmapped(), faceMapper::faceMapper(), isoSurfaceCell::isoSurfaceCell(), isoSurfaceTopo::isoSurfaceTopo(), dynamicRefineFvMesh::mapFields(), Foam::operator<<(), pointMapper::pointMapper(), meshRefinement::printMeshInfo(), ensightCase::printTimeset(), dynamicRefineFvMesh::selectRefineCells(), dynamicRefineFvMesh::selectUnrefinePoints(), faceAreaWeightAMI::setNextFaces(), addPatchCellLayer::setRefinement(), meshRefinement::updateIntersections(), and triSurface::writeStats().
bool intersects | ( | const bitSet & | other | ) | const |
True if any bits in the other bitset intersect (are the same).
Definition at line 287 of file bitSet.C.
References PackedList< Width >::blocks_, Foam::min(), and PackedList< Width >::size().
|
inline |
Test for True value at specified position, never auto-vivify entries.
Definition at line 329 of file bitSet.H.
References Foam::pos().
Referenced by extendedEdgeMesh::autoMap(), Foam::calcElementMasks(), Foam::calcNormalDistance_filtered(), dynamicRefineFvMesh::calculateProtectedCells(), primitiveMeshTools::cellDeterminant(), dynamicRefineFvMesh::checkEightAnchorPoints(), ensightFaces::classify(), ensightMesh::correct(), meshRefinement::countHits(), snappyLayerDriver::doLayers(), dynamicRefineFvMesh::extendMarkedCells(), distanceSurface::filterKeepLargestRegion(), distanceSurface::filterKeepNearestRegions(), distanceSurface::filterPrepareRegionSplit(), meshRefinement::gAverage(), dynamicRefineFvMesh::init(), isoSurfaceTopo::isoSurfaceTopo(), bitSet::operator()(), distanceSurface::refineBlockedCells(), fvMeshSubset::reset(), dynamicRefineFvMesh::selectRefineCells(), dynamicRefineFvMesh::selectUnrefinePoints(), lumpedPointMovement::setInterpolator(), faceAreaWeightAMI::setNextFaces(), fieldSmoother::smoothLambdaMuDisplacement(), extendedEdgeMesh::sortPointsAndEdges(), triSurface::subsetMesh(), meshRefinement::updateIntersections(), cellCellStencil::walkFront(), meshRefinement::weightedSum(), and meshRefinement::zonify().
|
inline |
Test for True value at specified position, never auto-vivify entries.
Definition at line 338 of file bitSet.H.
References Foam::pos().
Referenced by bitSet::found().
|
inline |
Locate the first bit that is set.
Definition at line 260 of file bitSetI.H.
References PackedList< 1 >::blocks_, PackedList< 1 >::elem_per_block, PackedList< 1 >::first_block(), and Foam::pos().
Referenced by Foam::ListOps::setValue().
|
inline |
Locate the first bit that is unset.
Definition at line 289 of file bitSetI.H.
References PackedList< 1 >::blocks_, PackedList< 1 >::elem_per_block, PackedList< 1 >::first_not_block(), and Foam::pos().
Referenced by fileOperation::nProcs().
|
inline |
Locate the last bit set.
Definition at line 321 of file bitSetI.H.
References PackedList< 1 >::blocks_, PackedList< 1 >::elem_per_block, PackedList< 1 >::num_blocks(), Foam::pos(), and PackedList< 1 >::size().
Referenced by topoBitSet::check(), bitSet::orEq(), bitSet::resize_last(), topoBitSet::updateLabels(), and bitSet::xorEq().
|
inline |
Locate the next bit set, starting one beyond the specified position.
Definition at line 347 of file bitSetI.H.
References PackedList< 1 >::blocks_, PackedList< 1 >::elem_per_block, PackedList< 1 >::num_blocks(), Foam::pos(), and PackedList< 1 >::size().
Referenced by faceAreaWeightAMI::setNextFaces(), and Foam::ListOps::setValue().
Foam::labelList toc | ( | ) | const |
The indices of the on bits as a sorted labelList.
Definition at line 467 of file bitSet.C.
References Foam::BitOps::any(), Foam::BitOps::count(), Foam::output(), and Foam::pos().
Referenced by snappySnapDriver::calcNearestSurface(), snappySnapDriver::detectNearSurfaces(), bitSet::sortedToc(), and Foam::BitOps::toc().
|
inline |
The indices of the on bits as a sorted labelList.
This is identical to toc(), which is always sorted.
Definition at line 441 of file bitSetI.H.
References bitSet::toc().
Referenced by faMesh::boundaryPoints(), dynamicMultiMotionSolverFvMesh::init(), faMesh::internalPoints(), multiSolidBodyMotionSolver::multiSolidBodyMotionSolver(), fvMeshSubset::reset(), cellSetOption::setCellSelection(), and Foam::BitOps::sortedToc().
Foam::List< bool > values | ( | ) | const |
Return the bitset values as a boolList.
When the output is a bool, this is more efficient than unpack()
Definition at line 506 of file bitSet.C.
References Foam::output(), and Foam::pos().
Referenced by faceBitSet::distribute(), and pointBitSet::distribute().
|
inline |
Assign all entries to the given value.
Definition at line 474 of file bitSetI.H.
References PackedList< 1 >::blocks_, PackedList< 1 >::clear_trailing_bits(), PackedList< 1 >::empty(), PackedList< 1 >::num_blocks(), and PackedList< 1 >::size().
Referenced by bitSet::assign(), bitSet::bitSet(), and bitSet::operator=().
void assign | ( | const UList< bool > & | bools | ) |
Copy assign all entries from a list of bools.
Definition at line 267 of file bitSet.C.
References Foam::HashSetOps::bools(), clear(), resize(), and UList< T >::size().
Referenced by bitSet::bitSet(), volPointInterpolationAdjoint::calcBoundaryAddressing(), faceBitSet::distribute(), and pointBitSet::distribute().
|
inline |
Set specified bits from another bitset.
The current set size may grow to accommodate any new bits (auto-vivifies).
Definition at line 498 of file bitSetI.H.
References Foam::HashSetOps::bitset(), and bitSet::orEq().
Referenced by AABBTree< Type >::AABBTree(), geometric::add(), Foam::apply(), cellToFaceZone::applyToSet(), extendedEdgeMesh::autoMap(), meshRefinement::blockLeakFaces(), Foam::calcElementMasks(), dynamicRefineFvMesh::calculateProtectedCells(), oversetFvMeshBase::cellAverage(), cuttingSurfaceBase::cellSelection(), dynamicRefineFvMesh::checkEightAnchorPoints(), edgeCollapser::checkMeshQuality(), ABAQUSCore::readHelper::compact_nodes(), fvMeshSubsetProxy::correct(), ensightMesh::correct(), dynamicRefineFvMesh::extendMarkedCells(), distanceSurface::filterKeepLargestRegion(), distanceSurface::filterKeepNearestRegions(), PstreamBuffers::finishedSends(), meshRefinement::getMasterEdges(), isoSurfaceBase::ignoreCyclics(), dynamicMultiMotionSolverFvMesh::init(), dynamicRefineFvMesh::init(), isoSurfaceCell::isoSurfaceCell(), isoSurfaceTopo::isoSurfaceTopo(), dynamicRefineFvMesh::mapFields(), meshRefinement::markOutsideFaces(), Foam::markupBoundaryPoints(), PatchTools::matchEdges(), multiSolidBodyMotionSolver::multiSolidBodyMotionSolver(), fileOperation::nProcs(), cuttingSurfaceBase::performCut(), NASedgeFormat::read(), STARCDedgeFormat::read(), dynamicRefineFvMesh::refine(), distanceSurface::refineBlockedCells(), sampledPatch::sampleOnPoints(), sampledFaceZone::sampleOnPoints(), cellCellStencil::seedCell(), ZoneMesh< cellZone, polyMesh >::selection(), dynamicRefineFvMesh::selectRefineCandidates(), dynamicRefineFvMesh::selectUnrefinePoints(), Foam::BitOps::set(), lumpedPointMovement::setInterpolator(), addPatchCellLayer::setRefinement(), cellCellStencil::setUpFront(), cellCellStencil::setUpFrontOnOversetPatch(), Foam::simpleGeometricFilter(), topoBitSet::subset(), triSurface::subsetMesh(), MeshedSurface< Foam::face >::subsetMesh(), dynamicRefineFvMesh::unrefine(), rawTopoChangerFvMesh::update(), topoBitSet::updateLabels(), writeObjects::write(), triSurface::writeStats(), and zoneMotion::zoneMotion().
void set | ( | const labelRange & | range | ) |
Set the specified range of bits.
The current set size may grow to accommodate any new bits (auto-vivifies).
Definition at line 307 of file bitSet.C.
References labelRange::adjust(), IntRange< IntType >::begin_value(), IntRange< IntType >::empty(), IntRange< IntType >::end_value(), range, reserve(), and resize().
|
inline |
Unset (subtract) the bits specified in the other bitset, which is a set difference corresponds to the logical operation.
The result is comparable to 'operator-='
A and B can have different sizes. Does not change the original set size.
Definition at line 536 of file bitSetI.H.
References bitSet::minusEq().
Referenced by Foam::apply(), faceAreaWeightAMI::calcAddressing(), cellMapper::cellMapper(), triSurface::checkTriangles(), mapDistributeBase::countUnmapped(), faceMapper::faceMapper(), syncTools::getInternalOrCoupledFaces(), syncTools::getInternalOrMasterFaces(), syncTools::getMasterFaces(), pointMapper::pointMapper(), Foam::simpleGeometricFilter(), Foam::BitOps::unset(), and bitSet::unset().
void unset | ( | const labelRange & | range | ) |
Unset the specified range of bits specified, never auto-vivifies.
Definition at line 386 of file bitSet.C.
References IntRange< IntType >::begin_value(), IntRange< IntType >::empty(), IntRange< IntType >::end_value(), range, and resize().
|
inline |
Invert all bits in the addressable region.
Definition at line 542 of file bitSetI.H.
References PackedList< 1 >::blocks_, PackedList< 1 >::clear_trailing_bits(), PackedList< 1 >::num_blocks(), and PackedList< 1 >::size().
Referenced by ensightMesh::correct(), faMesh::internalPoints(), Foam::invertCellSelection(), and Foam::operator~().
|
inline |
Invert bit at the specified position.
A no-op if the position is out-of-range
Definition at line 557 of file bitSetI.H.
References bitSet::reference::flip(), and PackedList< 1 >::size().
|
inline |
Resize to include the last on bit only.
Functionally identical to resize(find_last()+1)
Definition at line 447 of file bitSetI.H.
References PackedList< 1 >::clear(), bitSet::find_last(), Foam::pos(), and PackedList< 1 >::resize().
Referenced by Foam::operator-(), Foam::operator^(), and Foam::operator|().
|
inline |
Swap contents.
Definition at line 462 of file bitSetI.H.
References Foam::HashSetOps::bitset(), and PackedList< Width >::swap().
|
inline |
Transfer the contents of the argument list into this list and annul the argument list.
Definition at line 468 of file bitSetI.H.
References Foam::HashSetOps::bitset(), and PackedList< Width >::transfer().
Referenced by fvMeshSubsetProxy::correct(), bitSet::operator=(), and cellCellStencil::walkFront().
|
inline |
Ensure the addressable range does not exceed maxSize.
Either decreases the size of the bitSet or is a no-op.
Definition at line 566 of file bitSetI.H.
References PackedList< 1 >::resize(), and PackedList< 1 >::size().
Referenced by bitSet::bound().
|
inline |
Ensure the addressable range does not exceed that of other.
Either decreases the size of the bitSet or is a no-op.
Definition at line 577 of file bitSetI.H.
References bitSet::bound(), and PackedList< Width >::size().
|
inline |
Ensure that minSize is covered by the bitSet.
Either increases the size of the bitSet or is a no-op.
Definition at line 583 of file bitSetI.H.
References PackedList< 1 >::resize(), and PackedList< 1 >::size().
Referenced by bitSet::extend().
|
inline |
Ensure the bitset is addressable throughout the range of other.
Either increases the size of the bitSet or is a no-op.
Definition at line 594 of file bitSetI.H.
References bitSet::extend(), and PackedList< Width >::size().
label setMany | ( | InputIter | first, |
InputIter | last | ||
) |
Set the locations listed by the iterator range, auto-vivify entries if needed.
Referenced by holeToFace::applyToSet(), bitSet::bitSet(), and bitSet::set().
|
inline |
Set the listed locations to 1.
Does auto-vivify for non-existent entries.
Definition at line 504 of file bitSetI.H.
References UList< T >::begin(), UList< T >::end(), and bitSet::setMany().
|
inline |
Set the listed locations to 1.
Does auto-vivify for non-existent entries.
Set the listed locations to 1.
Does auto-vivify for non-existent entries.
label unset | ( | InputIter | first, |
InputIter | last | ||
) |
Unset the locations listed by the iterator range, never auto-vivify entries.
|
inline |
Unset the listed locations, never auto-vivifies.
Definition at line 520 of file bitSetI.H.
References UList< T >::begin(), UList< T >::end(), and bitSet::unset().
|
inline |
Unset the listed locations, never auto-vivifies.
Unset the listed locations, never auto-vivifies.
|
inline |
|
inline |
|
inline |
Iterator set to the position of the first on bit that occurs at or beyond the given position.
Definition at line 236 of file bitSetI.H.
References Foam::pos().
|
inline |
Iterator set to the position of the first on bit that occurs at or beyond the given position.
Definition at line 242 of file bitSetI.H.
References Foam::pos().
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Test value at specified position, same as test()
Enables use as a predicate
Definition at line 602 of file bitSetI.H.
References Foam::pos(), and bitSet::test().
|
inline |
|
inline |
Non-const access to value at index.
Fatal for out-of-range indices
Definition at line 614 of file bitSetI.H.
References PackedList< 1 >::checkIndex().
|
inline |
Copy assignment.
Definition at line 623 of file bitSetI.H.
References Foam::HashSetOps::bitset(), and PackedList< Width >::operator=().
|
inline |
Move assignment.
Definition at line 630 of file bitSetI.H.
References Foam::HashSetOps::bitset(), and bitSet::transfer().
|
inline |
Assign all entries to the given value. fill()
Definition at line 637 of file bitSetI.H.
References bitSet::fill().
Bitwise-AND all the bits in other with the bits in this bitset.
The operands may have dissimilar sizes, never changes the original set size. Non-overlapping elements are considered off.
|
inline |
Bitwise-OR operator - similar to the set() method.
The operands may have dissimilar sizes, the set grows to accommodate new on bits.
Definition at line 650 of file bitSetI.H.
References bitSet::orEq().
|
inline |
Bitwise-XOR operator - retains unique entries.
The operands may have dissimilar sizes, the set grows to accommodate new on bits.
Definition at line 656 of file bitSetI.H.
References bitSet::xorEq().
|
inline |
Remove entries from this list - identical to the unset() method.
The operands may have dissimilar sizes, never changes the original set size.
Definition at line 662 of file bitSetI.H.
References bitSet::minusEq().
|
inline |
Same as contains()
Definition at line 847 of file bitSet.H.
References bitSet::contains().
|
inline |
Deprecated(2020-11) use fill()
Definition at line 854 of file bitSet.H.
References bitSet::fill().
|
inline |
Definition at line 512 of file bitSetI.H.
References IndirectListBase< T, Addr >::begin(), IndirectListBase< T, Addr >::end(), and bitSet::setMany().
|
inline |
Definition at line 528 of file bitSetI.H.
References IndirectListBase< T, Addr >::begin(), IndirectListBase< T, Addr >::end(), and bitSet::unset().
Foam::label setMany | ( | InputIter | first, |
InputIter | last | ||
) |
Definition at line 67 of file bitSetTemplates.C.
References Foam::max(), and reserve().
Foam::label unset | ( | InputIter | first, |
InputIter | last | ||
) |
Definition at line 93 of file bitSetTemplates.C.
References Foam::BitOps::unset().
Definition at line 110 of file bitSetTemplates.C.
References FixedList< T, N >::begin(), and FixedList< T, N >::end().
Definition at line 117 of file bitSetTemplates.C.
References FixedList< T, N >::begin(), FixedList< T, N >::end(), and Foam::BitOps::unset().