FixedList.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-2021 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::FixedList
29 
30 Description
31  A 1D vector of objects of type <T> with a fixed length <N>.
32 
33 SourceFiles
34  FixedList.C
35  FixedListI.H
36  FixedListIO.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef FixedList_H
41 #define FixedList_H
42 
43 #include "bool.H"
44 #include "label.H"
45 #include "uLabel.H"
46 #include "zero.H"
47 #include "contiguous.H"
48 #include "autoPtr.H"
49 #include "Hash.H"
50 #include "Swap.H"
51 #include "SLListFwd.H"
52 #include "ListPolicy.H"
53 
54 #include <initializer_list>
55 #include <iterator>
56 #include <type_traits>
57 #include <limits>
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 // Forward Declarations
65 
66 template<class T, unsigned N> class FixedList;
67 template<class T> class UList;
68 
69 template<class T, unsigned N>
70 Istream& operator>>(Istream& is, FixedList<T, N>& list);
71 
72 template<class T, unsigned N>
73 Ostream& operator<<(Ostream& os, const FixedList<T, N>& list);
74 
75 
76 /*---------------------------------------------------------------------------*\
77  Class FixedList Declaration
78 \*---------------------------------------------------------------------------*/
79 
80 template<class T, unsigned N>
81 class FixedList
82 {
83  static_assert
84  (
86  "Size must be positive (non-zero) and fit as a signed int value"
87  );
88 
89  // Private Data
90 
91  //- Vector of values of type T of length N.
92  T v_[N];
93 
94 
95 protected:
96 
97  // Protected Member Functions
98 
99  //- Write the FixedList with its compound type
100  void writeEntry(Ostream& os) const;
101 
102 
103 public:
104 
105  // STL Type Definitions
106 
107  //- The value type the FixedList contains
108  typedef T value_type;
109 
110  //- The pointer type for non-const access to value_type items
111  typedef T* pointer;
112 
113  //- The pointer type for const access to value_type items
114  typedef const T* const_pointer;
115 
116  //- The type used for storing into value_type objects
117  typedef T& reference;
118 
119  //- The type used for reading from constant value_type objects.
120  typedef const T& const_reference;
121 
122  //- Random access iterator for traversing FixedList
123  typedef T* iterator;
124 
125  //- Random access iterator for traversing FixedList
126  typedef const T* const_iterator;
127 
128  //- The type to represent the size of a FixedList
129  typedef label size_type;
130 
131  //- The difference between iterator objects
132  typedef label difference_type;
133 
134  //- Reverse iterator (non-const access)
135  typedef std::reverse_iterator<iterator> reverse_iterator;
136 
137  //- Reverse iterator (const access)
138  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
139 
140 
141  // Static Functions
142 
143  //- Return a null FixedList
144  inline static const FixedList<T, N>& null();
145 
146 
147  // Constructors
148 
149  //- Default construct
150  FixedList() = default;
151 
152  //- Construct and initialize all entries to given value
153  inline explicit FixedList(const T& val);
154 
155  //- Construct and initialize all entries to zero
156  inline explicit FixedList(const Foam::zero);
157 
158  //- Copy construct from C-array (deprecated)
159  inline explicit FixedList(const T list[N]);
160 
161  //- Copy construct
162  inline FixedList(const FixedList<T, N>& list);
163 
164  //- Move construct by using move assignment for the individual
165  //- list elements
166  inline FixedList(FixedList<T, N>&& list);
167 
168  //- Construct from an initializer list. Runtime size check
169  inline FixedList(std::initializer_list<T> list);
170 
171  //- Construct from UList. Runtime size check
172  inline explicit FixedList(const UList<T>& list);
173 
174  //- Copy construct from a subset of the input. No size check
175  template<unsigned AnyNum>
176  inline FixedList
177  (
178  const FixedList<T, AnyNum>& list,
179  const FixedList<label, N>& indices
180  );
181 
182  //- Copy construct from a subset of the input. No size check
183  inline FixedList
184  (
185  const UList<T>& list,
186  const FixedList<label, N>& indices
187  );
188 
189  //- Construct from SLList. Runtime size check
190  inline explicit FixedList(const SLList<T>& list);
191 
192  //- Construct from Istream
193  explicit FixedList(Istream& is);
194 
195  //- Clone
196  inline autoPtr<FixedList<T, N>> clone() const;
197 
198 
199  // Member Functions
200 
201  // Access
202 
203  //- Return pointer to the underlying array serving as data storage.
204  inline const T* cdata() const noexcept;
205 
206  //- Return pointer to the underlying array serving as data storage.
207  inline T* data() noexcept;
208 
209  //- Return pointer to the underlying array serving as data storage,
210  // reinterpreted as byte data
211  // \note Only meaningful for contiguous data
212  inline const char* cdata_bytes() const noexcept;
213 
214  //- Return pointer to the underlying array serving as data storage,
215  // reinterpreted as byte data
216  // \note Only meaningful for contiguous data
217  inline char* data_bytes() noexcept;
218 
219 
220  //- The first element of the list, position [0]
221  inline T& first() noexcept;
222 
223  //- The first element of the list, position [0]
224  inline const T& first() const noexcept;
225 
226  //- The last element of the list, position [N-1]
227  inline T& last() noexcept;
228 
229  //- The last element of the list, position [N-1]
230  inline const T& last() const noexcept;
231 
232  //- Number of contiguous bytes for the list data,
233  // \note Only meaningful for contiguous data
234  inline static std::streamsize size_bytes() noexcept;
235 
236  //- Number of contiguous bytes for the list data,
237  //- runtime FatalError if type is not contiguous
238  static std::streamsize byteSize();
239 
240  //- Return the forward circular index, i.e. next index
241  //- which returns to the first at the end of the list
242  inline label fcIndex(const label i) const;
243 
244  //- Return forward circular value (ie, next value in the list)
245  inline const T& fcValue(const label i) const;
246 
247  //- Return forward circular value (ie, next value in the list)
248  inline T& fcValue(const label i);
249 
250  //- Return the reverse circular index, i.e. previous index
251  //- which returns to the last at the beginning of the list
252  inline label rcIndex(const label i) const;
253 
254  //- Return reverse circular value (ie, previous value in the list)
255  inline const T& rcValue(const label i) const;
256 
257  //- Return reverse circular value (ie, previous value in the list)
258  inline T& rcValue(const label i);
259 
260 
261  // Check
262 
263  //- Check start is within valid range [0,size)
264  inline void checkStart(const label start) const;
265 
266  //- Check size is identical to template parameter N
267  inline void checkSize(const label size) const;
268 
269  //- Check index is within valid range [0,N)
270  inline void checkIndex(const label i) const;
271 
272  //- True if all entries have identical values, and list is non-empty
273  inline bool uniform() const;
274 
275 
276  // Search
277 
278  //- Find index of the first occurrence of the value.
279  // Any occurrences before the start pos are ignored.
280  // Linear search.
281  // \return -1 if not found.
282  label find(const T& val, label pos = 0) const;
283 
284  //- Find index of the last occurrence of the value.
285  // Any occurrences after the end pos are ignored.
286  // Linear search.
287  // \return position in list or -1 if not found.
288  label rfind(const T& val, label pos = -1) const;
289 
290  //- True if the value if found in the list.
291  // Any occurrences before the start pos are ignored.
292  // Linear search.
293  inline bool found(const T& val, label pos = 0) const;
294 
295 
296  // Edit
297 
298  //- Dummy function, to make FixedList consistent with List
299  inline void resize(const label n);
300 
301  //- Dummy function, to make FixedList consistent with List
302  inline void resize_nocopy(const label n);
303 
304  //- Dummy function, to make FixedList consistent with List
305  void setSize(const label n) { this->resize(n); }
306 
307  //- Assign all entries to the given value
308  inline void fill(const T& val);
309 
310  //- Assign all entries to zero
311  inline void fill(const Foam::zero);
312 
313  //- Move element to the first position.
314  void moveFirst(const label i);
315 
316  //- Move element to the last position.
317  void moveLast(const label i);
318 
319  //- Swap element with the first element.
320  void swapFirst(const label i);
321 
322  //- Swap element with the last element.
323  void swapLast(const label i);
324 
325  //- Transfer by swapping using a move assignment for the content
326  //- of the individual list elements
327  inline void transfer(FixedList<T, N>& list);
328 
329 
330  // Member Operators
331 
332  //- Return element of FixedList
333  inline T& operator[](const label i);
334 
335  //- Return element of constant FixedList
336  inline const T& operator[](const label i) const;
337 
338  //- Assignment to array operator. Takes linear time
339  inline void operator=(const T list[N]);
340 
341  //- Assignment to UList operator. Takes linear time
342  inline void operator=(const UList<T>& list);
343 
344  //- Assignment to SLList operator. Takes linear time
345  inline void operator=(const SLList<T>& list);
346 
347  //- Assignment to an initializer list. Takes linear time
348  inline void operator=(std::initializer_list<T> list);
349 
350  //- Assign all entries to the given value. fill()
351  inline void operator=(const T& val);
352 
353  //- Assign all entries to zero. fill()
354  inline void operator=(const Foam::zero);
355 
356  //- Copy assignment
357  inline void operator=(const FixedList<T, N>& list);
358 
359  //- Move assignment
360  inline void operator=(FixedList<T, N>&& list);
361 
362 
363  // Random access iterator (non-const)
364 
365  //- Return an iterator to begin traversing the FixedList
366  inline iterator begin() noexcept;
367 
368  //- Return an iterator to end traversing the FixedList
369  inline iterator end() noexcept;
370 
371 
372  // Random access iterator (const)
373 
374  //- Return const_iterator to begin traversing the constant FixedList
375  inline const_iterator cbegin() const noexcept;
376 
377  //- Return const_iterator to end traversing the constant FixedList
378  inline const_iterator cend() const noexcept;
379 
380  //- Return const_iterator to begin traversing the constant FixedList
381  inline const_iterator begin() const noexcept;
382 
383  //- Return const_iterator to end traversing the constant FixedList
384  inline const_iterator end() const noexcept;
385 
386 
387  // Reverse iterator (non-const)
388 
389  //- Return reverse_iterator to begin reverse traversing the FixedList
390  inline reverse_iterator rbegin();
391 
392  //- Return reverse_iterator to end reverse traversing the FixedList
393  inline reverse_iterator rend();
394 
395 
396  // Reverse iterator (const)
397 
398  //- Return const_reverse_iterator to begin reverse traversing FixedList
399  inline const_reverse_iterator crbegin() const;
400 
401  //- Return const_reverse_iterator to end reverse traversing FixedList
402  inline const_reverse_iterator crend() const;
403 
404  //- Return const_reverse_iterator to begin reverse traversing FixedList
405  inline const_reverse_iterator rbegin() const;
406 
407  //- Return const_reverse_iterator to end reverse traversing FixedList
408  inline const_reverse_iterator rend() const;
409 
410 
411  // STL Member Functions
412 
413  //- Always false since zero-sized FixedList is compile-time disabled.
414  static constexpr bool empty() noexcept { return !N; }
415 
416  //- Return the number of elements in the FixedList
417  static constexpr label size() noexcept { return N; }
418 
419  //- The dimensioned size (template parameter N) of the FixedList
420  static constexpr unsigned max_size() noexcept { return N; }
421 
422  //- Swap lists by swapping the content of the individual list elements
423  inline void swap(FixedList<T, N>& other);
424 
425 
426  // STL Member Operators
427 
428  //- Equality operation on FixedLists of the same type.
429  // Returns true when the FixedLists are element-wise equal
430  // (using FixedList::value_type::operator==). Takes linear time
431  bool operator==(const FixedList<T, N>& list) const;
432 
433  //- The opposite of the equality operation. Takes linear time
434  bool operator!=(const FixedList<T, N>& list) const;
435 
436  //- Compare two FixedLists lexicographically. Takes linear time
437  bool operator<(const FixedList<T, N>& list) const;
438 
439  //- Compare two FixedLists lexicographically. Takes linear time
440  bool operator>(const FixedList<T, N>& list) const;
441 
442  //- Return true if !(a > b). Takes linear time
443  bool operator<=(const FixedList<T, N>& list) const;
444 
445  //- Return true if !(a < b). Takes linear time
446  bool operator>=(const FixedList<T, N>& list) const;
447 
448 
449  // Reading/writing
450 
451  //- Read from Istream, discarding contents of existing List
452  Istream& readList(Istream& is);
453 
454  //- Write the list as a dictionary entry with keyword
455  void writeEntry(const word& keyword, Ostream& os) const;
456 
457  //- Write List, with line-breaks in ASCII when length exceeds shortLen.
458  // Using '0' suppresses line-breaks entirely.
459  Ostream& writeList(Ostream& os, const label shortLen=0) const;
460 
461 
462  // IOstream Operators
463 
464  //- Use the readList() method to read contents from Istream.
465  friend Istream& operator>> <T, N>
466  (
467  Istream& is,
468  FixedList<T, N>& list
469  );
470 
471 
472  // Hashing
473 
474  //- Hashing functor for FixedList.
475  struct hasher
476  {
477  inline unsigned operator()
478  (
479  const FixedList<T, N>& obj,
480  unsigned seed=0
481  ) const
482  {
484  {
485  return Foam::Hasher(obj.cdata(), obj.size_bytes(), seed);
486  }
487 
488  Foam::Hash<T> op;
489  for (const T& val : obj)
490  {
491  seed = op(val, seed);
492  }
493  return seed;
494  }
495  };
496 
497  //- Deprecated(2021-04) hashing functor. Use hasher()
498  // \deprecated(2021-04) - use hasher() functor
499  template<class Unused=bool>
500  struct Hash : FixedList<T, N>::hasher
501  {
502  FOAM_DEPRECATED_FOR(2021-04, "hasher()") Hash() {}
503  };
504 };
505 
506 
507 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
508 
509 //- FixedList is contiguous if the type is contiguous
510 template<class T, unsigned N>
511 struct is_contiguous<FixedList<T, N>> : is_contiguous<T> {};
512 
513 //- Check for FixedList of labels
514 template<class T, unsigned N>
516 
517 //- Check for FixedList of scalars
518 template<class T, unsigned N>
520 
521 //- Hashing for FixedList data
522 template<class T, unsigned N>
523 struct Hash<FixedList<T, N>> : FixedList<T, N>::hasher {};
524 
525 
526 // * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //
527 
528 //- Swap FixedList contents - see FixedList::swap().
529 // Internally actually swaps the individual list elements
530 template<class T, unsigned N>
531 inline void Swap(FixedList<T, N>& a, FixedList<T, N>& b)
532 {
533  a.swap(b);
534 }
535 
536 
537 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
538 
539 //- Read List contents from Istream, list must have the proper size!
540 template<class T, unsigned N>
542 {
543  return list.readList(is);
544 }
545 
546 
547 //- Write List to Ostream, as per FixedList::writeList() with default length.
548 // The default short-length is given by Detail::ListPolicy::short_length
549 template<class T, unsigned N>
551 {
552  return list.writeList(os, Detail::ListPolicy::short_length<T>::value);
553 }
554 
555 
556 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
557 
558 } // End namespace Foam
559 
560 
561 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
562 
563 #include "FixedListI.H"
564 
565 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
566 
567 #ifdef NoRepository
568  #include "FixedList.C"
569  #include "FixedListIO.C"
570 #endif
571 
572 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
573 
574 #endif
575 
576 // ************************************************************************* //
Foam::FixedList::resize_nocopy
void resize_nocopy(const label n)
Dummy function, to make FixedList consistent with List.
Definition: FixedListI.H:351
FixedListIO.C
Foam::FixedList::fcValue
const T & fcValue(const label i) const
Return forward circular value (ie, next value in the list)
Definition: FixedListI.H:242
Foam::FixedList::clone
autoPtr< FixedList< T, N > > clone() const
Clone.
Definition: FixedListI.H:159
Foam::FixedList::readList
Istream & readList(Istream &is)
Read from Istream, discarding contents of existing List.
Definition: FixedListIO.C:148
Foam::Swap
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
Definition: DynamicList.H:429
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::FixedList::writeEntry
void writeEntry(Ostream &os) const
Write the FixedList with its compound type.
Definition: FixedListIO.C:37
Foam::FixedList::end
iterator end() noexcept
Return an iterator to end traversing the FixedList.
Definition: FixedListI.H:548
Foam::FixedList::swapLast
void swapLast(const label i)
Swap element with the last element.
Definition: FixedList.C:133
Foam::FixedList::cend
const_iterator cend() const noexcept
Return const_iterator to end traversing the constant FixedList.
Definition: FixedListI.H:564
Foam::FixedList::crbegin
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing FixedList.
Definition: FixedListI.H:588
Foam::FixedList::checkIndex
void checkIndex(const label i) const
Check index is within valid range [0,N)
Definition: FixedListI.H:302
Foam::FixedList::swap
void swap(FixedList< T, N > &other)
Swap lists by swapping the content of the individual list elements.
Definition: FixedListI.H:380
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:581
Foam::FixedList::transfer
void transfer(FixedList< T, N > &list)
Definition: FixedListI.H:395
Foam::FixedList::cdata_bytes
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
Definition: FixedListI.H:185
Foam::FixedList::last
T & last() noexcept
The last element of the list, position [N-1].
Definition: FixedListI.H:221
Foam::FixedList::operator<=
bool operator<=(const FixedList< T, N > &list) const
Return true if !(a > b). Takes linear time.
Definition: FixedList.C:207
Foam::FixedList::const_pointer
const typedef T * const_pointer
The pointer type for const access to value_type items.
Definition: FixedList.H:113
Foam::FixedList::max_size
static constexpr unsigned max_size() noexcept
The dimensioned size (template parameter N) of the FixedList.
Definition: FixedList.H:419
Foam::FixedList::cdata
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
Definition: FixedListI.H:169
Foam::FixedList::checkStart
void checkStart(const label start) const
Check start is within valid range [0,size)
Definition: FixedListI.H:277
Foam::FixedList::pointer
T * pointer
The pointer type for non-const access to value_type items.
Definition: FixedList.H:110
Foam::FixedList::size_bytes
static std::streamsize size_bytes() noexcept
Number of contiguous bytes for the list data,.
Definition: FixedListI.H:200
Foam::FixedList::size
static constexpr label size() noexcept
Return the number of elements in the FixedList.
Definition: FixedList.H:416
Foam::FixedList::find
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
Definition: FixedList.C:50
Foam::FixedList::size_type
label size_type
The type to represent the size of a FixedList.
Definition: FixedList.H:128
FixedListI.H
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::FixedList::operator=
void operator=(const T list[N])
Assignment to array operator. Takes linear time.
Definition: FixedListI.H:432
Foam::FixedList::operator!=
bool operator!=(const FixedList< T, N > &list) const
The opposite of the equality operation. Takes linear time.
Definition: FixedList.C:193
Foam::FixedList::resize
void resize(const label n)
Dummy function, to make FixedList consistent with List.
Definition: FixedListI.H:342
ListPolicy.H
Foam::FixedList::fill
void fill(const T &val)
Assign all entries to the given value.
Definition: FixedListI.H:360
Foam::FixedList::difference_type
label difference_type
The difference between iterator objects.
Definition: FixedList.H:131
Foam::FixedList::fcIndex
label fcIndex(const label i) const
Definition: FixedListI.H:235
Foam::is_contiguous_label
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:83
Foam::FixedList::reference
T & reference
The type used for storing into value_type objects.
Definition: FixedList.H:116
Swap.H
Swap arguments as per std::swap, but in Foam namespace.
Foam::FixedList::first
T & first() noexcept
The first element of the list, position [0].
Definition: FixedListI.H:207
Foam::LList
Template class for non-intrusive linked lists.
Definition: LList.H:54
Foam::FixedList::begin
iterator begin() noexcept
Return an iterator to begin traversing the FixedList.
Definition: FixedListI.H:524
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
Foam::Hash
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...
Definition: Hash.H:53
Foam::FixedList::operator==
bool operator==(const FixedList< T, N > &list) const
Equality operation on FixedLists of the same type.
Definition: FixedList.C:149
SLListFwd.H
Forward declarations for SLList.
Foam::FixedList::operator<
bool operator<(const FixedList< T, N > &list) const
Compare two FixedLists lexicographically. Takes linear time.
Definition: FixedList.C:169
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::FixedList::rfind
label rfind(const T &val, label pos=-1) const
Find index of the last occurrence of the value.
Definition: FixedList.C:72
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::FixedList::byteSize
static std::streamsize byteSize()
Definition: FixedList.C:35
Foam::FixedList::iterator
T * iterator
Random access iterator for traversing FixedList.
Definition: FixedList.H:122
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::Detail::ListPolicy::short_length
Number of items before requiring line-breaks in the list output.
Definition: ListPolicy.H:61
Foam::FixedList::rcValue
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list)
Definition: FixedListI.H:263
Foam::FixedList::const_reference
const typedef T & const_reference
The type used for reading from constant value_type objects.
Definition: FixedList.H:119
bool.H
System bool.
zero.H
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::FixedList::crend
const_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing FixedList.
Definition: FixedListI.H:612
Foam::FixedList::moveFirst
void moveFirst(const label i)
Move element to the first position.
Definition: FixedList.C:97
os
OBJstream os(runTime.globalPath()/outputName)
Foam::FixedList::value_type
T value_type
The value type the FixedList contains.
Definition: FixedList.H:107
Foam::FixedList::rend
reverse_iterator rend()
Return reverse_iterator to end reverse traversing the FixedList.
Definition: FixedListI.H:596
Foam::FixedList::setSize
void setSize(const label n)
Dummy function, to make FixedList consistent with List.
Definition: FixedList.H:304
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::FixedList::operator[]
T & operator[](const label i)
Return element of FixedList.
Definition: FixedListI.H:412
Foam::is_contiguous_scalar
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition: contiguous.H:91
Foam::FixedList::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Reverse iterator (const access)
Definition: FixedList.H:137
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::FixedList::data_bytes
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
Definition: FixedListI.H:193
Foam::FixedList::operator>
bool operator>(const FixedList< T, N > &list) const
Compare two FixedLists lexicographically. Takes linear time.
Definition: FixedList.C:200
Foam::FixedList::writeList
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
Definition: FixedListIO.C:77
Foam::FixedList::operator>=
bool operator>=(const FixedList< T, N > &list) const
Return true if !(a < b). Takes linear time.
Definition: FixedList.C:214
Foam::FixedList::Hash
Deprecated(2021-04) hashing functor. Use hasher()
Definition: FixedList.H:499
label.H
contiguous.H
Foam::FixedList::swapFirst
void swapFirst(const label i)
Swap element with the first element.
Definition: FixedList.C:121
Foam::FixedList
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:104
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::FixedList::Hash::FOAM_DEPRECATED_FOR
FOAM_DEPRECATED_FOR(2021-04, "hasher()") Hash()
Definition: FixedList.H:501
Hash.H
Foam::FixedList::FixedList
FixedList()=default
Default construct.
Foam::FixedList::cbegin
const_iterator cbegin() const noexcept
Return const_iterator to begin traversing the constant FixedList.
Definition: FixedListI.H:540
Foam::FixedList::hasher
Hashing functor for FixedList.
Definition: FixedList.H:474
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
N
const Vector< label > N(dict.get< Vector< label >>("N"))
Foam::FixedList::const_iterator
const typedef T * const_iterator
Random access iterator for traversing FixedList.
Definition: FixedList.H:125
Foam::FixedList::empty
static constexpr bool empty() noexcept
Always false since zero-sized FixedList is compile-time disabled.
Definition: FixedList.H:413
Foam::FixedList::found
bool found(const T &val, label pos=0) const
True if the value if found in the list.
Definition: FixedListI.H:332
uLabel.H
Foam::FixedList::checkSize
void checkSize(const label size) const
Check size is identical to template parameter N.
Definition: FixedListI.H:290
Foam::FixedList::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator (non-const access)
Definition: FixedList.H:134
Foam::FixedList::rcIndex
label rcIndex(const label i) const
Definition: FixedListI.H:256
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55
FixedList.C
Foam::FixedList::rbegin
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the FixedList.
Definition: FixedListI.H:572
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::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62
Foam::FixedList::moveLast
void moveLast(const label i)
Move element to the last position.
Definition: FixedList.C:109
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177
autoPtr.H