33 template<
class T,
unsigned N>
40 template<
class T,
unsigned N>
47 template<
class T,
unsigned N>
51 std::copy(list.
begin(), list.
end(), v_);
55 template<
class T,
unsigned N>
59 std::move(list.
begin(), list.
end(), v_);
63 template<
class T,
unsigned N>
66 checkSize(list.size());
67 std::copy_n(list.begin(),
N, v_);
71 template<
class T,
unsigned N>
74 checkSize(list.
size());
79 template<
class T,
unsigned N>
80 template<
unsigned AnyNum>
87 for (
unsigned i = 0; i <
N; ++i)
89 v_[i] = list[indices[i]];
94 template<
class T,
unsigned N>
98 const FixedList<label, N>& indices
101 for (
unsigned i = 0; i <
N; ++i)
103 v_[i] = list[indices[i]];
108 template<
class T,
unsigned N>
112 return autoPtr<FixedList<T, N>>
::New(*
this);
118 template<
class T,
unsigned N>
126 template<
class T,
unsigned N>
134 template<
class T,
unsigned N>
138 return reinterpret_cast<const char*
>(v_);
142 template<
class T,
unsigned N>
146 return reinterpret_cast<char*
>(v_);
150 template<
class T,
unsigned N>
157 template<
class T,
unsigned N>
158 template<
unsigned Index>
161 static_assert(Index <
N,
"Address outside FixedList range");
166 template<
class T,
unsigned N>
167 template<
unsigned Index>
170 static_assert(Index <
N,
"Address outside FixedList range");
175 template<
class T,
unsigned N>
182 template<
class T,
unsigned N>
189 template<
class T,
unsigned N>
196 template<
class T,
unsigned N>
203 template<
class T,
unsigned N>
206 return (i ==
N-1 ? 0 : i+1);
210 template<
class T,
unsigned N>
213 return this->operator[](this->fcIndex(i));
217 template<
class T,
unsigned N>
220 return this->operator[](this->fcIndex(i));
224 template<
class T,
unsigned N>
227 return (i ? i-1 :
N-1);
231 template<
class T,
unsigned N>
234 return this->operator[](this->rcIndex(i));
238 template<
class T,
unsigned N>
241 return this->operator[](this->rcIndex(i));
245 template<
class T,
unsigned N>
248 if (start < 0 || (start &&
unsigned(start) >=
N))
252 <<
"start " << start <<
" out of range [0," <<
N <<
")" 258 template<
class T,
unsigned N>
261 if (
unsigned(size) !=
N)
264 <<
"size " << size <<
" != " <<
N 270 template<
class T,
unsigned N>
273 if (i < 0 ||
unsigned(i) >=
N)
276 <<
"index " << i <<
" out of range [0," <<
N <<
")" 282 template<
class T,
unsigned N>
285 if (empty())
return false;
288 for (
unsigned i=1; i<
N; ++i)
300 template<
class T,
unsigned N>
304 return (iter != this->
cend());
308 template<
class T,
unsigned N>
316 return (this->
find(val,
pos, len) >= 0);
320 template<
class T,
unsigned N>
329 template<
class T,
unsigned N>
339 template<
class T,
unsigned N>
348 template<
class T,
unsigned N>
352 std::fill_n(v_,
N, val);
356 template<
class T,
unsigned N>
362 for (
unsigned i = 0; i <
N; ++i)
369 template<
class T,
unsigned N>
378 for (
unsigned i=0; i<
N; ++i)
385 template<
class T,
unsigned N>
394 std::move(list.begin(), list.end(), v_);
400 template<
class T,
unsigned N>
410 template<
class T,
unsigned N>
420 template<
class T,
unsigned N>
423 checkSize(list.
size());
424 std::copy_n(list.
begin(),
N, v_);
428 template<
class T,
unsigned N>
431 checkSize(list.size());
432 std::copy_n(list.begin(),
N, v_);
436 template<
class T,
unsigned N>
443 template<
class T,
unsigned N>
450 template<
class T,
unsigned N>
459 std::copy(list.
begin(), list.
end(), v_);
463 template<
class T,
unsigned N>
472 std::move(list.
begin(), list.
end(), v_);
478 template<
class T,
unsigned N>
486 template<
class T,
unsigned N>
494 template<
class T,
unsigned N>
502 template<
class T,
unsigned N>
510 template<
class T,
unsigned N>
518 template<
class T,
unsigned N>
526 template<
class T,
unsigned N>
534 template<
class T,
unsigned N>
542 template<
class T,
unsigned N>
550 template<
class T,
unsigned N>
558 template<
class T,
unsigned N>
566 template<
class T,
unsigned N>
570 return const_reverse_iterator(
begin());
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
void resize(const label n)
Dummy function, to make FixedList consistent with List Any resizing is ignored (Fatal with bad sizing...
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as ListOps::find_if.
void size(const label n)
Older name for setAddressableSize.
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator (non-const access)
A 1D vector of objects of type <T> with a fixed length <N>.
iterator begin() noexcept
Return an iterator to begin traversing the FixedList.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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).
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 ...
bool uniform() const
True if all entries have identical values, and list is non-empty.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
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...
iterator end() noexcept
Return an iterator to end traversing the FixedList.
T & back() noexcept
Access last element of the list, position [N-1].
void checkIndex(const label i) const
Check index is within valid range [0,N)
autoPtr< FixedList< T, N > > clone() const
Clone.
bool contains(const T &val) const
True if the value is contained in the list.
T & operator[](const label i)
Return element of FixedList.
std::reverse_iterator< const_iterator > const_reverse_iterator
Reverse iterator (const access)
dimensionedScalar pos(const dimensionedScalar &ds)
reverse_iterator rend()
Return reverse_iterator to end reverse traversing the FixedList.
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
const T * const_iterator
Random access iterator for traversing FixedList.
static std::streamsize size_bytes() noexcept
Number of contiguous bytes for the list data,.
void checkStart(const label start) const
Check start is within valid range [0,size)
void operator=(const UList< T > &list)
Assignment to UList operator. Takes linear time.
void fill(const T &val)
Assign all entries to the given value.
constexpr auto cend(const C &c) -> decltype(c.end())
Return const_iterator to the end of the container c.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
errorManip< error > abort(error &err)
iterator begin() noexcept
Return an iterator to begin traversing the UList.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
T * iterator
Random access iterator for traversing FixedList.
T & get() noexcept
Element access using compile-time indexing.
void checkSize(const label size) const
Check size is identical to template parameter N.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
constexpr auto cbegin(const C &c) -> decltype(c.begin())
Return const_iterator to the beginning of the container c.
const_iterator cbegin() const noexcept
Return const_iterator to begin traversing the constant FixedList.
const Vector< label > N(dict.get< Vector< label >>("N"))
const_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing FixedList.
void resize_nocopy(const label n)
Dummy function, to make FixedList consistent with List Any resizing is ignored (Fatal with bad sizing...
T & front() noexcept
Access first element of the list, position [0].
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list)
const T & fcValue(const label i) const
Return forward circular value (ie, next value in the list)
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
Exchange contents of lists - see DynamicList::swap().
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the FixedList.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
const_iterator cend() const noexcept
Return const_iterator to end traversing the constant FixedList.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing FixedList.
iterator end() noexcept
Return an iterator to end traversing the UList.
void transfer(FixedList< T, N > &list)
Transfer by swapping using a move assignment for the content of the individual list elements...
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
FixedList()=default
Default construct.
void swap(FixedList< T, N > &other)
Swap lists by swapping the content of the individual list elements.
static constexpr const zero Zero
Global zero (0)