DynamicField< T, SizeMin > Class Template Reference

Dynamically sized Field. More...

Inheritance diagram for DynamicField< T, SizeMin >:
[legend]

Public Member Functions

constexpr DynamicField () noexcept
 Construct null. More...
 
 DynamicField (const label len)
 Construct empty field with given reserve size. More...
 
 DynamicField (const label len, const T &val)
 Construct given size and initial value. More...
 
 DynamicField (const label len, const Foam::zero)
 Construct given size and initial value of zero. More...
 
 DynamicField (const DynamicField< T, SizeMin > &list)
 Copy construct. More...
 
template<int AnySizeMin>
 DynamicField (const DynamicField< T, AnySizeMin > &list)
 Copy construct with different sizing parameters. More...
 
 DynamicField (const UList< T > &list)
 Copy construct from UList. Size set to UList size. More...
 
template<class Addr >
 DynamicField (const IndirectListBase< T, Addr > &list)
 Copy construct from IndirectList. More...
 
 DynamicField (List< T > &&content)
 Move construct from List contents. More...
 
 DynamicField (DynamicField< T, SizeMin > &&content)
 Move construct from dynamic Field contents. More...
 
template<int AnySizeMin>
 DynamicField (DynamicField< T, AnySizeMin > &&content)
 Move construct with different sizing parameters. More...
 
 DynamicField (const UList< T > &mapF, const labelUList &mapAddressing)
 Construct by 1 to 1 mapping from the given field. More...
 
 DynamicField (const UList< T > &mapF, const labelListList &mapAddressing, const scalarListList &weights)
 Construct by interpolative mapping from the given field. More...
 
 DynamicField (const UList< T > &mapF, const FieldMapper &map)
 Construct by mapping from the given field. More...
 
 DynamicField (Istream &is)
 Construct from Istream. Size set to size of list read. More...
 
tmp< DynamicField< T, SizeMin > > clone () const
 Clone. More...
 
label capacity () const noexcept
 Size of the underlying storage. More...
 
void setCapacity (const label nElem)
 Alter the size of the underlying storage. More...
 
void setSize (const label nElem)
 Alter the addressed list size. More...
 
void setSize (const label nElem, const T &val)
 Alter the addressed list size and fill new space with a constant. More...
 
void resize (const label nElem)
 Alter the addressed list size. More...
 
void resize (const label nElem, const T &val)
 Alter the addressed list size and fill new space with a. More...
 
void reserve (const label nElem)
 Reserve allocation space for at least this size. More...
 
void clear ()
 Clear the addressed list, i.e. set the size to zero. More...
 
void clearStorage ()
 Clear the list and delete storage. More...
 
label expandStorage ()
 Expand the addressable size to fit the allocated capacity. More...
 
DynamicField< T, SizeMin > & shrink ()
 Shrink the allocated space to the number of elements used. More...
 
template<int AnySizeMin>
void swap (DynamicField< T, AnySizeMin > &list)
 Swap content with any sized DynamicField. More...
 
void transfer (List< T > &list)
 Transfer the parameter contents into this. More...
 
template<int AnySizeMin>
void transfer (DynamicList< T, AnySizeMin > &list)
 Transfer the parameter contents into this. More...
 
template<int AnySizeMin>
void transfer (DynamicField< T, AnySizeMin > &list)
 Transfer the parameter contents into this. More...
 
DynamicField< T, SizeMin > & append (const T &val)
 Append an element at the end of the list. More...
 
DynamicField< T, SizeMin > & append (const UList< T > &list)
 Append a List at the end of this list. More...
 
T remove ()
 Remove and return the top element. More...
 
Toperator() (const label i)
 Return non-const access to an element, resizing list if necessary. More...
 
void operator= (const T &val)
 Assign addressed entries to the given value. More...
 
void operator= (const UList< T > &list)
 Copy assignment. More...
 
void operator= (const DynamicField< T, SizeMin > &list)
 Copy assignment. More...
 
void operator= (List< T > &&list)
 Move assignment. More...
 
void operator= (DynamicField< T, SizeMin > &&list)
 Move assignment. More...
 
template<int AnySizeMin>
void operator= (DynamicField< T, AnySizeMin > &&list)
 Move assignment. More...
 

Static Public Member Functions

static const DynamicField< T, SizeMin > & null ()
 Return a null field. More...
 

Detailed Description

template<class T, int SizeMin = 64>
class Foam::DynamicField< T, SizeMin >

Dynamically sized Field.

Source files

Definition at line 51 of file DynamicField.H.

Constructor & Destructor Documentation

◆ DynamicField() [1/15]

constexpr DynamicField ( )
inlineconstexprnoexcept

Construct null.

Definition at line 60 of file DynamicFieldI.H.

◆ DynamicField() [2/15]

DynamicField ( const label  len)
inlineexplicit

Construct empty field with given reserve size.

Definition at line 68 of file DynamicFieldI.H.

◆ DynamicField() [3/15]

DynamicField ( const label  len,
const T val 
)
inline

Construct given size and initial value.

Definition at line 79 of file DynamicFieldI.H.

◆ DynamicField() [4/15]

DynamicField ( const label  len,
const Foam::zero   
)
inline

Construct given size and initial value of zero.

Definition at line 91 of file DynamicFieldI.H.

◆ DynamicField() [5/15]

DynamicField ( const DynamicField< T, SizeMin > &  list)
inline

Copy construct.

Definition at line 103 of file DynamicFieldI.H.

◆ DynamicField() [6/15]

DynamicField ( const DynamicField< T, AnySizeMin > &  list)
inline

Copy construct with different sizing parameters.

Definition at line 115 of file DynamicFieldI.H.

◆ DynamicField() [7/15]

DynamicField ( const UList< T > &  list)
inlineexplicit

Copy construct from UList. Size set to UList size.

Also constructs from DynamicField with different sizing parameters.

Definition at line 126 of file DynamicFieldI.H.

◆ DynamicField() [8/15]

DynamicField ( const IndirectListBase< T, Addr > &  list)
inlineexplicit

Copy construct from IndirectList.

Definition at line 138 of file DynamicFieldI.H.

◆ DynamicField() [9/15]

DynamicField ( List< T > &&  content)
inlineexplicit

Move construct from List contents.

Definition at line 149 of file DynamicFieldI.H.

◆ DynamicField() [10/15]

DynamicField ( DynamicField< T, SizeMin > &&  content)
inline

Move construct from dynamic Field contents.

Definition at line 160 of file DynamicFieldI.H.

◆ DynamicField() [11/15]

DynamicField ( DynamicField< T, AnySizeMin > &&  content)
inline

Move construct with different sizing parameters.

Definition at line 174 of file DynamicFieldI.H.

◆ DynamicField() [12/15]

DynamicField ( const UList< T > &  mapF,
const labelUList mapAddressing 
)
inline

Construct by 1 to 1 mapping from the given field.

Definition at line 187 of file DynamicFieldI.H.

◆ DynamicField() [13/15]

DynamicField ( const UList< T > &  mapF,
const labelListList mapAddressing,
const scalarListList weights 
)
inline

Construct by interpolative mapping from the given field.

Definition at line 199 of file DynamicFieldI.H.

◆ DynamicField() [14/15]

DynamicField ( const UList< T > &  mapF,
const FieldMapper map 
)
inline

Construct by mapping from the given field.

Definition at line 213 of file DynamicFieldI.H.

◆ DynamicField() [15/15]

DynamicField ( Istream is)
explicit

Construct from Istream. Size set to size of list read.

Definition at line 34 of file DynamicField.C.

Member Function Documentation

◆ null()

static const DynamicField<T, SizeMin>& null ( )
inlinestatic

Return a null field.

Definition at line 96 of file DynamicField.H.

◆ clone()

Foam::tmp< Foam::DynamicField< T, SizeMin > > clone ( ) const

Clone.

Definition at line 43 of file DynamicField.C.

◆ capacity()

Foam::label capacity ( ) const
inlinenoexcept

Size of the underlying storage.

Definition at line 226 of file DynamicFieldI.H.

Referenced by extendedEdgeMesh::cut(), and DynamicField< Foam::Vector >::transfer().

Here is the caller graph for this function:

◆ setCapacity()

void setCapacity ( const label  nElem)
inline

Alter the size of the underlying storage.

The addressed size will be truncated if needed to fit, but will remain otherwise untouched. Use this or reserve() in combination with append().

Definition at line 234 of file DynamicFieldI.H.

Referenced by extendedEdgeMesh::cut(), and DynamicField< Foam::Vector >::swap().

Here is the caller graph for this function:

◆ setSize() [1/2]

void setSize ( const label  nElem)
inline

Alter the addressed list size.

New space will be allocated if required. Use this to resize the list prior to using the operator[] for setting values (as per List usage).

Definition at line 284 of file DynamicFieldI.H.

Referenced by DynamicField< Foam::Vector >::swap().

Here is the caller graph for this function:

◆ setSize() [2/2]

void setSize ( const label  nElem,
const T val 
)
inline

Alter the addressed list size and fill new space with a constant.

Definition at line 312 of file DynamicFieldI.H.

◆ resize() [1/2]

void resize ( const label  nElem)
inline

Alter the addressed list size.

New space will be allocated if required. Use this to resize the list prior to using the operator[] for setting values (as per List usage).

Definition at line 330 of file DynamicFieldI.H.

◆ resize() [2/2]

void resize ( const label  nElem,
const T val 
)
inline

Alter the addressed list size and fill new space with a.

constant.

Definition at line 340 of file DynamicFieldI.H.

◆ reserve()

void reserve ( const label  nElem)
inline

Reserve allocation space for at least this size.

Never shrinks the allocated size, use setCapacity() for that.

Definition at line 256 of file DynamicFieldI.H.

◆ clear()

void clear ( )
inline

Clear the addressed list, i.e. set the size to zero.

Allocated size does not change

Definition at line 350 of file DynamicFieldI.H.

Referenced by isoAlpha::reconstruct().

Here is the caller graph for this function:

◆ clearStorage()

void clearStorage ( )
inline

Clear the list and delete storage.

Definition at line 357 of file DynamicFieldI.H.

Referenced by zoneDistribute::getFields(), and DynamicField< Foam::Vector >::transfer().

Here is the caller graph for this function:

◆ expandStorage()

Foam::label expandStorage ( )
inline

Expand the addressable size to fit the allocated capacity.

Returns the previous addressable size.

Definition at line 365 of file DynamicFieldI.H.

Referenced by DynamicField< Foam::Vector >::swap().

Here is the caller graph for this function:

◆ shrink()

Foam::DynamicField< T, SizeMin > & shrink ( )
inline

Shrink the allocated space to the number of elements used.

Returns a reference to the DynamicField.

Definition at line 378 of file DynamicFieldI.H.

◆ swap()

void swap ( DynamicField< T, AnySizeMin > &  list)
inline

Swap content with any sized DynamicField.

Definition at line 398 of file DynamicFieldI.H.

◆ transfer() [1/3]

void transfer ( List< T > &  list)
inline

Transfer the parameter contents into this.

Definition at line 428 of file DynamicFieldI.H.

◆ transfer() [2/3]

void transfer ( DynamicList< T, AnySizeMin > &  list)
inline

Transfer the parameter contents into this.

Definition at line 439 of file DynamicFieldI.H.

◆ transfer() [3/3]

void transfer ( DynamicField< T, AnySizeMin > &  list)
inline

Transfer the parameter contents into this.

Definition at line 461 of file DynamicFieldI.H.

◆ append() [1/2]

Foam::DynamicField< T, SizeMin > & append ( const T val)
inline

Append an element at the end of the list.

Definition at line 483 of file DynamicFieldI.H.

Referenced by extendedEdgeMesh::add(), extendedEdgeMesh::cut(), zoneDistribute::getFields(), and isoAlpha::reconstruct().

Here is the caller graph for this function:

◆ append() [2/2]

Foam::DynamicField< T, SizeMin > & append ( const UList< T > &  list)
inline

Append a List at the end of this list.

Definition at line 498 of file DynamicFieldI.H.

◆ remove()

T remove ( )
inline

Remove and return the top element.

Definition at line 520 of file DynamicFieldI.H.

◆ operator()()

T & operator() ( const label  i)
inline

Return non-const access to an element, resizing list if necessary.

Definition at line 543 of file DynamicFieldI.H.

◆ operator=() [1/6]

void operator= ( const T val)
inline

Assign addressed entries to the given value.

Definition at line 558 of file DynamicFieldI.H.

◆ operator=() [2/6]

void operator= ( const UList< T > &  list)
inline

Copy assignment.

Definition at line 568 of file DynamicFieldI.H.

◆ operator=() [3/6]

void operator= ( const DynamicField< T, SizeMin > &  list)
inline

Copy assignment.

Definition at line 578 of file DynamicFieldI.H.

◆ operator=() [4/6]

void operator= ( List< T > &&  list)
inline

Move assignment.

Definition at line 593 of file DynamicFieldI.H.

◆ operator=() [5/6]

void operator= ( DynamicField< T, SizeMin > &&  list)
inline

Move assignment.

Definition at line 603 of file DynamicFieldI.H.

◆ operator=() [6/6]

void operator= ( DynamicField< T, AnySizeMin > &&  list)
inline

Move assignment.

Definition at line 614 of file DynamicFieldI.H.


The documentation for this class was generated from the following files: