bitSetI.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 \*---------------------------------------------------------------------------*/
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 inline Foam::label Foam::bitSet::first_not_block() const
31 {
32  if (empty())
33  {
34  return -1;
35  }
36 
37  // Use complement to change 0 <-> 1 and check if any 1's now appear
38 
39  const label nblocks = num_blocks(size());
40 
41  // Extra bits in the final block?
42  const unsigned int off = size() % elem_per_block;
43 
44  if (!off)
45  {
46  for (label blocki=0; blocki < nblocks; ++blocki)
47  {
48  if (~(blocks_[blocki]))
49  {
50  return blocki;
51  }
52  }
53  }
54  else
55  {
56  for (label blocki=0; blocki < nblocks-1; ++blocki)
57  {
58  if (~(blocks_[blocki]))
59  {
60  return blocki;
61  }
62  }
63 
64  // The final block needs masking
65  if (~(blocks_[nblocks-1]) & mask_lower(off))
66  {
67  return nblocks-1;
68  }
69  }
70 
71  return -1;
72 }
73 
74 
75 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
76 
77 inline Foam::bitSet::bitSet() noexcept
78 :
79  PackedList<1>()
80 {}
81 
82 
83 inline Foam::bitSet::bitSet(const label n)
84 :
85  PackedList<1>(n)
86 {}
87 
88 
89 inline Foam::bitSet::bitSet(const label n, const bool val)
90 :
91  bitSet(n)
92 {
93  if (val) fill(val);
94 }
95 
96 
98 :
99  PackedList<1>(bitset)
100 {}
101 
102 
104 :
105  PackedList<1>(std::move(bitset))
106 {}
107 
108 
110 :
111  bitSet()
112 {
113  assign(bools);
114 }
115 
116 
117 inline Foam::bitSet::bitSet(const label n, const labelUList& locations)
118 :
119  bitSet(n)
120 {
121  setMany(locations.begin(), locations.end());
122 }
123 
124 
125 template<class Addr>
127 (
128  const label n,
129  const IndirectListBase<label, Addr>& locations
130 )
131 :
132  bitSet(n)
133 {
134  setMany(locations.begin(), locations.end());
135 }
136 
137 
139 (
140  const label n,
141  std::initializer_list<label> locations
142 )
143 :
144  bitSet(n)
145 {
146  setMany(locations.begin(), locations.end());
147 }
148 
149 
150 inline Foam::bitSet::bitSet(const labelUList& locations)
151 :
152  bitSet()
153 {
154  setMany(locations.begin(), locations.end());
155 }
156 
157 
158 template<class Addr>
160 (
161  const IndirectListBase<label, Addr>& locations
162 )
163 :
164  bitSet()
165 {
166  setMany(locations.begin(), locations.end());
167 }
168 
169 
171 {
172  return autoPtr<bitSet>::New(*this);
173 }
174 
175 
176 // * * * * * * * * * * * * * * * * References * * * * * * * * * * * * * * * * //
177 
179 (
180  bitSet* parent,
181  const label index
182 )
183 :
184  PackedList<1>::reference(parent, index)
185 {}
186 
187 
189 {
190  const unsigned int mask = (max_value << shift_);
191  ref_ ^= mask;
192 }
193 
194 
195 inline void Foam::bitSet::reference::operator=
196 (
197  const reference& other
198 )
199 {
200  // Accepts self-assignment
201  set(other.get());
202 }
203 
204 
205 inline void Foam::bitSet::reference::operator=
206 (
207  const unsigned int val
208 )
209 {
210  set(val);
211 }
212 
213 
214 inline Foam::bitSet::reference::operator unsigned int () const
215 {
216  return get();
217 }
218 
219 
220 // * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * //
221 
222 inline Foam::bitSet::const_iterator::const_iterator() noexcept
223 :
224  set_(nullptr),
225  pos_(-1)
226 {}
227 
228 
229 inline Foam::bitSet::const_iterator::const_iterator(const bitSet* parent)
230 :
231  set_(parent),
232  pos_(set_->find_first())
233 {}
234 
235 
236 inline Foam::bitSet::const_iterator::const_iterator
237 (
238  const bitSet* parent,
239  label pos
240 )
241 :
242  set_(parent),
243  pos_(set_->find_next(pos-1))
244 {}
245 
246 
247 inline Foam::label Foam::bitSet::const_iterator::operator*() const noexcept
248 {
249  return pos_;
250 }
251 
252 
254 {
255  pos_ = set_->find_next(pos_);
256  return *this;
257 }
258 
259 
260 inline bool Foam::bitSet::const_iterator::operator==
261 (
262  const const_iterator& iter
263 ) const noexcept
264 {
265  return (iter.pos_ == pos_);
266 }
267 
268 
269 inline bool Foam::bitSet::const_iterator::operator!=
270 (
271  const const_iterator& iter
272 ) const noexcept
273 {
274  return (iter.pos_ != pos_);
275 }
276 
277 
279 {
280  return const_iterator(this);
281 }
282 
283 
285 {
286  return const_iterator(this);
287 }
288 
289 
291 {
292  return const_iterator(this, pos);
293 }
294 
295 
297 {
298  return const_iterator(this, pos);
299 }
300 
301 
303 {
304  return const_iterator();
305 }
306 
307 
309 {
310  return const_iterator();
311 }
312 
313 
314 inline Foam::label Foam::bitSet::find_first() const
315 {
316  // Process block-wise, detecting any '1' bits
317 
318  const label nblocks = num_blocks(size());
319  for (label blocki = 0; blocki < nblocks; ++blocki)
320  {
321  label pos = (blocki * elem_per_block);
322 
323  for
324  (
325  unsigned int blockval = blocks_[blocki];
326  blockval;
327  blockval >>= 1u
328  )
329  {
330  if (blockval & 1u)
331  {
332  return pos;
333  }
334  ++pos;
335  }
336  }
337 
338  return -1;
339 }
340 
341 
342 inline Foam::label Foam::bitSet::find_first_not() const
343 {
344  const label blocki = first_not_block();
345 
346  if (blocki >= 0)
347  {
348  label pos = (blocki * elem_per_block);
349 
350  // Detect first '0' bit by checking the complement.
351 
352  // No special masking for the final block, that was already checked
353  // in the first_not_block() call.
354 
355  for
356  (
357  unsigned int blockval = ~(blocks_[blocki]);
358  blockval;
359  blockval >>= 1u
360  )
361  {
362  if (blockval & 1u)
363  {
364  return pos;
365  }
366  ++pos;
367  }
368  }
369 
370  return -1;
371 }
372 
373 
374 inline Foam::label Foam::bitSet::find_last() const
375 {
376  // Process block-wise, detecting any '1' bits
377 
378  for (label blocki = num_blocks(size())-1; blocki >= 0; --blocki)
379  {
380  unsigned int blockval = blocks_[blocki];
381 
382  if (blockval)
383  {
384  label pos = (blocki * elem_per_block) - 1;
385 
386  while (blockval)
387  {
388  blockval >>= 1u;
389  ++pos;
390  }
391 
392  return pos;
393  }
394  }
395 
396  return -1;
397 }
398 
399 
400 inline Foam::label Foam::bitSet::find_next(label pos) const
401 {
402  ++pos;
403  if (pos < 0 || pos >= size())
404  {
405  return -1;
406  }
407 
408  // The corresponding block/offset
409  label blocki = pos / elem_per_block;
410  unsigned int off = pos % elem_per_block;
411 
412  for
413  (
414  unsigned int blockval = (blocks_[blocki] >> off);
415  blockval;
416  blockval >>= 1u
417  )
418  {
419  if (blockval & 1u)
420  {
421  return pos;
422  }
423  ++pos;
424  }
425 
426  // Normal block-wise search. Starting at the next block
427 
428  const label nblocks = num_blocks(size());
429  for (++blocki; blocki < nblocks; ++blocki)
430  {
431  label pos = (blocki * elem_per_block);
432 
433  for
434  (
435  unsigned int blockval = blocks_[blocki];
436  blockval;
437  blockval >>= 1u
438  )
439  {
440  if (blockval & 1u)
441  {
442  return pos;
443  }
444  ++pos;
445  }
446  }
447 
448  return -1;
449 }
450 
451 
452 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
453 
455 {
456  return NullObjectRef<bitSet>();
457 }
458 
459 
460 inline bool Foam::bitSet::all() const
461 {
462  if (empty()) return true; // SIC. boost convention
463 
464  return -1 == first_not_block();
465 }
466 
467 
468 inline bool Foam::bitSet::any() const
469 {
470  if (size())
471  {
472  const label nblocks = num_blocks(size());
473 
474  for (label blocki=0; blocki < nblocks; ++blocki)
475  {
476  if (blocks_[blocki])
477  {
478  return true;
479  }
480  }
481  }
482 
483  return false;
484 }
485 
486 
487 inline bool Foam::bitSet::none() const
488 {
489  return !any();
490 }
491 
492 
493 inline bool Foam::bitSet::uniform() const
494 {
495  return (size() == 1 || (size() > 1 && (test(0) ? all() : none())));
496 }
497 
498 
499 inline unsigned int Foam::bitSet::count(const bool on) const
500 {
501  unsigned int total = 0;
502 
503  const label nblocks = num_blocks(size());
504 
505  for (label blocki = 0; blocki < nblocks; ++blocki)
506  {
507  total += BitOps::bit_count(blocks_[blocki]);
508  }
509 
510  if (!on)
511  {
512  // Return the number of bits that are OFF.
513  return (unsigned(size()) - total);
514  }
515 
516  return total;
517 }
518 
519 
520 inline bool Foam::bitSet::test(const label pos) const
521 {
522  return get(pos);
523 }
524 
525 
526 inline bool Foam::bitSet::found(const label pos) const
527 {
528  return get(pos);
529 }
530 
531 
533 {
534  return toc();
535 }
536 
537 
539 {
541 }
542 
543 
545 {
547 }
548 
549 
550 inline void Foam::bitSet::fill(const bool val)
551 {
552  if (empty())
553  {
554  return; // Trivial case
555  }
556 
557  const label nblocks = num_blocks(size());
558 
559  // Fill value for complete blocks
560  const unsigned int blockval = (val ? ~0u : 0u);
561 
562  for (label blocki=0; blocki < nblocks; ++blocki)
563  {
564  blocks_[blocki] = blockval;
565  }
566 
567  if (val)
568  {
570  }
571 }
572 
573 
574 inline void Foam::bitSet::set(const bitSet& bitset)
575 {
576  orEq(bitset, false); // Non-strict: Lets the set size grow.
577 }
578 
579 
580 inline Foam::label Foam::bitSet::set(const labelUList& locations)
581 {
582  return setMany(locations.begin(), locations.end());
583 }
584 
585 
586 template<class Addr>
587 inline Foam::label Foam::bitSet::set
588 (
589  const IndirectListBase<label, Addr>& locations
590 )
591 {
592  return setMany(locations.begin(), locations.end());
593 }
594 
595 
596 inline Foam::label Foam::bitSet::unset(const labelUList& locations)
597 {
598  return unset(locations.begin(), locations.end());
599 }
600 
601 
602 template<class Addr>
603 inline Foam::label Foam::bitSet::unset
604 (
605  const IndirectListBase<label, Addr>& locations
606 )
607 {
608  return unset(locations.begin(), locations.end());
609 }
610 
611 
613 {
614  return minusEq(other);
615 }
616 
617 
618 inline void Foam::bitSet::flip()
619 {
620  if (size())
621  {
622  const label nblocks = num_blocks(size());
623 
624  for (label blocki=0; blocki < nblocks; ++blocki)
625  {
626  blocks_[blocki] = ~(blocks_[blocki]);
627  }
629  }
630 }
631 
632 
633 inline void Foam::bitSet::flip(const label i)
634 {
635  if (i >= 0 && i < size())
636  {
637  reference(this, i).flip();
638  }
639 }
640 
641 
642 inline Foam::bitSet& Foam::bitSet::bound(const label maxSize)
643 {
644  if (maxSize < size())
645  {
646  resize(maxSize);
647  }
648 
649  return *this;
650 }
651 
652 
654 {
655  return bound(other.size());
656 }
657 
658 
659 inline Foam::bitSet& Foam::bitSet::extend(const label minSize)
660 {
661  if (size() < minSize)
662  {
663  resize(minSize);
664  }
665 
666  return *this;
667 }
668 
669 
671 {
672  return extend(other.size());
673 }
674 
675 
676 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
677 
678 inline bool Foam::bitSet::operator()(const label pos) const
679 {
680  return test(pos);
681 }
682 
683 
684 inline unsigned int Foam::bitSet::operator[](const label i) const
685 {
686  return get(i);
687 }
688 
689 
691 {
692  #ifdef FULLDEBUG
693  checkIndex(i);
694  #endif
695  return reference(this, i);
696 }
697 
698 
700 {
702  return *this;
703 }
704 
705 
707 {
708  transfer(bitset);
709  return *this;
710 }
711 
712 
713 inline Foam::bitSet& Foam::bitSet::operator=(const bool val)
714 {
715  fill(val);
716  return *this;
717 }
718 
719 
721 {
722  return andEq(other);
723 }
724 
725 
727 {
728  return orEq(other);
729 }
730 
731 
733 {
734  return xorEq(other);
735 }
736 
737 
739 {
740  return minusEq(other);
741 }
742 
743 
744 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
745 
747 {
748  bitSet result(bitset);
749  result.flip();
750  return result;
751 }
752 
753 
754 inline Foam::bitSet Foam::operator&(const bitSet& a, const bitSet& b)
755 {
756  bitSet result(a);
757  return (result &= b);
758 }
759 
760 
761 inline Foam::bitSet Foam::operator|(const bitSet& a, const bitSet& b)
762 {
763  bitSet result(a);
764  return (result |= b);
765 }
766 
767 
768 inline Foam::bitSet Foam::operator^(const bitSet& a, const bitSet& b)
769 {
770  bitSet result(a);
771  return (result ^= b);
772 }
773 
774 
775 inline Foam::bitSet Foam::operator-(const bitSet& a, const bitSet& b)
776 {
777  bitSet result(a);
778  return (result -= b);
779 }
780 
781 
782 // ************************************************************************* //
Foam::bitSet::found
bool found(const label pos) const
Test value at specified position, never auto-vivify entries.
Definition: bitSetI.H:526
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::bitSet::andEq
bitSet & andEq(const bitSet &other)
The set logical AND.
Definition: bitSet.C:77
Foam::bitSet::operator-=
bitSet & operator-=(const bitSet &other)
Remove entries from this list - identical to the unset() method.
Definition: bitSetI.H:738
Foam::bitSet::operator[]
unsigned int operator[](const label i) const
Identical to get() - get value at index.
Definition: bitSetI.H:684
Foam::PackedList< 1 >::resize
void resize(const label numElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
Definition: PackedListI.H:409
Foam::IndirectListBase::end
iterator end()
Return an iterator at end of list.
Definition: IndirectListBase.H:346
Foam::bitSet::end
const_iterator end() const noexcept
Iterator beyond the end of the bitSet.
Definition: bitSetI.H:302
Foam::bitSet::find_first
label find_first() const
Locate the first bit that is set.
Definition: bitSetI.H:314
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::PackedList::reference::ref_
block_type & ref_
Reference to the block.
Definition: PackedList.H:474
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::UList::end
iterator end() noexcept
Return an iterator to end traversing the UList.
Definition: UListI.H:350
Foam::operator&
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
Foam::bitSet::bound
bitSet & bound(const label maxSize)
Ensure the addressable range does not exceed maxSize.
Definition: bitSetI.H:642
Foam::BitOps::bit_count
unsigned int bit_count(UIntType x)
Count arbitrary number of bits (of an integral type)
Definition: BitOps.H:130
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::null
static const bitSet & null()
Return a null bitSet reference.
Definition: bitSetI.H:454
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::PackedList< 1 >::clear_trailing_bits
void clear_trailing_bits()
Clear any partial rubbish in the last addressable block.
Definition: PackedListI.H:83
Foam::PackedList< 1 >::empty
bool empty() const noexcept
True if the list is empty (ie, size() is zero).
Definition: PackedListI.H:384
Foam::bitSet::operator|=
bitSet & operator|=(const bitSet &other)
Bitwise-OR operator - similar to the set() method.
Definition: bitSetI.H:726
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::PackedList< 1 >::checkIndex
void checkIndex(const label i) const
Check index is within valid range [0,size)
Definition: PackedListI.H:359
Foam::bitSet::count
unsigned int count(const bool on=true) const
Count number of bits set.
Definition: bitSetI.H:499
Foam::PackedList::swap
void swap(PackedList< Width > &rhs)
Swap contents with argument.
Definition: PackedListI.H:603
Foam::PackedList< 1 >::get
unsigned int get(const label i) const
Get value at index i or 0 for out-of-range.
Definition: PackedListI.H:630
Foam::PackedList< 1 >::mask_lower
static constexpr block_type mask_lower(unsigned elementOffset)
Masking for all bits below the element offset.
Definition: PackedList.H:170
Foam::bitSet::operator()
bool operator()(const label pos) const
Test value at specified position, same as test()
Definition: bitSetI.H:678
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::bitSet::reference::flip
void flip()
Flip the bit at the position, no range-checking.
Definition: bitSetI.H:188
Foam::PackedList< 1 >::blocks_
block_container blocks_
The blocks of raw data.
Definition: PackedList.H:184
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::UList::begin
iterator begin() noexcept
Return an iterator to begin traversing the UList.
Definition: UListI.H:329
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::bitSet::find_last
label find_last() const
Locate the last bit set.
Definition: bitSetI.H:374
Foam::bitSet::reference::reference
reference(bitSet *parent, const label index)
Definition: bitSetI.H:179
Foam::bitSet::fill
void fill(const bool val)
Assign all entries to the given value.
Definition: bitSetI.H:550
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::bitSet::operator&=
bitSet & operator&=(const bitSet &other)
Bitwise-AND all the bits in other with the bits in this bitset.
Definition: bitSetI.H:720
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::begin
const_iterator begin() const
Iterator set to the position of the first on bit.
Definition: bitSetI.H:278
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::PackedList::transfer
void transfer(PackedList< Width > &rhs)
Definition: PackedListI.H:616
Foam::bitSet::operator=
bitSet & operator=(const bitSet &bitset)
Copy assignment.
Definition: bitSetI.H:699
Foam::IndirectListBase::begin
iterator begin()
Return an iterator at begin of list.
Definition: IndirectListBase.H:340
Foam::PackedList< 1 >::max_value
static constexpr block_type max_value
Definition: PackedList.H:152
Foam::bitSet::none
bool none() const
True if no bits in this bitset are set.
Definition: bitSetI.H:487
Foam::autoPtr< Foam::bitSet >
Foam::operator~
bitSet operator~(const bitSet &bitset)
Bitset complement, returns a copy of the bitset with all its bits flipped.
Definition: bitSetI.H:746
Foam::PackedList< 1 >::elem_per_block
static constexpr unsigned elem_per_block
The number of elements stored per data block.
Definition: PackedList.H:147
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::PackedList::operator=
void operator=(const PackedList< Width > &lst)
Copy assignment.
Definition: PackedListI.H:773
Foam::PackedList< 1 >::size
label size() const noexcept
Number of entries.
Definition: PackedListI.H:377
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
Foam::bitSet::operator^=
bitSet & operator^=(const bitSet &other)
Bitwise-XOR operator - retains unique entries.
Definition: bitSetI.H:732
Foam::IndirectListBase
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
Definition: IndirectListBase.H:56
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::PackedList::reference::shift_
unsigned shift_
The bit shift to access the given sub-portion.
Definition: PackedList.H:477
Foam::operator|
bitSet operator|(const bitSet &a, const bitSet &b)
Bitwise-OR of two bitsets.
Definition: bitSetI.H:761
Foam::bitSet::uniform
bool uniform() const
True if all entries have identical values, and the set is non-empty.
Definition: bitSetI.H:493
Foam::PackedList< 1 >::num_blocks
static constexpr label num_blocks(label numElem) noexcept
Definition: PackedList.H:163
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
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177