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

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

#include <OpenFOAM/DynamicList.H>


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 77 of file DynamicList.H.

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.
T  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.
Ostream &  operator (Ostream &, const DynamicList< T, SizeInc, SizeMult, SizeDiv > &)
Istream &  operator>> (Istream &, DynamicList< T, SizeInc, SizeMult, SizeDiv > &)
 Read from Istream, discarding contents of existing DynamicList.

Constructor & Destructor Documentation

DynamicList (  ) [inline]

Construct null.

Definition at line 29 of file DynamicListI.H.

References List< T >::size().

DynamicList ( const label   nElem  ) [inline, explicit]

Construct given size.

Definition at line 40 of file DynamicListI.H.

References List< T >::size().

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

Construct copy.

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

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

Construct from UIndirectList. Size set to UIndirectList size.

Definition at line 76 of file DynamicListI.H.

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

Construct by transferring the parameter contents.

Definition at line 87 of file DynamicListI.H.

DynamicList ( Istream &   is  ) [explicit]

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

Definition at line 32 of file DynamicList.C.


Member Function Documentation

Foam::label capacity (  ) const [inline]

Size of the underlying storage.

Definition at line 100 of file DynamicListI.H.

Referenced by primitiveMesh::cellEdges(), primitiveMesh::cellPoints(), primitiveMesh::faceEdges(), and primitiveMesh::pointPoints().

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

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

Referenced by primitiveMesh::cellEdges(), primitiveMesh::cellPoints(), primitiveMesh::faceEdges(), primitiveMesh::pointPoints(), and surfaceFeatures::selectFeatureEdges().

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

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

Referenced by primitiveMesh::pointCells(), and face::triangles().

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

References setSize(), and List< T >::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 222 of file DynamicListI.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 232 of file DynamicListI.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 130 of file DynamicListI.H.

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

Referenced by STARCDsurfaceFormat< Face >::read().

void clearStorage (  ) [inline]

Clear the list and delete storage.

Definition at line 249 of file DynamicListI.H.

References List< T >::clear().

Referenced by NASsurfaceFormat< Face >::read(), and List< T >::transfer().

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

Transfer contents of the argument List into this DynamicList.

Reimplemented from List< T >.

Definition at line 277 of file DynamicListI.H.

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

Referenced by OBJsurfaceFormat< Face >::read().

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

References List< T >::transfer().

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

Transfer contents to the Xfer container as a plain List.

Reimplemented from List< T >.

Definition at line 301 of file DynamicListI.H.

Referenced by fileName::components(), STARCDsurfaceFormat< Face >::read(), OFFsurfaceFormat< Face >::read(), OBJsurfaceFormat< Face >::read(), and NASsurfaceFormat< Face >::read().

void append ( const T &   t  ) [inline]

Append an element at the end of the list.

Definition at line 309 of file DynamicListI.H.

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

Referenced by pointZoneSet::addSet(), faceZoneSet::addSet(), cellZoneSet::addSet(), normalToFace::applyToSet(), primitiveMesh::cellCells(), primitiveMesh::cellEdges(), primitiveMesh::cellPoints(), fileName::components(), geomCellLooper::cut(), primitiveMesh::edgeCells(), primitiveMesh::edgeFaces(), primitiveMesh::faceEdges(), Particle< ParticleType >::findFaces(), triSurfaceMesh::findLineAll(), searchableBox::findLineAll(), FreeStream< CloudType >::FreeStream(), removeCells::getExposedFaces(), boundaryMesh::getNearest(), indexedOctree< Type >::indexedOctree(), meshSearch::intersections(), LocalInteraction< CloudType >::LocalInteraction(), hsReactionThermo::NewType(), hReactionThermo::NewType(), hsCombustionThermo::NewType(), hCombustionThermo::NewType(), csvTableReader< Type >::operator()(), primitiveMesh::pointCells(), primitiveMesh::pointPoints(), ProcessorTopology< Patch, ProcPatch >::ProcessorTopology(), STARCDsurfaceFormat< Face >::read(), OFFsurfaceFormat< Face >::read(), OBJsurfaceFormat< Face >::read(), NASsurfaceFormat< Face >::read(), AC3DsurfaceFormat< Face >::read(), STARCDsurfaceFormatCore::readPoints(), interactionLists::realCellsInRangeOfSegment(), interactionLists::referredCellsInRangeOfSegment(), searchableSurfaceCollection::regions(), scalarRanges::scalarRanges(), surfaceFeatures::selectFeatureEdges(), dynamicRefineFvMesh::selectRefineCells(), boundaryMesh::setFeatureEdges(), hexRef8::setRefinement(), faceCollapser::setRefinement(), boundaryCutter::setRefinement(), pointZoneSet::subset(), cellZoneSet::subset(), surfaceIntersection::surfaceIntersection(), and wallLayerCells::wallLayerCells().

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

Append a List at the end of this list.

Reimplemented from List< T >.

Definition at line 322 of file DynamicListI.H.

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

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

Append a UIndirectList at the end of this list.

Reimplemented from List< T >.

Definition at line 347 of file DynamicListI.H.

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

T remove (  ) [inline]

Remove and return the top element.

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

References setSize().

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

Assignment of all addressed entries to the given value.

Reimplemented from List< T >.

Definition at line 401 of file DynamicListI.H.

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

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

Assignment from UList.

Reimplemented from List< T >.

Definition at line 411 of file DynamicListI.H.

References List< T >::operator=(), List< T >::size(), and UIndirectList< T >::size().


Friends And Related Function Documentation

friend class List< T > [friend]

Declare friendship with the List class.

Reimplemented from UList< T >.

Definition at line 93 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: