33 template<
class T,
unsigned N>
36 return NullObjectRef<FixedList<T, N>>();
42 template<
class T,
unsigned N>
49 template<
class T,
unsigned N>
56 template<
class T,
unsigned N>
60 std::copy(list.
begin(), list.
end(), v_);
64 template<
class T,
unsigned N>
68 std::move(list.
begin(), list.
end(), v_);
72 template<
class T,
unsigned N>
75 checkSize(list.size());
76 std::copy_n(list.begin(),
N, v_);
80 template<
class T,
unsigned N>
83 checkSize(list.
size());
88 template<
class T,
unsigned N>
89 template<
unsigned AnyNum>
96 for (
unsigned i = 0; i <
N; ++i)
98 v_[i] = list[indices[i]];
103 template<
class T,
unsigned N>
106 const UList<T>& list,
107 const FixedList<label, N>& indices
110 for (
unsigned i = 0; i <
N; ++i)
112 v_[i] = list[indices[i]];
117 template<
class T,
unsigned N>
121 return autoPtr<FixedList<T, N>>
::New(*
this);
127 template<
class T,
unsigned N>
135 template<
class T,
unsigned N>
143 template<
class T,
unsigned N>
147 return reinterpret_cast<const char*
>(v_);
151 template<
class T,
unsigned N>
155 return reinterpret_cast<char*
>(v_);
159 template<
class T,
unsigned N>
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>
176 template<
unsigned Index>
179 static_assert(Index <
N,
"Address outside FixedList range");
184 template<
class T,
unsigned N>
191 template<
class T,
unsigned N>
198 template<
class T,
unsigned N>
205 template<
class T,
unsigned N>
212 template<
class T,
unsigned N>
215 return (i ==
N-1 ? 0 : i+1);
219 template<
class T,
unsigned N>
222 return this->operator[](this->fcIndex(i));
226 template<
class T,
unsigned N>
229 return this->operator[](this->fcIndex(i));
233 template<
class T,
unsigned N>
236 return (i ? i-1 :
N-1);
240 template<
class T,
unsigned N>
243 return this->operator[](this->rcIndex(i));
247 template<
class T,
unsigned N>
250 return this->operator[](this->rcIndex(i));
254 template<
class T,
unsigned N>
257 if (start < 0 || (start &&
unsigned(start) >=
N))
261 <<
"start " << start <<
" out of range [0," <<
N <<
")" 267 template<
class T,
unsigned N>
270 if (
unsigned(size) !=
N)
273 <<
"size " << size <<
" != " <<
N 279 template<
class T,
unsigned N>
282 if (i < 0 ||
unsigned(i) >=
N)
285 <<
"index " << i <<
" out of range [0," <<
N <<
")" 291 template<
class T,
unsigned N>
294 if (empty())
return false;
297 for (
unsigned i=1; i<
N; ++i)
309 template<
class T,
unsigned N>
313 return (iter != this->
cend());
317 template<
class T,
unsigned N>
325 return (this->
find(val,
pos, len) >= 0);
329 template<
class T,
unsigned N>
338 template<
class T,
unsigned N>
348 template<
class T,
unsigned N>
357 template<
class T,
unsigned N>
361 std::fill_n(v_,
N, val);
365 template<
class T,
unsigned N>
371 for (
unsigned i = 0; i <
N; ++i)
378 template<
class T,
unsigned N>
387 for (
unsigned i=0; i<
N; ++i)
394 template<
class T,
unsigned N>
403 std::move(list.begin(), list.end(), v_);
409 template<
class T,
unsigned N>
419 template<
class T,
unsigned N>
429 template<
class T,
unsigned N>
432 checkSize(list.
size());
433 std::copy_n(list.
begin(),
N, v_);
437 template<
class T,
unsigned N>
440 checkSize(list.size());
441 std::copy_n(list.begin(),
N, v_);
445 template<
class T,
unsigned N>
452 template<
class T,
unsigned N>
459 template<
class T,
unsigned N>
468 std::copy(list.
begin(), list.
end(), v_);
472 template<
class T,
unsigned N>
481 std::move(list.
begin(), list.
end(), v_);
487 template<
class T,
unsigned N>
495 template<
class T,
unsigned N>
503 template<
class T,
unsigned N>
511 template<
class T,
unsigned N>
519 template<
class T,
unsigned N>
527 template<
class T,
unsigned N>
535 template<
class T,
unsigned N>
543 template<
class T,
unsigned N>
551 template<
class T,
unsigned N>
559 template<
class T,
unsigned N>
567 template<
class T,
unsigned N>
575 template<
class T,
unsigned N>
579 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.
static const FixedList< T, N > & null()
Return a null FixedList.
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)