Loading...
Searching...
No Matches
bitSet Class Reference

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...

#include <bitSet.H>

Inheritance diagram for bitSet:
Collaboration diagram for bitSet:

Classes

class  reference
 A reference supporting read/write access to an entry. More...
class  const_iterator
 A const_iterator for iterating across on values. More...

Public Types

typedef bool value_type
 A bitSet acts like a packed boolList.
typedef unsigned int const_reference
Public Types inherited from PackedList< 1 >
typedef unsigned int block_type
 The storage block type for bit elements.
typedef unsigned int const_reference

Public Member Functions

 ClassName ("bitSet")
 Declare type-name (with debug switch).
constexpr bitSet () noexcept
 Default construct an empty, zero-sized bitSet.
 bitSet (Istream &is)
 Construct from Istream.
 bitSet (const label n)
 Construct with given size, with all bits set to 0.
 bitSet (const label n, const bool val)
 Construct with given size and value for all elements.
 bitSet (const bitSet &bitset)
 Copy construct.
 bitSet (bitSet &&bitset)
 Move construct.
 bitSet (const bitSet &bitset, const labelUList &addr)
 Construct a new bitSet by extracting the specified (unique) locations of an existing bitSet.
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.
 bitSet (const bitSet &bitset, const labelRange &range)
 Construct a new bitSet by extracting the specified range locations of an existing bitSet.
 bitSet (const UList< bool > &bools)
 Construct from a list of bools.
 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.
 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.
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.
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.
 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.
 bitSet (const labelRange &range)
 Construct with automatic sizing (filled with 0), and set the specified locations as 1.
 bitSet (const labelUList &locations)
 Construct with automatic sizing (filled with 0), and set the specified locations as 1.
template<class Addr>
 bitSet (const IndirectListBase< label, Addr > &locations)
 Construct with automatic sizing (filled with 0), and set the specified locations as 1.
template<unsigned N>
 bitSet (const FixedList< label, N > &locations)
 Construct with automatic sizing (filled with 0), and set the specified locations as 1.
autoPtr< bitSetclone () const
 Clone.
bool all () const
 True if all bits in this bitset are set or if the set is empty.
bool any () const
 True if any bits in this bitset are set.
bool none () const
 True if no bits in this bitset are set.
unsigned int count (const bool on=true) const
 Count number of bits set.
bool intersects (const bitSet &other) const
 True if any bits in the other bitset intersect (are the same).
bool test (const label pos) const
 Test for True value at specified position, never auto-vivify entries.
bool contains (const label pos) const
 Test for True value at specified position, never auto-vivify entries.
label find_first () const
 Locate the first bit that is set.
label find_first_not () const
 Locate the first bit that is unset.
label find_last () const
 Locate the last bit set.
label find_next (label pos) const
 Locate the next bit set, starting one beyond the specified position.
labelList toc () const
 The indices of the on bits as a sorted labelList.
labelList sortedToc () const
 The indices of the on bits as a sorted labelList.
List< bool > values () const
 Return the bitset values as a boolList.
void fill (const bool val)
 Assign all entries to the given value.
void assign (const UList< bool > &bools)
 Copy assign all entries from a list of bools.
void set (const bitSet &bitset)
 Set specified bits from another bitset.
void set (const labelRange &range)
 Set the specified range of bits.
bool test_set (const label i, const bool val=true)
 Test for True value at specified position and change the value at that position.
bitSetunset (const bitSet &other)
 Unset (subtract) the bits specified in the other bitset, which is a set difference corresponds to the logical operation.
void unset (const labelRange &range)
 Unset the specified range of bits specified, never auto-vivifies.
void flip ()
 Invert all bits in the addressable region.
void flip (const label pos)
 Invert bit at the specified position.
void resize_last ()
 Resize to include the last on bit only.
void swap (bitSet &bitset)
 Swap contents.
void transfer (bitSet &bitset)
 Transfer the contents of the argument list into this list and annul the argument list.
bitSetbound (const label maxSize)
 Ensure the addressable range does not exceed maxSize.
bitSetbound (const bitSet &other)
 Ensure the addressable range does not exceed that of other.
bitSetextend (const label minSize)
 Ensure that minSize is covered by the bitSet.
bitSetextend (const bitSet &other)
 Ensure the bitset is addressable throughout the range of other.
template<class InputIter>
label setMany (InputIter first, InputIter last)
 Set the locations listed by the iterator range, auto-vivify entries if needed.
label set (const labelUList &locations)
 Set the listed locations to 1.
template<class Addr>
label set (const IndirectListBase< label, Addr > &locations)
 Set the listed locations to 1.
template<unsigned N>
label set (const FixedList< label, N > &locations)
 Set the listed locations to 1.
template<class InputIter>
label unset (InputIter first, InputIter last)
 Unset the locations listed by the iterator range, never auto-vivify entries.
label unset (const labelUList &locations)
 Unset the listed locations, never auto-vivifies.
template<class Addr>
label unset (const IndirectListBase< label, Addr > &locations)
 Unset the listed locations, never auto-vivifies.
template<unsigned N>
label unset (const FixedList< label, N > &locations)
 Unset the listed locations, never auto-vivifies.
const_iterator begin () const
 Iterator set to the position of the first on bit.
const_iterator cbegin () const
 Iterator set to the position of the first on bit.
const_iterator begin (label pos) const
 Iterator set to the position of the first on bit that occurs at or beyond the given position.
const_iterator cbegin (label pos) const
 Iterator set to the position of the first on bit that occurs at or beyond the given position.
const_iterator end () const noexcept
 Iterator beyond the end of the bitSet.
const_iterator cend () const noexcept
 Iterator beyond the end of the bitSet.
bool operator() (const label pos) const
 Test value at specified position, same as test().
unsigned int operator[] (const label i) const
 Identical to get() - get value at index.
reference operator[] (const label i)
 Non-const access to value at index.
bitSetoperator= (const bitSet &bitset)
 Copy assignment.
bitSetoperator= (bitSet &&bitset)
 Move assignment.
bitSetoperator= (const bool val)
 Assign all entries to the given value. fill().
bitSetoperator&= (const bitSet &other)
 Bitwise-AND all the bits in other with the bits in this bitset.
bitSetoperator|= (const bitSet &other)
 Bitwise-OR operator - similar to the set() method.
bitSetoperator^= (const bitSet &other)
 Bitwise-XOR operator - retains unique entries.
bitSetoperator-= (const bitSet &other)
 Remove entries from this list - identical to the unset() method.
IstreamreadListToc (Istream &is)
 Read contents in "compact" format, which is the listing of the 'on' bits (toc).
OstreamwriteListToc (Ostream &os, label shortLen=0) const
 Write contents in "compact" format, which is the listing of the 'on' bits (toc), with line-breaks in ASCII guided by shortLen parameter ('0' suppresses line-breaks entirely).
InfoProxy< bitSetinfo () const noexcept
 Return info proxy, used to print information to a stream.
void broadcast (int communicator=-1, bool syncSizes=true)
 Broadcast the contents.
void broadcast (std::pair< int, int > communicator_root, bool syncSizes=true)
 Broadcast the contents using the specified communicator/root.
void reduceAnd (int communicator=-1, bool syncSizes=true)
 Inplace bit_and parallel reduction.
void reduceOr (int communicator=-1, bool syncSizes=true)
 Inplace bit_or parallel reduction.
bool found (const label pos) const
 Same as contains().
void assign (const unsigned int val)
 Deprecated(2020-11) use fill().
template<class Addr>
Foam::label set (const IndirectListBase< label, Addr > &locations)
template<class Addr>
Foam::label unset (const IndirectListBase< label, Addr > &locations)
Public Member Functions inherited from PackedList< 1 >
Foam::List< IntType > unpack () const
Foam::List< IntType > unpack (const labelRange &range) const
Foam::List< IntType > unpack (const labelUList &locations) const
constexpr PackedList () noexcept
 Default construct, zero-sized and no allocation.
autoPtr< PackedList< Width > > clone () const
 Clone.
void checkIndex (const label i) const
 Check index is within valid range [0,size).
bool empty () const noexcept
 True if the list is empty (ie, size() is zero).
label size () const noexcept
 Number of entries.
label capacity () const noexcept
 Number of elements that can be stored without reallocating.
bool uniform () const
 True if all entries have identical values (and list is non-empty).
bool equal (const PackedList< Width > &other) const
 Test for equality of sizes and the bits set.
unsigned int get (const label i) const
 Get value at index i or 0 for out-of-range.
bool set (const label i, unsigned int val=~0u)
 Set value at index i, default value set is the max_value.
bool unset (const label i)
 Unset the entry at index i.
labelList values () const
 Return the values as a list of labels.
void fill (const unsigned int val)
 Assign all entries to the given value.
bool trim (label minpos=-1)
 Trim any trailing zero elements, optionally specifying a a minimum position, below which trimming will not occur.
void reset ()
 Clear all bits but do not adjust the addressable size.
void setCapacity (const label numElem)
 Alter the size of the underlying storage.
void resize (const label numElem, const unsigned int val=0u)
 Reset addressable list size, does not shrink the allocated size.
void resize_nocopy (const label numElem)
 Currently identical to resize. Subject to future change (Oct-2021).
void reserve (const label numElem)
 Reserve allocation space for at least this size (uses a size doubling strategy).
void reserve_exact (const label numElem)
 Reserve allocation space for at least this size (uses the specified size without any other resizing strategy).
void clear ()
 Clear the list, i.e. set addressable size to zero.
void clearStorage ()
 Clear the list and delete storage.
void shrink_to_fit ()
 Shrink the allocated space to what is actually used.
void shrink ()
 Alias for shrink_to_fit().
void swap (PackedList< Width > &rhs)
 Swap contents with argument.
void transfer (PackedList< Width > &rhs)
 Transfer the contents of the argument list into this list and annul the argument list.
const List< block_type > & storage () const noexcept
 Return the underlying storage blocks.
const block_typecdata () const noexcept
 A const pointer to the raw storage.
block_typedata () noexcept
 A pointer to the raw storage.
const char * cdata_bytes () const noexcept
 A const pointer to the raw storage, reinterpreted as byte data.
char * data_bytes () noexcept
 A pointer to the raw storage, reinterpreted as byte data.
std::streamsize size_data () const noexcept
 The number of integer blocks addressed in the raw storage. Same as num_blocks().
std::streamsize size_bytes () const noexcept
 The number of bytes addressed in the raw storage including any padding.
std::streamsize byteSize () const noexcept
 Same as size_bytes().
OstreamprintBits (Ostream &os, bool debugOutput=false) const
 Print bit patterns, optionally with extra debug.
IstreamreadList (Istream &is)
 Clear list and read from stream.
OstreamwriteList (Ostream &os, label shortLen=0) const
 Write List, with line-breaks in ASCII when length exceeds shortLen.
void push_back (const unsigned int val)
 Append a value at the end of the list.
void pop_back (label n=1)
 Reduce size by 1 or more elements. Can be called on an empty list.
unsigned int remove ()
 Remove and return the last element.
unsigned int operator[] (const label i) const
 Identical to get() - get value at index.
void operator= (const PackedList< Width > &list)
 Copy assignment.
InfoProxy< PackedList< Width > > info () const noexcept
 Return info proxy, used to print information to a stream.
void assign (const unsigned int val)
 Deprecated(2020-11) use fill().
void setSize (const label n, unsigned int val=0u)
 Alias for resize().
PackedList< Width > & append (const unsigned int val)
 Append a value at the end of the list.
Public Member Functions inherited from PackedListCore
 ClassNameNoDebug ("PackedList")
 Define template name.

Static Public Member Functions

static const bitSetnull () noexcept
 Return a null bitSet (reference to a nullObject).
static bitSet gatherValues (bool localValue, int communicator=-1)
 Gather individual values into bitSet locations.
static bitSet allGather (bool localValue, int communicator=-1)
 Allgather individual values into bitSet locations.
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.
static constexpr block_type mask_lower (unsigned elementOffset)
 Masking for all bits below the element offset.

Protected Member Functions

bitSetminusEq (const bitSet &other)
 The set difference.
bitSetandEq (const bitSet &other)
 The set logical AND.
bitSetorEq (const bitSet &other)
 The set logical OR.
bitSetxorEq (const bitSet &other)
 The set logical XOR.
Protected Member Functions inherited from PackedList< 1 >
unsigned int repeated_value (unsigned val)
unsigned int readValue (Istream &is)
void setPair (Istream &is)
void writeEntry (Ostream &os) const
 Write as a dictionary entry.
void clear_trailing_bits ()
 Clear any partial rubbish in the last addressable block.
void copyAssign (const PackedList< Width > &rhs)
 Copy assignment.
label first_block () const
 Find the first block with a '1' bit.
label first_not_block () const
 Find the first block with a '0' bit.

Additional Inherited Members

Static Public Attributes inherited from PackedList< 1 >
static constexpr unsigned bits_per_block
 The number of bits in a single block.
static constexpr unsigned element_width
 The width of an individual element (in bits).
static constexpr unsigned elem_per_block
 The number of elements stored per data block.
static constexpr block_type max_value
 The max value for an element which is also the bit-mask of the individual element.
Protected Types inherited from PackedList< 1 >
typedef List< block_typeblock_container
 The internal container for storing the blocks.
Protected Attributes inherited from PackedList< 1 >
block_container blocks_
 The blocks of raw data.
label size_
 Number of entries used.

Detailed Description

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.

Source files
See also
Foam::BitOps Foam::PackedList

Definition at line 58 of file bitSet.H.

Member Typedef Documentation

◆ value_type

typedef bool value_type

A bitSet acts like a packed boolList.

Definition at line 123 of file bitSet.H.

◆ const_reference

typedef unsigned int const_reference

Definition at line 130 of file bitSet.H.

Constructor & Destructor Documentation

◆ bitSet() [1/19]

bitSet ( )
inlineconstexprnoexcept

Default construct an empty, zero-sized bitSet.

Definition at line 23 of file bitSetI.H.

References Foam::noexcept, and PackedList< 1 >::PackedList().

Referenced by allGather(), andEq(), bitSet(), bitSet(), bitSet(), bitSet(), bitSet(), bitSet(), bitSet(), bitSet(), bitSet(), bitSet(), bitSet(), bitSet(), bitSet(), bitSet(), bitSet(), bound(), ClassName(), extend(), gatherValues(), info(), intersects(), minusEq(), null(), operator&=(), operator-=(), operator=(), operator=(), operator^=(), operator|=(), orEq(), readListToc(), set(), swap(), transfer(), unset(), writeListToc(), and xorEq().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bitSet() [2/19]

bitSet ( Istream & is)
explicit

Construct from Istream.

Definition at line 219 of file bitSet.C.

References PackedList< 1 >::PackedList().

Here is the call graph for this function:

◆ bitSet() [3/19]

bitSet ( const label n)
inlineexplicit

Construct with given size, with all bits set to 0.

Definition at line 29 of file bitSetI.H.

References n, and PackedList< 1 >::PackedList().

Here is the call graph for this function:

◆ bitSet() [4/19]

bitSet ( const label n,
const bool val )
inline

Construct with given size and value for all elements.

Definition at line 35 of file bitSetI.H.

References bitSet(), fill(), and n.

Here is the call graph for this function:

◆ bitSet() [5/19]

bitSet ( const bitSet & bitset)
inline

Copy construct.

Definition at line 43 of file bitSetI.H.

References bitSet(), and PackedList< 1 >::PackedList().

Here is the call graph for this function:

◆ bitSet() [6/19]

bitSet ( bitSet && bitset)
inline

Move construct.

Definition at line 49 of file bitSetI.H.

References bitSet(), and PackedList< 1 >::PackedList().

Here is the call graph for this function:

◆ bitSet() [7/19]

bitSet ( const bitSet & bitset,
const labelUList & addr )

Construct a new bitSet by extracting the specified (unique) locations of an existing bitSet.

Definition at line 227 of file bitSet.C.

References bitSet(), PackedList< Width >::get(), set(), PackedList< 1 >::size(), and UList< T >::size().

Here is the call graph for this function:

◆ bitSet() [8/19]

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.

References bitSet(), N(), n, and range.

Here is the call graph for this function:

◆ bitSet() [9/19]

bitSet ( const bitSet & bitset,
const labelRange & range )

Construct a new bitSet by extracting the specified range locations of an existing bitSet.

Definition at line 240 of file bitSet.C.

References bitSet(), PackedList< Width >::get(), Foam::pos(), range, set(), and PackedList< 1 >::size().

Here is the call graph for this function:

◆ bitSet() [10/19]

bitSet ( const UList< bool > & bools)
inlineexplicit

Construct from a list of bools.

Definition at line 55 of file bitSetI.H.

References assign(), and bitSet().

Here is the call graph for this function:

◆ bitSet() [11/19]

bitSet ( const label n,
const labelRange & range )
explicit

Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed.

Definition at line 255 of file bitSet.C.

References bitSet(), n, range, and set().

Here is the call graph for this function:

◆ bitSet() [12/19]

bitSet ( const label n,
const labelUList & locations )
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(), bitSet(), UList< T >::end(), n, and setMany().

Here is the call graph for this function:

◆ bitSet() [13/19]

template<class Addr>
bitSet ( const label n,
const IndirectListBase< label, Addr > & locations )
inline

Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed.

Definition at line 72 of file bitSetI.H.

References IndirectListBase< T, Addr >::begin(), bitSet(), IndirectListBase< T, Addr >::end(), n, and setMany().

Here is the call graph for this function:

◆ bitSet() [14/19]

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.

References bitSet(), N(), n, and range.

Here is the call graph for this function:

◆ bitSet() [15/19]

bitSet ( const label n,
std::initializer_list< label > locations )
inline

Construct with given pre-size (filled with 0), subsequently add specified locations as 1, auto-vivify entries if needed.

Definition at line 84 of file bitSetI.H.

References bitSet(), n, and setMany().

Here is the call graph for this function:

◆ bitSet() [16/19]

bitSet ( const labelRange & range)
explicit

Construct with automatic sizing (filled with 0), and set the specified locations as 1.

Definition at line 263 of file bitSet.C.

References range, and set().

Here is the call graph for this function:

◆ bitSet() [17/19]

bitSet ( const labelUList & locations)
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(), bitSet(), UList< T >::end(), and setMany().

Here is the call graph for this function:

◆ bitSet() [18/19]

template<class Addr>
bitSet ( const IndirectListBase< label, Addr > & locations)
inlineexplicit

Construct with automatic sizing (filled with 0), and set the specified locations as 1.

Definition at line 105 of file bitSetI.H.

References IndirectListBase< T, Addr >::begin(), bitSet(), IndirectListBase< T, Addr >::end(), and setMany().

Here is the call graph for this function:

◆ bitSet() [19/19]

template<unsigned N>
bitSet ( const FixedList< label, N > & locations)
explicit

Construct with automatic sizing (filled with 0), and set the specified locations as 1.

References all(), any(), bitSet(), clone(), count(), intersects(), N(), and none().

Here is the call graph for this function:

Member Function Documentation

◆ minusEq()

Foam::bitSet & minusEq ( const bitSet & other)
protected

The set difference.

A = (A - B)
A = (A & !B)
A = (A & ~B)
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)

A and B can have different sizes. Never changes the original set size. Non-overlapping parts are considered off.

Definition at line 39 of file bitSet.C.

References bitSet(), PackedList< Width >::blocks_, PackedList< 1 >::blocks_, InfoInFunction, Foam::nl, none(), PackedList< 1 >::num_blocks(), PackedList< 1 >::reset(), Foam::rhs(), PackedList< Width >::size(), and PackedList< 1 >::size().

Referenced by operator-=(), and unset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ andEq()

Foam::bitSet & andEq ( const bitSet & other)
protected

The set logical AND.

A = (A & B)

A and B can have different sizes. Never changes the original set size. Non-overlapping parts are considered off.

Definition at line 74 of file bitSet.C.

References bitSet(), PackedList< Width >::blocks_, PackedList< 1 >::blocks_, FOAM_UNLIKELY, InfoInFunction, Foam::nl, none(), none, PackedList< 1 >::num_blocks(), reset(), resize(), Foam::rhs(), PackedList< Width >::size(), and PackedList< 1 >::size().

Referenced by operator&=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ orEq()

Foam::bitSet & orEq ( const bitSet & other)
protected

The set logical OR.

A = (A | B)

A and B can have different sizes

The size grows to accommodate new on bits.

Definition at line 126 of file bitSet.C.

References bitSet(), PackedList< Width >::blocks_, PackedList< 1 >::blocks_, find_last(), InfoInFunction, Foam::nl, none(), PackedList< 1 >::num_blocks(), resize(), Foam::rhs(), PackedList< Width >::size(), and PackedList< 1 >::size().

Referenced by operator|=(), and set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xorEq()

Foam::bitSet & xorEq ( const bitSet & other)
protected

The set logical XOR.

A = (A ^ B)

A and B can have different sizes.

The size grows to accommodate new on bits.

Definition at line 171 of file bitSet.C.

References bitSet(), PackedList< Width >::blocks_, PackedList< 1 >::blocks_, find_last(), InfoInFunction, Foam::nl, none(), PackedList< 1 >::num_blocks(), reset(), resize(), Foam::rhs(), PackedList< Width >::size(), and PackedList< 1 >::size().

Referenced by operator^=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ null()

const bitSet & null ( )
inlinestaticnoexcept

Return a null bitSet (reference to a nullObject).

Definition at line 138 of file bitSet.H.

References bitSet(), Foam::noexcept, and Foam::NullObjectRef().

Referenced by PatchTools::edgeNormals(), PatchTools::edgeNormals(), addPatchCellLayer::globalEdgeFaces(), PatchTools::pointNormals(), and PatchTools::pointNormals().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ClassName()

ClassName ( "bitSet" )

Declare type-name (with debug switch).

References bitSet(), n, and Foam::noexcept.

Here is the call graph for this function:

◆ clone()

Foam::autoPtr< Foam::bitSet > clone ( ) const
inline

Clone.

Definition at line 116 of file bitSetI.H.

References autoPtr< T >::New().

Referenced by bitSet().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ all()

bool all ( ) const
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.

Note
Method name compatibility with boost::dynamic_bitset

Definition at line 401 of file bitSetI.H.

References PackedList< 1 >::empty(), and PackedList< 1 >::first_not_block().

Referenced by bitSet(), triSurface::checkTriangles(), ensightCase::printTimeset(), NASedgeFormat::read(), and STARCDedgeFormat::read().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ any()

bool any ( ) const
inline

True if any bits in this bitset are set.

Note
Method name compatibility with boost::dynamic_bitset

Definition at line 408 of file bitSetI.H.

References PackedList< 1 >::first_block().

Referenced by bitSet(), ensightMesh::correct(), toc(), cellCellStencil::walkFront(), writeObjects::write(), and writeListToc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ none()

bool none ( ) const
inline

True if no bits in this bitset are set.

Note
Method name compatibility with boost::dynamic_bitset

Definition at line 414 of file bitSetI.H.

References PackedList< 1 >::first_block().

Referenced by andEq(), bitSet(), ensightMesh::correct(), distanceSurface::createGeometry(), distanceSurface::filterRegionProximity(), minusEq(), orEq(), and xorEq().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ count()

unsigned int count ( const bool on = true) const
inline

◆ intersects()

bool intersects ( const bitSet & other) const

True if any bits in the other bitset intersect (are the same).

Note
Method name compatibility with boost::dynamic_bitset

Definition at line 296 of file bitSet.C.

References bitSet(), PackedList< Width >::blocks_, PackedList< 1 >::blocks_, PackedList< 1 >::num_blocks(), Foam::rhs(), PackedList< Width >::size(), and PackedList< 1 >::size().

Referenced by bitSet().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test()

bool test ( const label pos) const
inline

Test for True value at specified position, never auto-vivify entries.

Note
Method name compatibility with std::bitset

Definition at line 334 of file bitSet.H.

References PackedList< 1 >::get(), Foam::pos(), and test().

Referenced by polyMeshTetDecomposition::adjustTetBasePtIs(), extendedEdgeMesh::autoMap(), Foam::calcElementMasks(), polyDualMesh::calcFeatures(), Foam::calcNormalDistance_filtered(), dynamicRefineFvMesh::calculateProtectedCells(), primitiveMeshTools::cellDeterminant(), 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(), dynamicRefineFvMesh::init(), isoSurfaceTopo::isoSurfaceTopo(), edgeMesh::mergeEdges(), operator()(), cell::opposingFace(), plicRDF::reconstruct(), distanceSurface::refineBlockedCells(), snappySnapDriver::repatchToSurface(), fvMeshSubset::reset(), dynamicRefineFvMesh::selectRefineCells(), dynamicRefineFvMesh::selectUnrefinePoints(), motionSmootherAlgo::setDisplacement(), faceAreaWeightAMI::setNextFaces(), edgeCollapser::setRefinement(), hexRef8::setRefinement(), fieldSmoother::smoothLambdaMuDisplacement(), fieldSmoother::smoothNormals(), extendedEdgeMesh::sortPointsAndEdges(), triSurface::subsetMesh(), test(), test_set(), meshRefinement::updateIntersections(), cellCellStencil::walkFront(), meshRefinement::weightedSum(), and meshRefinement::zonify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ contains()

bool contains ( const label pos) const
inline

Test for True value at specified position, never auto-vivify entries.

Note
Method name compatibility with HashSet

Definition at line 343 of file bitSet.H.

References PackedList< 1 >::get(), and Foam::pos().

Referenced by found().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_first()

Foam::label find_first ( ) const
inline

Locate the first bit that is set.

Returns
the location or -1 if there are no bits set.
Note
Method name compatibility with boost::dynamic_bitset

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::reorder(), Foam::ListOps::setValue(), and writeListToc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_first_not()

Foam::label find_first_not ( ) const
inline

Locate the first bit that is unset.

Returns
the location or -1 if the set is empty or all bits are on.
Note
Provided for symmetry with find_first()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_last()

Foam::label find_last ( ) const
inline

Locate the last bit set.

Returns
the location or -1 if there are no bits set.
Note
Provided for symmetry with find_first()

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(), orEq(), resize_last(), topoBitSet::updateLabels(), and xorEq().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_next()

Foam::label find_next ( label pos) const
inline

Locate the next bit set, starting one beyond the specified position.

Returns
the location or -1 if there are no further bits set.
Note
Method name compatibility with boost::dynamic_bitset

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 Foam::reorder(), faceAreaWeightAMI::setNextFaces(), Foam::ListOps::setValue(), and writeListToc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toc()

Foam::labelList toc ( ) const

The indices of the on bits as a sorted labelList.

Note
Method name compatibility with HashSet

Definition at line 476 of file bitSet.C.

References any(), PackedList< 1 >::blocks_, count(), PackedList< 1 >::elem_per_block, PackedList< 1 >::num_blocks(), Foam::pos(), and PackedList< 1 >::size().

Referenced by snappySnapDriver::calcNearestSurface(), snappySnapDriver::detectNearSurfaces(), sortedToc(), Foam::BitOps::toc(), and solidBodyFvGeometryScheme::updateGeom().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortedToc()

Foam::labelList sortedToc ( ) const
inline

The indices of the on bits as a sorted labelList.

This is identical to toc(), which is always sorted.

Note
Method name compatibility with HashSet

Definition at line 441 of file bitSetI.H.

References toc().

Referenced by meshRefinement::blockLeakFaces(), faMesh::boundaryPoints(), snappyRefineDriver::doRefine(), dynamicMultiMotionSolverFvMesh::init(), faMesh::internalPoints(), meshRefinement::intersectedPoints(), multiSolidBodyMotionSolver::multiSolidBodyMotionSolver(), noiseModel::octaves(), fvMeshSubset::reset(), cellSetOption::setCellSelection(), Foam::BitOps::sortedToc(), PatchTools::subsetMap(), and reconstructionSchemes::surface().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ values()

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 515 of file bitSet.C.

References PackedList< 1 >::blocks_, PackedList< 1 >::elem_per_block, PackedList< 1 >::num_blocks(), Foam::pos(), and PackedList< 1 >::size().

Referenced by faceBitSet::distribute(), and pointBitSet::distribute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill()

void fill ( const bool val)
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(), and PackedList< 1 >::num_blocks().

Referenced by assign(), assign(), bitSet(), operator=(), and readListToc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assign() [1/2]

void assign ( const UList< bool > & bools)

Copy assign all entries from a list of bools.

Definition at line 271 of file bitSet.C.

References b, PackedList< 1 >::blocks_, PackedList< Width >::elem_per_block, fill(), resize(), and UList< T >::size().

Referenced by bitSet(), faceBitSet::distribute(), pointBitSet::distribute(), and gatherValues().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set() [1/6]

void set ( const bitSet & bitset)
inline

Set specified bits from another bitset.

The current set size may grow to accommodate any new bits (auto-vivifies).

Definition at line 502 of file bitSetI.H.

References bitSet(), and orEq().

Referenced by AABBTree< Type >::AABBTree(), geometric::add(), polyMeshTetDecomposition::adjustTetBasePtIs(), Foam::apply(), cellToFaceZone::applyToSet(), extendedEdgeMesh::autoMap(), bitSet(), bitSet(), bitSet(), bitSet(), meshRefinement::blockLeakFaces(), PatchTools::calcBounds(), Foam::calcElementMasks(), polyDualMesh::calcFeatures(), createShellMesh::calcPointRegions(), dynamicRefineFvMesh::calculateProtectedCells(), oversetFvMeshBase::cellAverage(), cuttingSurfaceBase::cellSelection(), edgeCollapser::checkMeshQuality(), ABAQUSCore::readHelper::compact_nodes(), edgeCollapser::consistentCollapse(), hexRef8::consistentSlowRefinement2(), hexRef8::consistentUnrefinement(), ensightMesh::correct(), Foam::BitSetOps::create(), Foam::BitSetOps::create(), Foam::BitSetOps::create(), AABBTree< Type >::createBoxes(), inverseDistance::createStencil(), snappyLayerDriver::doLayers(), snappyRefineDriver::doRefine(), dynamicRefineFvMesh::extendMarkedCells(), distanceSurface::filterFaceProximity(), distanceSurface::filterKeepLargestRegion(), distanceSurface::filterKeepNearestRegions(), distanceSurface::filterPrepareRegionSplit(), distanceSurface::filterRegionProximity(), addPatchCellLayer::findDuplicatedPoints(), meshRefinement::findRegions(), PstreamBuffers::finishedSends(), gatherValues(), meshRefinement::getMasterEdges(), syncTools::getMasterEdges(), meshRefinement::getMasterPoints(), syncTools::getMasterPoints(), dynamicMultiMotionSolverFvMesh::init(), dynamicRefineFvMesh::init(), meshRefinement::intersectedPoints(), isoSurfaceCell::isoSurfaceCell(), isoSurfacePoint::isoSurfacePoint(), isoSurfaceTopo::isoSurfaceTopo(), dynamicRefineFvMesh::mapFields(), displacementPointSmoothingMotionSolver::markAffectedFaces(), displacementSmartPointSmoothingMotionSolver::markAffectedFaces(), meshRefinement::markOutsideFaces(), Foam::markupBoundaryPoints(), PatchTools::matchEdges(), edgeMesh::mergeEdges(), multiSolidBodyMotionSolver::multiSolidBodyMotionSolver(), oversetFvMeshBase::normalisation(), fileOperation::nProcs(), noiseModel::octaves(), bitSet::reference::operator=(), bitSet::reference::operator=(), cell::opposingFace(), cuttingSurfaceBase::performCut(), pointSmoother::pointsToMove(), NASedgeFormat::read(), STARCDedgeFormat::read(), readListToc(), plicRDF::reconstruct(), dynamicRefineFvMesh::refine(), distanceSurface::refineBlockedCells(), displacementPointSmoothingMotionSolver::relax(), displacementSmartPointSmoothingMotionSolver::relax(), Foam::reorder(), snappySnapDriver::repatchToSurface(), sampledFaceZone::sampleOnPoints(), sampledPatch::sampleOnPoints(), sampledSurface::sampleOnPoints(), cellCellStencil::seedCell(), ZoneMesh< ZoneType, MeshType >::selection(), dynamicRefineFvMesh::selectRefineCandidates(), dynamicRefineFvMesh::selectUnrefinePoints(), Foam::BitOps::set(), refinementSurfaces::setCurvatureMinLevelFields(), addPatchCellLayer::setRefinement(), edgeCollapser::setRefinement(), hexRef8::setRefinement(), cellCellStencil::setUpFront(), cellCellStencil::setUpFrontOnOversetPatch(), Foam::simpleGeometricFilter(), fieldSmoother::smoothNormals(), topoBitSet::subset(), PatchTools::subsetMap(), MeshedSurface< Face >::subsetMesh(), triSurface::subsetMesh(), reconstructionSchemes::surface(), Foam::fvc::surfaceSum(), 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(), cellCellStencil::walkFront(), writeObjects::write(), AMICache::writeData(), and triSurface::writeStats().

Here is the call graph for this function:

◆ set() [2/6]

void set ( const labelRange & range)

Set the specified range of bits.

The current set size may grow to accommodate any new bits (auto-vivifies).

Note
this operation is generally more efficient than calling set(pos) on individual bits.

Definition at line 316 of file bitSet.C.

References labelRange::adjust(), IntRange< IntType >::begin_value(), PackedList< 1 >::blocks_, PackedList< 1 >::elem_per_block, IntRange< IntType >::empty(), IntRange< IntType >::end_value(), PackedList< 1 >::mask_lower(), range, reserve(), resize(), and PackedList< 1 >::size().

Here is the call graph for this function:

◆ test_set()

bool test_set ( const label i,
const bool val = true )
inline

Test for True value at specified position and change the value at that position.

Does auto-vivify for non-existent, non-zero entries.

Note
Method name compatibility with std::bitset

Definition at line 494 of file bitSetI.H.

References PackedList< Width >::set(), and test().

Here is the call graph for this function:

◆ unset() [1/7]

◆ unset() [2/7]

void unset ( const labelRange & range)

Unset the specified range of bits specified, never auto-vivifies.

Note
this operation can be more efficient than calling unset(pos) on individual bits.

Definition at line 395 of file bitSet.C.

References IntRange< IntType >::begin_value(), PackedList< 1 >::blocks_, PackedList< 1 >::elem_per_block, IntRange< IntType >::empty(), IntRange< IntType >::end_value(), PackedList< 1 >::mask_lower(), range, resize(), and PackedList< 1 >::size().

Here is the call graph for this function:

◆ flip() [1/2]

◆ flip() [2/2]

void flip ( const label pos)
inline

Invert bit at the specified position.

A no-op if the position is out-of-range

Definition at line 561 of file bitSetI.H.

References bitSet::reference::flip(), and PackedList< 1 >::size().

Here is the call graph for this function:

◆ resize_last()

void resize_last ( )
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(), find_last(), Foam::pos(), and PackedList< 1 >::resize().

Referenced by Foam::operator&(), Foam::operator-(), Foam::operator^(), and Foam::operator|().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swap()

void swap ( bitSet & bitset)
inline

Swap contents.

Definition at line 462 of file bitSetI.H.

References bitSet(), and PackedList< Width >::swap().

Here is the call graph for this function:

◆ transfer()

void transfer ( bitSet & bitset)
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 bitSet(), and PackedList< Width >::transfer().

Referenced by operator=(), topoBitSet::updateLabels(), and cellCellStencil::walkFront().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bound() [1/2]

Foam::bitSet & bound ( const label maxSize)
inline

Ensure the addressable range does not exceed maxSize.

Either decreases the size of the bitSet or is a no-op.

pointField& pts = mesh.points();
bitset.bound(pts.size());
for (const label pointi : bitset)
{
pts[pointi] ...
}
bitSet & bound(const label maxSize)
Ensure the addressable range does not exceed maxSize.
Definition bitSetI.H:570
dynamicFvMesh & mesh
vectorField pointField
pointField is a vectorField.
const pointField & pts

Definition at line 570 of file bitSetI.H.

References PackedList< 1 >::resize(), and PackedList< 1 >::size().

Referenced by bound().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bound() [2/2]

Foam::bitSet & bound ( const bitSet & other)
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 581 of file bitSetI.H.

References bitSet(), bound(), and PackedList< Width >::size().

Here is the call graph for this function:

◆ extend() [1/2]

Foam::bitSet & extend ( const label minSize)
inline

Ensure that minSize is covered by the bitSet.

Either increases the size of the bitSet or is a no-op.

Definition at line 587 of file bitSetI.H.

References PackedList< 1 >::resize(), and PackedList< 1 >::size().

Referenced by extend(), and reduceOr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extend() [2/2]

Foam::bitSet & extend ( const bitSet & other)
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 598 of file bitSetI.H.

References bitSet(), extend(), and PackedList< Width >::size().

Here is the call graph for this function:

◆ setMany()

template<class InputIter>
label setMany ( InputIter first,
InputIter last )

Set the locations listed by the iterator range, auto-vivify entries if needed.

Returns
number of locations changed

Referenced by cellToFaceZone::applyToSet(), holeToFace::applyToSet(), bitSet(), bitSet(), bitSet(), bitSet(), bitSet(), Foam::HashSetOps::bitset(), set(), and set().

Here is the caller graph for this function:

◆ set() [3/6]

Foam::label set ( const labelUList & locations)
inline

Set the listed locations to 1.

Does auto-vivify for non-existent entries.

Returns
number of locations changed

Definition at line 508 of file bitSetI.H.

References UList< T >::begin(), UList< T >::end(), and setMany().

Here is the call graph for this function:

◆ set() [4/6]

template<class Addr>
label set ( const IndirectListBase< label, Addr > & locations)
inline

Set the listed locations to 1.

Does auto-vivify for non-existent entries.

Returns
number of locations changed

◆ set() [5/6]

template<unsigned N>
label set ( const FixedList< label, N > & locations)

Set the listed locations to 1.

Does auto-vivify for non-existent entries.

Returns
number of locations changed

◆ unset() [3/7]

template<class InputIter>
label unset ( InputIter first,
InputIter last )

Unset the locations listed by the iterator range, never auto-vivify entries.

Returns
number of locations changed

◆ unset() [4/7]

Foam::label unset ( const labelUList & locations)
inline

Unset the listed locations, never auto-vivifies.

Returns
number of locations changed

Definition at line 524 of file bitSetI.H.

References UList< T >::begin(), UList< T >::end(), and unset().

Here is the call graph for this function:

◆ unset() [5/7]

template<class Addr>
label unset ( const IndirectListBase< label, Addr > & locations)
inline

Unset the listed locations, never auto-vivifies.

Returns
number of locations changed

◆ unset() [6/7]

template<unsigned N>
label unset ( const FixedList< label, N > & locations)

Unset the listed locations, never auto-vivifies.

Returns
number of locations changed

◆ begin() [1/2]

Foam::bitSet::const_iterator begin ( ) const
inline

Iterator set to the position of the first on bit.

Definition at line 224 of file bitSetI.H.

Referenced by bitSet::const_iterator::bitSet.

Here is the caller graph for this function:

◆ cbegin() [1/2]

Foam::bitSet::const_iterator cbegin ( ) const
inline

Iterator set to the position of the first on bit.

Definition at line 230 of file bitSetI.H.

Referenced by bitSet::const_iterator::bitSet.

Here is the caller graph for this function:

◆ begin() [2/2]

Foam::bitSet::const_iterator begin ( label pos) const
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().

Here is the call graph for this function:

◆ cbegin() [2/2]

Foam::bitSet::const_iterator cbegin ( label pos) const
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().

Here is the call graph for this function:

◆ end()

Foam::bitSet::const_iterator end ( ) const
inlinenoexcept

Iterator beyond the end of the bitSet.

Definition at line 248 of file bitSetI.H.

References Foam::noexcept.

Referenced by bitSet::const_iterator::bitSet.

Here is the caller graph for this function:

◆ cend()

Foam::bitSet::const_iterator cend ( ) const
inlinenoexcept

Iterator beyond the end of the bitSet.

Definition at line 254 of file bitSetI.H.

References Foam::noexcept.

Referenced by bitSet::const_iterator::bitSet.

Here is the caller graph for this function:

◆ operator()()

bool operator() ( const label pos) const
inline

Test value at specified position, same as test().

Enables use as a predicate

Definition at line 606 of file bitSetI.H.

References Foam::pos(), and test().

Here is the call graph for this function:

◆ operator[]() [1/2]

unsigned int operator[] ( const label i) const
inline

Identical to get() - get value at index.

Never auto-vivify entries.

Definition at line 612 of file bitSetI.H.

References PackedList< 1 >::get().

Here is the call graph for this function:

◆ operator[]() [2/2]

Foam::bitSet::reference operator[] ( const label i)
inline

Non-const access to value at index.

Fatal for out-of-range indices

Definition at line 618 of file bitSetI.H.

References PackedList< 1 >::checkIndex().

Here is the call graph for this function:

◆ operator=() [1/3]

Foam::bitSet & operator= ( const bitSet & bitset)
inline

Copy assignment.

Definition at line 627 of file bitSetI.H.

References bitSet(), and PackedList< Width >::operator=().

Here is the call graph for this function:

◆ operator=() [2/3]

Foam::bitSet & operator= ( bitSet && bitset)
inline

Move assignment.

Definition at line 634 of file bitSetI.H.

References bitSet(), and transfer().

Here is the call graph for this function:

◆ operator=() [3/3]

Foam::bitSet & operator= ( const bool val)
inline

Assign all entries to the given value. fill().

Definition at line 641 of file bitSetI.H.

References fill().

Here is the call graph for this function:

◆ operator&=()

Foam::bitSet & operator&= ( const bitSet & other)
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 648 of file bitSetI.H.

References andEq(), and bitSet().

Here is the call graph for this function:

◆ operator|=()

Foam::bitSet & operator|= ( const bitSet & other)
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 654 of file bitSetI.H.

References bitSet(), and orEq().

Here is the call graph for this function:

◆ operator^=()

Foam::bitSet & operator^= ( const bitSet & other)
inline

Bitwise-XOR operator - retains unique entries.

The operands may have dissimilar sizes, the set grows to accommodate new on bits.

Definition at line 660 of file bitSetI.H.

References bitSet(), and xorEq().

Here is the call graph for this function:

◆ operator-=()

Foam::bitSet & operator-= ( const bitSet & other)
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 666 of file bitSetI.H.

References bitSet(), and minusEq().

Here is the call graph for this function:

◆ readListToc()

Foam::Istream & readListToc ( Istream & is)

Read contents in "compact" format, which is the listing of the 'on' bits (toc).

This function mostly useful for relatively sparse sets.

Note
currently ASCII only.

Definition at line 132 of file bitSetIO.C.

References token::BEGIN_LIST, bitSet(), PackedList< Width >::clear(), Foam::exit(), IOstream::fatalCheck(), Foam::FatalIOError, FatalIOErrorInFunction, fill(), FUNCTION_NAME, token::info(), token::isLabel(), token::labelToken(), Foam::nl, token::read(), Istream::readBeginList(), Istream::readEndList(), PackedList< Width >::resize(), and set().

Referenced by bitSet::const_iterator::bitSet.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeListToc()

Foam::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 ASCII guided by shortLen parameter ('0' suppresses line-breaks entirely).

This function mostly useful for relatively sparse sets.

Note
currently ASCII only.

Definition at line 35 of file bitSetIO.C.

References any(), token::BEGIN_BLOCK, token::BEGIN_LIST, bitSet(), count(), token::END_BLOCK, token::END_LIST, Switch::FALSE, find_first(), find_next(), Switch::INVALID, Foam::nl, os(), PackedList< Width >::size(), token::SPACE, and Switch::TRUE.

Referenced by bitSet::const_iterator::bitSet.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ info()

InfoProxy< bitSet > info ( ) const
inlinenoexcept

Return info proxy, used to print information to a stream.

Definition at line 871 of file bitSet.H.

References bitSet(), info(), and Foam::noexcept.

Referenced by info().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ broadcast() [1/2]

void broadcast ( int communicator = -1,
bool syncSizes = true )

Broadcast the contents.

Parameters
communicatorThe UPstream communicator (default is worldComm)
syncSizesFalse: sizes already consistent. True: adjust sizes.

Definition at line 642 of file bitSet.C.

References UPstream::is_parallel(), UPstream::masterNo(), and UPstream::worldComm.

Referenced by allGather().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ broadcast() [2/2]

void broadcast ( std::pair< int, int > communicator_root,
bool syncSizes = true )

Broadcast the contents using the specified communicator/root.

Parameters
communicator_rootUPstream communicator and broadcast root
syncSizesFalse: sizes already consistent. True: adjust sizes.

Definition at line 626 of file bitSet.C.

References UList< T >::first(), and UPstream::is_parallel().

Here is the call graph for this function:

◆ reduceAnd()

void reduceAnd ( int communicator = -1,
bool syncSizes = true )

Inplace bit_and parallel reduction.

Parameters
communicatorThe UPstream communicator (default is worldComm)
syncSizesFalse: sizes already consistent. True: adjust (shrink) sizes.

Definition at line 656 of file bitSet.C.

References PackedList< 1 >::clear_trailing_bits(), PackedList< 1 >::data(), PackedList< 1 >::empty(), UPstream::is_parallel(), UPstream::mpiAllReduce(), PackedList< 1 >::num_blocks(), resize(), PackedList< 1 >::size(), and UPstream::worldComm.

Here is the call graph for this function:

◆ reduceOr()

void reduceOr ( int communicator = -1,
bool syncSizes = true )

Inplace bit_or parallel reduction.

Parameters
communicatorThe UPstream communicator (default is worldComm)
syncSizesFalse: sizes already consistent. True: adjust (extend) sizes.

Definition at line 705 of file bitSet.C.

References PackedList< 1 >::clear_trailing_bits(), PackedList< 1 >::data(), PackedList< 1 >::empty(), extend(), UPstream::is_parallel(), UPstream::mpiAllReduce(), PackedList< 1 >::num_blocks(), PackedList< 1 >::size(), and UPstream::worldComm.

Here is the call graph for this function:

◆ gatherValues()

Foam::bitSet gatherValues ( bool localValue,
int communicator = -1 )
static

Gather individual values into bitSet locations.

On master, the resulting bitSet has size == nProcs, otherwise zero length.
For non-parallel : the length of the returned set is 1 with localValue.

Parameters
localValueThe processor-local value
communicatorThe UPstream communicator (default is worldComm)

Definition at line 755 of file bitSet.C.

References assign(), bitSet(), UList< T >::data(), UPstream::is_parallel(), UPstream::master(), UPstream::mpiGather(), UPstream::nProcs(), List< T >::resize(), PackedList< Width >::resize(), set(), and UPstream::worldComm.

Referenced by allGather().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allGather()

Foam::bitSet allGather ( bool localValue,
int communicator = -1 )
static

Allgather individual values into bitSet locations.

The resulting bitSet has size nProcs, identical on all ranks. Behaves like Pstream::allGatherValues() but returning a bitSet.

Parameters
localValueThe processor-local value
communicatorThe UPstream communicator (default is worldComm)

Definition at line 800 of file bitSet.C.

References bitSet(), broadcast(), gatherValues(), UPstream::is_parallel(), UPstream::nProcs(), PackedList< Width >::resize(), and UPstream::worldComm.

Here is the call graph for this function:

◆ found()

bool found ( const label pos) const
inline

Same as contains().

Definition at line 960 of file bitSet.H.

References contains(), and Foam::pos().

Here is the call graph for this function:

◆ assign() [2/2]

void assign ( const unsigned int val)
inline

Deprecated(2020-11) use fill().

Deprecated
(2020-11) use fill()

Definition at line 967 of file bitSet.H.

References fill().

Here is the call graph for this function:

◆ set() [6/6]

template<class Addr>
Foam::label set ( const IndirectListBase< label, Addr > & locations)
inline

Definition at line 515 of file bitSetI.H.

References IndirectListBase< T, Addr >::begin(), IndirectListBase< T, Addr >::end(), and setMany().

Here is the call graph for this function:

◆ unset() [7/7]

template<class Addr>
Foam::label unset ( const IndirectListBase< label, Addr > & locations)
inline

Definition at line 531 of file bitSetI.H.

References IndirectListBase< T, Addr >::begin(), IndirectListBase< T, Addr >::end(), and unset().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
  • src/OpenFOAM/containers/Bits/bitSet/bitSet.H
  • src/OpenFOAM/containers/Bits/bitSet/bitSet.C
  • src/OpenFOAM/containers/Bits/bitSet/bitSetI.H
  • src/OpenFOAM/containers/Bits/bitSet/bitSetIO.C