A bit-packed bool list. More...


Public Member Functions | |
| PackedBoolList () | |
| Construct null. More... | |
| PackedBoolList (Istream &) | |
| Construct from Istream. More... | |
| PackedBoolList (const label size) | |
| Construct with given size, initialises list to 0. More... | |
| PackedBoolList (const label size, const bool val) | |
| Construct with given size and value for all elements. More... | |
| PackedBoolList (const PackedBoolList &) | |
| Copy constructor. More... | |
| PackedBoolList (const PackedList< 1 > &) | |
| Copy constructor. More... | |
| PackedBoolList (const Foam::UList< bool > &) | |
| Construct from a list of bools. More... | |
| PackedBoolList (const labelUList &indices) | |
| Construct from a list of labels. More... | |
| PackedBoolList (const UIndirectList< label > &indices) | |
| Construct from a list of labels. More... | |
| autoPtr< PackedBoolList > | clone () const |
| Clone. More... | |
| void | set (const PackedList< 1 > &) |
| Set specified bits. More... | |
| label | set (const labelUList &indices) |
| Set the listed indices. Return number of elements changed. More... | |
| label | set (const UIndirectList< label > &indices) |
| Set the listed indices. Return number of elements changed. More... | |
| void | unset (const PackedList< 1 > &) |
| Unset specified bits. More... | |
| label | unset (const labelUList &indices) |
| Unset the listed indices. Return number of elements changed. More... | |
| label | unset (const UIndirectList< label > &indices) |
| Unset the listed indices. Return number of elements changed. More... | |
| void | subset (const PackedList< 1 > &) |
| Subset with the specified list. More... | |
| label | subset (const labelUList &indices) |
| Subset with the listed indices. More... | |
| label | subset (const UIndirectList< label > &indices) |
| Subset with the listed indices. More... | |
| labelList | used () const |
| Return indices of the used (true) elements as a list of labels. More... | |
| void | transfer (PackedBoolList &) |
| Transfer the contents of the argument list into this list. More... | |
| void | transfer (PackedList< 1 > &) |
| Transfer the contents of the argument list into this list. More... | |
| void | operator= (const bool val) |
| Assignment of all entries to the given value. More... | |
| void | operator= (const PackedBoolList &) |
| Assignment operator. More... | |
| void | operator= (const PackedList< 1 > &) |
| Assignment operator. More... | |
| void | operator= (const Foam::UList< bool > &) |
| Assignment operator. More... | |
| void | operator= (const labelUList &indices) |
| Assignment operator,. More... | |
| void | operator= (const UIndirectList< label > &) |
| Assignment operator,. More... | |
| PackedBoolList | operator~ () const |
| Complement operator. More... | |
| PackedBoolList & | operator&= (const PackedList< 1 > &) |
| And operator (lists may be dissimilar sizes) More... | |
| PackedBoolList & | operator&= (const labelUList &indices) |
| And operator (lists may be dissimilar sizes) More... | |
| PackedBoolList & | operator&= (const UIndirectList< label > &) |
| And operator (lists may be dissimilar sizes) More... | |
| PackedBoolList & | operator^= (const PackedList< 1 > &) |
| Xor operator (lists may be dissimilar sizes) More... | |
| PackedBoolList & | operator|= (const PackedList< 1 > &) |
| Or operator (lists may be dissimilar sizes) More... | |
| PackedBoolList & | operator|= (const labelUList &indices) |
| Or operator (lists may be dissimilar sizes),. More... | |
| PackedBoolList & | operator|= (const UIndirectList< label > &) |
| Or operator (lists may be dissimilar sizes),. More... | |
| PackedBoolList & | operator+= (const PackedList< 1 > &) |
| Add entries to this list, synonymous with the or operator. More... | |
| PackedBoolList & | operator+= (const labelUList &indices) |
| Add entries to this list, synonymous with the or operator. More... | |
| PackedBoolList & | operator+= (const UIndirectList< label > &) |
| Add entries to this list, synonymous with the or operator. More... | |
| PackedBoolList & | operator-= (const PackedList< 1 > &) |
| Remove entries from this list - unset the specified bits. More... | |
| PackedBoolList & | operator-= (const labelUList &indices) |
| Remove entries from this list - unset the specified bits. More... | |
| PackedBoolList & | operator-= (const UIndirectList< label > &) |
| Remove entries from this list - unset the specified bits. More... | |
| template<class LabelListType > | |
| Foam::label | setIndices (const LabelListType &indices) |
| template<class LabelListType > | |
| Foam::label | unsetIndices (const LabelListType &indices) |
| template<class LabelListType > | |
| Foam::label | subsetIndices (const LabelListType &indices) |
Public Member Functions inherited from PackedList< 1 > | |
| label | packedLength () const |
| The list length when packed. More... | |
| PackedList () | |
| Null constructor. More... | |
| PackedList (const label size) | |
| Construct with given size, initialises list to 0. More... | |
| PackedList (const label size, const unsigned val) | |
| Construct with given size and value for all elements. More... | |
| PackedList (Istream &) | |
| Construct from Istream. More... | |
| PackedList (const PackedList< nBits > &) | |
| Copy constructor. More... | |
| PackedList (PackedList< nBits > &&) | |
| Move constructor. More... | |
| PackedList (const labelUList &) | |
| Construct from a list of labels. More... | |
| PackedList (const UIndirectList< label > &) | |
| Construct from an indirect list of labels. More... | |
| autoPtr< PackedList< nBits > > | clone () const |
| Clone. More... | |
| label | capacity () const |
| The number of elements that can be stored before reallocating. More... | |
| label | size () const |
| Number of entries. More... | |
| bool | empty () const |
| Return true if the list is empty (ie, size() is zero). More... | |
| unsigned int | get (const label) const |
| Get value at index I. More... | |
| bool | set (const label, const unsigned int val=~0u) |
| Set value at index I. Return true if value changed. More... | |
| bool | unset (const label) |
| Unset the entry at index I. Return true if value changed. More... | |
| List< unsigned int > & | storage () |
| Return the underlying packed storage. More... | |
| const List< unsigned int > & | storage () const |
| Return the underlying packed storage. More... | |
| std::streamsize | byteSize () const |
| Return the binary size in number of characters. More... | |
| unsigned int | count () const |
| Count number of bits set, O(log(n)) More... | |
| labelList | values () const |
| Return the values as a list of labels. More... | |
| Ostream & | printBits (Ostream &, const bool fullOutput=false) const |
| Print bit patterns, optionally output unused elements. More... | |
| Ostream & | printInfo (Ostream &, const bool fullOutput=false) const |
| Print information and bit patterns (with printBits) More... | |
| bool | trim () |
| Trim any trailing zero elements. More... | |
| void | flip () |
| Invert the bits in the addressable region. More... | |
| void | reset () |
| Clear all bits. More... | |
| void | setCapacity (const label) |
| Alter the size of the underlying storage. More... | |
| void | resize (const label, const unsigned int &val=0u) |
| Reset addressable list size, does not shrink the allocated size. More... | |
| void | setSize (const label, const unsigned int &val=0u) |
| Alias for resize() More... | |
| void | reserve (const label) |
| Reserve allocation space for at least this size. More... | |
| void | clear () |
| Clear the list, i.e. set addressable size to zero. More... | |
| void | clearStorage () |
| Clear the list and delete storage. More... | |
| void | shrink () |
| Shrink the allocated space to what is actually used. More... | |
| void | transfer (PackedList< nBits > &) |
| Transfer the contents of the argument list into this list. More... | |
| Istream & | read (Istream &) |
| Clear list and read from stream. More... | |
| Ostream & | write (Ostream &, const bool indexedOutput=false) const |
| Write, optionally with indexedOutput. More... | |
| PackedList< nBits > & | 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) const |
| Get value at index I. More... | |
| iteratorBase | operator[] (const label) |
| Set value at index I. More... | |
| void | operator= (const unsigned int val) |
| Assignment of all entries to the given value. Takes linear time. More... | |
| void | operator= (const PackedList< nBits > &) |
| Assignment operator. More... | |
| void | operator= (PackedList< nBits > &&) |
| Move assignment operator. More... | |
| void | operator= (const labelUList &) |
| Assignment operator. More... | |
| void | operator= (const UIndirectList< label > &) |
| Assignment operator. More... | |
| iterator | begin () |
| Iterator set to the beginning of the PackedList. More... | |
| const_iterator | begin () const |
| const_iterator set to the beginning of the PackedList More... | |
| iterator | end () |
| Iterator set to beyond the end of the PackedList. More... | |
| const_iterator | end () const |
| const_iterator set to beyond the end of the PackedList More... | |
| const_iterator | cbegin () const |
| const_iterator set to the beginning of the PackedList More... | |
| const_iterator | cend () const |
| const_iterator set to beyond the end of the PackedList More... | |
Public Member Functions inherited from PackedListCore | |
| PackedListCore () | |
| Construct null. More... | |
| ClassName ("PackedList") | |
| Define template name and debug. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from PackedList< 1 > | |
| static unsigned int | max_bits () |
| The max. number of bits that can be templated. More... | |
| static unsigned int | max_value () |
| The max. value for an entry, which simultaneously the bit-mask. More... | |
| static unsigned int | packing () |
| The number of entries per packed storage element. More... | |
| static unsigned int | maskLower (unsigned offset) |
| Masking for all bits below the offset. More... | |
Protected Types inherited from PackedList< 1 > | |
| typedef unsigned int | StorageType |
| typedef List< StorageType > | StorageList |
Protected Member Functions inherited from PackedList< 1 > | |
| unsigned int | readValue (Istream &is) |
| void | setPair (Istream &) |
| Read an index/value pair and set accordingly. More... | |
| void | setPair (Istream &is) |
Static Protected Member Functions inherited from PackedList< 1 > | |
| static label | packedLength (const label) |
| Calculate the list length when packed. More... | |
| static unsigned int | readValue (Istream &) |
| Read a list entry (allows for specialisation) More... | |
A bit-packed bool list.
In addition to the obvious memory advantage over using a List<bool>, this class also provides a number of bit-like operations.
Definition at line 63 of file PackedBoolList.H.
|
inline |
Construct null.
Definition at line 28 of file PackedBoolListI.H.
| PackedBoolList | ( | Istream & | is | ) |
Construct from Istream.
Definition at line 159 of file PackedBoolList.C.
|
inlineexplicit |
Construct with given size, initialises list to 0.
Definition at line 34 of file PackedBoolListI.H.
|
inline |
Construct with given size and value for all elements.
Definition at line 40 of file PackedBoolListI.H.
|
inline |
Copy constructor.
Definition at line 50 of file PackedBoolListI.H.
|
inlineexplicit |
Copy constructor.
Definition at line 56 of file PackedBoolListI.H.
|
inlineexplicit |
Construct from a list of bools.
Definition at line 62 of file PackedBoolListI.H.
References PackedBoolList::operator=().

|
inlineexplicit |
Construct from a list of labels.
using the labels as indices to indicate which bits are set
Definition at line 70 of file PackedBoolListI.H.
References PackedBoolList::set().

|
inlineexplicit |
Construct from a list of labels.
using the labels as indices to indicate which bits are set
Definition at line 78 of file PackedBoolListI.H.
References PackedBoolList::set().

|
inline |
Clone.
Definition at line 87 of file PackedBoolListI.H.
| void set | ( | const PackedList< 1 > & | lst | ) |
Set specified bits.
Definition at line 169 of file PackedBoolList.C.
References PackedList< nBits >::storage(), and Foam::stringOps::trim().
Referenced by PatchTools::calcBounds(), hexRef8::consistentUnrefinement(), meshRefinement::intersectedPoints(), PackedBoolList::PackedBoolList(), NASedgeFormat::read(), STARCDedgeFormat::read(), refiner::refiner(), snappySnapDriver::repatchToSurface(), hexRef8::setRefinement(), masterUncollatedFileOperation::subRanks(), PackedBoolList::subsetIndices(), refiner::update(), and triSurface::writeStats().


| Foam::label set | ( | const labelUList & | indices | ) |
Set the listed indices. Return number of elements changed.
Does auto-vivify for non-existent entries.
Definition at line 191 of file PackedBoolList.C.
| Foam::label set | ( | const UIndirectList< label > & | indices | ) |
Set the listed indices. Return number of elements changed.
Does auto-vivify for non-existent entries.
Definition at line 197 of file PackedBoolList.C.
| void unset | ( | const PackedList< 1 > & | lst | ) |
Unset specified bits.
Definition at line 203 of file PackedBoolList.C.
References Foam::min(), PackedList< nBits >::packedLength(), and PackedList< nBits >::storage().
Referenced by hexRef8::consistentUnrefinement(), syncTools::getInternalOrCoupledFaces(), syncTools::getInternalOrMasterFaces(), syncTools::getMasterFaces(), hexRef8::setRefinement(), and refiner::update().


| Foam::label unset | ( | const labelUList & | indices | ) |
Unset the listed indices. Return number of elements changed.
Never auto-vivify entries.
Definition at line 219 of file PackedBoolList.C.
| Foam::label unset | ( | const UIndirectList< label > & | indices | ) |
Unset the listed indices. Return number of elements changed.
Never auto-vivify entries.
Definition at line 225 of file PackedBoolList.C.
| void subset | ( | const PackedList< 1 > & | lst | ) |
Subset with the specified list.
Definition at line 231 of file PackedBoolList.C.
References resize(), PackedList< nBits >::size(), and PackedList< nBits >::storage().

| Foam::label subset | ( | const labelUList & | indices | ) |
Subset with the listed indices.
Return number of elements subsetted.
Definition at line 252 of file PackedBoolList.C.
| Foam::label subset | ( | const UIndirectList< label > & | indices | ) |
Subset with the listed indices.
Return number of elements subsetted.
Definition at line 258 of file PackedBoolList.C.
| Foam::labelList used | ( | ) | const |
Return indices of the used (true) elements as a list of labels.
Definition at line 264 of file PackedBoolList.C.
References Foam::count(), forAll, List< T >::setSize(), and List< T >::size().

|
inline |
Transfer the contents of the argument list into this list.
and annul the argument list.
Definition at line 95 of file PackedBoolListI.H.
References PackedList< nBits >::transfer().
Referenced by refiner::update().


|
inline |
Transfer the contents of the argument list into this list.
and annul the argument list.
Definition at line 101 of file PackedBoolListI.H.
References PackedList< nBits >::transfer().

|
inline |
Assignment of all entries to the given value.
Definition at line 109 of file PackedBoolListI.H.
References PackedList< nBits >::operator=().
Referenced by PackedBoolList::PackedBoolList().


|
inline |
Assignment operator.
Definition at line 115 of file PackedBoolListI.H.
References PackedList< nBits >::operator=().

|
inline |
Assignment operator.
Definition at line 121 of file PackedBoolListI.H.
References PackedList< nBits >::operator=().

| void operator= | ( | const Foam::UList< bool > & | lst | ) |
Assignment operator.
Definition at line 289 of file PackedBoolList.C.
References forAll, setSize(), and UList< T >::size().

|
inline |
Assignment operator,.
using the labels as indices to indicate which bits are set
Definition at line 127 of file PackedBoolListI.H.
References clear().

|
inline |
Assignment operator,.
using the labels as indices to indicate which bits are set
Definition at line 134 of file PackedBoolListI.H.
References clear().

|
inline |
Complement operator.
Definition at line 142 of file PackedBoolListI.H.
References PackedList< nBits >::flip().

|
inline |
And operator (lists may be dissimilar sizes)
Definition at line 152 of file PackedBoolListI.H.
References Foam::subset().

|
inline |
And operator (lists may be dissimilar sizes)
using the labels as indices to indicate which bits are set
Definition at line 160 of file PackedBoolListI.H.
References Foam::subset().

|
inline |
And operator (lists may be dissimilar sizes)
using the labels as indices to indicate which bits are set
Definition at line 168 of file PackedBoolListI.H.
References Foam::subset().

| Foam::PackedBoolList & operator^= | ( | const PackedList< 1 > & | lst | ) |
Xor operator (lists may be dissimilar sizes)
Retains unique entries
Definition at line 302 of file PackedBoolList.C.
References PackedList< nBits >::storage(), and Foam::stringOps::trim().

|
inline |
Or operator (lists may be dissimilar sizes)
Definition at line 176 of file PackedBoolListI.H.
|
inline |
Or operator (lists may be dissimilar sizes),.
using the labels as indices to indicate which bits are set
Definition at line 184 of file PackedBoolListI.H.
|
inline |
Or operator (lists may be dissimilar sizes),.
using the labels as indices to indicate which bits are set
Definition at line 192 of file PackedBoolListI.H.
|
inline |
Add entries to this list, synonymous with the or operator.
Definition at line 200 of file PackedBoolListI.H.
|
inline |
Add entries to this list, synonymous with the or operator.
Definition at line 207 of file PackedBoolListI.H.
|
inline |
Add entries to this list, synonymous with the or operator.
Definition at line 214 of file PackedBoolListI.H.
|
inline |
Remove entries from this list - unset the specified bits.
Definition at line 221 of file PackedBoolListI.H.
|
inline |
Remove entries from this list - unset the specified bits.
Definition at line 229 of file PackedBoolListI.H.
|
inline |
Remove entries from this list - unset the specified bits.
Definition at line 237 of file PackedBoolListI.H.
| Foam::label setIndices | ( | const LabelListType & | indices | ) |
Definition at line 93 of file PackedBoolList.C.
References forAll.
| Foam::label unsetIndices | ( | const LabelListType & | indices | ) |
Definition at line 112 of file PackedBoolList.C.
References forAll.
| Foam::label subsetIndices | ( | const LabelListType & | indices | ) |
Definition at line 128 of file PackedBoolList.C.
References clear(), forAll, PackedList< nBits >::reserve(), and PackedBoolList::set().
