bitSet.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2018-2019 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::bitSet
28 
29 Description
30  A bitSet stores bits (elements with only two states) in packed internal
31  format and supports a variety of bit-set operations.
32  Its behaviour is largely list-like, with some HashSet features.
33 
34 SourceFiles
35  bitSetI.H
36  bitSet.C
37  bitSetIO.C
38  bitSetTemplates.C
39 
40 See also
41  Foam::BitOps
42  Foam::PackedList
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef bitSet_H
47 #define bitSet_H
48 
49 #include "className.H"
50 #include "PackedList.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward declarations
58 class bitSet;
59 class labelRange;
60 
61 /*---------------------------------------------------------------------------*\
62  Class bitSet Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class bitSet
66 :
67  public PackedList<1>
68 {
69 private:
70 
71  // Private Member Functions
72 
73  //- Find the first block with a '0' bit
74  // \return block number or -1 if the set is empty or all bits are on.
75  inline label first_not_block() const;
76 
77 
78 protected:
79 
80  // Protected Member Functions
81 
82  //- Write as a dictionary entry
83  void writeEntry(Ostream& os) const;
84 
85  // Logic/Set Operations
86 
87  //- The set difference
88  // \code
89  // A = (A - B)
90  // A = (A & !B)
91  // A = (A & ~B)
92  // \endcode
93  // A and B can have different sizes.
94  // Does not change the original set size.
95  bitSet& minusEq(const bitSet& other);
96 
97  //- The set logical AND
98  // \code
99  // A = (A & B)
100  //
101  // \endcode
102  // A and B can have different sizes..
103  // Does not change the original set size.
104  bitSet& andEq(const bitSet& other);
105 
106  //- The set logical OR
107  // \code
108  // A = (A | B)
109  // \endcode
110  // A and B can have different sizes
111  //
112  // \note
113  // The default (strict=true) ignores additional length from B,
114  // whereas (strict=false) permits the set to automatically grow
115  // to accommodate additional elements arising from B.
116  bitSet& orEq(const bitSet& other, const bool strict=true);
117 
118  //- The set logical XOR
119  // \code
120  // A = (A ^ B)
121  // \endcode
122  // A and B can have different sizes. Sizing behaviour as per orEq.
123  bitSet& xorEq(const bitSet& other, const bool strict=true);
124 
125 
126 public:
127 
128  // Forward declaration of access classes
129 
130  class reference;
131  class const_iterator;
132  typedef unsigned int const_reference;
133 
134  //- Define class name and debug
135  ClassName("bitSet");
136 
137 
138  // Constructors
139 
140  //- Construct an empty, zero-sized set
141  inline bitSet() noexcept;
142 
143  //- Construct from Istream
144  explicit bitSet(Istream& is);
145 
146  //- Construct with given size, with all bits set to 0
147  inline explicit bitSet(const label n);
148 
149  //- Construct with given size and value for all elements
150  inline bitSet(const label n, const bool val);
151 
152  //- Copy construct
153  inline bitSet(const bitSet& bitset);
154 
155  //- Move construct
156  inline bitSet(bitSet&& bitset);
157 
158  //- Copy construct a subset
159  bitSet(const bitSet& bitset, const labelUList& addr);
160 
161  //- Copy construct a subset
162  template<class Addr>
163  bitSet
164  (
165  const bitSet& bitset,
166  const IndirectListBase<label, Addr>& addr
167  );
168 
169  //- Copy construct a subset range
170  bitSet(const bitSet& bitset, const labelRange& range);
171 
172  //- Construct from a list of bools
173  inline explicit bitSet(const UList<bool>& bools);
174 
175  //- Construct with given size with all bits set to 0,
176  //- subsequently add specified locations as 1.
177  inline bitSet(const label n, const labelUList& locations);
178 
179  //- Construct with given size with all bits set to 0,
180  //- subsequently add specified locations as 1.
181  template<class Addr>
182  bitSet
183  (
184  const label n,
185  const IndirectListBase<label, Addr>& locations
186  );
187 
188  //- Construct with given size with all bits set to 0,
189  //- subsequently add specified locations as 1.
190  template<unsigned N>
191  bitSet(const label n, const FixedList<label, N>& locations);
192 
193  //- Construct with given size with all bits set to 0,
194  //- subsequently add specified locations as 1.
195  inline bitSet(const label n, std::initializer_list<label> locations);
196 
197  //- Construct with automatic sizing (filled with 0),
198  //- and populate with specified locations as 1.
199  inline explicit bitSet(const labelUList& locations);
200 
201  //- Construct with automatic sizing (filled with 0),
202  //- and populate with specified locations as 1.
203  template<class Addr>
204  inline explicit bitSet(const IndirectListBase<label, Addr>& locations);
205 
206  //- Construct with automatic sizing (filled with 0),
207  //- and populate with specified locations as 1.
208  template<unsigned N>
209  explicit bitSet(const FixedList<label, N>& locations);
210 
211  //- Clone
212  inline autoPtr<bitSet> clone() const;
213 
214 
215  // Member Functions
216 
217  // Query
218 
219  //- True if all bits in this bitset are set or if the set is empty.
220  inline bool all() const;
221 
222  //- True if any bits in this bitset are set.
223  inline bool any() const;
224 
225  //- True if no bits in this bitset are set.
226  inline bool none() const;
227 
228  //- True if all entries have identical values, and the set is non-empty
229  inline bool uniform() const;
230 
231  //- Count number of bits set.
232  // \param on can be set to false to count the number of unset bits
233  // instead.
234  inline unsigned int count(const bool on=true) const;
235 
236  //- True if any bits in the other bitset intersect (are the same).
237  //
238  // \note Method name compatibility with boost::dynamic_bitset
239  bool intersects(const bitSet& other) const;
240 
241  //- Test value at specified position, never auto-vivify entries.
242  //
243  // \note Method name compatibility with std::bitset
244  inline bool test(const label pos) const;
245 
246  //- Locate the first bit that is set.
247  // \return the location or -1 if there are no bits set.
248  //
249  // \note Method name compatibility with boost::dynamic_bitset
250  inline label find_first() const;
251 
252  //- Locate the first bit that is unset.
253  // \return the location or -1 if the set is empty or all bits are on.
254  //
255  // \note Provided for symmetry with find_first()
256  inline label find_first_not() const;
257 
258  //- Locate the last bit set.
259  // \return the location or -1 if there are no bits set.
260  //
261  // \note Provided for symmetry with find_first()
262  inline label find_last() const;
263 
264  //- Locate the next bit set, starting one beyond the specified position
265  // \return the location or -1 if there are no further bits set.
266  //
267  // \note Method name compatibility with boost::dynamic_bitset
268  inline label find_next(label pos) const;
269 
270  //- The indices of the \a on bits as a sorted labelList.
271  //
272  // \note Method name compatibility with HashSet
273  labelList toc() const;
274 
275  //- The indices of the \a on bits as a sorted labelList.
276  // This is identical to toc(), which is always sorted.
277  //
278  // \note Method name compatibility with HashSet
279  inline labelList sortedToc() const;
280 
281  //- Return the bitset values as a boolList.
282  // When the output is a bool, this is more efficient than unpack()
283  List<bool> values() const;
284 
285 
286  // Assignment
287 
288  //- Assign all entries to the given value.
289  inline void assign(const bool val);
290 
291  //- Copy assign all entries from a list of bools.
292  void assign(const UList<bool>& bools);
293 
294 
295  // Setting single or multiple values
296 
297  //- Assign a single index/value
298  using PackedList<1>::set;
299 
300  //- Set specified bits from another bitset.
301  // The current set size may grow to accommodate any new bits
302  // (auto-vivifies).
303  inline void set(const bitSet& bitset);
304 
305  //- Set the specified range of bits specified
306  // The current set size may grow to accommodate any new bits
307  // (auto-vivifies).
308  // \note this operation is generally more efficient than calling
309  // set(pos) on individual bits.
310  void set(const labelRange& range);
311 
312 
313  // Unsetting single or multiple values
314 
315  //- Unset a single index
316  using PackedList<1>::unset;
317 
318  //- Unset (subtract) the bits specified in the other bitset, which is
319  //- a set difference corresponds to the logical operation
320  // \code
321  // A = (A & !B)
322  // \endcode
323  // The result is comparable to 'operator-='
324  // \endcode
325  //
326  // A and B can have different sizes.
327  // Does not change the original set size.
328  inline bitSet& unset(const bitSet& other);
329 
330  //- Unset the specified range of bits specified, never auto-vivifies.
331  // \note this operation can be more efficient than calling
332  // unset(pos) on individual bits.
333  void unset(const labelRange& range);
334 
335 
336  // Edit
337 
338  //- Invert all bits in the addressable region
339  inline void flip();
340 
341  //- Invert bits at the specified position.
342  // A no-op if the position is out-of-range
343  inline void flip(const label pos);
344 
345  //- Swap contents
346  inline void swap(bitSet& bitset);
347 
348  //- Transfer the contents of the argument list into this list
349  //- and annul the argument list.
350  inline void transfer(bitSet& bitset);
351 
352 
353  // Convenience methods
354 
355  //- Ensure the addressable range does not exceed maxSize.
356  // Either decreases the size of the bitSet or is a no-op.
357  //
358  // \code
359  // pointField& pts = mesh.points();
360  // bitset.bound(pts.size());
361  //
362  // for (const label pointi : bitset)
363  // {
364  // pts[pointi] ...
365  // }
366  // \endcode
367  inline bitSet& bound(const label maxSize);
368 
369  //- Ensure the addressable range does not exceed that of other.
370  // Either decreases the size of the bitSet or is a no-op.
371  inline bitSet& bound(const bitSet& other);
372 
373  //- Ensure that minSize is covered by the bitSet.
374  // Either increases the size of the bitSet or is a no-op.
375  inline bitSet& extend(const label minSize);
376 
377  //- Ensure the bitset is addressable throughout the range of other.
378  // Either increases the size of the bitSet or is a no-op.
379  inline bitSet& extend(const bitSet& other);
380 
381  //- Set the locations listed by the iterator range,
382  // auto-vivify entries if needed.
383  //
384  // \return number of locations changed
385  template<class InputIter>
386  label setMany(InputIter first, InputIter last);
387 
388  //- Set the listed locations to true.
389  // Does auto-vivify for non-existent entries.
390  //
391  // \return number of locations changed
392  inline label set(const labelUList& locations);
393 
394  //- Set the listed locations to true.
395  // Does auto-vivify for non-existent entries.
396  //
397  // \return number of locations changed
398  template<class Addr>
399  inline label set(const IndirectListBase<label, Addr>& locations);
400 
401  //- Set the listed locations to true.
402  // Does auto-vivify for non-existent entries.
403  //
404  // \return number of locations changed
405  template<unsigned N>
406  label set(const FixedList<label, N>& locations);
407 
408  //- Unset the locations listed by the iterator range,
409  //- never auto-vivify entries.
410  //
411  // \return number of locations changed
412  template<class InputIter>
413  label unset(InputIter first, InputIter last);
414 
415  //- Unset the listed locations, never auto-vivifies.
416  //
417  // \return number of locations changed
418  inline label unset(const labelUList& locations);
419 
420  //- Unset the listed locations, never auto-vivifies.
421  //
422  // \return number of locations changed
423  template<class Addr>
424  inline label unset(const IndirectListBase<label, Addr>& locations);
425 
426  //- Unset the listed locations, never auto-vivifies.
427  //
428  // \return number of locations changed
429  template<unsigned N>
430  label unset(const FixedList<label, N>& locations);
431 
432 
433  // Access helpers
434 
435  //- A reference supporting read/write access to an entry
436  class reference
437  :
438  public PackedList<1>::reference
439  {
440  protected:
441  friend class bitSet; // Access for parent
442  void operator&() = delete; // Refuse to provide its address
443 
444  //- Construct by taking reference of block from within
445  //- the list and the specified index.
446  inline reference(bitSet* parent, const label index);
447 
448  public:
449 
450  //- Flip the bit at the position, no range-checking
451  inline void flip();
452 
453  //- Value assignment
454  inline void operator=(const reference& other);
455 
456  //- Value assignment
457  inline void operator=(const unsigned int val);
458 
459  //- Conversion operator
460  inline operator unsigned int () const;
461  };
462 
463 
464  // Iteration
465 
466  //- A const_iterator for iterating across \a on values
467  class const_iterator
468  {
469  friend class bitSet;
470 
471  //- The parent being iterated
472  const bitSet* set_;
473 
474  //- Global position of the current \a on bit
475  label pos_;
476 
477  //- Construct null - an end iterator
478  inline const_iterator() noexcept;
479 
480  //- Construct begin iterator
481  inline const_iterator(const bitSet* bitset);
482 
483  //- Construct iterator, starting at or beyond the given position
484  inline const_iterator(const bitSet* bitset, label pos);
485 
486  public:
487 
488  //- Return the current \a on position
489  inline label operator*() const noexcept;
490 
491  //- Move to the next \a on position
492  inline const_iterator& operator++();
493 
494  inline bool operator==(const const_iterator& iter) const noexcept;
495  inline bool operator!=(const const_iterator& iter) const noexcept;
496  };
497 
498 
499  //- Iterator set to the position of the first \a on bit
500  inline const_iterator begin() const;
501 
502  //- Iterator set to the position of the first \a on bit
503  inline const_iterator cbegin() const;
504 
505  //- Iterator set to the position of the first \a on bit that occurs
506  //- at or beyond the given position
507  inline const_iterator begin(label pos) const;
508 
509  //- Iterator set to the position of the first \a on bit that occurs
510  //- at or beyond the given position
511  inline const_iterator cbegin(label pos) const;
512 
513  //- Iterator beyond the end of the bitSet
514  inline const_iterator end() const noexcept;
515 
516  //- Iterator beyond the end of the bitSet
517  inline const_iterator cend() const noexcept;
518 
519 
520  // Member Operators
521 
522  //- Test value at specified position, same as test()
523  // Enables use as a predicate
524  inline bool operator()(const label pos) const;
525 
526  //- Identical to get() - get value at index.
527  // Never auto-vivify entries.
528  inline unsigned int operator[](const label i) const;
529 
530  //- Non-const access to value at index.
531  // Fatal for out-of-range indices
532  inline reference operator[](const label i);
533 
534  //- Assignment of all entries to the given value.
535  inline bitSet& operator=(const bool val);
536 
537  //- Copy assignment
538  inline bitSet& operator=(const bitSet& bitset);
539 
540  //- Move assignment
541  inline bitSet& operator=(bitSet&& bitset);
542 
543  //- Bitwise-AND all the bits in other with the bits in this bitset.
544  // The operands may have dissimilar sizes without affecting the size
545  // of the set.
546  inline bitSet& operator&=(const bitSet& other);
547 
548  //- Bitwise-OR operator - similar to the set() method.
549  // The operands may have dissimilar sizes without affecting the size
550  // of the set.
551  inline bitSet& operator|=(const bitSet& other);
552 
553  //- Bitwise-XOR operator - retains unique entries.
554  // The operands may have dissimilar sizes without affecting the size
555  // of the set.
556  inline bitSet& operator^=(const bitSet& other);
557 
558  //- Remove entries from this list - identical to the unset() method.
559  // The operands may have dissimilar sizes without affecting the size
560  // of the set.
561  inline bitSet& operator-=(const bitSet& other);
562 
563 
564  // IO
565 
566  //- Write bitSet, with line-breaks (ASCII) when length exceeds shortLen.
567  // Using '0' suppresses line-breaks entirely.
568  Ostream& writeList(Ostream& os, const label shortLen=0) const;
569 
570  //- Write as a dictionary entry with keyword
571  void writeEntry(const word& keyword, Ostream& os) const;
572 
573 
574  // IOstream Operators
575 
576  //- Return info proxy
577  InfoProxy<bitSet> info() const
578  {
579  return *this;
580  }
581 };
582 
583 
584 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
585 
586 //- Write bitset to Ostream, as per bitSet::writeList() with default length
587 //- of 40 items.
588 Ostream& operator<<(Ostream& os, const bitSet& bitset);
589 
590 //- Output bitset information
591 Ostream& operator<<(Ostream& os, const InfoProxy<bitSet>& info);
592 
593 
594 //- Bitset complement, returns a copy of the bitset with all its bits flipped
595 inline bitSet operator~(const bitSet& bitset);
596 
597 //- Bitwise-AND of two bitsets.
598 // See bitSet::operator&= for more details.
599 inline bitSet operator&(const bitSet& a, const bitSet& b);
600 
601 //- Bitwise-OR of two bitsets
602 // See bitSet::operator|= for more details.
603 inline bitSet operator|(const bitSet& a, const bitSet& b);
604 
605 //- Bitwise-XOR of two bitsets to form a unique bit-set
606 // See bitSet::operator^= for more details.
607 inline bitSet operator^(const bitSet& a, const bitSet& b);
608 
609 //- Bitwise difference (subset) of two bitsets to form a unique bit-set
610 // See bitSet::operator-= for more details.
611 inline bitSet operator-(const bitSet& a, const bitSet& b);
612 
613 
614 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
615 
616 } // End namespace Foam
617 
618 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
619 
620 #include "bitSetI.H"
621 
622 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
623 
624 #ifdef NoRepository
625  #include "bitSetTemplates.C"
626 #endif
627 
628 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
629 
630 #endif
631 
632 // ************************************************************************* //
Foam::bitSet::andEq
bitSet & andEq(const bitSet &other)
The set logical AND.
Definition: bitSet.C:77
Foam::bitSet::end
const_iterator end() const noexcept
Iterator beyond the end of the bitSet.
Definition: bitSetI.H:302
Foam::val
label ListType::const_reference val
Definition: ListOps.H:407
bitSetTemplates.C
Foam::bitSet::find_first
label find_first() const
Locate the first bit that is set.
Definition: bitSetI.H:314
PackedList.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::bitSet::bitSet
bitSet() noexcept
Construct an empty, zero-sized set.
Definition: bitSetI.H:77
Foam::HashSetOps::bools
List< bool > bools(const labelHashSet &locations)
Definition: HashOps.C:81
Foam::InfoProxy
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:47
Foam::bitSet::all
bool all() const
True if all bits in this bitset are set or if the set is empty.
Definition: bitSetI.H:454
Foam::bitSet::xorEq
bitSet & xorEq(const bitSet &other, const bool strict=true)
The set logical XOR.
Definition: bitSet.C:205
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:64
Foam::operator&
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
Foam::PackedList< 1 >::operator
friend Ostream & operator(Ostream &os, const InfoProxy< PackedList< Width >> &info)
Foam::bitSet::bound
bitSet & bound(const label maxSize)
Ensure the addressable range does not exceed maxSize.
Definition: bitSetI.H:631
Foam::bitSet::clone
autoPtr< bitSet > clone() const
Clone.
Definition: bitSetI.H:170
Foam::bitSet::reference
A reference supporting read/write access to an entry.
Definition: bitSet.H:435
Foam::bitSet::unset
bitSet & unset(const bitSet &other)
Definition: bitSetI.H:601
Foam::bitSet::any
bool any() const
True if any bits in this bitset are set.
Definition: bitSetI.H:460
Foam::operator-
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Foam::bitSet::ClassName
ClassName("bitSet")
Define class name and debug.
Foam::bitSet::cend
const_iterator cend() const noexcept
Iterator beyond the end of the bitSet.
Definition: bitSetI.H:308
Foam::bitSet::const_iterator::operator++
const_iterator & operator++()
Move to the next on position.
Definition: bitSetI.H:253
Foam::bitSet::set
void set(const bitSet &bitset)
Set specified bits from another bitset.
Definition: bitSetI.H:563
Foam::bitSet::setMany
label setMany(InputIter first, InputIter last)
Set the locations listed by the iterator range,.
Foam::bitSet::writeEntry
void writeEntry(Ostream &os) const
Write as a dictionary entry.
Definition: bitSetIO.C:33
Foam::bitSet::test
bool test(const label pos) const
Test value at specified position, never auto-vivify entries.
Definition: bitSetI.H:512
Foam::HashSetOps::bitset
bitSet bitset(const labelHashSet &locations)
Transform the on locations to a bitSet.
Definition: HashOps.C:72
Foam::bitSet::const_iterator::operator*
label operator*() const noexcept
Return the current on position.
Definition: bitSetI.H:247
Foam::bitSet::count
unsigned int count(const bool on=true) const
Count number of bits set.
Definition: bitSetI.H:491
Foam::bitSet::info
InfoProxy< bitSet > info() const
Return info proxy.
Definition: bitSet.H:576
Foam::uniform
Definition: uniform.H:50
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::bitSet::toc
labelList toc() const
The indices of the on bits as a sorted labelList.
Definition: bitSet.C:527
Foam::bitSet::cbegin
const_iterator cbegin() const
Iterator set to the position of the first on bit.
Definition: bitSetI.H:284
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::bitSet::find_last
label find_last() const
Locate the last bit set.
Definition: bitSetI.H:374
className.H
Macro definitions for declaring ClassName(), NamespaceName(), etc.
Foam::bitSet::const_iterator
A const_iterator for iterating across on values.
Definition: bitSet.H:466
Foam::bitSet::find_first_not
label find_first_not() const
Locate the first bit that is unset.
Definition: bitSetI.H:342
Foam::labelRange
A range or interval of labels defined by a start and a size.
Definition: labelRange.H:58
Foam::bitSet::minusEq
bitSet & minusEq(const bitSet &other)
The set difference.
Definition: bitSet.C:42
Foam::bitSet::const_reference
unsigned int const_reference
Definition: bitSet.H:130
Foam::bitSet::begin
const_iterator begin() const
Iterator set to the position of the first on bit.
Definition: bitSetI.H:278
Foam::bitSet::const_iterator::operator!=
bool operator!=(const const_iterator &iter) const noexcept
Definition: bitSetI.H:270
Foam::bitSet::writeList
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write bitSet, with line-breaks (ASCII) when length exceeds shortLen.
Definition: bitSetIO.C:42
Foam::bitSet::flip
void flip()
Invert all bits in the addressable region.
Definition: bitSetI.H:607
Foam::bitSet::orEq
bitSet & orEq(const bitSet &other, const bool strict=true)
The set logical OR.
Definition: bitSet.C:118
Foam::bitSet::find_next
label find_next(label pos) const
Locate the next bit set, starting one beyond the specified position.
Definition: bitSetI.H:400
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::bitSet::intersects
bool intersects(const bitSet &other) const
True if any bits in the other bitset intersect (are the same).
Definition: bitSet.C:348
Foam::bitSet::none
bool none() const
True if no bits in this bitset are set.
Definition: bitSetI.H:479
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::operator~
bitSet operator~(const bitSet &bitset)
Bitset complement, returns a copy of the bitset with all its bits flipped.
Definition: bitSetI.H:735
range
scalar range
Definition: LISASMDCalcMethod1.H:12
Foam::bitSet::swap
void swap(bitSet &bitset)
Swap contents.
Definition: bitSetI.H:524
Foam::List< label >
Foam::bitSet::extend
bitSet & extend(const label minSize)
Ensure that minSize is covered by the bitSet.
Definition: bitSetI.H:648
Foam::PackedList
A dynamic list of packed unsigned integers, with the number of bits per item specified by the <Width>...
Definition: PackedList.H:108
Foam::bitSet::operator=
bitSet & operator=(const bool val)
Assignment of all entries to the given value.
Definition: bitSetI.H:688
Foam::FixedList
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:104
Foam::UList< label >
Foam::bitSet::const_iterator::operator==
bool operator==(const const_iterator &iter) const noexcept
Definition: bitSetI.H:261
Foam::IndirectListBase
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
Definition: IndirectListBase.H:57
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
N
const Vector< label > N(dict.get< Vector< label >>("N"))
Foam::bitSet::assign
void assign(const bool val)
Assign all entries to the given value.
Definition: bitSetI.H:536
Foam::operator^
bitSet operator^(const bitSet &a, const bitSet &b)
Bitwise-XOR of two bitsets to form a unique bit-set.
Definition: bitSetI.H:757
Foam::operator|
bitSet operator|(const bitSet &a, const bitSet &b)
Bitwise-OR of two bitsets.
Definition: bitSetI.H:750
Foam::bitSet::values
List< bool > values() const
Return the bitset values as a boolList.
Definition: bitSet.C:566
Foam::bitSet::sortedToc
labelList sortedToc() const
The indices of the on bits as a sorted labelList.
Definition: bitSetI.H:518
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
Foam::bitSet::transfer
void transfer(bitSet &bitset)
Definition: bitSetI.H:530
bitSetI.H
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177