31template<
class T,
int SizeMin>
32template<
class ListType>
38 const label len = list.
size();
43 List<T>::setAddressableSize(capacity_);
44 List<T>::resize_nocopy(len);
45 capacity_ = List<T>::size();
49 List<T>::setAddressableSize(len);
50 List<T>::operator=(list);
54template<
class T,
int SizeMin>
58 const label newCapacity
61 if (newCapacity == capacity_)
67 const label currLen =
min(List<T>::size(), newCapacity);
70 if (List<T>::size() == newCapacity)
72 List<T>::setAddressableSize(currLen+1);
77 List<T>::resize_nocopy(newCapacity);
81 List<T>::resize(newCapacity);
84 capacity_ = List<T>::size();
85 List<T>::setAddressableSize(currLen);
89template<
class T,
int SizeMin>
99 const label currLen = List<T>::size();
102 capacity_ =
max(SizeMin,
max(len, label(2*capacity_)));
106 List<T>::resize_nocopy(capacity_);
117template<
class T,
int SizeMin>
124 this->doReserve(nocopy, len);
131template<
class T,
int SizeMin>
139template<
class T,
int SizeMin>
149template<
class T,
int SizeMin>
161template<
class T,
int SizeMin>
169 capacity_(
Field<
T>::size())
173template<
class T,
int SizeMin>
184template<
class T,
int SizeMin>
185template<
int AnySizeMin>
192 capacity_(
Field<
T>::size())
196template<
class T,
int SizeMin>
203 capacity_(
Field<
T>::size())
207template<
class T,
int SizeMin>
215 capacity_(
Field<
T>::size())
219template<
class T,
int SizeMin>
225 Field<
T>(std::move(content)),
226 capacity_(
Field<
T>::size())
230template<
class T,
int SizeMin>
231template<
int AnySizeMin>
244template<
class T,
int SizeMin>
257template<
class T,
int SizeMin>
258template<
int AnySizeMin>
271template<
class T,
int SizeMin>
279 capacity_(
Field<
T>::size())
283template<
class T,
int SizeMin>
296template<
class T,
int SizeMin>
304 capacity_(
Field<
T>::size())
308template<
class T,
int SizeMin>
312 capacity_(
Field<
T>::size())
316template<
class T,
int SizeMin>
326template<
class T,
int SizeMin>
333template<
class T,
int SizeMin>
334inline std::streamsize
337 return std::streamsize(capacity_)*
sizeof(
T);
341template<
class T,
int SizeMin>
347 this->doCapacity(
false, len);
351template<
class T,
int SizeMin>
357 this->doCapacity(
true, len);
361template<
class T,
int SizeMin>
371template<
class T,
int SizeMin>
377 this->doReserve(
false, len);
381template<
class T,
int SizeMin>
387 this->doReserve(
true, len);
391template<
class T,
int SizeMin>
397 this->doResize(
false, len);
401template<
class T,
int SizeMin>
407 this->doResize(
true, len);
411template<
class T,
int SizeMin>
424 this->operator[](idx) = val;
430template<
class T,
int SizeMin>
437template<
class T,
int SizeMin>
445template<
class T,
int SizeMin>
457template<
class T,
int SizeMin>
462 if (currLen < capacity_)
473template<
class T,
int SizeMin>
477 this->shrinkStorage();
482template<
class T,
int SizeMin>
483template<
int AnySizeMin>
491 static_cast<const List<T>*
>(
this)
492 ==
static_cast<const List<T>*
>(&other)
502 std::swap(this->capacity_, other.capacity_);
506template<
class T,
int SizeMin>
507template<
int AnySizeMin>
515 static_cast<const List<T>*
>(
this)
516 ==
static_cast<const List<T>*
>(&other)
526 const label oldCap = this->capacity();
527 const label newCap = other.
capacity();
529 this->setCapacity_unsafe(newCap);
534template<
class T,
int SizeMin>
538 capacity_ = list.
size();
543template<
class T,
int SizeMin>
544template<
int AnySizeMin>
552 static_cast<const List<T>*
>(
this)
553 ==
static_cast<const List<T>*
>(&list)
568template<
class T,
int SizeMin>
569template<
int AnySizeMin>
577 static_cast<const List<T>*
>(
this)
578 ==
static_cast<const List<T>*
>(&list)
593template<
class T,
int SizeMin>
602 this->operator[](idx) = val;
606template<
class T,
int SizeMin>
615 this->operator[](idx) = std::move(val);
619template<
class T,
int SizeMin>
628 <<
"Attempted appending to self"
635 for (
const T& val : list)
637 this->operator[](idx++) = val;
642template<
class T,
int SizeMin>
664template<
class T,
int SizeMin>
675 return this->operator[](i);
679template<
class T,
int SizeMin>
689template<
class T,
int SizeMin>
699template<
class T,
int SizeMin>
709template<
class T,
int SizeMin>
724template<
class T,
int SizeMin>
734template<
class T,
int SizeMin>
744template<
class T,
int SizeMin>
745template<
int AnySizeMin>
755template<
class T,
int SizeMin>
756template<
int AnySizeMin>
768template<
class T,
int SizeMin>
787template<
class T,
int SizeMin>
794 return rhs.readList(is);
798template<
class T,
int SizeMin>
802 const DynamicField<T, SizeMin>& rhs
805 os << static_cast<const Field<T>&>(rhs);
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
T remove()
Remove and return the top element.
void swap(DynamicField< T, AnySizeMin > &other)
Swap content, independent of sizing parameter.
void resize_nocopy(const label len)
void setCapacity_nocopy(const label len)
void reserve_nocopy(const label len)
void setCapacity_unsafe(const label len) noexcept
std::streamsize capacity_bytes() const noexcept
Number of contiguous bytes of the underlying storage.
void clearStorage()
Clear the list and delete storage.
label capacity() const noexcept
Size of the underlying storage.
void shrinkStorage()
Shrink the allocated space to the number of elements used.
tmp< DynamicField< T, SizeMin > > clone() const
Clone.
label expandStorage() noexcept
Expand the addressable size to fit the allocated capacity.
constexpr DynamicField() noexcept
Default construct, an empty field without allocation.
DynamicField< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
void reserve(const label len)
void setCapacity(const label len)
Alter the size of the underlying storage.
Istream & readList(Istream &is)
Read from Istream, discarding existing contents.
friend Ostream & operator(Ostream &os, const DynamicField< T, SizeMin > &rhs)
Write to Ostream.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void setCapacity_unsafe(const label len) noexcept
void clearStorage()
Clear the list and delete storage.
label capacity() const noexcept
Size of the underlying storage.
Istream & readList(Istream &is)
Read from Istream, discarding existing contents.
virtual bool resize()
Resize the ODE solver.
Abstract base class to hold the Field mapping addressing and weights.
Generic templated field type.
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
transferModelList & transfer()
Transfer.
A class for managing temporary objects.
bool append() const noexcept
True if output format uses an append mode.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
patchWriters resize(patchIds.size())
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)