|
|
|
PackedList< nBits > Class Template ReferenceA dynamically allocatable list of packed unsigned integers. More...
Inheritance diagram for PackedList< nBits >:
![]()
Collaboration diagram for PackedList< nBits >:
![]()
Detailed Descriptiontemplate<unsigned nBits = 1>
A dynamically allocatable list of packed unsigned integers.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PackedList | ( | ) | [inline] |
Null constructor.
Definition at line 65 of file PackedListI.H.
References PackedList< nBits >::packing().

| PackedList | ( | const label | size | ) | [inline] |
| PackedList | ( | const label | size, | |
| const unsigned | val | |||
| ) |
Construct with given size and value for all elements.
| PackedList | ( | const PackedList< nBits > & | lst | ) | [inline] |
| PackedList | ( | const Xfer< PackedList< nBits > > & | lst | ) | [inline] |
| PackedList | ( | const UList< label > & | lst | ) | [inline] |
| unsigned int max_bits | ( | ) | [inline, static] |
The max. number of bits that can be templated.
Might someday be useful for a template assert.
Definition at line 25 of file PackedListI.H.
| unsigned int max_value | ( | ) | [inline, static] |
The max. value for an entry, which simultaneously the bit-mask.
eg, ((1 << 2) - 1) yields 0b0011
Definition at line 32 of file PackedListI.H.
| unsigned int packing | ( | ) | [inline, static] |
The number of entries per packed storage element.
Definition at line 39 of file PackedListI.H.
Referenced by PackedList< nBits >::count(), PackedList< nBits >::PackedList(), and PackedList< nBits >::setCapacity().

| unsigned int maskLower | ( | unsigned | offset | ) | [inline, static] |
Masking for all bits below the offset.
Definition at line 46 of file PackedListI.H.
Referenced by PackedList< nBits >::count().

| Foam::autoPtr< Foam::PackedList< nBits > > clone | ( | ) | const [inline] |
Clone.
Reimplemented from List< unsigned int >.
Definition at line 97 of file PackedListI.H.
References PackedList< nBits >::transfer().

| Foam::label capacity | ( | ) | const [inline] |
The number of elements that can be stored before reallocating.
Definition at line 634 of file PackedListI.H.
References PackedList< nBits >::resize().

| Foam::label size | ( | ) | const [inline] |
Number of entries.
Reimplemented from List< unsigned int >.
Definition at line 545 of file PackedListI.H.
Referenced by PackedList< nBits >::operator=(), syncTools::syncEdgeList(), syncTools::syncFaceList(), and syncTools::syncPointList().

| bool empty | ( | ) | const [inline] |
Return true if the list is empty (ie, size() is zero).
Reimplemented from UList< unsigned int >.
Definition at line 552 of file PackedListI.H.
| unsigned int get | ( | const label | i | ) | const [inline] |
Get value at index I.
Never auto-vivify entries.
Definition at line 731 of file PackedListI.H.
References Foam::xferMove().
Referenced by syncTools::syncEdgeList(), syncTools::syncFaceList(), and syncTools::syncPointList().


| bool set | ( | const label | i, | |
| const unsigned int | val = ~0u | |||
| ) | [inline] |
Set value at index I. Return true if value changed.
Does auto-vivify for non-existent entries. Default value set is the max_value.
Definition at line 771 of file PackedListI.H.
Referenced by syncTools::syncEdgeList(), syncTools::syncFaceList(), and syncTools::syncPointList().

| Foam::List< unsigned int > & storage | ( | ) | [inline] |
Return the underlying packed storage.
Definition at line 698 of file PackedListI.H.
References List< T >::setSize().

| const Foam::List< unsigned int > & storage | ( | ) | const [inline] |
| unsigned int count | ( | ) | const [inline] |
Count number of bits set, O(log(n)).
Uses the Hamming weight (population count) method http://en.wikipedia.org/wiki/Hamming_weight
Definition at line 71 of file PackedList.C.
References COUNT_PACKEDBITS, PackedList< nBits >::maskLower(), UList< T >::operator[](), and PackedList< nBits >::packing().

| Foam::labelList values | ( | ) | const [inline] |
Return the values as a labelList.
Definition at line 169 of file PackedList.C.
References UList< unsigned int >::operator, and UList< T >::operator[]().

| Foam::Ostream & print | ( | Ostream & | os | ) | const [inline] |
| bool trim | ( | ) | [inline] |
| void flip | ( | ) | [inline] |
| void setCapacity | ( | const label | nElem | ) | [inline] |
Alter the size of the underlying storage.
The addressed size will be truncated if needed to fit, but will remain otherwise untouched.
Definition at line 641 of file PackedListI.H.
References PackedList< nBits >::packing(), and List< T >::size().
Referenced by PackedList< nBits >::operator=().


| void resize | ( | const label | nElem, | |
| const unsigned int & | val = 0 | |||
| ) | [inline] |
Reset addressable list size, does not shrink the allocated size.
Optionally specify a value for new elements.
Reimplemented from List< unsigned int >.
Definition at line 560 of file PackedListI.H.
Referenced by PackedList< nBits >::append(), and PackedList< nBits >::capacity().

| void setSize | ( | const label | newSize, | |
| const unsigned int & | val = 0 | |||
| ) | [inline] |
Alias for resize().
Reimplemented from List< unsigned int >.
Definition at line 623 of file PackedListI.H.
| void reserve | ( | const label | nElem | ) | [inline] |
Reserve allocation space for at least this size.
Never shrinks the allocated size.
Definition at line 655 of file PackedListI.H.
| void clear | ( | ) | [inline] |
Clear the list, i.e. set addressable size to zero.
Does not adjust the underlying storage
Reimplemented from List< unsigned int >.
Definition at line 670 of file PackedListI.H.
References List< T >::setSize().

| void clearStorage | ( | ) | [inline] |
| void shrink | ( | ) | [inline] |
Shrink the allocated space to what is used.
Definition at line 685 of file PackedListI.H.
References List< T >::clear().

| void transfer | ( | PackedList< nBits > & | lst | ) | [inline] |
Transfer the contents of the argument list into this list.
and annull the argument list.
Definition at line 713 of file PackedListI.H.
Referenced by PackedList< nBits >::clone().

| Foam::Xfer< Foam::PackedList< nBits > > xfer | ( | ) | [inline] |
Transfer contents to the Xfer container.
Reimplemented from List< unsigned int >.
Definition at line 724 of file PackedListI.H.
| void append | ( | const unsigned int | val | ) | [inline] |
Append a value at the end of the list.
Definition at line 796 of file PackedListI.H.
References PackedList< nBits >::resize().

| unsigned int remove | ( | ) | [inline] |
| unsigned int operator[] | ( | const label | i | ) | const [inline] |
Get value at index I.
Never auto-vivify entries.
Reimplemented from UList< unsigned int >.
Definition at line 755 of file PackedListI.H.
| Foam::PackedList< nBits >::iteratorBase operator[] | ( | const label | i | ) | [inline] |
Set value at index I.
Returns iterator to perform the actual operation. Does not auto-vivify entries, but will when assigned to.
Reimplemented from UList< unsigned int >.
Definition at line 827 of file PackedListI.H.
| void operator= | ( | const unsigned int | val | ) | [inline] |
Assignment of all entries to the given value. Takes linear time.
Definition at line 835 of file PackedListI.H.
| void operator= | ( | const PackedList< nBits > & | lst | ) | [inline] |
Assignment operator. Takes linear time.
Definition at line 267 of file PackedList.C.
References List< T >::operator=(), PackedList< nBits >::setCapacity(), and PackedList< nBits >::size().

| Foam::PackedList< nBits >::iterator begin | ( | ) | [inline] |
iterator set to the beginning of the PackedList
Reimplemented from UList< unsigned int >.
Definition at line 496 of file PackedListI.H.
| Foam::PackedList< nBits >::iterator end | ( | ) | [inline] |
iterator set to beyond the end of the PackedList
Reimplemented from UList< unsigned int >.
Definition at line 520 of file PackedListI.H.
| Foam::PackedList< nBits >::const_iterator cbegin | ( | ) | const [inline] |
const_iterator set to the beginning of the PackedList
Reimplemented from UList< unsigned int >.
Definition at line 512 of file PackedListI.H.
| Foam::PackedList< nBits >::const_iterator cend | ( | ) | const [inline] |
const_iterator set to beyond the end of the PackedList
Reimplemented from UList< unsigned int >.
Definition at line 536 of file PackedListI.H.
| Foam::PackedList< nBits >::const_iterator begin | ( | ) | const [inline] |
const_iterator set to the beginning of the PackedList
Reimplemented from UList< unsigned int >.
Definition at line 504 of file PackedListI.H.
| Foam::PackedList< nBits >::const_iterator end | ( | ) | const [inline] |
const_iterator set to beyond the end of the PackedList
Reimplemented from UList< unsigned int >.
Definition at line 528 of file PackedListI.H.