33template<
class T,
int SizeMin>
34template<
class ListType>
40 const label len = list.
size();
45 List<T>::setAddressableSize(capacity_);
46 List<T>::resize_nocopy(len);
47 capacity_ = List<T>::size();
51 List<T>::setAddressableSize(len);
52 List<T>::operator=(list);
56template<
class T,
int SizeMin>
60 const label newCapacity
63 if (newCapacity == capacity_)
69 const label currLen =
min(List<T>::size(), newCapacity);
72 if (List<T>::size() == newCapacity)
78 List<T>::setAddressableSize(currLen+1);
83 List<T>::resize_nocopy(newCapacity);
87 List<T>::resize(newCapacity);
90 capacity_ = List<T>::size();
91 List<T>::setAddressableSize(currLen);
95template<
class T,
int SizeMin>
105 const label currLen = List<T>::size();
108 capacity_ =
max(SizeMin,
max(len, label(2*capacity_)));
112 List<T>::resize_nocopy(capacity_);
123template<
class T,
int SizeMin>
130 this->doReserve(nocopy, len);
137template<
class T,
int SizeMin>
145template<
class T,
int SizeMin>
155template<
class T,
int SizeMin>
163 capacity_(
List<
T>::size())
167template<
class T,
int SizeMin>
175 capacity_(
List<
T>::size())
179template<
class T,
int SizeMin>
190template<
class T,
int SizeMin>
191template<
int AnySizeMin>
198 capacity_(
List<
T>::size())
202template<
class T,
int SizeMin>
213template<
class T,
int SizeMin>
221 capacity_(
List<
T>::size())
225template<
class T,
int SizeMin>
228 std::initializer_list<T> lst
232 capacity_(
List<
T>::size())
236template<
class T,
int SizeMin>
244 capacity_(
List<
T>::size())
248template<
class T,
int SizeMin>
260template<
class T,
int SizeMin>
261template<
int AnySizeMin>
273template<
class T,
int SizeMin>
280 capacity_(
List<
T>::size())
286template<
class T,
int SizeMin>
293template<
class T,
int SizeMin>
294inline std::streamsize
297 return std::streamsize(capacity_)*
sizeof(
T);
301template<
class T,
int SizeMin>
307 this->doCapacity(
false, len);
311template<
class T,
int SizeMin>
317 this->doCapacity(
true, len);
321template<
class T,
int SizeMin>
331template<
class T,
int SizeMin>
337 this->doReserve(
false, len);
341template<
class T,
int SizeMin>
347 this->doReserve(
true, len);
351template<
class T,
int SizeMin>
357 this->doResize(
false, len);
361template<
class T,
int SizeMin>
367 this->doResize(
true, len);
371template<
class T,
int SizeMin>
384 this->operator[](idx) = val;
390template<
class T,
int SizeMin>
397template<
class T,
int SizeMin>
405template<
class T,
int SizeMin>
417template<
class T,
int SizeMin>
421 if (currLen < capacity_)
432template<
class T,
int SizeMin>
436 this->shrinkStorage();
441template<
class T,
int SizeMin>
442template<
int AnySizeMin>
450 static_cast<const List<T>*
>(
this)
451 ==
static_cast<const List<T>*
>(&other)
461 std::swap(this->capacity_, other.capacity_);
465template<
class T,
int SizeMin>
470 capacity_ = list.
size();
475template<
class T,
int SizeMin>
476template<
int AnySizeMin>
485 static_cast<const List<T>*
>(
this)
486 ==
static_cast<const List<T>*
>(&list)
501template<
class T,
int SizeMin>
510 this->operator[](idx) = val;
514template<
class T,
int SizeMin>
523 this->operator[](idx) = std::move(val);
527template<
class T,
int SizeMin>
536 <<
"Attempted appending to self"
543 for (
const T& val : lst)
545 this->operator[](idx++) = val;
550template<
class T,
int SizeMin>
560 for (
const T& val : lst)
562 this->operator[](idx++) = val;
567template<
class T,
int SizeMin>
570 std::initializer_list<T> lst
576 for (
const T& val : lst)
578 this->operator[](idx++) = val;
583template<
class T,
int SizeMin>
591 const label
n = lst.
size();
595 for (label i=0; i<
n; ++i)
597 this->operator[](idx++) = lst[i];
602template<
class T,
int SizeMin>
611 <<
"Attempted appending to self"
627template<
class T,
int SizeMin>
628template<
int AnySizeMin>
639template<
class T,
int SizeMin>
642 if (this->
found(val))
654template<
class T,
int SizeMin>
674template<
class T,
int SizeMin>
693 return this->remove();
697template<
class T,
int SizeMin>
703 return this->removeElements(this->validateRange(
range));
707template<
class T,
int SizeMin>
710 std::initializer_list<label> start_size
713 return this->removeElements(this->validateRange(start_size));
717template<
class T,
int SizeMin>
723 return this->subsetElements(this->validateRange(
range));
727template<
class T,
int SizeMin>
730 std::initializer_list<label> start_size
733 return this->subsetElements(this->validateRange(start_size));
739template<
class T,
int SizeMin>
750 return this->operator[](i);
754template<
class T,
int SizeMin>
764template<
class T,
int SizeMin>
774template<
class T,
int SizeMin>
784template<
class T,
int SizeMin>
795template<
class T,
int SizeMin>
810template<
class T,
int SizeMin>
811template<
int AnySizeMin>
819 static_cast<const List<T>*
>(
this)
820 ==
static_cast<const List<T>*
>(&list)
830template<
class T,
int SizeMin>
833 std::initializer_list<T> lst
840template<
class T,
int SizeMin>
851template<
class T,
int SizeMin>
862template<
class T,
int SizeMin>
878template<
class T,
int SizeMin>
879template<
int AnySizeMin>
887 static_cast<const List<T>*
>(
this)
888 ==
static_cast<const List<T>*
>(&list)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
constexpr DynamicList() noexcept
Default construct, an empty list without allocation.
void swap(DynamicList< T, AnySizeMin > &other)
Swap content, independent of sizing parameter.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
T remove()
Remove and return the last element. Fatal on an empty list.
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
void transfer(DynamicList< T, AnySizeMin > &list)
Transfer contents of any sized DynamicList into this.
std::streamsize capacity_bytes() const noexcept
Number of contiguous bytes of the underlying storage.
void clearStorage()
Clear the list and delete storage.
label appendUniq(const T &val)
Append an element if not already in the list.
label capacity() const noexcept
Size of the underlying storage.
void shrinkStorage()
Shrink the allocated space to the number of elements used.
label expandStorage() noexcept
Expand the addressable size to fit the allocated capacity.
friend Ostream & operator(Ostream &os, const DynamicList< T, SizeMin > &list)
Write to Ostream.
void reserve(const label len)
label subset(const labelRange &range)
Retain a (start,size) subset from the list.
void setCapacity(const label len)
Alter the size of the underlying storage.
virtual bool resize()
Resize the ODE solver.
A 1D vector of objects of type <T> with a fixed length <N>.
static constexpr label size() noexcept
Return the number of elements in the FixedList.
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
label size() const noexcept
The number of elements in the list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
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.
A range or interval of labels defined by a start and a size.
transferModelList & transfer()
Transfer.
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.
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)