PackedList.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::PackedList
26 
27 Description
28  A dynamically allocatable list of packed unsigned integers.
29 
30  The list resizing is similar to DynamicList, thus the methods clear()
31  and setSize() behave like their DynamicList counterparts and the methods
32  reserve() and setCapacity() can be used to influence the allocation.
33 
34  The number of bits per item is specified by the template parameter nBits.
35 
36  In a const context, the '[]' operator simply returns the stored value,
37  with out-of-range elements returned as zero.
38  In a non-const context, the '[]' operator returns an iteratorBase, which
39  might not have a valid reference for out-of-range elements.
40  The iteratorBase class handles the assignment of new values.
41 
42  Using the iteratorBase as a proxy allows assignment of values
43  between list elements. Thus the following bit of code works as expected:
44  \code
45  list[1] = list[5]; // value assignment, not iterator position
46  list[2] = list[5] = 4; // propagates value
47  list[1] = list[5] = list[6]; // propagates value
48  \endcode
49 
50  Using get() or the '[]' operator are similarly fast. Looping and reading
51  via an iterator is approx. 15% slower, but can be more flexible.
52 
53  Using the set() operator (and the '[]' operator) are marginally slower
54  (approx. 5%) than using an iterator, but the set() method has the
55  advantage of also returning a bool if the value changed. This can be
56  useful for branching on changed values.
57 
58  \code
59  list[5] = 4;
60  changed = list.set(5, 8);
61  if (changed) ...
62  \endcode
63 
64  The lazy evaluation used means that reading an out-of-range element
65  returns zero, but does not affect the list size. Even in a non-const
66  context, only the assignment itself causes the element to be created.
67  For example,
68  \code
69  list.resize(4);
70  Info<< list[10] << nl; // print zero, but doesn't adjust list
71  list[8] = 1;
72  \endcode
73 
74  Also note that all unused internal storage elements are guaranteed to
75  always be bit-wise zero. This property must not be violated by any
76  inheriting classes.
77 
78  In addition to the normal output format, PackedList also supports a
79  compact ASCII format that may be convenient for user input in some
80  situations. The general format is a group of index/value pairs:
81  \verbatim
82  { (index1 value1) (index2 value2) (index3 value3) }
83  \endverbatim
84  The bool specialisation just uses the indices corresponding to
85  non-zero entries instead of a index/value pair:
86  \verbatim
87  { index1 index2 index3 }
88  \endverbatim
89  In both cases, the supplied indices can be randomly ordered.
90 
91 See also
92  Foam::DynamicList
93 
94 SourceFiles
95  PackedListI.H
96  PackedList.C
97 
98 \*---------------------------------------------------------------------------*/
99 
100 #ifndef PackedList_H
101 #define PackedList_H
102 
103 #include "labelList.H"
104 #include "UIndirectList.H"
105 #include <type_traits>
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 namespace Foam
110 {
111 
112 // Forward declaration of classes
113 class Istream;
114 class Ostream;
115 
116 // Forward declaration of friend functions and operators
117 template<unsigned nBits> class PackedList;
118 
119 template<unsigned nBits>
120 void writeEntry(Ostream& os, const PackedList<nBits>&);
121 
122 template<unsigned nBits>
124 
125 template<unsigned nBits>
127 
128 
129 /*---------------------------------------------------------------------------*\
130  Class PackedListCore Declaration
131 \*---------------------------------------------------------------------------*/
132 
133 //- Template-invariant bits for PackedList
134 struct PackedListCore
135 {
136  //- Construct null
138  {}
139 
140  //- Define template name and debug
141  ClassName("PackedList");
142 };
143 
144 
145 /*---------------------------------------------------------------------------*\
146  Class PackedList Declaration
147 \*---------------------------------------------------------------------------*/
148 
149 template<unsigned nBits=1>
150 class PackedList
151 :
152  public PackedListCore,
153  private List<unsigned int>
154 {
155 protected:
156 
157  typedef unsigned int StorageType;
159 
160  // Protected Member Functions
161 
162  //- Calculate the list length when packed
163  inline static label packedLength(const label);
164 
165  //- Read a list entry (allows for specialisation)
166  inline static unsigned int readValue(Istream&);
167 
168  //- Read an index/value pair and set accordingly.
169  // For bool specialisation, read a single index value
170  inline void setPair(Istream&);
171 
172 
173 private:
174 
175  //- nBits must be positive (non-zero) and fit within the storage.
176  // For efficiency, however, require packing at least 2 items otherwise
177  // it is more efficient to use a normal list.
178  // Thus max nBits is 1/2 of the base storage size.
179  // For simplicity, assume 8-bit bytes in the assert.
180  static_assert
181  (
182  nBits && nBits <= (sizeof(StorageType) << 2),
183  "nBits must be positive (non-zero) and fit within the storage"
184  );
185 
186  // Private Data
187 
188  //- Number of nBits entries
189  label size_;
190 
191 
192 public:
193 
194  // Public data
195 
196  //- The max. number of bits that can be templated.
197  // Might someday be useful for a template assert.
198  inline static unsigned int max_bits();
199 
200  //- The max. value for an entry, which simultaneously the bit-mask
201  // eg, ((1 << 2) - 1) yields 0b0011
202  inline static unsigned int max_value();
203 
204  //- The number of entries per packed storage element
205  inline static unsigned int packing();
206 
207  //- Masking for all bits below the offset
208  inline static unsigned int maskLower(unsigned offset);
209 
210 
211  // Forward declaration of iterators
212 
213  class iteratorBase;
214  class iterator;
215  class const_iterator;
216 
217 
218  // Constructors
219 
220  //- Null constructor
221  inline PackedList();
222 
223  //- Construct with given size, initialises list to 0
224  explicit inline PackedList(const label size);
225 
226  //- Construct with given size and value for all elements
227  inline PackedList(const label size, const unsigned val);
228 
229  //- Construct from Istream
230  inline PackedList(Istream&);
231 
232  //- Copy constructor
233  inline PackedList(const PackedList<nBits>&);
234 
235  //- Move constructor
236  inline PackedList(PackedList<nBits>&&);
237 
238  //- Construct from a list of labels
239  explicit inline PackedList(const labelUList&);
240 
241  //- Construct from an indirect list of labels
242  explicit inline PackedList(const UIndirectList<label>&);
243 
244  //- Clone
245  inline autoPtr<PackedList<nBits>> clone() const;
246 
247 
248  // Member Functions
249 
250  // Access
251 
252  //- The number of elements that can be stored before reallocating
253  inline label capacity() const;
254 
255  //- Number of entries.
256  inline label size() const;
257 
258  //- Return true if the list is empty (ie, size() is zero).
259  inline bool empty() const;
260 
261  //- Get value at index I.
262  // Never auto-vivify entries.
263  inline unsigned int get(const label) const;
264 
265  //- Set value at index I. Return true if value changed.
266  // Does auto-vivify for non-existent entries.
267  // Default value set is the max_value.
268  inline bool set(const label, const unsigned int val = ~0u);
269 
270  //- Unset the entry at index I. Return true if value changed.
271  // Never auto-vivify entries.
272  inline bool unset(const label);
273 
274  //- Return the underlying packed storage
275  // Manipulate with utmost caution
276  inline List<unsigned int>& storage();
277 
278  //- Return the underlying packed storage
279  inline const List<unsigned int>& storage() const;
280 
281  //- The list length when packed
282  inline label packedLength() const;
283 
284  //- Return the binary size in number of characters
285  // used in the underlying storage
286  inline std::streamsize byteSize() const;
287 
288  //- Count number of bits set, O(log(n))
289  // Uses the Hamming weight (population count) method
290  // http://en.wikipedia.org/wiki/Hamming_weight
291  unsigned int count() const;
292 
293  //- Return the values as a list of labels
294  labelList values() const;
295 
296  //- Print bit patterns, optionally output unused elements
297  //
298  // addressable bits:
299  // on: '1', off: '-'
300  //
301  // non-addressable bits:
302  // on: '!', off: '.'
303  //
304  Ostream& printBits(Ostream&, const bool fullOutput=false) const;
305 
306  //- Print information and bit patterns (with printBits)
307  Ostream& printInfo(Ostream&, const bool fullOutput=false) const;
308 
309 
310  // Edit
311 
312  //- Trim any trailing zero elements
313  bool trim();
314 
315  //- Invert the bits in the addressable region
316  void flip();
317 
318  //- Clear all bits
319  inline void reset();
320 
321  //- Alter the size of the underlying storage.
322  // The addressed size will be truncated if needed to fit, but will
323  // remain otherwise untouched.
324  inline void setCapacity(const label);
325 
326  //- Reset addressable list size, does not shrink the allocated size.
327  // Optionally specify a value for new elements.
328  inline void resize(const label, const unsigned int& val = 0u);
329 
330  //- Alias for resize()
331  inline void setSize(const label, const unsigned int& val = 0u);
332 
333  //- Reserve allocation space for at least this size.
334  // Never shrinks the allocated size.
335  // The list size is adjusted as per DynamicList with
336  // SizeInc=0, SizeMult=2, SizeDiv=1
337  inline void reserve(const label);
338 
339  //- Clear the list, i.e. set addressable size to zero.
340  // Does not adjust the underlying storage
341  inline void clear();
342 
343  //- Clear the list and delete storage.
344  inline void clearStorage();
345 
346  //- Shrink the allocated space to what is actually used.
347  inline void shrink();
348 
349  //- Transfer the contents of the argument list into this list
350  // and annul the argument list.
351  inline void transfer(PackedList<nBits>&);
352 
353 
354  // IO
355 
356  //- Clear list and read from stream
357  Istream& read(Istream&);
358 
359  //- Write, optionally with indexedOutput
360  //
361  // The indexed output may be convenient in some situations.
362  // The general format is a group of index/value pairs:
363  // \verbatim
364  // { (index1 value1) (index2 value2) (index3 value3) }
365  // \endverbatim
366  // The bool specialisation just uses the indices corresponding to
367  // non-zero entries instead of a index/value pair:
368  // \verbatim
369  // { index1 index2 index3 }
370  // \endverbatim
371  //
372  // Note the indexed output is only supported for ASCII streams.
373  Ostream& write
374  (
375  Ostream&,
376  const bool indexedOutput=false
377  ) const;
378 
379 
380  // Member Operators
381 
382  //- Append a value at the end of the list
383  inline PackedList<nBits>& append(const unsigned int val);
384 
385  //- Remove and return the last element
386  inline unsigned int remove();
387 
388  //- Get value at index I
389  // Never auto-vivify entries.
390  inline unsigned int operator[](const label) const;
391 
392  //- Set value at index I.
393  // Returns iterator to perform the actual operation.
394  // Does not auto-vivify entries, but will when assigned to.
395  inline iteratorBase operator[](const label);
396 
397  //- Assignment of all entries to the given value. Takes linear time.
398  inline void operator=(const unsigned int val);
399 
400  //- Assignment operator
401  void operator=(const PackedList<nBits>&);
402 
403  //- Move assignment operator
405 
406  //- Assignment operator
407  void operator=(const labelUList&);
408 
409  //- Assignment operator
410  void operator=(const UIndirectList<label>&);
411 
412 
413  // Iterators and helpers
414 
415  //- The iterator base for PackedList
416  // Note: data and functions are protected, to allow reuse by iterator
417  // and prevent most external usage.
418  class iteratorBase
419  {
420  friend class PackedList;
421 
422  protected:
423 
424  // Protected Data
425 
426  //- Pointer to original list
427  // This also lets us use the default bitwise copy/assignment
428  PackedList* list_;
429 
430  //- Element index
431  label index_;
432 
433 
434  // Protected Member Functions
435 
436  //- Get value as unsigned, no range-checking
437  inline unsigned int get() const;
438 
439  //- Set value, returning true if changed, no range-checking
440  inline bool set(unsigned int);
441 
442 
443  // Protected Constructors
444 
445  //- Construct null
446  inline iteratorBase();
447 
448  //- Construct from base list and position index
449  inline iteratorBase(const PackedList*, const label);
450 
451 
452  public:
453 
454  // Constructors
455 
456  //- Default copy constructor
457  iteratorBase(const iteratorBase&) = default;
458 
459 
460  // Member Functions
461 
462  //- Return the element index corresponding to the iterator
463  inline label key() const;
464 
465  //- Write index/value for a non-zero entry
466  // The bool specialisation writes the index only
467  inline bool writeIfSet(Ostream&) const;
468 
469  // Member Operators
470 
471  //- Compare values (not positions)
472  inline bool operator==(const iteratorBase&) const;
473  inline bool operator!=(const iteratorBase&) const;
474 
475  //- Assign value, not position.
476  // This allows packed[0] = packed[3] for assigning values
477  inline void operator=(const iteratorBase&);
478 
479  //- Assign value.
480  // A non-existent entry will be auto-vivified.
481  inline void operator=(const unsigned int val);
482 
483  //- Conversion operator
484  // Never auto-vivify entries.
485  inline operator unsigned int () const;
486 
487  //- Print information and values
488  Ostream& printInfo(Ostream&) const;
489  };
490 
491 
492  //- The iterator class used for PackedList
493  class iterator
494  :
495  public iteratorBase
496  {
497 
498  //- Disallow default bitwise copy construction
499  // This would violate const-ness!
500  iterator(const const_iterator&);
501 
502  //- Disallow assignment from const_iterator
503  // This would violate const-ness!
504  void operator=(const const_iterator&);
505 
506 
507  public:
508 
509  // Constructors
510 
511  //- Construct null
512  inline iterator();
513 
514  //- Construct from iterator base, eg iter(packedlist[i])
515  // but also "iterator iter = packedlist[i];"
516  // An out-of-range iterator is assigned end()
517  inline iterator(const iteratorBase&);
518 
519  //- Construct from base list and position index
520  inline iterator(const PackedList*, const label);
521 
522 
523  // Member Operators
524 
525  //- Compare positions (not values)
526  inline bool operator==(const iteratorBase&) const;
527  inline bool operator!=(const iteratorBase&) const;
528 
529  //- Assign from iteratorBase, eg iter = packedlist[i]
530  // An out-of-range iterator is assigned end()
531  inline void operator=(const iteratorBase&);
532 
533  //- Return value
534  inline unsigned int operator*() const;
535 
536  //- Return value
537  inline unsigned int operator()() const;
538 
539  //- Return iteratorBase for assigning values
540  inline iteratorBase& operator*();
541 
542  //- Return iteratorBase for assigning values
543  inline iteratorBase& operator()();
544 
545  inline iterator& operator++();
546  inline iterator operator++(int);
547 
548  inline iterator& operator--();
549  inline iterator operator--(int);
550 
551  };
552 
553  //- Iterator set to the beginning of the PackedList
554  inline iterator begin();
555 
556  //- Iterator set to beyond the end of the PackedList
557  inline iterator end();
558 
559 
560  //- The const_iterator for PackedList
561  class const_iterator
562  :
563  public iteratorBase
564  {
565  public:
566 
567  // Constructors
568 
569  //- Construct null
570  inline const_iterator();
571 
572  //- Construct from iterator base, eg iter(packedlist[i])
573  // but also "const_iterator iter = packedlist[i];"
574  // An out-of-range iterator is assigned cend()
575  inline const_iterator(const iteratorBase&);
576 
577  //- Construct from base list and position index
578  inline const_iterator(const PackedList*, const label);
579 
580  //- Construct from iterator
581  inline const_iterator(const iterator&);
582 
583 
584  // Member Operators
585 
586  //- Compare positions (not values)
587  inline bool operator==(const iteratorBase&) const;
588  inline bool operator!=(const iteratorBase&) const;
589 
590  //- Assign from iteratorBase or derived
591  // eg, iter = packedlist[i] or even iter = list.begin()
592  inline void operator=(const iteratorBase&);
593 
594  //- Return referenced value directly
595  inline unsigned int operator*() const;
596 
597  //- Return referenced value directly
598  inline unsigned int operator()() const;
599 
600  inline const_iterator& operator++();
601  inline const_iterator operator++(int);
602 
603  inline const_iterator& operator--();
604  inline const_iterator operator--(int);
605  };
606 
607 
608  //- const_iterator set to the beginning of the PackedList
609  inline const_iterator cbegin() const;
610 
611  //- const_iterator set to beyond the end of the PackedList
612  inline const_iterator cend() const;
613 
614  //- const_iterator set to the beginning of the PackedList
615  inline const_iterator begin() const;
616 
617  //- const_iterator set to beyond the end of the PackedList
618  inline const_iterator end() const;
619 
620 
621  // IOstream Operators
622 
623  friend Istream& operator>> <nBits>
624  (
625  Istream&,
627  );
628 
629  friend Ostream& operator<< <nBits>
630  (
631  Ostream&,
632  const PackedList<nBits>&
633  );
634 };
635 
636 
637 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
638 
639 } // End namespace Foam
640 
641 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
642 
643 #include "PackedListI.H"
644 
645 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
646 
647 #ifdef NoRepository
648  #include "PackedList.C"
649 #endif
650 
651 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
652 
653 #endif
654 
655 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
The const_iterator for PackedList.
Definition: PackedList.H:563
void operator=(const iteratorBase &)
Assign from iteratorBase or derived.
Definition: PackedListI.H:536
bool operator==(const iteratorBase &) const
Compare positions (not values)
Definition: PackedListI.H:498
const_iterator & operator--()
Definition: PackedListI.H:601
unsigned int operator()() const
Return referenced value directly.
Definition: PackedListI.H:654
const_iterator & operator++()
Definition: PackedListI.H:563
bool operator!=(const iteratorBase &) const
Definition: PackedListI.H:508
unsigned int operator*() const
Return referenced value directly.
Definition: PackedListI.H:646
The iterator base for PackedList.
Definition: PackedList.H:418
void operator=(const iteratorBase &)
Assign value, not position.
Definition: PackedListI.H:357
bool operator==(const iteratorBase &) const
Compare values (not positions)
Definition: PackedListI.H:337
label key() const
Return the element index corresponding to the iterator.
Definition: PackedListI.H:329
Ostream & printInfo(Ostream &) const
Print information and values.
Definition: PackedList.C:149
bool operator!=(const iteratorBase &) const
Definition: PackedListI.H:347
bool set(unsigned int)
Set value, returning true if changed, no range-checking.
Definition: PackedListI.H:302
iteratorBase()
Construct null.
Definition: PackedListI.H:269
label index_
Element index.
Definition: PackedList.H:430
unsigned int get() const
Get value as unsigned, no range-checking.
Definition: PackedListI.H:290
bool writeIfSet(Ostream &) const
Write index/value for a non-zero entry.
Definition: PackedListI.H:146
PackedList * list_
Pointer to original list.
Definition: PackedList.H:427
The iterator class used for PackedList.
Definition: PackedList.H:495
bool operator==(const iteratorBase &) const
Compare positions (not values)
Definition: PackedListI.H:478
unsigned int operator()() const
Return value.
iterator()
Construct null.
Definition: PackedListI.H:397
bool operator!=(const iteratorBase &) const
Definition: PackedListI.H:488
unsigned int operator*() const
Return value.
A dynamically allocatable list of packed unsigned integers.
Definition: PackedList.H:153
static unsigned int max_value()
The max. value for an entry, which simultaneously the bit-mask.
Definition: PackedListI.H:38
autoPtr< PackedList< nBits > > clone() const
Clone.
Definition: PackedListI.H:260
void flip()
Invert the bits in the addressable region.
Definition: PackedList.C:104
void shrink()
Shrink the allocated space to what is actually used.
Definition: PackedListI.H:905
List< unsigned int > & storage()
Return the underlying packed storage.
Definition: PackedListI.H:916
bool set(const label, const unsigned int val=~0u)
Set value at index I. Return true if value changed.
Definition: PackedListI.H:985
static unsigned int maskLower(unsigned offset)
Masking for all bits below the offset.
Definition: PackedListI.H:52
Istream & read(Istream &)
Clear list and read from stream.
Definition: PackedList.C:254
void resize(const label, const unsigned int &val=0u)
Reset addressable list size, does not shrink the allocated size.
Definition: PackedListI.H:726
void setSize(const label, const unsigned int &val=0u)
Alias for resize()
Definition: PackedListI.H:820
void setCapacity(const label)
Alter the size of the underlying storage.
Definition: PackedListI.H:838
labelList values() const
Return the values as a list of labels.
Definition: PackedList.C:134
label size() const
Number of entries.
Definition: PackedListI.H:711
void transfer(PackedList< nBits > &)
Transfer the contents of the argument list into this list.
Definition: PackedListI.H:944
label capacity() const
The number of elements that can be stored before reallocating.
Definition: PackedListI.H:831
bool trim()
Trim any trailing zero elements.
Definition: PackedList.C:74
label packedLength() const
The list length when packed.
Definition: PackedListI.H:930
void setPair(Istream &)
Read an index/value pair and set accordingly.
Definition: PackedListI.H:120
iterator end()
Iterator set to beyond the end of the PackedList.
Definition: PackedListI.H:686
bool empty() const
Return true if the list is empty (ie, size() is zero).
Definition: PackedListI.H:718
static unsigned int packing()
The number of entries per packed storage element.
Definition: PackedListI.H:45
List< StorageType > StorageList
Definition: PackedList.H:157
const_iterator cend() const
const_iterator set to beyond the end of the PackedList
Definition: PackedListI.H:702
iterator begin()
Iterator set to the beginning of the PackedList.
Definition: PackedListI.H:662
void reserve(const label)
Reserve allocation space for at least this size.
Definition: PackedListI.H:860
unsigned int get(const label) const
Get value at index I.
Definition: PackedListI.H:954
void clearStorage()
Clear the list and delete storage.
Definition: PackedListI.H:897
PackedList()
Null constructor.
Definition: PackedListI.H:168
static unsigned int max_bits()
The max. number of bits that can be templated.
Definition: PackedListI.H:31
const_iterator cbegin() const
const_iterator set to the beginning of the PackedList
Definition: PackedListI.H:678
bool unset(const label)
Unset the entry at index I. Return true if value changed.
Definition: PackedListI.H:1006
void operator=(const unsigned int val)
Assignment of all entries to the given value. Takes linear time.
Definition: PackedListI.H:1059
std::streamsize byteSize() const
Return the binary size in number of characters.
Definition: PackedListI.H:937
static unsigned int readValue(Istream &)
Read a list entry (allows for specialisation)
Definition: PackedListI.H:103
PackedList< nBits > & append(const unsigned int val)
Append a value at the end of the list.
Definition: PackedListI.H:1022
void clear()
Clear the list, i.e. set addressable size to zero.
Definition: PackedListI.H:889
unsigned int operator[](const label) const
Get value at index I.
Definition: PackedListI.H:969
unsigned int count() const
Count number of bits set, O(log(n))
Definition: PackedList.C:55
void reset()
Clear all bits.
Definition: PackedListI.H:882
Ostream & printInfo(Ostream &, const bool fullOutput=false) const
Print information and bit patterns (with printBits)
Definition: PackedList.C:235
Ostream & printBits(Ostream &, const bool fullOutput=false) const
Print bit patterns, optionally output unused elements.
Definition: PackedList.C:166
unsigned int remove()
Remove and return the last element.
Definition: PackedListI.H:1034
Ostream & write(Ostream &, const bool indexedOutput=false) const
Write, optionally with indexedOutput.
Definition: PackedList.C:399
unsigned int StorageType
Definition: PackedList.H:156
A List with indirect addressing.
Definition: UIndirectList.H:60
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Namespace for OpenFOAM.
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:59
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
Istream & operator>>(Istream &, pistonPointEdgeData &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
void offset(label &lst, const label o)
Template-invariant bits for PackedList.
Definition: PackedList.H:134
PackedListCore()
Construct null.
Definition: PackedList.H:136
ClassName("PackedList")
Define template name and debug.