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