64template<
class T>
class List;
80 return std::count(bools.
begin(), bools.
end(), val);
170template<
class UIntType>
175 for (;
x; ++
n) {
x &= (
x-1); }
185 x -= (
x >> 1) & 0x55555555;
186 x = (
x & 0x33333333) + ((
x >> 2) & 0x33333333);
188 return ((((
x + (
x >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24);
196 x -= (
x >> 1) & 0x5555555555555555;
197 x = (
x & 0x3333333333333333) + ((
x >> 2) & 0x3333333333333333);
200 ((((
x + (
x >> 4)) & 0x0F0F0F0F0F0F0F0F) * 0x0101010101010101) >> 56);
210template<
class UIntType,
unsigned BitW
idth>
215 BitWidth && std::numeric_limits<UIntType>::digits >= BitWidth,
216 "BitWidth too large for target output"
220 const unsigned nrepeat = (std::numeric_limits<UIntType>::digits / BitWidth);
223 const unsigned mask = ((1u << BitWidth) - 1);
226 UIntType fillval = ((val >= mask) ? mask : val);
229 for (
unsigned i = 1; i < nrepeat; ++i)
231 fillval |= (fillval << BitWidth);
239template<
class UIntType>
252 unsigned test = (1u << (std::numeric_limits<UIntType>::digits-1));
257 os << ((value & test) ? on : off);
266template<
class UIntType>
279 operator UIntType ()
const {
return value; }
282 operator UIntType& () {
return value; }
358template<
class UIntType>
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
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.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A range or interval of labels defined by a start and a size.
OBJstream os(runTime.globalPath()/outputName)
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').
List< bool > select(const label n, const labelUList &locations)
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.
bool any(const UList< bool > &bools)
True if any entries are 'true'.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
bool all(const UList< bool > &bools)
True if all entries are 'true' or if the set is empty.
unsigned int bit_count(UIntType x)
Count arbitrary number of bits (of an integral type)
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
Ostream & print(Ostream &os, UIntType value, char off='0', char on='1')
Print 0/1 bits in the (unsigned) integral type.
bool none(const UList< bool > &bools)
True if no entries are 'true'.
UIntType repeat_value(unsigned val)
Repeat a value of the given BitWidth into the destination output type.
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)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
UList< label > labelUList
A UList of labels.
An (unsigned) integral type adapter, for output of bit values.
bitInfo(UIntType val)
Value construct.
constexpr bitInfo() noexcept
Null constructible as zero.