PackedListI.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2017-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "error.H"
30 
31 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
32 
33 template<unsigned Width>
34 inline unsigned int Foam::PackedList<Width>::repeated_value(unsigned val)
35 {
36  return BitOps::repeat_value<block_type,Width>(val);
37 }
38 
39 
40 template<unsigned Width>
42 {
43  const unsigned int val = readLabel(is);
44 
45  if (val > max_value)
46  {
48  << "Out-of-range value " << val << " for PackedList<" << Width
49  << ">. Maximum permitted value is " << max_value << "."
50  << exit(FatalIOError);
51  }
52 
53  return val;
54 }
55 
56 
57 template<unsigned Width>
59 {
60  is.readBegin("Tuple2<label,uint32>");
61 
62  const label ind = readLabel(is);
63  const unsigned int val = readLabel(is);
64 
65  is.readEnd("Tuple2<label,uint32>");
66 
67  if (val > max_value)
68  {
70  << "Out-of-range value " << val << " for PackedList<" << Width
71  << "> at index " << ind
72  << ". Maximum permitted value is " << max_value << "."
73  << exit(FatalIOError);
74  }
75 
76  set(ind, val);
77 
78  is.check(FUNCTION_NAME);
79 }
80 
81 
82 template<unsigned Width>
84 {
85  // Mask off any partial rubbish in final block
86  const unsigned int blk = size() / elem_per_block;
87  const unsigned int off = size() % elem_per_block;
88 
89  if (off)
90  {
91  blocks_[blk] &= mask_lower(off);
92  }
93 }
94 
95 
96 template<unsigned Width>
97 inline bool Foam::PackedList<Width>::trim(label minpos)
98 {
99  if (empty())
100  {
101  return false; // Trivial case
102  }
103 
104  const label orig = size();
105  if (orig < minpos)
106  {
107  minpos = orig; // Don't allow allow accidental growth!
108  }
109 
110  for (label blocki = num_blocks(size())-1; blocki >= 0; --blocki)
111  {
112  // Truncate to the block begin
113  size_ = blocki * elem_per_block;
114 
115  unsigned int blockval = blocks_[blocki];
116 
117  // Some bits were found in the block, increment size again
118  if (blockval)
119  {
120  for (; blockval; ++size_)
121  {
122  blockval >>= Width;
123  }
124  break;
125  }
126  else if (size_ < minpos)
127  {
128  break;
129  }
130  }
131 
132  if (size_ < minpos)
133  {
134  size_ = minpos;
135  }
136 
137  return (size() != orig);
138 }
139 
140 
141 template<unsigned Width>
143 {
144  // Self-assignment silently ignored
145  blocks_ = rhs.blocks_;
146  size_ = rhs.size_;
147 }
148 
149 
150 // * * * * * * * * * * * * * * * Specializations * * * * * * * * * * * * * * //
151 
152 namespace Foam
153 {
154 
155 // constexpr noexcept
156 template<> inline unsigned int PackedList<1>::repeated_value(unsigned val)
157 {
158  return (val ? ~0u : 0u);
159 }
160 
161 template<> inline unsigned int PackedList<1>::readValue(Istream& is)
162 {
163  return readBool(is);
164 }
165 
166 template<> inline void PackedList<1>::setPair(Istream& is)
167 {
168  set(readLabel(is), true);
169 }
170 
171 } // End namespace Foam
172 
173 
174 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
175 
176 template<unsigned Width>
177 inline constexpr Foam::PackedList<Width>::PackedList() noexcept
178 :
179  blocks_(),
180  size_(0)
181 {}
182 
183 
184 template<unsigned Width>
185 inline Foam::PackedList<Width>::PackedList(const label numElem)
186 :
187  blocks_(num_blocks(numElem), 0u),
188  size_(numElem)
189 {}
190 
191 
192 template<unsigned Width>
194 (
195  const label numElem,
196  const unsigned int val
197 )
198 :
199  blocks_(num_blocks(numElem), 0u),
200  size_(numElem)
201 {
202  if (val)
203  {
204  operator=(val);
205  }
206 }
207 
208 
209 template<unsigned Width>
211 :
212  blocks_(),
213  size_(0)
214 {
215  read(is);
216 }
217 
218 
219 template<unsigned Width>
221 :
222  blocks_(list.blocks_),
223  size_(list.size_)
224 {}
225 
226 
227 template<unsigned Width>
229 :
230  blocks_(std::move(list.blocks_)),
231  size_(list.size_)
232 {
233  list.size_ = 0;
234 }
235 
236 
237 template<unsigned Width>
239 :
240  blocks_(num_blocks(values.size()), 0u),
241  size_(values.size())
242 {
243  const label len = values.size();
244 
245  // Could add more intelligent filling (blockwise),
246  // but likely done fairly infrequently
247 
248  for (label i = 0; i < len; ++i)
249  {
250  const unsigned int val(values[i]);
251  if (val) set(i, val);
252  }
253 }
254 
255 
256 template<unsigned Width>
257 template<class Addr>
259 (
261 )
262 :
263  blocks_(num_blocks(values.size()), 0u),
264  size_(values.size())
265 {
266  const label len = values.size();
267 
268  // Could add more intelligent filling (blockwise),
269  // but likely done fairly infrequently
270 
271  for (label i = 0; i < len; ++i)
272  {
273  const unsigned int val(values[i]);
274  if (val) set(i, val);
275  }
276 }
277 
278 
279 template<unsigned Width>
282 {
283  return autoPtr<PackedList<Width>>::New(*this);
284 }
285 
286 
287 // * * * * * * * * * * * * * * * * References * * * * * * * * * * * * * * * * //
288 
289 template<unsigned Width>
291 (
292  PackedList<Width>* parent,
293  const label index
294 )
295 :
296  ref_(parent->blocks_[index / elem_per_block]),
297  shift_(Width * (index % elem_per_block))
298 {}
299 
300 
301 template<unsigned Width>
302 inline unsigned int Foam::PackedList<Width>::reference::get() const
303 {
304  return ((ref_ >> shift_) & max_value);
305 }
306 
307 
308 template<unsigned Width>
309 inline bool Foam::PackedList<Width>::reference::set(const unsigned int val)
310 {
311  const unsigned int mask = (max_value << shift_);
312  const unsigned int prev = ref_;
313 
314  if (val >= max_value)
315  {
316  ref_ |= mask; // Overflow is max_value, so fill entirely
317  }
318  else
319  {
320  ref_ &= ~mask;
321  ref_ |= mask & (val << shift_);
322  }
323 
324  return (prev != ref_);
325 }
326 
327 
328 template<unsigned Width>
330 (
331  const reference& other
332 )
333 {
334  // Accepts self-assignment
335  this->set(other.get());
336 }
337 
338 
339 template<unsigned Width>
341 (
342  const unsigned int val
343 )
344 {
345  this->set(val);
346 }
347 
348 
349 template<unsigned Width>
351 {
352  return this->get();
353 }
354 
355 
356 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
357 
358 template<unsigned Width>
359 inline void Foam::PackedList<Width>::checkIndex(const label i) const
360 {
361  if (!size_)
362  {
364  << "attempt to access element " << i << " from zero sized list"
365  << abort(FatalError);
366  }
367  else if (i < 0 || i >= size_)
368  {
370  << "index " << i << " out of range [0," << size_ << ")"
371  << abort(FatalError);
372  }
373 }
374 
375 
376 template<unsigned Width>
377 inline Foam::label Foam::PackedList<Width>::size() const noexcept
378 {
379  return size_;
380 }
381 
382 
383 template<unsigned Width>
384 inline bool Foam::PackedList<Width>::empty() const noexcept
385 {
386  return !size_;
387 }
388 
389 
390 template<unsigned Width>
391 inline Foam::label Foam::PackedList<Width>::capacity() const
392 {
393  return elem_per_block * blocks_.size();
394 }
395 
396 
397 template<unsigned Width>
399 (
400  const label newSize,
401  const unsigned int val
402 )
403 {
404  reserve(newSize);
405 
406  const label oldSize = size();
407  size_ = newSize;
408 
409  if (oldSize < size())
410  {
411  // Fill new elements or newly exposed elements
412  if (val)
413  {
414  // Fill value for complete blocks
415  const unsigned int blockval = repeated_value(val);
416 
417  // Fill complete blocks
418  const label oldLen = num_blocks(oldSize);
419  const label newLen = num_blocks(size());
420  for (label blocki = oldLen; blocki < newLen; ++blocki)
421  {
422  blocks_[blocki] = blockval;
423  }
424 
425  // Finish previous partial block, preserve existing value
426  {
427  const unsigned int blk = oldSize / elem_per_block;
428  const unsigned int off = oldSize % elem_per_block;
429  if (off)
430  {
431  const unsigned int mask = mask_lower(off);
432 
433  blocks_[blk] &= mask;
434  blocks_[blk] |= ~mask & blockval;
435  }
436  }
437 
439  }
440  }
441  else if (size() < oldSize)
442  {
443  // The list is now shorter than before, so we zero assign the unused
444  // blocks and any trailing junk. This costs slightly here, but make
445  // things much simpler elsewhere.
446 
447  // Clear complete blocks
448  const label oldLen = num_blocks(oldSize);
449  const label newLen = num_blocks(size());
450  for (label blocki = newLen; blocki < oldLen; ++blocki)
451  {
452  blocks_[blocki] = 0u;
453  }
454 
456  }
457 }
458 
459 
460 template<unsigned Width>
461 inline void Foam::PackedList<Width>::setCapacity(const label numElem)
462 {
463  const label nblocks = num_blocks(numElem);
464 
465  blocks_.resize(nblocks, 0u);
466 
467  if (numElem < size())
468  {
469  size_ = numElem;
471  }
472 }
473 
474 
475 template<unsigned Width>
476 inline void Foam::PackedList<Width>::reserve(const label numElem)
477 {
478  const label oldLen = blocks_.size();
479  const label newLen = num_blocks(numElem);
480 
481  // Allocate more capacity if necessary
482  if (oldLen < newLen)
483  {
485  (
486  // SizeMin=16, allocation doubling
487  max(16, max(newLen, 2*oldLen)),
488  0u
489  );
490  }
491 }
492 
493 
494 template<unsigned Width>
496 {
497  blocks_ = 0u;
498 }
499 
500 
501 template<unsigned Width>
503 {
504  reset();
505  size_ = 0;
506 }
507 
508 
509 template<unsigned Width>
511 {
512  blocks_.clear();
513  size_ = 0;
514 }
515 
516 
517 template<unsigned Width>
519 {
520  // Any unneeded space allocated?
521  const label nblocks = num_blocks(size());
522  if (nblocks < blocks_.size())
523  {
524  blocks_.resize(nblocks);
525  }
526 }
527 
528 
529 template<unsigned Width>
531 {
532  return blocks_;
533 }
534 
535 
536 template<unsigned Width>
538 {
539  return blocks_;
540 }
541 
542 
543 template<unsigned Width>
544 inline Foam::label Foam::PackedList<Width>::nBlocks() const
545 {
546  return num_blocks(size());
547 }
548 
549 
550 template<unsigned Width>
551 inline std::streamsize Foam::PackedList<Width>::byteSize() const
552 {
553  return num_blocks(size()) * sizeof(block_type);
554 }
555 
556 
557 template<unsigned Width>
559 {
560  if (this == &rhs)
561  {
562  return; // Self-swap is a no-op
563  }
564 
565  blocks_.swap(rhs.blocks_);
566  Foam::Swap(size_, rhs.size_);
567 }
568 
569 
570 template<unsigned Width>
572 {
573  if (this == &rhs)
574  {
575  return; // Self-assignment is a no-op
576  }
577 
578  blocks_.transfer(rhs.blocks_);
579  size_ = rhs.size_;
580  rhs.size_ = 0;
581 }
582 
583 
584 template<unsigned Width>
585 inline unsigned int Foam::PackedList<Width>::get(const label i) const
586 {
587  if (i < 0 || i >= size())
588  {
589  #ifdef FULLDEBUG
590  if (i < 0)
591  {
593  << "Ignoring attempt to get a negative index " << i
594  << " range is [0," << size_ << ")"
595  << endl;
596  }
597  #endif
598 
599  return 0u; // Out-of-bounds (lazy): return 0 (false)
600  }
601 
602  return reference(const_cast<PackedList<Width>*>(this), i).get();
603 }
604 
605 
606 template<unsigned Width>
608 (
609  const label i,
610  const unsigned int val
611 )
612 {
613  if (i < 0)
614  {
615  #ifdef FULLDEBUG
617  << "Ignoring attempt to set a negative index " << i
618  << " range is [0," << size_ << ")"
619  << endl;
620  #endif
621 
622  return false; // Out-of-bounds: ignore
623  }
624  else if (i >= size())
625  {
626  if (!val) // Unset out-of-bounds: ignore
627  {
628  return false;
629  }
630 
631  resize(i + 1); // Lazy evaluation: adjust size for assign
632  }
633 
634  return reference(this, i).set(val);
635 }
636 
637 
638 template<unsigned Width>
639 inline bool Foam::PackedList<Width>::unset(const label i)
640 {
641  if (i < 0 || i >= size())
642  {
643  return false; // Unset out-of-bounds: ignore
644  }
645 
646  return reference(this, i).set(0u);
647 }
648 
649 
650 template<unsigned Width>
652 Foam::PackedList<Width>::append(const unsigned int val)
653 {
654  const label idx = size();
655  reserve(idx + 1);
656  ++size_;
657 
658  reference(this, idx).set(val);
659  return *this;
660 }
661 
662 
663 template<unsigned Width>
664 inline unsigned int Foam::PackedList<Width>::remove()
665 {
666  // Location of last element and simultaneously the new size
667  const label idx = size()-1;
668 
669  if (idx < 0)
670  {
672  << "List is empty" << abort(FatalError);
673  }
674 
675  const unsigned int old = reference(this, idx).get();
676  resize(idx);
677 
678  return old;
679 }
680 
681 
682 template<unsigned Width>
683 inline void Foam::PackedList<Width>::fill(const unsigned int val)
684 {
685  if (empty())
686  {
687  return; // Trivial case
688  }
689 
690  const label nblocks = num_blocks(size());
691 
692  // Fill value for complete blocks
693  const unsigned int blockval = (val ? repeated_value(val) : 0u);
694 
695  for (label blocki=0; blocki < nblocks; ++blocki)
696  {
697  blocks_[blocki] = blockval;
698  }
699 
700  if (val)
701  {
703  }
704 }
705 
706 
707 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
708 
709 template<unsigned Width>
710 inline unsigned int Foam::PackedList<Width>::operator[](const label i) const
711 {
712  return get(i);
713 }
714 
715 
716 template<unsigned Width>
719 {
720  #ifdef FULLDEBUG
721  checkIndex(i);
722  #endif
723  return reference(this, i);
724 }
725 
726 
727 template<unsigned Width>
729 {
730  copyAssign(rhs);
731 }
732 
733 
734 template<unsigned Width>
736 {
737  transfer(rhs);
738 }
739 
740 
741 template<unsigned Width>
742 inline void Foam::PackedList<Width>::operator=(const unsigned int val)
743 {
744  fill(val);
745 }
746 
747 
748 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
749 
750 template<unsigned Width>
751 inline bool Foam::operator==
752 (
753  const PackedList<Width>& a,
754  const PackedList<Width>& b
755 )
756 {
757  return a.equal(b);
758 }
759 
760 
761 template<unsigned Width>
762 inline bool Foam::operator!=
763 (
764  const PackedList<Width>& a,
765  const PackedList<Width>& b
766 )
767 {
768  return !a.equal(b);
769 }
770 
771 
772 // ************************************************************************* //
Foam::PackedList::reset
void reset()
Clear all bits but do not adjust the addressable size.
Definition: PackedListI.H:495
Foam::PackedList::reference::set
bool set(unsigned int val)
Set value, returning true if changed, no range-checking.
Definition: PackedListI.H:309
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::PackedList::reference::ref_
block_type & ref_
Reference to the block.
Definition: PackedList.H:455
Foam::PackedList::reference
A reference supporting read/write access to an entry.
Definition: PackedList.H:447
Foam::HashTableOps::values
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:149
Foam::PackedList::clone
autoPtr< PackedList< Width > > clone() const
Clone.
Definition: PackedListI.H:281
Foam::PackedList::block_type
unsigned int block_type
The storage block type for bit elements.
Definition: PackedList.H:136
Foam::PackedList::reference::reference
reference(PackedList *parent, const label index)
Foam::PackedList::nBlocks
label nBlocks() const
The number of internal storage blocks.
Definition: PackedListI.H:544
Foam::PackedList::clear_trailing_bits
void clear_trailing_bits()
Clear any partial rubbish in the last addressable block.
Definition: PackedListI.H:83
Foam::FatalIOError
IOerror FatalIOError
Foam::PackedList::empty
bool empty() const noexcept
True if the list is empty (ie, size() is zero).
Definition: PackedListI.H:384
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::PackedList::PackedList
constexpr PackedList() noexcept
Default construct, zero-sized and no allocation.
Definition: PackedListI.H:177
Foam::Istream::readEnd
bool readEnd(const char *funcName)
End read of data chunk, ends with ')'.
Definition: Istream.C:127
Foam::Swap
void Swap(DynamicList< T, SizeMin1 > &a, DynamicList< T, SizeMin2 > &b)
Definition: DynamicListI.H:913
Foam::PackedList::checkIndex
void checkIndex(const label i) const
Check index is within valid range [0,size)
Definition: PackedListI.H:359
Foam::PackedList::resize
void resize(const label nElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
Definition: PackedListI.H:399
Foam::PackedList::swap
void swap(PackedList< Width > &rhs)
Swap contents with argument.
Definition: PackedListI.H:558
Foam::PackedList::get
unsigned int get(const label i) const
Get value at index i or 0 for out-of-range.
Definition: PackedListI.H:585
Foam::PackedList::reference::get
unsigned int get() const
Get value as unsigned, no range-checking.
Definition: PackedListI.H:302
Foam::Istream::readBegin
bool readBegin(const char *funcName)
Begin read of data chunk, starts with '('.
Definition: Istream.C:109
Foam::PackedList::mask_lower
static constexpr block_type mask_lower(unsigned elementOffset)
Masking for all bits below the element offset.
Definition: PackedList.H:170
Foam::PackedList::size_
label size_
Number of entries used.
Definition: PackedList.H:187
Foam::PackedList::blocks_
block_container blocks_
The blocks of raw data.
Definition: PackedList.H:184
Foam::PackedList::repeated_value
static unsigned int repeated_value(unsigned val)
A fill value for complete blocks.
Definition: PackedListI.H:34
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
error.H
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::readBool
bool readBool(Istream &is)
Read bool from stream using Foam::Switch(Istream&)
Definition: bool.C:71
Foam::PackedList::setCapacity
void setCapacity(const label nElem)
Alter the size of the underlying storage.
Definition: PackedListI.H:461
Foam::List::transfer
void transfer(List< T > &list)
Definition: List.C:459
Foam::PackedList::unset
bool unset(const label i)
Unset the entry at index i.
Definition: PackedListI.H:639
Foam::PackedList::remove
unsigned int remove()
Remove and return the last element.
Definition: PackedListI.H:664
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::PackedList::fill
void fill(const unsigned int val)
Assign all entries to the given value.
Definition: PackedListI.H:683
Foam::List::resize
void resize(const label newSize)
Adjust allocated size of list.
Definition: ListI.H:139
Foam::blockMeshTools::read
void read(Istream &, label &, const dictionary &)
In-place read with dictionary lookup.
Definition: blockMeshTools.C:33
Foam::PackedList::num_blocks
static constexpr label num_blocks(label numElem)
Definition: PackedList.H:163
Foam::PackedList::byteSize
std::streamsize byteSize() const
Definition: PackedListI.H:551
Foam::PackedList::operator[]
unsigned int operator[](const label i) const
Identical to get() - get value at index.
Definition: PackedListI.H:710
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:51
Foam::FatalError
error FatalError
Foam::PackedList::transfer
void transfer(PackedList< Width > &rhs)
Definition: PackedListI.H:571
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::PackedList::append
PackedList< Width > & append(const unsigned int val)
Append a value at the end of the list.
Definition: PackedListI.H:652
Foam::PackedList::equal
bool equal(const PackedList< Width > &other) const
Test for equality of sizes and the bits set.
Definition: PackedList.C:152
Foam::PackedList::setPair
void setPair(Istream &is)
Read an index/value pair and set accordingly.
Definition: PackedListI.H:58
Foam::PackedList::max_value
static constexpr block_type max_value
Definition: PackedList.H:152
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::PackedList::capacity
label capacity() const
The number of elements that can be stored with reallocating.
Definition: PackedListI.H:391
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
Foam::PackedList::elem_per_block
static constexpr unsigned elem_per_block
The number of elements stored per data block.
Definition: PackedList.H:147
Foam::readLabel
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
Definition: label.H:66
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
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:728
Foam::PackedList::size
label size() const noexcept
Number of entries.
Definition: PackedListI.H:377
Foam::UList< label >
Foam::PackedList::reserve
void reserve(const label nElem)
Reserve allocation space for at least this size.
Definition: PackedListI.H:476
Foam::List::clear
void clear()
Clear the list, i.e. set size to zero.
Definition: ListI.H:115
Foam::PackedList::trim
bool trim(label minpos=-1)
Definition: PackedListI.H:97
Foam::PackedList::storage
const List< unsigned int > & storage() const
Return the underlying storage blocks.
Definition: PackedListI.H:537
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:270
Foam::PackedList::clearStorage
void clearStorage()
Clear the list and delete storage.
Definition: PackedListI.H:510
Foam::PackedList::set
bool set(const label i, unsigned int val=~0u)
Set value at index i, default value set is the max_value.
Definition: PackedListI.H:608
Foam::PackedList::shrink
void shrink()
Shrink the allocated space to what is actually used.
Definition: PackedListI.H:518
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:401
Foam::IndirectListBase
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
Definition: IndirectListBase.H:56
Foam::PackedList::reference::shift_
unsigned shift_
The bit shift to access the given sub-portion.
Definition: PackedList.H:458
Foam::PackedList::copyAssign
void copyAssign(const PackedList< Width > &rhs)
Copy assignment.
Definition: PackedListI.H:142
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:303
Foam::PackedList::clear
void clear()
Clear the list, i.e. set addressable size to zero.
Definition: PackedListI.H:502
Foam::PackedList::readValue
static unsigned int readValue(Istream &is)
Read a list entry (allows for specialization)
Definition: PackedListI.H:41