OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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

A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects. More...

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

List of all members.


Public Member Functions

 DynamicList ()
 Construct null.
 DynamicList (const label)
 Construct given size.
 DynamicList (const DynamicList< T, SizeInc, SizeMult, SizeDiv > &)
 Construct copy.
 DynamicList (const UList< T > &)
 Construct from UList. Size set to UList size.
 DynamicList (const UIndirectList< T > &)
 Construct from UIndirectList. Size set to UIndirectList size.
 DynamicList (const Xfer< List< T > > &)
 Construct by transferring the parameter contents.
 DynamicList (Istream &)
 Construct from Istream. Size set to size of read list.
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 constant.
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 constant.
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.
DynamicList< T, SizeInc,
SizeMult, SizeDiv > & 
shrink ()
 Shrink the allocated space to the number of elements used.
void transfer (List< T > &)
 Transfer contents of the argument List into this DynamicList.
void transfer (DynamicList< T, SizeInc, SizeMult, SizeDiv > &)
 Transfer contents of the argument DynamicList into this DynamicList.
Xfer< List< T > > xfer ()
 Transfer contents to the Xfer container as a plain List.
void append (const T &)
 Append an element at the end of the list.
void append (const UList< T > &)
 Append a List at the end of this list.
void append (const UIndirectList< T > &)
 Append a UIndirectList at the end of this list.
remove ()
 Remove and return the top element.
T & operator() (const label)
 Return non-const access to an element, resizing list if necessary.
void operator= (const T &)
 Assignment of all addressed entries to the given value.
void operator= (const DynamicList< T, SizeInc, SizeMult, SizeDiv > &)
 Assignment from DynamicList.
void operator= (const UList< T > &)
 Assignment from UList.

Friends

class List< T >
 Declare friendship with the List class.
Ostreamoperator (Ostream &, const DynamicList< T, SizeInc, SizeMult, SizeDiv > &)
Istreamoperator>> (Istream &, DynamicList< T, SizeInc, SizeMult, SizeDiv > &)
 Read from Istream, discarding contents of existing DynamicList.

Detailed Description

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

A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.

Internal storage is a compact array and the list can be shrunk to compact storage. The increase of list size is controlled by three template parameters, which allows the list storage to either increase by the given increment or by the given multiplier and divider (allowing non-integer multiples).

Source files

Definition at line 72 of file DynamicList.H.


Constructor & Destructor Documentation

DynamicList (  )  [inline]

Construct null.

Definition at line 21 of file DynamicListI.H.

DynamicList ( const label  nElem  )  [inline, explicit]

Construct given size.

Definition at line 32 of file DynamicListI.H.

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

Construct copy.

Definition at line 46 of file DynamicListI.H.

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

Construct from UList. Size set to UList size.

Also constructs from DynamicList with different sizing parameters.

Definition at line 57 of file DynamicListI.H.

DynamicList ( const UIndirectList< T > &  lst  )  [inline, explicit]

Construct from UIndirectList. Size set to UIndirectList size.

Definition at line 68 of file DynamicListI.H.

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

Construct by transferring the parameter contents.

Definition at line 79 of file DynamicListI.H.

DynamicList ( Istream is  )  [inline, explicit]

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

Definition at line 24 of file DynamicList.C.


Member Function Documentation

Foam::label capacity (  )  const [inline]

Size of the underlying storage.

Definition at line 92 of file DynamicListI.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 101 of file DynamicListI.H.

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 159 of file DynamicListI.H.

Referenced by DynamicList< T, SizeInc, SizeMult, SizeDiv >::clear(), and DynamicList< T, SizeInc, SizeMult, SizeDiv >::resize().

Here is the caller graph for this function:

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 196 of file DynamicListI.H.

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 214 of file DynamicListI.H.

References UList< T >::operator[]().

Here is the call graph for this function:

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 224 of file DynamicListI.H.

References DynamicList< T, SizeInc, SizeMult, SizeDiv >::setSize().

Here is the call graph for this function:

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 122 of file DynamicListI.H.

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 234 of file DynamicListI.H.

References DynamicList< T, SizeInc, SizeMult, SizeDiv >::setSize().

Referenced by Particle< ParticleType >::findFaces(), and DynamicList< T, SizeInc, SizeMult, SizeDiv >::shrink().

Here is the call graph for this function:

Here is the caller graph for this function:

void clearStorage (  )  [inline]

Clear the list and delete storage.

Definition at line 241 of file DynamicListI.H.

References List< T >::size().

Here is the call graph for this function:

Foam::DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink (  )  [inline]

Shrink the allocated space to the number of elements used.

Returns a reference to the DynamicList.

Definition at line 250 of file DynamicListI.H.

References DynamicList< T, SizeInc, SizeMult, SizeDiv >::clear().

Referenced by boundaryMesh::getNearest(), and Foam::parseNASCoord().

Here is the call graph for this function:

Here is the caller graph for this function:

void transfer ( List< T > &  lst  )  [inline]

Transfer contents of the argument List into this DynamicList.

Reimplemented from List< T >.

Definition at line 269 of file DynamicListI.H.

Referenced by DynamicList< T, SizeInc, SizeMult, SizeDiv >::transfer().

Here is the caller graph for this function:

void transfer ( DynamicList< T, SizeInc, SizeMult, SizeDiv > &  lst  )  [inline]

Transfer contents of the argument DynamicList into this DynamicList.

Reimplemented from List< T >.

Definition at line 279 of file DynamicListI.H.

References DynamicList< T, SizeInc, SizeMult, SizeDiv >::transfer().

Here is the call graph for this function:

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

Transfer contents to the Xfer container as a plain List.

Reimplemented from List< T >.

Definition at line 293 of file DynamicListI.H.

Referenced by Foam::parseNASCoord().

Here is the caller graph for this function:

void append ( const T &  t  )  [inline]

Append an element at the end of the list.

Definition at line 301 of file DynamicListI.H.

Referenced by primitiveMesh::cellEdges(), fileName::components(), Particle< ParticleType >::findFaces(), FreeStream< CloudType >::FreeStream(), boundaryMesh::getNearest(), and Foam::parseNASCoord().

Here is the caller graph for this function:

void append ( const UList< T > &  lst  )  [inline]

Append a List at the end of this list.

Reimplemented from List< T >.

Definition at line 314 of file DynamicListI.H.

void append ( const UIndirectList< T > &  lst  )  [inline]

Append a UIndirectList at the end of this list.

Reimplemented from List< T >.

Definition at line 339 of file DynamicListI.H.

References UList< T >::operator[]().

Here is the call graph for this function:

T remove (  )  [inline]

Remove and return the top element.

Definition at line 354 of file DynamicListI.H.

References UList< T >::operator[]().

Here is the call graph for this function:

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

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

Definition at line 378 of file DynamicListI.H.

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

Assignment of all addressed entries to the given value.

Reimplemented from List< T >.

Definition at line 393 of file DynamicListI.H.

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

Assignment from DynamicList.

Definition at line 426 of file DynamicListI.H.

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

Assignment from UList.

Reimplemented from List< T >.

Definition at line 403 of file DynamicListI.H.

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

Here is the call graph for this function:


Friends And Related Function Documentation

friend class List< T > [friend]

Declare friendship with the List class.

Reimplemented from UList< T >.

Definition at line 88 of file DynamicList.H.

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

Istream& operator>> ( Istream ,
DynamicList< T, SizeInc, SizeMult, SizeDiv > &   
) [friend]

Read from Istream, discarding contents of existing DynamicList.


The documentation for this class was generated from the following files:
Copyright © 2000-2009 OpenCFD Ltd