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-2019 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>
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 // * * * * * * * * * * * * * * * Specializations * * * * * * * * * * * * * * //
142 
143 namespace Foam
144 {
145  template<> inline unsigned int PackedList<1>::repeated_value(unsigned val)
146  {
147  return (val ? ~0u : 0u);
148  }
149 
150  template<> inline unsigned int PackedList<1>::readValue(Istream& is)
151  {
152  return readBool(is);
153  }
154 
155  template<> inline void PackedList<1>::setPair(Istream& is)
156  {
157  set(readLabel(is), true);
158  }
159 
160 } // End namespace Foam
161 
162 
163 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
164 
165 template<unsigned Width>
166 inline constexpr Foam::PackedList<Width>::PackedList() noexcept
167 :
168  blocks_(),
169  size_(0)
170 {}
171 
172 
173 template<unsigned Width>
175 :
176  blocks_(num_blocks(numElem), 0u),
177  size_(numElem)
178 {}
179 
180 
181 template<unsigned Width>
183 (
184  const label numElem,
185  const unsigned int val
186 )
187 :
188  blocks_(num_blocks(numElem), 0u),
189  size_(numElem)
190 {
191  if (val)
192  {
193  operator=(val);
194  }
195 }
196 
197 
198 template<unsigned Width>
200 :
201  blocks_(),
202  size_(0)
203 {
204  read(is);
205 }
206 
207 
208 template<unsigned Width>
210 :
211  blocks_(list.blocks_),
212  size_(list.size_)
213 {}
214 
215 
216 template<unsigned Width>
218 :
219  blocks_(std::move(list.blocks_)),
220  size_(list.size_)
221 {
222  list.size_ = 0;
223 }
224 
225 
226 template<unsigned Width>
228 :
229  blocks_(num_blocks(values.size()), 0u),
230  size_(values.size())
231 {
232  const label len = values.size();
233 
234  // Could add more intelligent filling (blockwise),
235  // but likely done fairly infrequently
236 
237  for (label i = 0; i < len; ++i)
238  {
239  const unsigned int val(values[i]);
240  if (val) set(i, val);
241  }
242 }
243 
244 
245 template<unsigned Width>
246 template<class Addr>
248 (
250 )
251 :
252  blocks_(num_blocks(values.size()), 0u),
253  size_(values.size())
254 {
255  const label len = values.size();
256 
257  // Could add more intelligent filling (blockwise),
258  // but likely done fairly infrequently
259 
260  for (label i = 0; i < len; ++i)
261  {
262  const unsigned int val(values[i]);
263  if (val) set(i, val);
264  }
265 }
266 
267 
268 template<unsigned Width>
271 {
272  return autoPtr<PackedList<Width>>::New(*this);
273 }
274 
275 
276 // * * * * * * * * * * * * * * * * References * * * * * * * * * * * * * * * * //
277 
278 template<unsigned Width>
280 (
281  PackedList<Width>* parent,
282  const label index
283 )
284 :
285  ref_(parent->blocks_[index / elem_per_block]),
286  shift_(Width * (index % elem_per_block))
287 {}
288 
289 
290 template<unsigned Width>
291 inline unsigned int Foam::PackedList<Width>::reference::get() const
292 {
293  return ((ref_ >> shift_) & max_value);
294 }
295 
296 
297 template<unsigned Width>
298 inline bool Foam::PackedList<Width>::reference::set(const unsigned int val)
299 {
300  const unsigned int mask = (max_value << shift_);
301  const unsigned int prev = ref_;
302 
303  if (val >= max_value)
304  {
305  ref_ |= mask; // Overflow is max_value, so fill entirely
306  }
307  else
308  {
309  ref_ &= ~mask;
310  ref_ |= mask & (val << shift_);
311  }
312 
313  return (prev != ref_);
314 }
315 
316 
317 template<unsigned Width>
319 (
320  const reference& other
321 )
322 {
323  // Accepts self-assignment
324  this->set(other.get());
325 }
326 
327 
328 template<unsigned Width>
330 (
331  const unsigned int val
332 )
333 {
334  this->set(val);
335 }
336 
337 
338 template<unsigned Width>
340 {
341  return this->get();
342 }
343 
344 
345 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
346 
347 template<unsigned Width>
348 inline void Foam::PackedList<Width>::checkIndex(const label i) const
349 {
350  if (!size_)
351  {
353  << "attempt to access element " << i << " from zero sized list"
354  << abort(FatalError);
355  }
356  else if (i < 0 || i >= size_)
357  {
359  << "index " << i << " out of range [0," << size_ << ")"
360  << abort(FatalError);
361  }
362 }
363 
364 
365 template<unsigned Width>
367 {
368  return size_;
369 }
370 
371 
372 template<unsigned Width>
373 inline bool Foam::PackedList<Width>::empty() const noexcept
374 {
375  return !size_;
376 }
377 
378 
379 template<unsigned Width>
381 {
382  return elem_per_block * blocks_.size();
383 }
384 
385 
386 template<unsigned Width>
388 (
389  const label newSize,
390  const unsigned int val
391 )
392 {
393  reserve(newSize);
394 
395  const label oldSize = size();
396  size_ = newSize;
397 
398  if (oldSize < size())
399  {
400  // Fill new elements or newly exposed elements
401  if (val)
402  {
403  // Fill value for complete blocks
404  const unsigned int blockval = repeated_value(val);
405 
406  // Fill complete blocks
407  const label oldLen = num_blocks(oldSize);
408  const label newLen = num_blocks(size());
409  for (label blocki = oldLen; blocki < newLen; ++blocki)
410  {
411  blocks_[blocki] = blockval;
412  }
413 
414  // Finish previous partial block, preserve existing value
415  {
416  const unsigned int blk = oldSize / elem_per_block;
417  const unsigned int off = oldSize % elem_per_block;
418  if (off)
419  {
420  const unsigned int mask = mask_lower(off);
421 
422  blocks_[blk] &= mask;
423  blocks_[blk] |= ~mask & blockval;
424  }
425  }
426 
428  }
429  }
430  else if (size() < oldSize)
431  {
432  // The list is now shorter than before, so we zero assign the unused
433  // blocks and any trailing junk. This costs slightly here, but make
434  // things much simpler elsewhere.
435 
436  // Clear complete blocks
437  const label oldLen = num_blocks(oldSize);
438  const label newLen = num_blocks(size());
439  for (label blocki = newLen; blocki < oldLen; ++blocki)
440  {
441  blocks_[blocki] = 0u;
442  }
443 
445  }
446 }
447 
448 
449 template<unsigned Width>
451 (
452  const label newSize,
453  const unsigned int val
454 )
455 {
456  resize(newSize, val);
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>
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>
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>
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>::assign(const unsigned int val)
684 {
685  const label nblocks = num_blocks(size());
686 
687  // Trivial cases first
688  if (!nblocks)
689  {
690  return;
691  }
692  else if (!val)
693  {
694  for (label blocki=0; blocki < nblocks; ++blocki)
695  {
696  blocks_[blocki] = 0u;
697  }
698  return;
699  }
700 
701  // Fill value for complete blocks
702  const unsigned int blockval = repeated_value(val);
703 
704  for (label blocki=0; blocki < nblocks; ++blocki)
705  {
706  blocks_[blocki] = blockval;
707  }
708 
710 }
711 
712 
713 template<unsigned Width>
715 {
716  blocks_ = list.blocks_;
717  size_ = list.size_;
718 }
719 
720 
721 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
722 
723 template<unsigned Width>
724 inline unsigned int Foam::PackedList<Width>::operator[](const label i) const
725 {
726  return get(i);
727 }
728 
729 
730 template<unsigned Width>
733 {
734  #ifdef FULLDEBUG
735  checkIndex(i);
736  #endif
737  return reference(this, i);
738 }
739 
740 
741 template<unsigned Width>
742 inline void Foam::PackedList<Width>::operator=(const unsigned int val)
743 {
744  assign(val);
745 }
746 
747 
748 template<unsigned Width>
750 {
751  assign(rhs);
752 }
753 
754 
755 template<unsigned Width>
757 {
758  transfer(rhs);
759 }
760 
761 
762 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
763 
764 template<unsigned Width>
765 inline bool Foam::operator==
766 (
767  const PackedList<Width>& a,
768  const PackedList<Width>& b
769 )
770 {
771  return a.equal(b);
772 }
773 
774 
775 template<unsigned Width>
776 inline bool Foam::operator!=
777 (
778  const PackedList<Width>& a,
779  const PackedList<Width>& b
780 )
781 {
782  return !a.equal(b);
783 }
784 
785 
786 // ************************************************************************* //
Foam::PackedList::reset
void reset()
Clear all bits but do not adjust the addressable size.
Definition: PackedListI.H:495
Foam::val
label ListType::const_reference val
Definition: ListOps.H:407
Foam::PackedList::reference::set
bool set(unsigned int val)
Set value, returning true if changed, no range-checking.
Definition: PackedListI.H:298
Foam::PackedList::reference::ref_
block_type & ref_
Reference to the block.
Definition: PackedList.H:457
Foam::PackedList::reference
A reference supporting read/write access to an entry.
Definition: PackedList.H:450
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:270
Foam::PackedList::block_type
unsigned int block_type
The storage block type for bit elements.
Definition: PackedList.H:138
Foam::PackedList::reference::reference
reference(PackedList *parent, const label index)
Definition: PackedListI.H:280
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:373
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::PackedList::PackedList
constexpr PackedList() noexcept
Null constructor.
Definition: PackedListI.H:166
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:909
Foam::PackedList::checkIndex
void checkIndex(const label i) const
Check index is within valid range [0,size)
Definition: PackedListI.H:348
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:388
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:291
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:171
Foam::PackedList::size_
label size_
Number of entries used.
Definition: PackedList.H:188
Foam::PackedList::blocks_
block_container blocks_
The blocks of raw data.
Definition: PackedList.H:185
Foam::PackedList::repeated_value
static unsigned int repeated_value(unsigned val)
A fill value for complete blocks.
Definition: PackedListI.H:34
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
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)
Definition: bool.C:70
Foam::PackedList::setCapacity
void setCapacity(const label nElem)
Alter the size of the underlying storage.
Definition: PackedListI.H:461
Foam::PackedList::operator=
void operator=(const unsigned int val)
Assignment of all entries to the given value. Takes linear time.
Definition: PackedListI.H:742
Foam::List::transfer
void transfer(List< T > &list)
Definition: List.C:436
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::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:164
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:724
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)
Transfer the contents of the argument list into this list.
Definition: PackedListI.H:571
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:137
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::assign
void assign(const unsigned int val)
Assign all entries to the given value. Takes linear time.
Definition: PackedListI.H:683
Foam::PackedList::max_value
static constexpr block_type max_value
Definition: PackedList.H:153
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:380
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
Foam::PackedList::setSize
void setSize(const label nElem, const unsigned int val=0u)
Alias for resize()
Definition: PackedListI.H:451
Foam::PackedList::elem_per_block
static constexpr unsigned elem_per_block
The number of elements stored per data block.
Definition: PackedList.H:148
Foam::readLabel
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
Definition: label.H:70
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:102
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::size
label size() const noexcept
Number of entries.
Definition: PackedListI.H:366
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:261
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:375
Foam::IndirectListBase
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
Definition: IndirectListBase.H:57
Foam::PackedList::reference::shift_
unsigned shift_
The bit shift to access the given sub-portion.
Definition: PackedList.H:460
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:294
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