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