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-2020 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 
135  //- Declare type-name (with debug switch)
136  ClassName("bitSet");
137 
138 
139  // Constructors
140 
141  //- Default construct an empty, zero-sized set
142  inline bitSet() noexcept;
143 
144  //- Construct from Istream
145  explicit bitSet(Istream& is);
146 
147  //- Construct with given size, with all bits set to 0
148  inline explicit bitSet(const label n);
149 
150  //- Construct with given size and value for all elements
151  inline bitSet(const label n, const bool val);
152 
153  //- Copy construct
154  inline bitSet(const bitSet& bitset);
155 
156  //- Move construct
157  inline bitSet(bitSet&& bitset);
158 
159  //- Copy construct a subset
160  bitSet(const bitSet& bitset, const labelUList& addr);
161 
162  //- Copy construct a subset
163  template<class Addr>
164  bitSet
165  (
166  const bitSet& bitset,
167  const IndirectListBase<label, Addr>& addr
168  );
169 
170  //- Copy construct a subset range
171  bitSet(const bitSet& bitset, const labelRange& range);
172 
173  //- Construct from a list of bools
174  inline explicit bitSet(const UList<bool>& bools);
175 
176  //- Construct with given size with all bits set to 0,
177  //- subsequently add specified locations as 1.
178  inline bitSet(const label n, const labelUList& locations);
179 
180  //- Construct with given size with all bits set to 0,
181  //- subsequently add specified locations as 1.
182  template<class Addr>
183  bitSet
184  (
185  const label n,
186  const IndirectListBase<label, Addr>& locations
187  );
188 
189  //- Construct with given size with all bits set to 0,
190  //- subsequently add specified locations as 1.
191  template<unsigned N>
192  bitSet(const label n, const FixedList<label, N>& locations);
193 
194  //- Construct with given size with all bits set to 0,
195  //- subsequently add specified locations as 1.
196  inline bitSet(const label n, std::initializer_list<label> locations);
197 
198  //- Construct with automatic sizing (filled with 0),
199  //- and populate with specified locations as 1.
200  inline explicit bitSet(const labelUList& locations);
201 
202  //- Construct with automatic sizing (filled with 0),
203  //- and populate with specified locations as 1.
204  template<class Addr>
205  inline explicit bitSet(const IndirectListBase<label, Addr>& locations);
206 
207  //- Construct with automatic sizing (filled with 0),
208  //- and populate with specified locations as 1.
209  template<unsigned N>
210  explicit bitSet(const FixedList<label, N>& locations);
211 
212  //- Clone
213  inline autoPtr<bitSet> clone() const;
214 
215 
216  // Member Functions
217 
218  // Query
219 
220  //- True if all bits in this bitset are set or if the set is empty.
221  inline bool all() const;
222 
223  //- True if any bits in this bitset are set.
224  inline bool any() const;
225 
226  //- True if no bits in this bitset are set.
227  inline bool none() const;
228 
229  //- True if all entries have identical values, and the set is non-empty
230  inline bool uniform() const;
231 
232  //- Count number of bits set.
233  // \param on can be set to false to count the number of unset bits
234  // instead.
235  inline unsigned int count(const bool on=true) const;
236 
237  //- True if any bits in the other bitset intersect (are the same).
238  //
239  // \note Method name compatibility with boost::dynamic_bitset
240  bool intersects(const bitSet& other) const;
241 
242  //- Test value at specified position, never auto-vivify entries.
243  //
244  // \note Method name compatibility with std::bitset
245  inline bool test(const label pos) const;
246 
247  //- Locate the first bit that is set.
248  // \return the location or -1 if there are no bits set.
249  //
250  // \note Method name compatibility with boost::dynamic_bitset
251  inline label find_first() const;
252 
253  //- Locate the first bit that is unset.
254  // \return the location or -1 if the set is empty or all bits are on.
255  //
256  // \note Provided for symmetry with find_first()
257  inline label find_first_not() const;
258 
259  //- Locate the last bit set.
260  // \return the location or -1 if there are no bits set.
261  //
262  // \note Provided for symmetry with find_first()
263  inline label find_last() const;
264 
265  //- Locate the next bit set, starting one beyond the specified position
266  // \return the location or -1 if there are no further bits set.
267  //
268  // \note Method name compatibility with boost::dynamic_bitset
269  inline label find_next(label pos) const;
270 
271  //- The indices of the \a on bits as a sorted labelList.
272  //
273  // \note Method name compatibility with HashSet
274  labelList toc() const;
275 
276  //- The indices of the \a on bits as a sorted labelList.
277  // This is identical to toc(), which is always sorted.
278  //
279  // \note Method name compatibility with HashSet
280  inline labelList sortedToc() const;
281 
282  //- Return the bitset values as a boolList.
283  // When the output is a bool, this is more efficient than unpack()
284  List<bool> values() const;
285 
286 
287  // Assignment
288 
289  //- Assign all entries to the given value.
290  inline void assign(const bool val);
291 
292  //- Copy assign all entries from a list of bools.
293  void assign(const UList<bool>& bools);
294 
295 
296  // Setting single or multiple values
297 
298  //- Assign a single index/value
299  using PackedList<1>::set;
300 
301  //- Set specified bits from another bitset.
302  // The current set size may grow to accommodate any new bits
303  // (auto-vivifies).
304  inline void set(const bitSet& bitset);
305 
306  //- Set the specified range of bits specified
307  // The current set size may grow to accommodate any new bits
308  // (auto-vivifies).
309  // \note this operation is generally more efficient than calling
310  // set(pos) on individual bits.
311  void set(const labelRange& range);
312 
313 
314  // Unsetting single or multiple values
315 
316  //- Unset a single index
317  using PackedList<1>::unset;
318 
319  //- Unset (subtract) the bits specified in the other bitset, which is
320  //- a set difference corresponds to the logical operation
321  // \code
322  // A = (A & !B)
323  // \endcode
324  // The result is comparable to 'operator-='
325  // \endcode
326  //
327  // A and B can have different sizes.
328  // Does not change the original set size.
329  inline bitSet& unset(const bitSet& other);
330 
331  //- Unset the specified range of bits specified, never auto-vivifies.
332  // \note this operation can be more efficient than calling
333  // unset(pos) on individual bits.
334  void unset(const labelRange& range);
335 
336 
337  // Edit
338 
339  //- Invert all bits in the addressable region
340  inline void flip();
341 
342  //- Invert bits at the specified position.
343  // A no-op if the position is out-of-range
344  inline void flip(const label pos);
345 
346  //- Swap contents
347  inline void swap(bitSet& bitset);
348 
349  //- Transfer the contents of the argument list into this list
350  //- and annul the argument list.
351  inline void transfer(bitSet& bitset);
352 
353 
354  // Convenience methods
355 
356  //- Ensure the addressable range does not exceed maxSize.
357  // Either decreases the size of the bitSet or is a no-op.
358  //
359  // \code
360  // pointField& pts = mesh.points();
361  // bitset.bound(pts.size());
362  //
363  // for (const label pointi : bitset)
364  // {
365  // pts[pointi] ...
366  // }
367  // \endcode
368  inline bitSet& bound(const label maxSize);
369 
370  //- Ensure the addressable range does not exceed that of other.
371  // Either decreases the size of the bitSet or is a no-op.
372  inline bitSet& bound(const bitSet& other);
373 
374  //- Ensure that minSize is covered by the bitSet.
375  // Either increases the size of the bitSet or is a no-op.
376  inline bitSet& extend(const label minSize);
377 
378  //- Ensure the bitset is addressable throughout the range of other.
379  // Either increases the size of the bitSet or is a no-op.
380  inline bitSet& extend(const bitSet& other);
381 
382  //- Set the locations listed by the iterator range,
383  // auto-vivify entries if needed.
384  //
385  // \return number of locations changed
386  template<class InputIter>
387  label setMany(InputIter first, InputIter last);
388 
389  //- Set the listed locations to true.
390  // Does auto-vivify for non-existent entries.
391  //
392  // \return number of locations changed
393  inline label set(const labelUList& locations);
394 
395  //- Set the listed locations to true.
396  // Does auto-vivify for non-existent entries.
397  //
398  // \return number of locations changed
399  template<class Addr>
400  inline label set(const IndirectListBase<label, Addr>& locations);
401 
402  //- Set the listed locations to true.
403  // Does auto-vivify for non-existent entries.
404  //
405  // \return number of locations changed
406  template<unsigned N>
407  label set(const FixedList<label, N>& locations);
408 
409  //- Unset the locations listed by the iterator range,
410  //- never auto-vivify entries.
411  //
412  // \return number of locations changed
413  template<class InputIter>
414  label unset(InputIter first, InputIter last);
415 
416  //- Unset the listed locations, never auto-vivifies.
417  //
418  // \return number of locations changed
419  inline label unset(const labelUList& locations);
420 
421  //- Unset the listed locations, never auto-vivifies.
422  //
423  // \return number of locations changed
424  template<class Addr>
425  inline label unset(const IndirectListBase<label, Addr>& locations);
426 
427  //- Unset the listed locations, never auto-vivifies.
428  //
429  // \return number of locations changed
430  template<unsigned N>
431  label unset(const FixedList<label, N>& locations);
432 
433 
434  // Access helpers
435 
436  //- A reference supporting read/write access to an entry
437  class reference
438  :
439  public PackedList<1>::reference
440  {
441  protected:
442 
443  friend class bitSet; // Access for parent
444  void operator&() = delete; // Refuse to provide its address
445 
446  //- Construct by taking reference of block from within
447  //- the list and the specified index.
448  inline reference(bitSet* parent, const label index);
449 
450  public:
451 
452  //- Copy construct
453  reference(const reference&) = default;
454 
455  //- Move construct
456  reference(reference&&) = default;
457 
458  //- Flip the bit at the position, no range-checking
459  inline void flip();
460 
461  //- Value assignment
462  inline void operator=(const reference& other);
463 
464  //- Value assignment
465  inline void operator=(const unsigned int val);
466 
467  //- Conversion operator
468  inline operator unsigned int () const;
469  };
470 
471 
472  // Iteration
473 
474  //- A const_iterator for iterating across \a on values
475  class const_iterator
476  {
477  friend class bitSet;
478 
479  //- The parent being iterated
480  const bitSet* set_;
481 
482  //- Global position of the current \a on bit
483  label pos_;
484 
485  //- Default construct - an end iterator
486  inline const_iterator() noexcept;
487 
488  //- Construct begin iterator
489  inline const_iterator(const bitSet* bitset);
490 
491  //- Construct iterator, starting at or beyond the given position
492  inline const_iterator(const bitSet* bitset, label pos);
493 
494  public:
495 
496  //- Return the current \a on position
497  inline label operator*() const noexcept;
498 
499  //- Move to the next \a on position
500  inline const_iterator& operator++();
501 
502  inline bool operator==(const const_iterator& iter) const noexcept;
503  inline bool operator!=(const const_iterator& iter) const noexcept;
504  };
505 
506 
507  //- Iterator set to the position of the first \a on bit
508  inline const_iterator begin() const;
509 
510  //- Iterator set to the position of the first \a on bit
511  inline const_iterator cbegin() const;
512 
513  //- Iterator set to the position of the first \a on bit that occurs
514  //- at or beyond the given position
515  inline const_iterator begin(label pos) const;
516 
517  //- Iterator set to the position of the first \a on bit that occurs
518  //- at or beyond the given position
519  inline const_iterator cbegin(label pos) const;
520 
521  //- Iterator beyond the end of the bitSet
522  inline const_iterator end() const noexcept;
523 
524  //- Iterator beyond the end of the bitSet
525  inline const_iterator cend() const noexcept;
526 
527 
528  // Member Operators
529 
530  //- Test value at specified position, same as test()
531  // Enables use as a predicate
532  inline bool operator()(const label pos) const;
533 
534  //- Identical to get() - get value at index.
535  // Never auto-vivify entries.
536  inline unsigned int operator[](const label i) const;
537 
538  //- Non-const access to value at index.
539  // Fatal for out-of-range indices
540  inline reference operator[](const label i);
541 
542  //- Assignment of all entries to the given value.
543  inline bitSet& operator=(const bool val);
544 
545  //- Copy assignment
546  inline bitSet& operator=(const bitSet& bitset);
547 
548  //- Move assignment
549  inline bitSet& operator=(bitSet&& bitset);
550 
551  //- Bitwise-AND all the bits in other with the bits in this bitset.
552  // The operands may have dissimilar sizes without affecting the size
553  // of the set.
554  inline bitSet& operator&=(const bitSet& other);
555 
556  //- Bitwise-OR operator - similar to the set() method.
557  // The operands may have dissimilar sizes without affecting the size
558  // of the set.
559  inline bitSet& operator|=(const bitSet& other);
560 
561  //- Bitwise-XOR operator - retains unique entries.
562  // The operands may have dissimilar sizes without affecting the size
563  // of the set.
564  inline bitSet& operator^=(const bitSet& other);
565 
566  //- Remove entries from this list - identical to the unset() method.
567  // The operands may have dissimilar sizes without affecting the size
568  // of the set.
569  inline bitSet& operator-=(const bitSet& other);
570 
571 
572  // IO
573 
574  //- Write bitSet, with line-breaks (ASCII) when length exceeds shortLen.
575  // Using '0' suppresses line-breaks entirely.
576  Ostream& writeList(Ostream& os, const label shortLen=0) const;
577 
578  //- Write as a dictionary entry with keyword
579  void writeEntry(const word& keyword, Ostream& os) const;
580 
581 
582  // IOstream Operators
583 
584  //- Return info proxy
585  InfoProxy<bitSet> info() const
586  {
587  return *this;
588  }
589 };
590 
591 
592 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
593 
594 //- Write bitset to Ostream, as per bitSet::writeList() with default length
595 //- of 40 items.
596 Ostream& operator<<(Ostream& os, const bitSet& bitset);
597 
598 //- Output bitset information
599 Ostream& operator<<(Ostream& os, const InfoProxy<bitSet>& info);
600 
601 
602 //- Bitset complement, returns a copy of the bitset with all its bits flipped
603 inline bitSet operator~(const bitSet& bitset);
604 
605 //- Bitwise-AND of two bitsets.
606 // See bitSet::operator&= for more details.
607 inline bitSet operator&(const bitSet& a, const bitSet& b);
608 
609 //- Bitwise-OR of two bitsets
610 // See bitSet::operator|= for more details.
611 inline bitSet operator|(const bitSet& a, const bitSet& b);
612 
613 //- Bitwise-XOR of two bitsets to form a unique bit-set
614 // See bitSet::operator^= for more details.
615 inline bitSet operator^(const bitSet& a, const bitSet& b);
616 
617 //- Bitwise difference (subset) of two bitsets to form a unique bit-set
618 // See bitSet::operator-= for more details.
619 inline bitSet operator-(const bitSet& a, const bitSet& b);
620 
621 
622 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
623 
624 } // End namespace Foam
625 
626 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
627 
628 #include "bitSetI.H"
629 
630 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
631 
632 #ifdef NoRepository
633  #include "bitSetTemplates.C"
634 #endif
635 
636 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
637 
638 #endif
639 
640 // ************************************************************************* //
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
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
Default 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:436
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")
Declare type-name (with debug switch)
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:584
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
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::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:474
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:56
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::bitSet::transfer
void transfer(bitSet &bitset)
Definition: bitSetI.H:530
bitSetI.H
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177