Go to the documentation of this file.
83 return std::all_of(
bools.begin(),
bools.end(), [](
bool b){
return b;});
90 return std::any_of(
bools.begin(),
bools.end(), [](
bool b){
return b;});
97 return std::none_of(
bools.begin(),
bools.end(), [](
bool b){
return b;});
102 template<
class UIntType>
107 for (;
x; ++
n) {
x &= (
x-1); }
117 x -= (
x >> 1) & 0x55555555;
118 x = (
x & 0x33333333) + ((
x >> 2) & 0x33333333);
120 return ((((
x + (
x >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24);
128 x -= (
x >> 1) & 0x5555555555555555;
129 x = (
x & 0x3333333333333333) + ((
x >> 2) & 0x3333333333333333);
132 ((((
x + (
x >> 4)) & 0x0F0F0F0F0F0F0F0F) * 0x0101010101010101) >> 56);
142 template<
class UIntType,
unsigned BitW
idth>
147 BitWidth && std::numeric_limits<UIntType>::digits >= BitWidth,
148 "BitWidth too large for target output"
152 const unsigned nrepeat = (std::numeric_limits<UIntType>::digits / BitWidth);
155 const unsigned mask = ((1u << BitWidth) - 1);
158 UIntType fillval = ((val >= mask) ? mask : val);
161 for (
unsigned i = 1; i < nrepeat; ++i)
163 fillval |= (fillval << BitWidth);
171 template<
class UIntType>
184 unsigned test = (1u << (std::numeric_limits<UIntType>::digits-1));
189 os << ((value & test) ? on : off);
198 template<
class UIntType>
211 operator UIntType ()
const {
return value; }
214 operator UIntType& () {
return value; }
290 template<
class UIntType>
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)
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
unsigned int bit_count(UIntType x)
Count arbitrary number of bits (of an integral type)
bitInfo(UIntType val)
Value construct.
streamFormat format() const noexcept
Get the current stream format.
constexpr bitInfo() noexcept
Null constructible as zero.
bool all(const UList< bool > &bools)
True if all entries are 'true' or if the set is empty.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
UIntType repeat_value(unsigned val)
Repeat a value of the given BitWidth into the destination output type.
bool any(const UList< bool > &bools)
True if any entries are 'true'.
bool none(const UList< bool > &bools)
True if no entries are 'true'.
An (unsigned) integral type adapter, for output of bit values.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Ostream & print(Ostream &os, UIntType value, char off='0', char on='1')
Print 0/1 bits in the (unsigned) integral type.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
UList< label > labelUList
A UList of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys and label hasher.