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;
297 set(elemI, lst[elemI]);
309 const bool needTrim = bitorPrepare(lst, len);
315 for (
label i=0; i < len; ++i)
void unset(const PackedList< 1 > &)
Unset specified bits.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
void set(const PackedList< 1 > &)
Set specified bits.
bool trim()
Trim any trailing zero elements.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
A simple container for copying or transferring objects of type <T>.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
List< unsigned int > & storage()
Return the underlying packed storage.
label size() const
Number of entries.
unsigned int count() const
Count number of bits set, O(log(n))
void transfer(PackedBoolList &)
Transfer the contents of the argument list into this list.
label packedLength() const
The list length when packed.
static label packedLength(const label)
Calculate the list length when packed.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
void setSize(const label)
Reset size of List.
void setSize(const label, const unsigned int &val=0u)
Alias for resize()
PackedBoolList()
Construct null.
A List with indirect addressing.
List< StorageType > StorageList
label size() const
Return the number of elements in the UList.
void reserve(const label)
Reserve allocation space for at least this size.
Xfer< labelList > used() const
Return indices of the used (true) elements as a list of labels.
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 subset(const PackedList< 1 > &)
Subset with the specified list.
PackedBoolList & operator=(const bool val)
Assignment of all entries to the given value.
static unsigned int packing()
The number of entries per packed storage element.
A dynamically allocatable list of packed unsigned integers.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
bool empty() const
Return true if the list is empty (ie, size() is zero).
PackedBoolList & operator^=(const PackedList< 1 > &)
Xor operator (lists may be dissimilar sizes)
void resize(const label, const unsigned int &val=0u)
Reset addressable list size, does not shrink the allocated size.