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