38 #ifndef Foam_DynamicField_H 39 #define Foam_DynamicField_H 52 template<
class T,
int SizeMin>
55 template<
class T,
int SizeMin>
56 inline Ostream& operator<<(Ostream&, const DynamicField<T, SizeMin>&);
62 template<
class T,
int SizeMin=64>
67 static_assert(SizeMin > 0,
"Invalid min size parameter");
78 template<
class ListType>
79 inline void doAssignDynList(
const ListType& list);
83 inline void doCapacity(
const bool nocopy,
const label len);
88 inline void doReserve(
const bool nocopy,
const label len);
93 inline void doResize(
const bool nocopy,
const label len);
103 return NullObjectRef<DynamicField<T, SizeMin>>();
113 inline explicit DynamicField(
const label initialCapacity);
125 template<
int AnySizeMin>
143 template<
int AnySizeMin>
147 template<
int AnySizeMin>
215 inline
void reserve(const label len);
228 inline
void resize(const label len);
231 inline
void resize(const label len, const
T& val);
270 template<
int AnySizeMin>
274 template<
int AnySizeMin>
275 inline
void swap(DynamicList<
T, AnySizeMin>& other);
281 template<
int AnySizeMin>
282 inline
void transfer(DynamicList<
T, AnySizeMin>& list);
285 template<
int AnySizeMin>
290 template<class... Args>
313 inline Istream&
readList(Istream& is);
338 template<
int AnySizeMin>
345 template<
int AnySizeMin>
void swap(List< T > &list)
Swap with plain List content. Implies shrink_to_fit().
void setCapacity(const label len)
Alter the size of the underlying storage.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
DynamicField< T, SizeMin > & shrink()
Calls shrink_to_fit() and returns a reference to the DynamicField.
void push_back(const T &val)
Copy append an element at the end of the list.
constexpr DynamicField() noexcept
Default construct, an empty field without allocation.
Base for lists with indirect addressing, templated on the list contents type and the addressing type...
Istream & readList(Istream &is)
Read from Istream, discarding existing contents.
void transfer(List< T > &list)
Transfer the parameter contents into this.
void reserve_nocopy(const label len)
Reserve allocation space for at least this size, allocating new space if required without retaining o...
void resize_nocopy(const label len)
Alter addressable list size, allocating new space if required without necessarily recovering old cont...
tmp< DynamicField< T, SizeMin > > clone() const
Clone.
void setCapacity_unsafe(const label len) noexcept
Change the value for the list capacity directly (ADVANCED, UNSAFE) Does not perform any memory manage...
label capacity() const noexcept
Size of the underlying storage.
void resize(const label len)
Alter addressable list size, allocating new space if required while recovering old content...
Abstract base class to hold the Field mapping addressing and weights.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Generic templated field type.
Istream & operator>>(Istream &, directionInfo &)
void shrink_to_fit()
Shrink the allocated space to the number of elements used.
void pop_back(label n=1)
Reduce size by 1 or more elements. Can be called on an empty list.
void reserve(const label len)
Reserve allocation space for at least this size, allocating new space if required and retaining old c...
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void shrink_unsafe()
Shrink the internal bookkeeping of the allocated space to the number of addressed elements without af...
void map(const UList< T > &mapF, const labelUList &mapAddressing)
1 to 1 map from the given field
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static const DynamicField< T, SizeMin > & null() noexcept
Return a null DynamicField (reference to a nullObject).
OBJstream os(runTime.globalPath()/outputName)
static constexpr label min_size() noexcept
Normal lower capacity limit - the SizeMin template parameter.
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
T & emplace_back(Args &&... args)
Construct an element at the end of the list, return reference to the new list element.
void clearStorage()
Clear the list and delete storage.
void setCapacity_nocopy(const label len)
Alter the size of the underlying storage, without retaining old content.
std::streamsize capacity_bytes() const noexcept
Number of contiguous bytes of the underlying storage.
void append(const T &val)
Append an element at the end of the list.
tmp< Field< T > > T() const
Return the field transpose (only defined for second rank tensors)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
A class for managing temporary objects.
Foam::argList args(argc, argv)
A non-counting (dummy) refCount.
constexpr List() noexcept
Default construct.
void setSize(const label n)
Alias for resize()
friend Ostream & operator(Ostream &os, const DynamicField< T, SizeMin > &rhs)
Write to Ostream.