31 bool Foam::PackedBoolList::bitorPrepare
33 const PackedList<1>& lst,
41 const label packLen2 = lst.packedLength();
45 bool needTrim =
false;
46 maxPackLen = packLen1;
48 if (packLen1 == packLen2)
53 this->
size() != lst.size()
55 && rhs[maxPackLen-1] > lhs[maxPackLen-1]
64 else if (packLen2 < packLen1)
67 maxPackLen = packLen2;
72 for (
label storeI = packLen1; storeI < packLen2; ++storeI)
76 maxPackLen = storeI+1;
81 if (maxPackLen > packLen1)
92 template<
class LabelListType>
93 Foam::label Foam::PackedBoolList::setIndices(
const LabelListType& indices)
101 if (
set(indices[elemI]))
111 template<
class LabelListType>
112 Foam::label Foam::PackedBoolList::unsetIndices(
const LabelListType& indices)
117 if (
unset(indices[elemI]))
127 template<
class LabelListType>
128 Foam::label Foam::PackedBoolList::subsetIndices(
const LabelListType& indices)
131 if (
empty() || indices.empty())
144 const label& index = indices[elemI];
145 if (
operator[](index))
173 const bool needTrim = bitorPrepare(lst, len);
179 for (
label i=0; i < len; ++i)
193 return setIndices(indices);
199 return setIndices(indices);
212 for (
label i=0; i < len; ++i)
221 return unsetIndices(indices);
227 return unsetIndices(indices);
245 for (
label i=0; i < len; ++i)
254 return subsetIndices(indices);
260 return subsetIndices(indices);
276 lst[nElem++] = elemI;
296 set(elemI, lst[elemI]);
306 const bool needTrim = bitorPrepare(lst, len);
312 for (
label i=0; i < len; ++i)
void subset(const PackedList< 1 > &)
Subset with the specified list.
A simple container for copying or transferring objects of type <T>.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static label packedLength(const label)
Calculate the list length when packed.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void size(const label)
Override size to be inconsistent with allocated storage.
void reserve(const label)
Reserve allocation space for at least this size.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
label packedLength() const
The list length when packed.
void set(const PackedList< 1 > &)
Set specified bits.
A dynamically allocatable list of packed unsigned integers.
void operator=(const bool val)
Assignment of all entries to the given value.
static unsigned int packing()
The number of entries per packed storage element.
void setSize(const label, const unsigned int &val=0u)
Alias for resize()
void clear()
Clear the list, i.e. set addressable size to zero.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void resize(const label, const unsigned int &val=0u)
Reset addressable list size, does not shrink the allocated size.
PackedBoolList & operator^=(const PackedList< 1 > &)
Xor operator (lists may be dissimilar sizes)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
PackedBoolList()
Construct null.
unsigned int count() const
Count number of bits set, O(log(n))
void setSize(const label)
Reset size of List.
bool trim()
Trim any trailing zero elements.
List< unsigned int > & storage()
Return the underlying packed storage.
void transfer(PackedBoolList &)
Transfer the contents of the argument list into this list.
A List with indirect addressing.
void unset(const PackedList< 1 > &)
Unset specified bits.
bool empty() const
Return true if the list is empty (ie, size() is zero).
label size() const
Number of entries.
List< StorageType > StorageList
label size() const
Return the number of elements in the UList.
Xfer< labelList > used() const
Return indices of the used (true) elements as a list of labels.