Various bit-wise operations and adaptor methods for containers that are somewhat similar to bitSet (eg, boolList, labelHashSet). More...
Classes | |
| struct | bitInfo |
| An (unsigned) integral type adapter, for output of bit values. More... | |
Functions | |
| unsigned int | count (const UList< bool > &bools, const bool val=true) |
| Count number of 'true' entries. | |
| bool | all (const UList< bool > &bools) |
| True if all entries are 'true' or if the list is empty. | |
| bool | any (const UList< bool > &bools) |
| True if any entries are 'true'. | |
| bool | none (const UList< bool > &bools) |
| True if no entries are 'true'. | |
| void | set (List< bool > &bools, const labelUList &locations) |
| Set the listed locations (assign 'true'). | |
| void | set (List< bool > &bools, const labelRange &range) |
| Set the specified range 'on' in a boolList. | |
| void | set (labelHashSet &hashset, const labelRange &range) |
| Set the specified range in a labelHashSet. | |
| void | set (bitSet &bitset, const labelRange &range) |
| Forward to bitSet::set(labelRange). | |
| void | unset (List< bool > &bools, const labelUList &locations) |
| Unset the listed locations (assign 'false'). | |
| void | unset (List< bool > &bools, const labelRange &range) |
| Unset the specified range 'on' in a boolList. | |
| void | unset (labelHashSet &hashset, const labelRange &range) |
| Unset the specified range in a labelHashSet. | |
| void | unset (bitSet &bitset, const labelRange &range) |
| Forward to bitSet::unset(labelRange). | |
| List< bool > | select (const label n, const labelUList &locations) |
| Construct a selection list of bools (all false) with the given pre-size, subsequently add specified locations as true, auto-vivify entries if needed. | |
| List< bool > | select (const labelUList &locations) |
| Construct an auto-sized selection list of bools (all false), and populate the specified locations as true. | |
| unsigned int | count (const bitSet &bitset, const bool on=true) |
| Forward to bitSet::count(). | |
| List< label > | toc (const UList< bool > &bools) |
| Return the (sorted) values corresponding to 'true' entries. | |
| List< label > | sortedToc (const UList< bool > &bools) |
| Return the (sorted) values corresponding to 'true' entries. | |
| List< label > | toc (const bitSet &bitset) |
| Forward to bitSet::toc(), the sorted values of the 'on' entries. | |
| List< label > | sortedToc (const bitSet &bitset) |
| Forward to bitSet::sortedToc(), the sorted values of the 'on' entries. | |
| List< label > | toc (const labelHashSet &hashset) |
| Forward to labelHashSet::sortedToc(), the sorted values of the 'on' entries. | |
| List< label > | sortedToc (const labelHashSet &hashset) |
| Forward to labelHashSet::sortedToc(), the sorted values of the 'on' entries. | |
| template<class UIntType> | |
| unsigned int | bit_count (UIntType x) |
| Count arbitrary number of bits (of an integral type). | |
| template<> | |
| unsigned int | bit_count (uint32_t x) |
| Count bits in a 32-bit value (Hamming weight method). | |
| template<> | |
| unsigned int | bit_count (uint64_t x) |
| Count bits in a 64-bit value (Hamming weight method). | |
| template<class UIntType, unsigned BitWidth> | |
| UIntType | repeat_value (unsigned val) |
| Repeat a value of the given BitWidth into the destination output type. | |
| template<class UIntType> | |
| Ostream & | print (Ostream &os, UIntType value, char off='0', char on='1') |
| Print 0/1 bits in the (unsigned) integral type. | |
Various bit-wise operations and adaptor methods for containers that are somewhat similar to bitSet (eg, boolList, labelHashSet).
The population count uses the Hamming weight (http://en.wikipedia.org/wiki/Hamming_weight).
|
inline |
Count number of 'true' entries.
| val | can be set to false to count the number of false values instead For compatibility with bitSet::count() |
Definition at line 73 of file BitOps.H.
References UList< T >::begin(), and UList< T >::end().
Referenced by geometric::add(), decompositionMethod::decompose(), and toc().


|
inline |
True if all entries are 'true' or if the list is empty.
For compatibility with bitSet::all()
Definition at line 83 of file BitOps.H.
References UList< T >::all().

|
inline |
True if any entries are 'true'.
For compatibility with bitSet::any()
Definition at line 90 of file BitOps.H.
References UList< T >::any().

|
inline |
True if no entries are 'true'.
For compatibility with bitSet::none()
Definition at line 97 of file BitOps.H.
References UList< T >::none().

| void set | ( | List< bool > & | bools, |
| const labelUList & | locations ) |
Set the listed locations (assign 'true').
Does auto-vivify for non-existent entries.
For compatibility with bitSet::set(labelUList)
Definition at line 35 of file BitOps.C.
References UList< T >::begin(), UList< T >::end(), Foam::max(), List< T >::resize(), and UList< T >::size().
Referenced by select(), and select().


| void set | ( | List< bool > & | bools, |
| const labelRange & | range ) |
Set the specified range 'on' in a boolList.
For compatibility with bitSet::set(labelRange)
Definition at line 57 of file BitOps.C.
References labelRange::adjust(), IntRange< IntType >::empty(), IntRange< IntType >::end_value(), range, List< T >::resize(), List< T >::set(), and UList< T >::size().

| void set | ( | labelHashSet & | hashset, |
| const labelRange & | range ) |
Set the specified range in a labelHashSet.
For compatibility with bitSet::set(labelRange)
Definition at line 86 of file BitOps.C.
References labelRange::adjust(), range, and HashSet< Key, Hash >::set().

| void set | ( | bitSet & | bitset, |
| const labelRange & | range ) |
Forward to bitSet::set(labelRange).
Definition at line 98 of file BitOps.C.
References range, and bitSet::set().

| void unset | ( | List< bool > & | bools, |
| const labelUList & | locations ) |
Unset the listed locations (assign 'false').
No auto-vivify non-existent entries.
For compatibility with bitSet::set(labelUList)
Definition at line 104 of file BitOps.C.
References UList< T >::unset().

| void unset | ( | List< bool > & | bools, |
| const labelRange & | range ) |
Unset the specified range 'on' in a boolList.
For compatibility with bitSet::unset(labelRange)
Definition at line 114 of file BitOps.C.
References range, and UList< T >::unset().

| void unset | ( | labelHashSet & | hashset, |
| const labelRange & | range ) |
Unset the specified range in a labelHashSet.
For compatibility with bitSet::unset(labelRange)
Definition at line 123 of file BitOps.C.
References range, and HashSet< Key, Hash >::unset().

| void unset | ( | bitSet & | bitset, |
| const labelRange & | range ) |
Forward to bitSet::unset(labelRange).
Definition at line 132 of file BitOps.C.
References range, and bitSet::unset().

| Foam::List< bool > select | ( | const label | n, |
| const labelUList & | locations ) |
Construct a selection list of bools (all false) with the given pre-size, subsequently add specified locations as true, auto-vivify entries if needed.
Similar to bitSet construction from locations
Definition at line 138 of file BitOps.C.

| Foam::List< bool > select | ( | const labelUList & | locations | ) |
| unsigned int count | ( | const bitSet & | bitset, |
| const bool | on = true ) |
Forward to bitSet::count().
Definition at line 28 of file BitOps.C.
References bitSet::count().

| Foam::List< Foam::label > toc | ( | const UList< bool > & | bools | ) |
Return the (sorted) values corresponding to 'true' entries.
Similar to bitSet::toc()
Definition at line 163 of file BitOps.C.
References b, count(), and UList< T >::size().
Referenced by sortedToc().


| Foam::List< Foam::label > sortedToc | ( | const UList< bool > & | bools | ) |
Return the (sorted) values corresponding to 'true' entries.
Similar to bitSet::sortedToc() and labelHashSet::sortedToc()
Definition at line 200 of file BitOps.C.
References toc().

| Foam::List< Foam::label > toc | ( | const bitSet & | bitset | ) |
Forward to bitSet::toc(), the sorted values of the 'on' entries.
Definition at line 206 of file BitOps.C.
References bitSet::toc().

| Foam::List< Foam::label > sortedToc | ( | const bitSet & | bitset | ) |
Forward to bitSet::sortedToc(), the sorted values of the 'on' entries.
Definition at line 212 of file BitOps.C.
References bitSet::sortedToc().

| Foam::List< Foam::label > toc | ( | const labelHashSet & | hashset | ) |
Forward to labelHashSet::sortedToc(), the sorted values of the 'on' entries.
Definition at line 218 of file BitOps.C.
References HashTable< T, Key, Hash >::sortedToc().

| Foam::List< Foam::label > sortedToc | ( | const labelHashSet & | hashset | ) |
Forward to labelHashSet::sortedToc(), the sorted values of the 'on' entries.
Definition at line 224 of file BitOps.C.
References HashTable< T, Key, Hash >::sortedToc().

|
inline |
Count arbitrary number of bits (of an integral type).
Definition at line 242 of file BitOps.H.
Referenced by bitSet::count().

|
inline |
|
inline |
|
inline |
Repeat a value of the given BitWidth into the destination output type.
Definition at line 289 of file BitOps.H.
Referenced by PackedList< Width >::repeated_value().

|
inline |
Print 0/1 bits in the (unsigned) integral type.
Definition at line 320 of file BitOps.H.
References IOstreamOption::BINARY, and os().
Referenced by Foam::operator<<(), and PackedList< Width >::printBits().

