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

PtrList< T > Class Template Reference

A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used for subscript bounds checking, etc. More...

#include <OpenFOAM/PtrList.H>


Detailed Description

template<class T>
class Foam::PtrList< T >

A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used for subscript bounds checking, etc.

The element operator [] returns a reference to the object rather than to the pointer.

Source files

Definition at line 98 of file PtrList.H.

Inherited by blockMesh, fvBoundaryMesh, IOPtrList< T >, pointBoundaryMesh, and polyBoundaryMesh.

Collaboration diagram for PtrList< T >:

List of all members.

Classes

class  iterator
 An STL-conforming iterator. More...

Public Types

typedef T  value_type
 Type of values the PtrList contains.
typedef T &  reference
 Type that can be used for storing into PtrList::value_type objects.
typedef const T &  const_reference
 Type that can be used for storing into constant PtrList::value_type.

Public Member Functions

 PtrList ()
 Null Constructor.
 PtrList (const label)
 Construct with length specified.
 PtrList (const PtrList< T > &)
 Copy constructor.
template<class CloneArg >
 PtrList (const PtrList< T > &, const CloneArg &)
 Copy constructor with additional argument for clone.
 PtrList (const Xfer< PtrList< T > > &)
 Construct by transferring the parameter contents.
 PtrList (PtrList< T > &, bool reUse)
 Construct as copy or re-use as specified.
 PtrList (const SLPtrList< T > &)
 Construct as copy of SLPtrList<T>
template<class INew >
 PtrList (Istream &, const INew &)
 Construct from Istream using given Istream constructor class.
 PtrList (Istream &)
 Construct from Istream using default Istream constructor class.
 ~PtrList ()
label  size () const
 Return the number of elements in the PtrList.
bool  empty () const
 Return true if the PtrList is empty (ie, size() is zero).
void  setSize (const label)
 Reset size of PtrList. This can only be used to set the size.
void  resize (const label)
 Reset size of PtrList. This can only be used to set the size.
void  clear ()
 Clear the PtrList, i.e. set size to zero deleting all the.
void  transfer (PtrList< T > &)
 Transfer the contents of the argument PtrList into this PtrList.
Xfer< PtrList< T > >  xfer ()
 Transfer contents to the Xfer container.
bool  set (const label) const
 Is element set.
autoPtr< T >  set (const label, T *)
 Set element. Return old element (can be NULL).
autoPtr< T >  set (const label, const autoPtr< T > &)
autoPtr< T >  set (const label, const tmp< T > &)
void  reorder (const UList< label > &)
 Reorders elements. Ordering does not have to be done in.
const T &  operator[] (const label) const
 Return element const reference.
T &  operator[] (const label)
 Return element reference.
const T *  operator() (const label) const
 Return element const pointer.
PtrList< T > &  operator= (const PtrList< T > &)
 Assignment.
iterator  begin ()
 Return an iterator to begin traversing the PtrList.
iterator  end ()
 Return an iterator to end traversing the PtrList.

Protected Member Functions

template<class INew >
void  read (Istream &, const INew &inewt)
 Read from Istream using given Istream constructor class.

Friends

class  iterator
Istream &  operator>> (Istream &, PtrList< T > &)
 Read List from Istream, discarding contents of existing List.
Ostream &  operator (Ostream &, const PtrList< T > &)

Member Typedef Documentation

typedef T value_type

Type of values the PtrList contains.

Definition at line 223 of file PtrList.H.

typedef T& reference

Type that can be used for storing into PtrList::value_type objects.

Definition at line 226 of file PtrList.H.

typedef const T& const_reference

Type that can be used for storing into constant PtrList::value_type.

objects.

Definition at line 230 of file PtrList.H.


Constructor & Destructor Documentation

PtrList (  )

Null Constructor.

Definition at line 34 of file PtrList.C.

PtrList ( const label   s  ) [explicit]

Construct with length specified.

Definition at line 41 of file PtrList.C.

PtrList ( const PtrList< T > &   a  )

Copy constructor.

Definition at line 48 of file PtrList.C.

References forAll.

PtrList ( const PtrList< T > &   a,
const CloneArg &   cloneArg  
)

Copy constructor with additional argument for clone.

Definition at line 61 of file PtrList.C.

References forAll.

PtrList ( const Xfer< PtrList< T > > &   lst  )

Construct by transferring the parameter contents.

Definition at line 73 of file PtrList.C.

PtrList ( PtrList< T > &   a,
bool   reUse  
)

Construct as copy or re-use as specified.

Definition at line 80 of file PtrList.C.

References forAll, and PtrList< T >::setSize().

PtrList ( const SLPtrList< T > &   sll  )

Construct as copy of SLPtrList<T>

Definition at line 104 of file PtrList.C.

References SLListBase::begin(), SLListBase::end(), and SLListBase::size().

PtrList ( Istream &   is,
const INew &   inewt  
)

Construct from Istream using given Istream constructor class.

Definition at line 152 of file PtrListIO.C.

PtrList ( Istream &   is  )

Construct from Istream using default Istream constructor class.

Definition at line 159 of file PtrListIO.C.

~PtrList (  )

Definition at line 127 of file PtrList.C.

References forAll.


Member Function Documentation

Foam::label size (  ) const [inline]

Return the number of elements in the PtrList.

Definition at line 34 of file PtrListI.H.

Referenced by polyMeshAdder::add(), fvMeshAdder::add(), autoLayerDriver::addLayers(), meshRefinement::addPatch(), LISA::atomizeParcel(), blobsSheetAtomization::atomizeParcel(), attachPolyTopoChanger::attach(), Foam::compressible::autoCreateAlphat(), Foam::compressible::autoCreateLowReMut(), Foam::incompressible::autoCreateLowReNut(), Foam::compressible::autoCreateMut(), Foam::incompressible::autoCreateNut(), blobsSwirlInjector::blobsSwirlInjector(), reitzDiwakar::breakupParcel(), scotchDecomp::calcCSR(), polyTopoChange::changeMesh(), polyBoundaryMesh::checkDefinition(), polyBoundaryMesh::checkParallelSync(), ChomiakInjector::ChomiakInjector(), constInjector::constInjector(), inversePointDistanceDiffusivity::correct(), inverseFaceDistanceDiffusivity::correct(), wallDistData< TransferType >::correct(), definedHollowConeInjector::definedHollowConeInjector(), fvMeshDistribute::distribute(), autoLayerDriver::doLayers(), fvDOM::fvDOM(), cellDistFuncs::getPatchIDs(), hollowConeInjector::hollowConeInjector(), fvBoundaryMesh::interfaces(), volPointInterpolation::interpolate(), LUscalarMatrix::LUscalarMatrix(), meshRefinement::makeDisplacementField(), polyTopoChange::makeMesh(), MeshedSurface< Face >::MeshedSurface(), meshTriangulation::meshTriangulation(), parcel::move(), ZoneMesh< ZoneType, MeshType >::names(), polyBoundaryMesh::names(), polyTopoChanger::names(), PtrList< T >::operator=(), polyBoundaryMesh::physicalTypes(), polyBoundaryMesh::polyBoundaryMesh(), Foam::polyMeshZipUpCells(), polyTopoChange::polyTopoChange(), pressureSwirlInjector::pressureSwirlInjector(), fvMeshDistribute::printMeshInfo(), boundaryMesh::read(), polyMesh::readUpdate(), ensightParts::recalculate(), refinementSurfaces::refinementSurfaces(), lduMatrix::residual(), fvMeshSubset::setCellSubset(), fvMeshSubset::setLargeCellSubset(), removeCells::setRefinement(), meshCutAndRemove::setRefinement(), shellSurfaces::shellSurfaces(), GAMGAgglomeration::size(), ensightParts::size(), GaussSeidelSmoother::smooth(), surfacePatchIOList::surfacePatchIOList(), surfZoneIOList::surfZoneIOList(), syncTools::syncEdgeList(), syncTools::syncFaceList(), syncTools::syncPointList(), ZoneMesh< ZoneType, MeshType >::types(), polyBoundaryMesh::types(), GeometricField< Type, PatchField, GeoMesh >::GeometricBoundaryField::types(), polyTopoChanger::types(), valveBank::valveBank(), wallLayerCells::wallLayerCells(), xmgraceSetWriter< Type >::write(), gnuplotSetWriter< Type >::write(), polyBoundaryMesh::writeData(), pointZoneSet::writeObject(), faceZoneSet::writeObject(), cellZoneSet::writeObject(), STARCD::writeSurface(), ZoneMesh< ZoneType, MeshType >::ZoneMesh(), and meshRefinement::zonify().

bool empty (  ) const [inline]

Return true if the PtrList is empty (ie, size() is zero).

Definition at line 41 of file PtrListI.H.

Referenced by sixDoFRigidBodyMotion::write().

void resize ( const label   newSize  ) [inline]

Reset size of PtrList. This can only be used to set the size.

of an empty PtrList, extend a PtrList, remove entries from the end of a PtrList. If the entries are non-empty they are deleted.

Definition at line 48 of file PtrListI.H.

References setSize().

void transfer ( PtrList< T > &   a  )

Transfer the contents of the argument PtrList into this PtrList.

and annull the argument list.

Definition at line 199 of file PtrList.C.

References clear().

Referenced by ensightParts::ensightParts(), IOPtrList< T >::IOPtrList(), and functionObjectList::read().

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

Transfer contents to the Xfer container.

Definition at line 95 of file PtrListI.H.

References Foam::xferMove().

Foam::autoPtr< T > set ( const label   i,
T *   ptr  
) [inline]

Set element. Return old element (can be NULL).

No checks on new element.

Definition at line 62 of file PtrListI.H.

Foam::autoPtr< T > set ( const label   i,
const autoPtr< T > &   aptr  
) [inline]

Definition at line 74 of file PtrListI.H.

Foam::autoPtr< T > set ( const label   i,
const tmp< T > &   t  
) [inline]

Definition at line 85 of file PtrListI.H.

void reorder ( const UList< label > &   oldToNew  )

Reorders elements. Ordering does not have to be done in.

ascending or descending order. Reordering has to be unique. (is shuffle)

Reimplemented in polyBoundaryMesh.

Definition at line 207 of file PtrList.C.

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

Referenced by meshRefinement::addPatch(), and polyBoundaryMesh::reorder().

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

Return element const reference.

Definition at line 104 of file PtrListI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorIn.

Referenced by fvBoundaryMesh::movePoints().

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

Return element reference.

Definition at line 118 of file PtrListI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorIn.

const T * operator() ( const label   i  ) const [inline]

Return element const pointer.

Definition at line 132 of file PtrListI.H.

Foam::PtrList< T > & operator= ( const PtrList< T > &   a  )

Assignment.

Definition at line 257 of file PtrList.C.

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

Referenced by IOPtrList< T >::operator=().

Foam::PtrList< T >::iterator begin (  ) [inline]

Return an iterator to begin traversing the PtrList.

Definition at line 286 of file PtrListI.H.

References UList< T >::begin().

Foam::PtrList< T >::iterator end (  ) [inline]

Return an iterator to end traversing the PtrList.

Reimplemented in functionObjectList, sampledSets, and sampledSurfaces.

Definition at line 293 of file PtrListI.H.

References UList< T >::end().


Friends And Related Function Documentation

friend class iterator [friend]

Definition at line 236 of file PtrList.H.

Istream& operator>> ( Istream &   ,
PtrList< T > &    
) [friend]

Read List from Istream, discarding contents of existing List.

Ostream& operator ( Ostream &   ,
const PtrList< T > &    
) [friend]

The documentation for this class was generated from the following files:
  • src/OpenFOAM/containers/Lists/PtrList/PtrList.H
  • src/OpenFOAM/containers/Lists/PtrList/PtrList.C
  • src/OpenFOAM/containers/Lists/PtrList/PtrListI.H
  • src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C