Go to the documentation of this file.
63 template<
class T>
class List;
86 return std::all_of(
bools.begin(),
bools.end(), [](
bool b){
return b;});
93 return std::any_of(
bools.begin(),
bools.end(), [](
bool b){
return b;});
100 return std::none_of(
bools.begin(),
bools.end(), [](
bool b){
return b;});
129 template<
class UIntType>
134 for (;
x; ++
n) {
x &= (
x-1); }
144 x -= (
x >> 1) & 0x55555555;
145 x = (
x & 0x33333333) + ((
x >> 2) & 0x33333333);
147 return ((((
x + (
x >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24);
155 x -= (
x >> 1) & 0x5555555555555555;
156 x = (
x & 0x3333333333333333) + ((
x >> 2) & 0x3333333333333333);
159 ((((
x + (
x >> 4)) & 0x0F0F0F0F0F0F0F0F) * 0x0101010101010101) >> 56);
169 template<
class UIntType,
unsigned BitW
idth>
174 BitWidth && std::numeric_limits<UIntType>::digits >= BitWidth,
175 "BitWidth too large for target output"
179 const unsigned nrepeat = (std::numeric_limits<UIntType>::digits / BitWidth);
182 const unsigned mask = ((1u << BitWidth) - 1);
185 UIntType fillval = ((val >= mask) ? mask : val);
188 for (
unsigned i = 1; i < nrepeat; ++i)
190 fillval |= (fillval << BitWidth);
198 template<
class UIntType>
211 unsigned test = (1u << (std::numeric_limits<UIntType>::digits-1));
216 os << ((value & test) ? on : off);
225 template<
class UIntType>
238 operator UIntType ()
const {
return value; }
241 operator UIntType& () {
return value; }
317 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.
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
List< bool > bools(const labelHashSet &locations)
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
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.
void unset(List< bool > &bools, const labelRange &range)
Unset the specified range 'on' in a boolList.
bitSet bitset(const labelHashSet &locations)
Transform the on locations to a bitSet.
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.
A range or interval of labels defined by a start and a size.
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.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
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.