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 |
![]() | |
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... | |
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) | |
template<class Addr > | |
bitSet (const bitSet &bitset, const IndirectListBase< label, Addr > &addr) | |
bitSet (const bitSet &bitset, const labelRange &range) | |
bitSet (const UList< bool > &bools) | |
Construct from a list of bools. More... | |
bitSet (const label n, const labelRange &range) | |
bitSet (const label n, const labelUList &locations) | |
template<class Addr > | |
bitSet (const label n, const IndirectListBase< label, Addr > &locations) | |
template<unsigned N> | |
bitSet (const label n, const FixedList< label, N > &locations) | |
bitSet (const label n, std::initializer_list< label > locations) | |
bitSet (const labelRange &range) | |
bitSet (const labelUList &locations) | |
template<class Addr > | |
bitSet (const IndirectListBase< label, Addr > &locations) | |
template<unsigned N> | |
bitSet (const FixedList< label, N > &locations) | |
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... | |
bool | uniform () const |
True if all entries have identical values, and the set is non-empty. 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 value at specified position, never auto-vivify entries. More... | |
bool | found (const label pos) const |
Test 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) |
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) |
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) |
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) |
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 |
const_iterator | cbegin (label pos) const |
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 |
Return info proxy. 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) |
![]() | |
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) | |
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... | |
label | size () const noexcept |
Number of entries. More... | |
bool | empty () const noexcept |
True if the list is empty (ie, size() is zero). More... | |
label | capacity () const noexcept |
The number of elements that can be stored with 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 |
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) |
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) |
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) |
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_bytes () const noexcept |
std::streamsize | byteSize () const noexcept |
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... | |
PackedList< Width > & | append (const unsigned int val) |
Append a value at the end of the 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 > &lst) |
Copy assignment. More... | |
void | operator= (PackedList< Width > &&lst) |
Move assignment. More... | |
void | operator= (const unsigned int val) |
Assign all entries to the given value. fill() More... | |
InfoProxy< PackedList< Width > > | info () const |
Return info proxy. 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... | |
![]() | |
ClassNameNoDebug ("PackedList") | |
Define template name. More... | |
Static Public Member Functions | |
static const bitSet & | null () |
Return a null bitSet reference. More... | |
![]() | |
static constexpr label | num_blocks (label numElem) noexcept |
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... | |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
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 |
![]() | |
typedef List< block_type > | block_container |
The internal container for storing the blocks. More... | |
![]() | |
static unsigned int | repeated_value (unsigned val) |
A fill value for complete blocks. More... | |
static unsigned int | readValue (Istream &is) |
Read a list entry (allows for specialization) More... | |
![]() | |
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 |
Construct with given size and value for all elements.
Definition at line 89 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 230 of file bitSet.C.
References PackedList< Width >::get(), bitSet::set(), 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 54 of file bitSetTemplates.C.
References PackedList< Width >::get(), bitSet::set(), 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 243 of file bitSet.C.
References PackedList< Width >::get(), Foam::pos(), range, and bitSet::set().
Construct from a list of bools.
Definition at line 109 of file bitSetI.H.
References bitSet::assign().
|
explicit |
Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed.
Definition at line 258 of file bitSet.C.
References bitSet::set().
|
inline |
Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed.
Definition at line 117 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 126 of file bitSetI.H.
References IndirectListBase< T, Addr >::begin(), IndirectListBase< T, Addr >::end(), and bitSet::setMany().
Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed.
Definition at line 34 of file bitSetTemplates.C.
References FixedList< T, N >::begin(), FixedList< T, N >::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 138 of file bitSetI.H.
References bitSet::setMany().
|
explicit |
|
inlineexplicit |
Construct with automatic sizing (filled with 0), and set the specified locations as 1.
Definition at line 150 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 159 of file bitSetI.H.
References IndirectListBase< T, Addr >::begin(), IndirectListBase< T, Addr >::end(), and bitSet::setMany().
Construct with automatic sizing (filled with 0), and set the specified locations as 1.
Definition at line 44 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 42 of file bitSet.C.
References PackedList< Width >::blocks_, PackedList< 1 >::blocks_, InfoInFunction, 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 77 of file bitSet.C.
References PackedList< Width >::blocks_, InfoInFunction, Foam::nl, bitSet::none(), resize(), and PackedList< Width >::size().
Referenced by bitSet::operator&=().
|
protected |
The set logical OR.
A and B can have different sizes
The size grows to accommodate new on bits.
Definition at line 129 of file bitSet.C.
References PackedList< Width >::blocks_, bitSet::find_last(), InfoInFunction, 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 174 of file bitSet.C.
References PackedList< Width >::blocks_, bitSet::find_last(), InfoInFunction, Foam::nl, bitSet::none(), resize(), and PackedList< Width >::size().
Referenced by bitSet::operator^=().
|
inlinestatic |
ClassName | ( | "bitSet" | ) |
Declare type-name (with debug switch)
|
inline |
Clone.
Definition at line 170 of file bitSetI.H.
References Time::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 461 of file bitSetI.H.
References PackedList< 1 >::empty().
Referenced by triSurface::checkTriangles(), ensightCase::printTimeset(), NASedgeFormat::read(), STARCDedgeFormat::read(), sampledMeshedSurface::sampledMeshedSurface(), and bitSet::uniform().
|
inline |
True if any bits in this bitset are set.
Definition at line 469 of file bitSetI.H.
References PackedList< 1 >::blocks_, PackedList< 1 >::num_blocks(), and PackedList< 1 >::size().
Referenced by ensightMesh::correct(), bitSet::none(), inverseDistance::walkFront(), and writeObjects::write().
|
inline |
True if no bits in this bitset are set.
Definition at line 488 of file bitSetI.H.
References bitSet::any().
Referenced by bitSet::andEq(), ensightMesh::correct(), distanceSurface::createGeometry(), distanceSurface::filterRegionProximity(), bitSet::minusEq(), bitSet::orEq(), sampledMeshedSurface::sampledMeshedSurface(), bitSet::uniform(), and bitSet::xorEq().
True if all entries have identical values, and the set is non-empty.
Definition at line 494 of file bitSetI.H.
References bitSet::all(), bitSet::none(), PackedList< 1 >::size(), and bitSet::test().
|
inline |
Count number of bits set.
on | can be set to false to count the number of unset bits instead. |
Definition at line 500 of file bitSetI.H.
References Foam::BitOps::bit_count(), PackedList< 1 >::blocks_, PackedList< 1 >::num_blocks(), and PackedList< 1 >::size().
Referenced by AABBTree< Type >::AABBTree(), AMIInterpolation::calcDistribution(), mapDistributeBase::countUnmapped(), polyMeshFilter::filterEdges(), isoSurfaceCell::isoSurfaceCell(), isoSurfaceTopo::isoSurfaceTopo(), dynamicRefineFvMesh::mapFields(), Foam::operator<<(), meshRefinement::printMeshInfo(), ensightCase::printTimeset(), dynamicRefineFvMesh::selectRefineCells(), dynamicRefineFvMesh::selectUnrefinePoints(), faceAreaWeightAMI::setNextFaces(), addPatchCellLayer::setRefinement(), meshRefinement::updateIntersections(), ConeInjection< CloudType >::updateMesh(), FieldActivatedInjection< CloudType >::updateMesh(), KinematicLookupTableInjection< CloudType >::updateMesh(), ReactingLookupTableInjection< CloudType >::updateMesh(), ReactingMultiphaseLookupTableInjection< CloudType >::updateMesh(), ThermoLookupTableInjection< CloudType >::updateMesh(), cellVolumeWeight::walkFront(), and triSurface::writeStats().
True if any bits in the other bitset intersect (are the same).
Definition at line 294 of file bitSet.C.
References PackedList< Width >::blocks_, and PackedList< Width >::size().
|
inline |
Test value at specified position, never auto-vivify entries.
Definition at line 521 of file bitSetI.H.
References PackedList< 1 >::get(), and Foam::pos().
Referenced by polyMeshTetDecomposition::adjustTetBasePtIs(), extendedEdgeMesh::autoMap(), Foam::calcElementMasks(), polyDualMesh::calcFeatures(), Foam::calcNormalDistance_filtered(), dynamicRefineFvMesh::calculateProtectedCells(), primitiveMeshTools::cellDeterminant(), dynamicRefineFvMesh::checkEightAnchorPoints(), ensightFaces::classify(), edgeCollapser::consistentCollapse(), hexRef8::consistentSlowRefinement2(), hexRef8::consistentUnrefinement(), ensightMesh::correct(), meshRefinement::countHits(), snappyLayerDriver::doLayers(), dynamicRefineFvMesh::extendMarkedCells(), distanceSurface::filterKeepLargestRegion(), distanceSurface::filterKeepNearestRegions(), distanceSurface::filterPrepareRegionSplit(), meshRefinement::findRegions(), meshRefinement::gAverage(), treeDataFace::getVolumeType(), dynamicRefineFvMesh::init(), meshRefinement::intersectedPoints(), isoSurfaceTopo::isoSurfaceTopo(), zoneSubSet::mapToZone(), edgeMesh::mergeEdges(), bitSet::operator()(), cell::opposingFace(), plicRDF::reconstruct(), distanceSurface::refineBlockedCells(), snappySnapDriver::repatchToSurface(), fvMeshSubset::reset(), dynamicRefineFvMesh::selectRefineCells(), dynamicRefineFvMesh::selectUnrefinePoints(), motionSmootherAlgo::setDisplacement(), faceAreaWeightAMI::setNextFaces(), hexRef8::setRefinement(), edgeCollapser::setRefinement(), fieldSmoother::smoothLambdaMuDisplacement(), fieldSmoother::smoothNormals(), extendedEdgeMesh::sortPointsAndEdges(), triSurface::subsetMesh(), bitSet::uniform(), meshRefinement::updateIntersections(), inverseDistance::walkFront(), cellVolumeWeight::walkFront(), meshRefinement::weightedSum(), and meshRefinement::zonify().
|
inline |
Test value at specified position, never auto-vivify entries.
Definition at line 527 of file bitSetI.H.
References PackedList< 1 >::get(), and Foam::pos().
|
inline |
Locate the first bit that is set.
Definition at line 314 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 AMIInterpolation::calcDistribution(), Foam::reorder(), and Foam::ListOps::setValue().
|
inline |
Locate the first bit that is unset.
Definition at line 343 of file bitSetI.H.
References PackedList< 1 >::blocks_, PackedList< 1 >::elem_per_block, and Foam::pos().
|
inline |
Locate the last bit set.
Definition at line 375 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 401 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 Foam::reorder(), faceAreaWeightAMI::setNextFaces(), and Foam::ListOps::setValue().
Foam::labelList toc | ( | ) | const |
The indices of the on bits as a sorted labelList.
Definition at line 474 of file bitSet.C.
References Foam::output(), and Foam::pos().
Referenced by snappySnapDriver::calcNearestSurface(), snappySnapDriver::detectNearSurfaces(), IOobjectList::names(), and bitSet::sortedToc().
|
inline |
The indices of the on bits as a sorted labelList.
This is identical to toc(), which is always sorted.
Definition at line 533 of file bitSetI.H.
References bitSet::toc().
Referenced by meshRefinement::blockLeakFaces(), faMesh::boundaryPoints(), dynamicMultiMotionSolverFvMesh::init(), faMesh::internalPoints(), multiSolidBodyMotionSolver::multiSolidBodyMotionSolver(), processorTopology::New(), noiseModel::octaves(), fvMeshSubset::reset(), cellSetOption::setCellSelection(), IOobjectList::sortedNames(), PatchTools::subsetMap(), reconstructionSchemes::surface(), and zoneMotion::zoneMotion().
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 513 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 566 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::bitSet(), and bitSet::operator=().
Copy assign all entries from a list of bools.
Definition at line 274 of file bitSet.C.
References clear(), resize(), and UList< T >::size().
Referenced by bitSet::bitSet(), 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 590 of file bitSetI.H.
References bitSet::orEq().
Referenced by AABBTree< Type >::AABBTree(), geometric::add(), polyMeshTetDecomposition::adjustTetBasePtIs(), Foam::apply(), holeToFace::applyToSet(), extendedEdgeMesh::autoMap(), bitSet::bitSet(), meshRefinement::blockLeakFaces(), PatchTools::calcBounds(), Foam::calcElementMasks(), polyDualMesh::calcFeatures(), createShellMesh::calcPointRegions(), dynamicRefineFvMesh::calculateProtectedCells(), dynamicOversetFvMesh::cellAverage(), cuttingSurfaceBase::cellSelection(), dynamicRefineFvMesh::checkEightAnchorPoints(), edgeCollapser::checkMeshQuality(), ABAQUSCore::readHelper::compact_nodes(), edgeCollapser::consistentCollapse(), hexRef8::consistentUnrefinement(), ensightMesh::correct(), fvMeshSubsetProxy::correct(), Foam::BitSetOps::create(), AABBTree< Type >::createBoxes(), inverseDistance::createStencil(), snappyLayerDriver::doLayers(), dynamicRefineFvMesh::extendMarkedCells(), distanceSurface::filterFaceProximity(), distanceSurface::filterKeepLargestRegion(), distanceSurface::filterKeepNearestRegions(), distanceSurface::filterPrepareRegionSplit(), distanceSurface::filterRegionProximity(), meshRefinement::findRegions(), PstreamBuffers::finishedSends(), syncTools::getMasterEdges(), meshRefinement::getMasterEdges(), syncTools::getMasterPoints(), meshRefinement::getMasterPoints(), dynamicMultiMotionSolverFvMesh::init(), dynamicRefineFvMesh::init(), meshRefinement::intersectedPoints(), isoSurfaceCell::isoSurfaceCell(), isoSurfacePoint::isoSurfacePoint(), isoSurfaceTopo::isoSurfaceTopo(), dynamicRefineFvMesh::mapFields(), meshRefinement::markOutsideFaces(), Foam::markupBoundaryPoints(), PatchTools::matchEdges(), edgeMesh::mergeEdges(), multiSolidBodyMotionSolver::multiSolidBodyMotionSolver(), processorTopology::New(), dynamicOversetFvMesh::normalisation(), noiseModel::octaves(), bitSet::reference::operator=(), cell::opposingFace(), cuttingSurfaceBase::performCut(), NASedgeFormat::read(), STARCDedgeFormat::read(), plicRDF::reconstruct(), dynamicRefineFvMesh::refine(), distanceSurface::refineBlockedCells(), Foam::reorder(), snappySnapDriver::repatchToSurface(), sampledMeshedSurface::sampledMeshedSurface(), sampledFaceZone::sampleOnPoints(), sampledPatch::sampleOnPoints(), sampledSurface::sampleOnPoints(), inverseDistance::seedCell(), ZoneMesh< ZoneType, MeshType >::selection(), dynamicRefineFvMesh::selectRefineCandidates(), dynamicRefineFvMesh::selectUnrefinePoints(), Foam::BitOps::set(), addPatchCellLayer::setRefinement(), hexRef8::setRefinement(), edgeCollapser::setRefinement(), Foam::simpleGeometricFilter(), fieldSmoother::smoothNormals(), PatchTools::subsetMap(), MeshedSurface< Face >::subsetMesh(), triSurface::subsetMesh(), reconstructionSchemes::surface(), dynamicRefineFvMesh::unrefine(), rawTopoChangerFvMesh::update(), topoBitSet::updateLabels(), ConeInjection< CloudType >::updateMesh(), FieldActivatedInjection< CloudType >::updateMesh(), KinematicLookupTableInjection< CloudType >::updateMesh(), ReactingLookupTableInjection< CloudType >::updateMesh(), ReactingMultiphaseLookupTableInjection< CloudType >::updateMesh(), ThermoLookupTableInjection< CloudType >::updateMesh(), dynamicRefineFvMesh::updateTopology(), inverseDistance::walkFront(), cellVolumeWeight::walkFront(), 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 314 of file bitSet.C.
References labelRange::adjust(), labelRange::after(), IntRange< IntType >::empty(), IntRange< IntType >::first(), range, resize(), and IntRange< IntType >::start().
|
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 628 of file bitSetI.H.
References bitSet::minusEq().
Referenced by Foam::apply(), faceAreaWeightAMI::calcAddressing(), triSurface::checkTriangles(), edgeCollapser::consistentCollapse(), hexRef8::consistentUnrefinement(), mapDistributeBase::countUnmapped(), syncTools::getInternalOrCoupledFaces(), syncTools::getInternalOrMasterFaces(), syncTools::getMasterEdges(), syncTools::getMasterFaces(), syncTools::getMasterPoints(), globalMeshData::mergePoints(), hexRef8::setRefinement(), Foam::BitOps::unset(), bitSet::unset(), InjectedParticleInjection< CloudType >::updateMesh(), and ManualInjection< CloudType >::updateMesh().
void unset | ( | const labelRange & | range | ) |
Unset the specified range of bits specified, never auto-vivifies.
Definition at line 393 of file bitSet.C.
References labelRange::after(), IntRange< IntType >::empty(), IntRange< IntType >::first(), range, resize(), and IntRange< IntType >::start().
|
inline |
Invert all bits in the addressable region.
Definition at line 634 of file bitSetI.H.
References PackedList< 1 >::blocks_, PackedList< 1 >::clear_trailing_bits(), PackedList< 1 >::num_blocks(), and PackedList< 1 >::size().
Referenced by parcelSelection::calculateFilter(), ensightMesh::correct(), faMesh::internalPoints(), Foam::invertCellSelection(), noiseModel::octaves(), Foam::operator~(), Foam::simpleGeometricFilter(), ConeInjection< CloudType >::updateMesh(), FieldActivatedInjection< CloudType >::updateMesh(), KinematicLookupTableInjection< CloudType >::updateMesh(), ReactingLookupTableInjection< CloudType >::updateMesh(), ReactingMultiphaseLookupTableInjection< CloudType >::updateMesh(), and ThermoLookupTableInjection< CloudType >::updateMesh().
|
inline |
Invert bit at the specified position.
A no-op if the position is out-of-range
Definition at line 649 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 539 of file bitSetI.H.
References PackedList< 1 >::clear(), bitSet::find_last(), Foam::pos(), and PackedList< 1 >::resize().
Referenced by Foam::operator&(), Foam::operator-(), Foam::operator^(), and Foam::operator|().
|
inline |
Swap contents.
Definition at line 554 of file bitSetI.H.
References PackedList< Width >::swap().
|
inline |
Transfer the contents of the argument list into this list and annul the argument list.
Definition at line 560 of file bitSetI.H.
References kinematicSingleLayer::transfer().
Referenced by fvMeshSubsetProxy::correct(), bitSet::operator=(), topoBitSet::updateLabels(), inverseDistance::walkFront(), and cellVolumeWeight::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 658 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 669 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 675 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 686 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 bitSet::bitSet(), Foam::HashSetOps::bitset(), and bitSet::set().
|
inline |
Set the listed locations to 1.
Does auto-vivify for non-existent entries.
Definition at line 596 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 612 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 290 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 296 of file bitSetI.H.
References Foam::pos().
|
inlinenoexcept |
|
inlinenoexcept |
Test value at specified position, same as test()
Enables use as a predicate
Definition at line 694 of file bitSetI.H.
References Foam::pos(), and bitSet::test().
|
inline |
Identical to get() - get value at index.
Never auto-vivify entries.
Definition at line 700 of file bitSetI.H.
References PackedList< 1 >::get().
|
inline |
Non-const access to value at index.
Fatal for out-of-range indices
Definition at line 706 of file bitSetI.H.
References PackedList< 1 >::checkIndex().
|
inline |
Copy assignment.
Definition at line 715 of file bitSetI.H.
References PackedList< Width >::operator=().
|
inline |
Move assignment.
Definition at line 722 of file bitSetI.H.
References bitSet::transfer().
|
inline |
Assign all entries to the given value. fill()
Definition at line 729 of file bitSetI.H.
References bitSet::fill().
|
inline |
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.
Definition at line 736 of file bitSetI.H.
References bitSet::andEq().
|
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 742 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 748 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 754 of file bitSetI.H.
References bitSet::minusEq().
|
inline |
Deprecated(2020-11) use fill()
|
inline |
Definition at line 603 of file bitSetI.H.
References IndirectListBase< T, Addr >::begin(), IndirectListBase< T, Addr >::end(), and bitSet::setMany().
|
inline |
Definition at line 619 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 75 of file bitSetTemplates.C.
References Foam::max().
Foam::label unset | ( | InputIter | first, |
InputIter | last | ||
) |
Definition at line 101 of file bitSetTemplates.C.
Definition at line 118 of file bitSetTemplates.C.
References FixedList< T, N >::begin(), and FixedList< T, N >::end().
Definition at line 125 of file bitSetTemplates.C.
References FixedList< T, N >::begin(), and FixedList< T, N >::end().