UList.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 Class
28  Foam::UList
29 
30 Description
31  A 1D vector of objects of type <T>, where the size of the vector is
32  known and can be used for subscript bounds checking, etc.
33 
34  Storage is not allocated during construction or use but is supplied to
35  the constructor as an argument. This type of list is particularly useful
36  for lists that refer to parts of existing lists such as SubList.
37 
38 SourceFiles
39  UList.C
40  UListI.H
41  UListIO.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef UList_H
46 #define UList_H
47 
48 #include "bool.H"
49 #include "label.H"
50 #include "uLabel.H"
51 #include "zero.H"
52 #include "one.H"
53 #include "contiguous.H"
54 #include "nullObject.H"
55 #include "stdFoam.H"
56 #include "Swap.H"
57 #include "HashFwd.H"
58 #include "ListPolicy.H"
59 
60 #include <initializer_list>
61 #include <iterator>
62 #include <type_traits>
63 #include <vector>
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 
70 // Forward Declarations
71 class labelRange;
72 template<class T> class List;
73 template<class T> class SubList;
74 template<class T> class UList;
75 template<class T> Istream& operator>>(Istream&, UList<T>&);
76 template<class T> Ostream& operator<<(Ostream&, const UList<T>&);
77 
78 // Common list types
81 typedef UList<label> labelUList;
82 
83 
84 /*---------------------------------------------------------------------------*\
85  Class UList Declaration
86 \*---------------------------------------------------------------------------*/
87 
88 template<class T>
89 class UList
90 {
91  // Private Data
92 
93  //- Number of elements in UList
94  label size_;
95 
96  //- Vector of values of type T
97  T* __restrict__ v_;
98 
99 
100 protected:
101 
102  // Protected Member Functions
103 
104  //- Override size to be inconsistent with allocated storage.
105  // Use with care
106  inline void size(const label n) noexcept;
107 
108  //- Write the UList with its compound type
109  void writeEntry(Ostream& os) const;
110 
111  //- Return a validated (start,size) subset range, which means that it
112  //- always addresses a valid section of the list.
114 
115 
116  //- No copy assignment (default: shallow copy)
117  //
118  // Assignment may need to be shallow (copy pointer)
119  // or deep (copy elements) depending on context or type of list.
120  // Disallow default assignment and provide separate 'shallowCopy' and
121  // 'deepCopy' member functions.
122  UList<T>& operator=(const UList<T>&) = delete;
123 
124 public:
125 
126  // STL type definitions
127 
128  //- The value type the list contains
129  typedef T value_type;
130 
131  //- The pointer type for non-const access to value_type items
132  typedef T* pointer;
133 
134  //- The pointer type for const access to value_type items
135  typedef const T* const_pointer;
136 
137  //- The type used for storing into value_type objects
138  typedef T& reference;
139 
140  //- The type used for reading from constant value_type objects.
141  typedef const T& const_reference;
142 
143  //- Random access iterator for traversing a UList
144  typedef T* iterator;
145 
146  //- Random access iterator for traversing a UList
147  typedef const T* const_iterator;
148 
149  //- The type to represent the size of a UList
150  typedef label size_type;
151 
152  //- The difference between iterator objects
153  typedef label difference_type;
154 
155  //- Reverse iterator (non-const access)
156  typedef std::reverse_iterator<iterator> reverse_iterator;
157 
158  //- Reverse iterator (const access)
159  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
160 
161 
162  // Related types
163 
164  //- Declare friendship with the List class
165  friend class List<T>;
166 
167  //- Declare friendship with the SubList class
168  friend class SubList<T>;
169 
170 
171  // Static Functions
172 
173  //- Return a UList reference to a nullObject
174  inline static const UList<T>& null();
175 
176 
177  // Public Classes
178 
179  //- A list compare binary predicate for normal sort
180  struct less
181  {
182  const UList<T>& values;
183 
184  less(const UList<T>& list)
185  :
186  values(list)
187  {}
188 
189  bool operator()(const label a, const label b) const
190  {
191  return values[a] < values[b];
192  }
193  };
194 
195  //- A list compare binary predicate for reverse sort
196  struct greater
197  {
198  const UList<T>& values;
199 
200  greater(const UList<T>& list)
201  :
202  values(list)
203  {}
204 
205  bool operator()(const label a, const label b) const
206  {
207  return values[b] < values[a];
208  }
209  };
210 
211 
212  // Generated Methods
213 
214  //- Copy construct
215  UList(const UList<T>&) = default;
216 
217 
218  // Constructors
219 
220  //- Default construct, zero-sized and nullptr
221  inline constexpr UList() noexcept;
222 
223  //- Construct from components
224  inline UList(T* __restrict__ v, label size) noexcept;
225 
226 
227  // Member Functions
228 
229  // Access
230 
231  //- Return the forward circular index, i.e. next index
232  //- which returns to the first at the end of the list
233  inline label fcIndex(const label i) const;
234 
235  //- Return forward circular value (ie, next value in the list)
236  inline const T& fcValue(const label i) const;
237 
238  //- Return forward circular value (ie, next value in the list)
239  inline T& fcValue(const label i);
240 
241  //- Return the reverse circular index, i.e. previous index
242  //- which returns to the last at the beginning of the list
243  inline label rcIndex(const label i) const;
244 
245  //- Return reverse circular value (ie, previous value in the list)
246  inline const T& rcValue(const label i) const;
247 
248  //- Return reverse circular value (ie, previous value in the list)
249  inline T& rcValue(const label i);
250 
251  //- Return the binary size in number of characters of the UList
252  //- if the element is a primitive type
253  // i.e. is_contiguous<T>::value == true.
254  // Note that is of type streamsize since used in stream ops
255  std::streamsize byteSize() const;
256 
257 
258  //- Return a const pointer to the first data element.
259  // Similar to the STL front() method and the string::data() method
260  // This can be used (with caution) when interfacing with C code
261  inline const T* cdata() const;
262 
263  //- Return a pointer to the first data element.
264  // Similar to the STL front() method and the string::data() method
265  // This can be used (with caution) when interfacing with C code
266  inline T* data();
267 
268  //- Return the first element of the list
269  inline T& first();
270 
271  //- Return first element of the list
272  inline const T& first() const;
273 
274  //- Return the last element of the list
275  inline T& last();
276 
277  //- Return the last element of the list
278  inline const T& last() const;
279 
280 
281  // Check
282 
283  //- Check start is within valid range [0,size)
284  inline void checkStart(const label start) const;
285 
286  //- Check size is within valid range [0,size]
287  inline void checkSize(const label size) const;
288 
289  //- Check index is within valid range [0,size)
290  inline void checkIndex(const label i) const;
291 
292  //- True if all entries have identical values, and list is non-empty
293  inline bool uniform() const;
294 
295 
296  // Search
297 
298  //- Find index of the first occurrence of the value.
299  // Any occurrences before the start pos are ignored.
300  // Linear search.
301  // \return position in list or -1 if not found.
302  label find(const T& val, label pos = 0) const;
303 
304  //- Find index of the last occurrence of the value.
305  // Any occurrences after the end pos are ignored.
306  // Linear search.
307  // \return position in list or -1 if not found.
308  label rfind(const T& val, label pos = -1) const;
309 
310  //- True if the value if found in the list.
311  // Any occurrences before the start pos are ignored.
312  // Linear search.
313  // \return true if found.
314  inline bool found(const T& val, label pos = 0) const;
315 
316 
317  // Edit
318 
319  //- Move element to the first position.
320  void moveFirst(const label i);
321 
322  //- Move element to the last position.
323  void moveLast(const label i);
324 
325  //- Swap element with the first element. Fatal on an empty list.
326  void swapFirst(const label i);
327 
328  //- Swap element with the last element. Fatal on an empty list.
329  void swapLast(const label i);
330 
331 
332  // Copy
333 
334  //- Copy the pointer held by the given UList
335  inline void shallowCopy(const UList<T>& list);
336 
337  //- Copy elements of the given UList
338  void deepCopy(const UList<T>& list);
339 
340 
341  // Member Operators
342 
343  //- Return element of UList
344  inline T& operator[](const label i);
345 
346  //- Return element of constant UList
347  // Note that the bool specialization adds lazy evaluation so reading
348  // an out-of-range element returns false without any ill-effects
349  inline const T& operator[](const label i) const;
350 
351  //- Return (start,size) subset from UList with non-const access.
352  // The range is subsetted with the list size itself to ensure that the
353  // result always addresses a valid section of the list.
354  UList<T> operator[](const labelRange& range);
355 
356  //- Return (start,size) subset from UList with const access.
357  // The range is subsetted with the list size itself to ensure that the
358  // result always addresses a valid section of the list.
359  const UList<T> operator[](const labelRange& range) const;
360 
361  //- Allow cast to a const List<T>&
362  inline operator const Foam::List<T>&() const;
363 
364  //- Assignment of all entries to the given value
365  void operator=(const T& val);
366 
367  //- Assignment of all entries to zero
368  void operator=(const Foam::zero);
369 
370 
371  // Random access iterator (non-const)
372 
373  //- Return an iterator to begin traversing the UList
374  inline iterator begin();
375 
376  //- Return an iterator to end traversing the UList
377  inline iterator end();
378 
379 
380  // Random access iterator (const)
381 
382  //- Return const_iterator to begin traversing the constant UList
383  inline const_iterator cbegin() const;
384 
385  //- Return const_iterator to end traversing the constant UList
386  inline const_iterator cend() const;
387 
388  //- Return const_iterator to begin traversing the constant UList
389  inline const_iterator begin() const;
390 
391  //- Return const_iterator to end traversing the constant UList
392  inline const_iterator end() const;
393 
394 
395  // Reverse iterators (non-const)
396 
397  //- Return reverse_iterator to begin reverse traversing the UList
398  inline reverse_iterator rbegin();
399 
400  //- Return reverse_iterator to end reverse traversing the UList
401  inline reverse_iterator rend();
402 
403 
404  // Reverse iterators (const)
405 
406  //- Return const_reverse_iterator to begin reverse traversing the UList
407  inline const_reverse_iterator crbegin() const;
408 
409  //- Return const_reverse_iterator to end reverse traversing the UList
410  inline const_reverse_iterator crend() const;
411 
412  //- Return const_reverse_iterator to begin reverse traversing the UList
413  inline const_reverse_iterator rbegin() const;
414 
415  //- Return const_reverse_iterator to end reverse traversing the UList
416  inline const_reverse_iterator rend() const;
417 
418 
419  // STL member functions
420 
421  //- The number of elements in the UList
422  inline label size() const noexcept;
423 
424  //- True if the UList is empty (ie, size() is zero)
425  inline bool empty() const noexcept;
426 
427  //- The size of the largest possible UList
428  static constexpr label max_size() noexcept { return labelMax; }
429 
430  //- Swap content with another UList of the same type in constant time
431  inline void swap(UList<T>& list);
432 
433 
434  // STL member operators
435 
436  //- Equality operation on ULists of the same type.
437  // Returns true when the ULists are element-wise equal
438  // (using UList::value_type::operator==). Takes linear time
439  bool operator==(const UList<T>& a) const;
440 
441  //- The opposite of the equality operation. Takes linear time
442  bool operator!=(const UList<T>& a) const;
443 
444  //- Compare two ULists lexicographically. Takes linear time
445  bool operator<(const UList<T>& list) const;
446 
447  //- Compare two ULists lexicographically. Takes linear time
448  bool operator>(const UList<T>& a) const;
449 
450  //- Return true if !(a > b). Takes linear time
451  bool operator<=(const UList<T>& a) const;
452 
453  //- Return true if !(a < b). Takes linear time
454  bool operator>=(const UList<T>& a) const;
455 
456 
457  // Writing
458 
459  //- Write the List as a dictionary entry with keyword
460  void writeEntry(const word& keyword, Ostream& os) const;
461 
462  //- Write List, with line-breaks in ASCII when length exceeds shortLen.
463  // Using '0' suppresses line-breaks entirely.
464  Ostream& writeList(Ostream& os, const label shortLen=0) const;
465 
466 
467  // IOstream Operators
468 
469  //- Read List contents from Istream.
470  // Requires size to have been set before
471  friend Istream& operator>> <T>
472  (
473  Istream& os,
474  UList<T>& list
475  );
476 
477 
478  // Special Methods
479 
480  //- A bitSet::test() method for a list of bool
481  //
482  // \return The element value, or false for out-of-range access
483  template<class TypeT = T>
484  typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
485  inline test(const label i) const
486  {
487  return (i >= 0 && i < size() && v_[i]);
488  }
489 
490  //- A bitSet::get() method for a list of bool
491  //
492  // \return The element value, or false for out-of-range access
493  template<class TypeT = T>
494  typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
495  inline get(const label i) const
496  {
497  return (i >= 0 && i < size_ && v_[i]);
498  }
499 
500  //- A bitSet::unset() method for a list of bool
501  //
502  // \return True if value changed and was not out-of-range
503  template<class TypeT = T>
504  typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
505  inline unset(const label i)
506  {
507  if (i >= 0 && i < size_ && v_[i])
508  {
509  v_[i] = false;
510  return true;
511  }
512  return false;
513  }
514 
515 
516  // Other
517 
518  //- Hashing function class for UList.
519  // Can use this one (instead of the global Hash<>) for inheritance
520  // in sub-classes
521  template<class HashT=Foam::Hash<T>>
522  struct Hash
523  {
524  inline unsigned operator()
525  (
526  const UList<T>& obj,
527  unsigned seed=0
528  ) const
529  {
531  {
532  return Hasher(obj.cdata(), obj.size()*sizeof(T), seed);
533  }
534 
535  for (const T& val : obj)
536  {
537  seed = HashT()(val, seed);
538  }
539  return seed;
540  }
541  };
542 };
543 
544 
545 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
546 
547 //- Write List to Ostream, as per UList::writeList() with default length.
548 // The default short-length is given by Detail::ListPolicy::short_length
549 template<class T>
550 Ostream& operator<<(Ostream& os, const UList<T>& list)
551 {
553 }
554 
555 //- Write std::vector to Ostream
556 template<class T>
557 Ostream& operator<<(Ostream& os, const std::vector<T>& list);
558 
559 
560 // * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //
561 
562 template<class T>
563 void sort(UList<T>& a);
564 
565 template<class T, class Compare>
566 void sort(UList<T>& a, const Compare& comp);
567 
568 template<class T>
569 void stableSort(UList<T>& a);
570 
571 template<class T, class Compare>
572 void stableSort(UList<T>& a, const Compare& comp);
573 
574 template<class T>
575 void shuffle(UList<T>& a);
576 
577 // Reverse the first n elements of the list
578 template<class T>
579 inline void reverse(UList<T>& list, const label n);
580 
581 // Reverse all the elements of the list
582 template<class T>
583 inline void reverse(UList<T>& list);
584 
585 // Exchange contents of lists - see UList::swap().
586 template<class T>
587 inline void Swap(UList<T>& a, UList<T>& b);
588 
589 
590 //- Hashing for UList data, which uses Hasher for contiguous data and
591 //- element-wise incrementally hashing otherwise.
592 template<class T>
593 struct Hash<UList<T>>
594 {
595  inline unsigned operator()(const UList<T>& obj, unsigned seed=0) const
596  {
598  {
599  return Hasher(obj.cdata(), obj.size()*sizeof(T), seed);
600  }
601  for (const T& val : obj)
602  {
603  seed = Hash<T>()(val, seed);
604  }
605  return seed;
606  }
607 };
608 
609 
610 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
611 
612 //- Object access operator or list access operator.
613 //- \sa ListListOps::combine()
614 template<class T>
615 struct accessOp
616 {
617  const T& operator()(const T& obj) const
618  {
619  return obj;
620  }
621 };
622 
623 
624 //- Test if object is empty, typically using its empty() method.
625 template<class T>
626 struct emptyOp
627 {
628  inline bool operator()(const T& obj) const
629  {
630  return obj.empty();
631  }
632 };
633 
634 
635 //- Extract size (as label) from an object, typically using its size() method.
636 template<class T>
637 struct sizeOp
638 {
639  inline label operator()(const T& obj) const
640  {
641  return obj.size();
642  }
643 };
644 
645 
646 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
647 
648 } // End namespace Foam
649 
650 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
651 
652 #include "UListI.H"
653 
654 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
655 
656 #ifdef NoRepository
657  #include "UList.C"
658  #include "stdVectorIO.C"
659 #endif
660 
661 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
662 
663 #endif
664 
665 // ************************************************************************* //
Foam::UList::writeList
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
Definition: UListIO.C:79
Foam::UList::cbegin
const_iterator cbegin() const
Return const_iterator to begin traversing the constant UList.
Definition: UListI.H:290
Foam::UList::test
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type test(const label i) const
A bitSet::test() method for a list of bool.
Definition: UList.H:484
Foam::reverse
void reverse(UList< T > &list, const label n)
Definition: UListI.H:396
Foam::UList::operator<
bool operator<(const UList< T > &list) const
Compare two ULists lexicographically. Takes linear time.
Definition: UList.C:322
Foam::UList::less::less
less(const UList< T > &list)
Definition: UList.H:183
Foam::accessOp
Definition: UList.H:614
Foam::labelMax
constexpr label labelMax
Definition: label.H:61
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::UList::validateRange
labelRange validateRange(const labelRange &range) const
Definition: UList.C:39
Foam::UList::cend
const_iterator cend() const
Return const_iterator to end traversing the constant UList.
Definition: UListI.H:311
Foam::UList::first
T & first()
Return the first element of the list.
Definition: UListI.H:170
Foam::UList::const_reference
const typedef T & const_reference
The type used for reading from constant value_type objects.
Definition: UList.H:140
Foam::UList::operator>=
bool operator>=(const UList< T > &a) const
Return true if !(a < b). Takes linear time.
Definition: UList.C:361
Foam::UList::UList
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
Definition: UListI.H:36
Foam::Hasher
unsigned Hasher(const void *data, size_t len, unsigned seed=0)
Bob Jenkins's 96-bit mixer hashing function (lookup3)
Definition: Hasher.C:473
Foam::UList::operator==
bool operator==(const UList< T > &a) const
Equality operation on ULists of the same type.
Definition: UList.C:291
Foam::SubList
A List obtained as a section of another List.
Definition: SubList.H:53
Foam::UList::operator<=
bool operator<=(const UList< T > &a) const
Return true if !(a > b). Takes linear time.
Definition: UList.C:354
Foam::UList::checkSize
void checkSize(const label size) const
Check size is within valid range [0,size].
Definition: UListI.H:116
Foam::Hash::operator()
unsigned operator()(const T &obj, unsigned seed=0) const
Definition: Hash.H:57
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::UList::size_type
label size_type
The type to represent the size of a UList.
Definition: UList.H:149
Foam::UList::deepCopy
void deepCopy(const UList< T > &list)
Copy elements of the given UList.
Definition: UList.C:105
ListPolicy.H
Foam::Swap
void Swap(DynamicList< T, SizeMin1 > &a, DynamicList< T, SizeMin2 > &b)
Definition: DynamicListI.H:913
Foam::UList::rcIndex
label rcIndex(const label i) const
Definition: UListI.H:82
Foam::UList::swapFirst
void swapFirst(const label i)
Swap element with the first element. Fatal on an empty list.
Definition: UList.C:79
Foam::UList::begin
iterator begin()
Return an iterator to begin traversing the UList.
Definition: UListI.H:276
Foam::stableSort
void stableSort(UList< T > &a)
Definition: UList.C:268
Swap.H
Swap arguments as per std::swap, but in Foam namespace.
Foam::UList::rfind
label rfind(const T &val, label pos=-1) const
Find index of the last occurrence of the value.
Definition: UList.C:229
Foam::UList::checkStart
void checkStart(const label start) const
Check start is within valid range [0,size)
Definition: UListI.H:103
UList.C
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::uniform
Definition: uniform.H:50
n
label n
Definition: TABSMDCalcMethod2.H:31
one.H
Foam::UList::less::values
const UList< T > & values
Definition: UList.H:181
Foam::Hash
Hash function class. The default definition is for primitives, non-primitives used to hash entries on...
Definition: Hash.H:55
Foam::sizeOp::operator()
label operator()(const T &obj) const
Definition: UList.H:638
Foam::UList::greater
A list compare binary predicate for reverse sort.
Definition: UList.H:195
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::Hash< UList< T > >::operator()
unsigned operator()(const UList< T > &obj, unsigned seed=0) const
Definition: UList.H:594
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::UList::iterator
T * iterator
Random access iterator for traversing a UList.
Definition: UList.H:143
Foam::UList::last
T & last()
Return the last element of the list.
Definition: UListI.H:184
Foam::UList::swapLast
void swapLast(const label i)
Swap element with the last element. Fatal on an empty list.
Definition: UList.C:91
Foam::UList::moveFirst
void moveFirst(const label i)
Move element to the first position.
Definition: UList.C:55
Foam::UList::reference
T & reference
The type used for storing into value_type objects.
Definition: UList.H:137
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::sort
void sort(UList< T > &a)
Definition: UList.C:254
Foam::Detail::ListPolicy::short_length
Number of items before requiring line-breaks in the list output.
Definition: ListPolicy.H:61
Foam::UList::max_size
static constexpr label max_size() noexcept
The size of the largest possible UList.
Definition: UList.H:427
Foam::UList::operator!=
bool operator!=(const UList< T > &a) const
The opposite of the equality operation. Takes linear time.
Definition: UList.C:315
Foam::labelRange
A range or interval of labels defined by a start and a size.
Definition: labelRange.H:55
Foam::UList::less
A list compare binary predicate for normal sort.
Definition: UList.H:179
bool.H
System bool.
zero.H
Foam::UList::crend
const_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing the UList.
Definition: UListI.H:353
Foam::emptyOp::operator()
bool operator()(const T &obj) const
Definition: UList.H:627
Foam::UList::empty
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
Definition: UListI.H:374
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UList::rend
reverse_iterator rend()
Return reverse_iterator to end reverse traversing the UList.
Definition: UListI.H:339
Foam::UList::fcValue
const T & fcValue(const label i) const
Return forward circular value (ie, next value in the list)
Definition: UListI.H:68
Foam::UList::writeEntry
void writeEntry(Ostream &os) const
Write the UList with its compound type.
Definition: UListIO.C:38
Foam::charUList
UList< char > charUList
A UList of chars.
Definition: UList.H:79
Foam::sizeOp
Extract size (as label) from an object, typically using its size() method.
Definition: UList.H:636
Foam::UList::unset
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type unset(const label i)
A bitSet::unset() method for a list of bool.
Definition: UList.H:504
Foam::UList::shallowCopy
void shallowCopy(const UList< T > &list)
Copy the pointer held by the given UList.
Definition: UListI.H:219
Foam::UList::operator>
bool operator>(const UList< T > &a) const
Compare two ULists lexicographically. Takes linear time.
Definition: UList.C:347
Foam::emptyOp
Test if object is empty, typically using its empty() method.
Definition: UList.H:625
Foam::UList::swap
void swap(UList< T > &list)
Swap content with another UList of the same type in constant time.
Definition: UListI.H:381
Foam::boolUList
UList< bool > boolUList
A UList of bools.
Definition: UList.H:78
range
scalar range
Definition: LISASMDCalcMethod1.H:12
Foam::UList::less::operator()
bool operator()(const label a, const label b) const
Definition: UList.H:188
Foam::UList::difference_type
label difference_type
The difference between iterator objects.
Definition: UList.H:152
Foam::UList::fcIndex
label fcIndex(const label i) const
Definition: UListI.H:61
label.H
Foam::shuffle
void shuffle(UList< T > &a)
Definition: UList.C:282
Foam::UList::rbegin
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the UList.
Definition: UListI.H:318
contiguous.H
Foam::UList::greater::values
const UList< T > & values
Definition: UList.H:197
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::UList::operator=
UList< T > & operator=(const UList< T > &)=delete
No copy assignment (default: shallow copy)
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::UList::Hash
Hashing function class for UList.
Definition: UList.H:521
stdFoam.H
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::UList::size
label size() const noexcept
The number of elements in the UList.
Definition: UListI.H:367
Foam::UList::const_pointer
const typedef T * const_pointer
The pointer type for const access to value_type items.
Definition: UList.H:134
Foam::UList::byteSize
std::streamsize byteSize() const
Definition: UList.C:191
Foam::UList::cdata
const T * cdata() const
Return a const pointer to the first data element.
Definition: UListI.H:198
Foam::UList::const_iterator
const typedef T * const_iterator
Random access iterator for traversing a UList.
Definition: UList.H:146
Foam::UList::greater::operator()
bool operator()(const label a, const label b) const
Definition: UList.H:204
Foam::UList::size
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
Definition: UListI.H:360
Foam::UList::found
bool found(const T &val, label pos=0) const
True if the value if found in the list.
Definition: UListI.H:212
nullObject.H
Foam::UList::get
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type get(const label i) const
A bitSet::get() method for a list of bool.
Definition: UList.H:494
Foam::UList::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Reverse iterator (const access)
Definition: UList.H:158
Foam::UList::pointer
T * pointer
The pointer type for non-const access to value_type items.
Definition: UList.H:131
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
stdVectorIO.C
uLabel.H
Foam::labelUList
UList< label > labelUList
A UList of labels.
Definition: UList.H:80
Foam::UList::end
iterator end()
Return an iterator to end traversing the UList.
Definition: UListI.H:297
Foam::UList::moveLast
void moveLast(const label i)
Move element to the last position.
Definition: UList.C:67
Foam::UList::find
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
Definition: UList.C:205
Foam::UList::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator (non-const access)
Definition: UList.H:155
Foam::UList::checkIndex
void checkIndex(const label i) const
Check index is within valid range [0,size)
Definition: UListI.H:128
Foam::UList::value_type
T value_type
The value type the list contains.
Definition: UList.H:128
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55
Foam::UList::greater::greater
greater(const UList< T > &list)
Definition: UList.H:199
HashFwd.H
Forward definition for Hash function class and the definition for the Hasher function.
UListI.H
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75
Foam::UList::rcValue
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list)
Definition: UListI.H:89
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62
Foam::UList::crbegin
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing the UList.
Definition: UListI.H:332
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177
Foam::accessOp::operator()
const T & operator()(const T &obj) const
Definition: UList.H:616