FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

DynamicField< T, SizeInc, SizeMult, SizeDiv > Class Template Reference

Dynamically sized Field. More...

#include <OpenFOAM/DynamicField.H>


Detailed Description

template<class T, unsigned SizeInc = 0, unsigned SizeMult = 2, unsigned SizeDiv = 1>
class Foam::DynamicField< T, SizeInc, SizeMult, SizeDiv >

Dynamically sized Field.

Source files

Definition at line 70 of file DynamicField.H.

Inheritance diagram for DynamicField< T, SizeInc, SizeMult, SizeDiv >:
Collaboration diagram for DynamicField< T, SizeInc, SizeMult, SizeDiv >:

List of all members.

Public Member Functions

 DynamicField ()
 Construct null.
 DynamicField (const label)
 Construct given size.
 DynamicField (const UList< T > &)
 Construct from UList. Size set to UList size.
 DynamicField (const Xfer< List< T > > &)
 Construct by transferring the parameter contents.
 DynamicField (const UList< T > &mapF, const labelList &mapAddressing)
 Construct by 1 to 1 mapping from the given field.
 DynamicField (const UList< T > &mapF, const labelListList &mapAddressing, const scalarListList &weights)
 Construct by interpolative mapping from the given field.
 DynamicField (const UList< T > &mapF, const FieldMapper &map)
 Construct by mapping from the given field.
 DynamicField (const DynamicField< T, SizeInc, SizeMult, SizeDiv > &)
 Construct copy.
 DynamicField (const Xfer< DynamicField< T, SizeInc, SizeMult, SizeDiv > > &)
 Construct by transferring the Field contents.
 DynamicField (Istream &)
 Construct from Istream. Size set to size of list read.
tmp< DynamicField< T, SizeInc,
SizeMult, SizeDiv > >  
clone () const
 Clone.
label  capacity () const
 Size of the underlying storage.
void  setCapacity (const label)
 Alter the size of the underlying storage.
void  setSize (const label)
 Alter the addressed list size.
void  setSize (const label, const T &)
 Alter the addressed list size and fill new space with a.
void  resize (const label)
 Alter the addressed list size.
void  resize (const label, const T &)
 Alter the addressed list size and fill new space with a.
void  reserve (const label)
 Reserve allocation space for at least this size.
void  clear ()
 Clear the addressed list, i.e. set the size to zero.
void  clearStorage ()
 Clear the list and delete storage.
DynamicField< T, SizeInc,
SizeMult, SizeDiv > &  
shrink ()
 Shrink the allocated space to the number of elements used.
Xfer< List< T > >  xfer ()
 Transfer contents to the Xfer container as a plain List.
DynamicField< T, SizeInc,
SizeMult, SizeDiv > &  
append (const T &)
 Append an element at the end of the list.
DynamicField< T, SizeInc,
SizeMult, SizeDiv > &  
append (const UList< T > &)
 Append a List at the end of this list.
T  remove ()
 Remove and return the top element.
T &  operator() (const label)
 Return non-const access to an element, resizing list if.
void  operator= (const T &)
 Assignment of all addressed entries to the given value.
void  operator= (const DynamicField< T, SizeInc, SizeMult, SizeDiv > &)
 Assignment from DynamicField.
void  operator= (const UList< T > &)
 Assignment from UList.

Static Public Member Functions

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

Friends

Ostream &  operator (Ostream &, const DynamicField< T, SizeInc, SizeMult, SizeDiv > &)
Istream &  operator>> (Istream &, DynamicField< T, SizeInc, SizeMult, SizeDiv > &)
 Read from Istream, discarding contents of existing DynamicField.

Constructor & Destructor Documentation

DynamicField (  ) [inline]

Construct null.

Definition at line 29 of file DynamicFieldI.H.

DynamicField ( const label   nElem  ) [inline, explicit]

Construct given size.

Definition at line 38 of file DynamicFieldI.H.

References List< Type >::size().

DynamicField ( const UList< T > &   lst  ) [inline, explicit]

Construct from UList. Size set to UList size.

Also constructs from DynamicField with different sizing parameters.

Definition at line 52 of file DynamicFieldI.H.

DynamicField ( const Xfer< List< T > > &   lst  ) [inline, explicit]

Construct by transferring the parameter contents.

Definition at line 63 of file DynamicFieldI.H.

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 ( 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 ( const UList< T > &   mapF,
const FieldMapper &   map  
) [inline]

Construct by mapping from the given field.

Definition at line 100 of file DynamicFieldI.H.

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

Construct copy.

Definition at line 112 of file DynamicFieldI.H.

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

Construct by transferring the Field contents.

Definition at line 123 of file DynamicFieldI.H.

DynamicField ( Istream &   is  ) [explicit]

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

Definition at line 31 of file DynamicField.C.


Member Function Documentation

static const DynamicField<T, SizeInc, SizeMult, SizeDiv>& null (  ) [inline, static]

Return a null field.

Reimplemented from Field< T >.

Definition at line 85 of file DynamicField.H.

References reinterpret_cast().

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

Clone.

Reimplemented from Field< T >.

Definition at line 40 of file DynamicField.C.

Foam::label capacity (  ) const [inline]

Size of the underlying storage.

Definition at line 135 of file DynamicFieldI.H.

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 List< Type >::setSize(), and List< Type >::size().

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).

Reimplemented from List< T >.

Definition at line 202 of file DynamicFieldI.H.

References Foam::max(), List< Type >::setSize(), and List< Type >::size().

void setSize ( const label   nElem,
const T &   t  
) [inline]

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

constant.

Reimplemented from List< T >.

Definition at line 239 of file DynamicFieldI.H.

References setSize(), and List< Type >::size().

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).

Reimplemented from List< T >.

Definition at line 257 of file DynamicFieldI.H.

References setSize().

void resize ( const label   nElem,
const T &   t  
) [inline]

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

constant.

Reimplemented from List< T >.

Definition at line 267 of file DynamicFieldI.H.

References setSize().

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(), List< Type >::setSize(), and List< Type >::size().

void clear (  ) [inline]

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

Allocated size does not change

Reimplemented from List< T >.

Definition at line 277 of file DynamicFieldI.H.

References List< Type >::size().

void clearStorage (  ) [inline]

Clear the list and delete storage.

Definition at line 284 of file DynamicFieldI.H.

References List< Type >::clear().

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 List< Type >::setSize(), and List< Type >::size().

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

Transfer contents to the Xfer container as a plain List.

Reimplemented from List< T >.

Definition at line 312 of file DynamicFieldI.H.

Foam::DynamicField< T, SizeInc, SizeMult, SizeDiv > & append ( const T &   t  ) [inline]

Append an element at the end of the list.

Definition at line 321 of file DynamicFieldI.H.

References setSize(), and List< T >::size().

Foam::DynamicField< T, SizeInc, SizeMult, SizeDiv > & append ( const UList< T > &   lst  ) [inline]

Append a List at the end of this list.

Reimplemented from List< T >.

Definition at line 336 of file DynamicFieldI.H.

References Foam::abort(), Foam::FatalError, FatalErrorIn, forAll, setSize(), UList< T >::size(), and List< T >::size().

T remove (  ) [inline]

Remove and return the top element.

Definition at line 361 of file DynamicFieldI.H.

References Foam::abort(), Foam::FatalError, FatalErrorIn, UList< T >::operator[](), List< T >::size(), and Foam::T().

T & operator() ( const label   elemI  ) [inline]

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

necessary

Definition at line 385 of file DynamicFieldI.H.

References setSize().

void operator= ( const T &   t  ) [inline]

Assignment of all addressed entries to the given value.

Reimplemented from Field< T >.

Definition at line 400 of file DynamicFieldI.H.

References UList< T >::operator=().

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

Assignment from UList.

Reimplemented from Field< T >.

Definition at line 442 of file DynamicFieldI.H.

References Field< Type >::operator=(), List< Type >::size(), and UList< T >::size().


Friends And Related Function Documentation

Ostream& operator ( Ostream &   ,
const DynamicField< T, SizeInc, SizeMult, SizeDiv > &    
) [friend]
Istream& operator>> ( Istream &   ,
DynamicField< T, SizeInc, SizeMult, SizeDiv > &    
) [friend]

Read from Istream, discarding contents of existing DynamicField.


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