37 return bitset.
count(on);
45 const auto max = std::max_element(locations.
begin(), locations.
end());
46 const label len = (
max != locations.
end() ? (1 + *
max) : 0);
48 if (len > bools.
size())
53 for (label i : locations)
66 labelRange slice(
range);
85 for (
const label i : slice)
95 labelRange slice(
range);
98 for (
const label i : slice)
113 for (
const label i : locations)
172 const label len = bools.
size();
177 for (
const bool b : bools)
182 labelList indices(count);
187 const label total(count);
190 for (label i = 0; i < len; ++i)
195 if (++count == total)
248 for (
const label idx : locations)
264 const labelUList& locations,
268 bitSet output(
n, !on);
270 for (
const label idx : locations)
287 const labelUList& values,
291 bitSet output(
n, !on);
294 const label len = std::min(
n,
values.size());
296 for (label idx = 0; idx < len; ++idx)
bool unset(const Key &key)
Unset the specified key - same as erase.
bool set(const Key &key)
Same as insert (no value to overwrite).
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
bool empty() const noexcept
True if range is empty (zero-sized).
IntType end_value() const noexcept
The value 1 beyond the end of the range.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
void resize(const label len)
Adjust allocated size of list.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
iterator begin() noexcept
Return an iterator to begin traversing the UList.
iterator end() noexcept
Return an iterator to end traversing the UList.
bool unset(const label i)
Unset the bool entry at specified position, always false for out-of-range access.
void size(const label n)
Older name for setAddressableSize.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
unsigned int count(const bool on=true) const
Count number of bits set.
labelList sortedToc() const
The indices of the on bits as a sorted labelList.
void set(const bitSet &bitset)
Set specified bits from another bitset.
labelList toc() const
The indices of the on bits as a sorted labelList.
bitSet & unset(const bitSet &other)
Unset (subtract) the bits specified in the other bitset, which is a set difference corresponds to the...
A range or interval of labels defined by a start and a size.
void adjust() noexcept
Adjust the start to avoid negative indices.
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').
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 l...
void unset(List< bool > &bools, const labelUList &locations)
Unset the listed locations (assign 'false').
List< label > toc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
bitSet create(const label n, const labelHashSet &locations, const bool on=true)
Create a bitSet with length n with the specified on locations.
List< bool > bools(const labelHashSet &locations)
Transform the on locations to a boolList, with true for each non-negative location and false for all ...
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
UList< label > labelUList
A UList of labels.