Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
DynamicField Class Reference

Dynamically sized Field. More...

Public Member Functions

 DynamicField ()
 Construct null. More...
 
 DynamicField (const label)
 Construct given size. More...
 
 DynamicField (const UList< T > &)
 Construct from UList. Size set to UList size. More...
 
 DynamicField (const Xfer< List< T > > &)
 Construct by transferring the parameter contents. More...
 
 DynamicField (const UList< T > &mapF, const labelList &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 (const DynamicField< T, SizeInc, SizeMult, SizeDiv > &)
 Construct copy. More...
 
 DynamicField (const Xfer< DynamicField< T, SizeInc, SizeMult, SizeDiv > > &)
 Construct by transferring the Field contents. More...
 
 DynamicField (Istream &)
 Construct from Istream. Size set to size of list read. More...
 
tmp< DynamicField< T, SizeInc, SizeMult, SizeDiv > > clone () const
 Clone. More...
 
label capacity () const
 Size of the underlying storage. More...
 
void setCapacity (const label)
 Alter the size of the underlying storage. More...
 
void setSize (const label)
 Alter the addressed list size. More...
 
void setSize (const label, const T &)
 Alter the addressed list size and fill new space with a. More...
 
void resize (const label)
 Alter the addressed list size. More...
 
void resize (const label, const T &)
 Alter the addressed list size and fill new space with a. More...
 
void reserve (const label)
 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...
 
DynamicField< T, SizeInc, SizeMult, SizeDiv > & shrink ()
 Shrink the allocated space to the number of elements used. More...
 
Xfer< List< T > > xfer ()
 Transfer contents to the Xfer container as a plain List. More...
 
DynamicField< T, SizeInc, SizeMult, SizeDiv > & append (const T &)
 Append an element at the end of the list. More...
 
DynamicField< T, SizeInc, SizeMult, SizeDiv > & append (const UList< T > &)
 Append a List at the end of this list. More...
 
T remove ()
 Remove and return the top element. More...
 
Toperator() (const label)
 Return non-const access to an element, resizing list if. More...
 
void operator= (const T &)
 Assignment of all addressed entries to the given value. More...
 
void operator= (const DynamicField< T, SizeInc, SizeMult, SizeDiv > &)
 Assignment from DynamicField. More...
 
void operator= (const UList< T > &)
 Assignment from UList. More...
 

Static Public Member Functions

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

Private Member Functions

 StaticAssert ((SizeInc||SizeMult) &&SizeDiv)
 Avoid invalid sizing parameters. More...
 

Private Attributes

label capacity_
 The capacity (allocated size) of the underlying field. More...
 

Detailed Description

Dynamically sized Field.

Source files

Definition at line 49 of file DynamicField.H.

Constructor & Destructor Documentation

◆ DynamicField() [1/10]

DynamicField ( )
inline

Construct null.

Definition at line 29 of file DynamicFieldI.H.

◆ DynamicField() [2/10]

DynamicField ( const  label)
inlineexplicit

Construct given size.

◆ DynamicField() [3/10]

DynamicField ( const UList< T > &  )
inlineexplicit

Construct from UList. Size set to UList size.

Also constructs from DynamicField with different sizing parameters.

◆ DynamicField() [4/10]

DynamicField ( const Xfer< List< T > > &  )
inlineexplicit

Construct by transferring the parameter contents.

◆ DynamicField() [5/10]

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

Construct by 1 to 1 mapping from the given field.

Definition at line 74 of file DynamicFieldI.H.

◆ DynamicField() [6/10]

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

Construct by interpolative mapping from the given field.

Definition at line 86 of file DynamicFieldI.H.

◆ DynamicField() [7/10]

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

Construct by mapping from the given field.

Definition at line 100 of file DynamicFieldI.H.

◆ DynamicField() [8/10]

DynamicField ( const DynamicField< T, SizeInc, SizeMult, SizeDiv > &  )
inline

Construct copy.

◆ DynamicField() [9/10]

DynamicField ( const Xfer< DynamicField< T, SizeInc, SizeMult, SizeDiv > > &  )
inline

Construct by transferring the Field contents.

◆ DynamicField() [10/10]

DynamicField ( Istream )
explicit

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

Member Function Documentation

◆ StaticAssert()

StaticAssert ( (SizeInc||SizeMult) &&  SizeDiv)
private

Avoid invalid sizing parameters.

◆ null()

static const DynamicField<T, SizeInc, SizeMult, SizeDiv>& null ( )
inlinestatic

Return a null field.

Definition at line 89 of file DynamicField.H.

References reinterpret_cast().

Here is the call graph for this function:

◆ clone()

Foam::tmp< Foam::DynamicField< T, SizeInc, SizeMult, SizeDiv > > clone ( ) const

Clone.

Definition at line 40 of file DynamicField.C.

◆ capacity()

Foam::label capacity ( ) const
inline

Size of the underlying storage.

Definition at line 135 of file DynamicFieldI.H.

Referenced by searchableSurfaces::checkIntersection(), extendedEdgeMesh::cut(), and meshRefinement::markSurfaceGapRefinement().

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 144 of file DynamicFieldI.H.

References setSize().

Referenced by extendedEdgeMesh::cut().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSize() [1/2]

void setSize ( const  label)
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).

Referenced by main().

Here is the caller graph for this function:

◆ setSize() [2/2]

void setSize ( const  label,
const T  
)
inline

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

constant.

◆ resize() [1/2]

void resize ( const  label)
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).

◆ resize() [2/2]

void resize ( const  label,
const T  
)
inline

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

constant.

◆ 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 165 of file DynamicFieldI.H.

References Foam::max(), and setSize().

Here is the call graph for this function:

◆ clear()

void clear ( )
inline

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

Allocated size does not change

Definition at line 277 of file DynamicFieldI.H.

Referenced by faceHeatShading::calculate(), faceShading::calculate(), autoSnapDriver::findDiagonalAttraction(), main(), and searchableSurfacesQueries::signedDistance().

Here is the caller graph for this function:

◆ clearStorage()

void clearStorage ( )
inline

Clear the list and delete storage.

Definition at line 284 of file DynamicFieldI.H.

References clear().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shrink()

Foam::DynamicField< T, SizeInc, SizeMult, SizeDiv > & shrink ( )
inline

Shrink the allocated space to the number of elements used.

Returns a reference to the DynamicField.

Definition at line 293 of file DynamicFieldI.H.

References setSize().

Referenced by meshRefinement::markInternalGapRefinement(), meshRefinement::markSmallFeatureRefinement(), and meshRefinement::markSurfaceGapRefinement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xfer()

Foam::Xfer< Foam::List< T > > xfer ( )
inline

Transfer contents to the Xfer container as a plain List.

Definition at line 312 of file DynamicFieldI.H.

Referenced by searchableSurfaces::checkIntersection().

Here is the caller graph for this function:

◆ append() [1/2]

DynamicField<T, SizeInc, SizeMult, SizeDiv>& append ( const T )
inline

◆ append() [2/2]

DynamicField<T, SizeInc, SizeMult, SizeDiv>& append ( const UList< T > &  )
inline

Append a List at the end of this list.

◆ remove()

T remove ( )
inline

Remove and return the top element.

Definition at line 358 of file DynamicFieldI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, List::size(), and Foam::T().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator()()

T & operator() ( const label  elemI)
inline

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

necessary

Definition at line 380 of file DynamicFieldI.H.

References setSize().

Here is the call graph for this function:

◆ operator=() [1/3]

void operator= ( const T )
inline

Assignment of all addressed entries to the given value.

◆ operator=() [2/3]

void operator= ( const DynamicField< T, SizeInc, SizeMult, SizeDiv > &  )
inline

Assignment from DynamicField.

◆ operator=() [3/3]

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

Assignment from UList.

Field Documentation

◆ capacity_

label capacity_
private

The capacity (allocated size) of the underlying field.

Definition at line 81 of file DynamicField.H.


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