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