Classes | Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
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...

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

Classes

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

Public Types

typedef T value_type
 Type of values the PtrList contains. More...
 
typedef Treference
 Type that can be used for storing into PtrList::value_type objects. More...
 
typedef const Tconst_reference
 Type that can be used for storing into constant PtrList::value_type. More...
 

Public Member Functions

 PtrList ()
 Null Constructor. More...
 
 PtrList (const label)
 Construct with size specified. More...
 
 PtrList (const PtrList< T > &)
 Copy constructor. More...
 
template<class CloneArg >
 PtrList (const PtrList< T > &, const CloneArg &)
 Copy constructor with additional argument for clone. More...
 
 PtrList (const Xfer< PtrList< T > > &)
 Construct by transferring the parameter contents. More...
 
 PtrList (PtrList< T > &, bool reUse)
 Construct as copy or re-use as specified. More...
 
 PtrList (const SLPtrList< T > &)
 Construct as copy of SLPtrList<T> More...
 
template<class INew >
 PtrList (Istream &, const INew &)
 Construct from Istream using given Istream constructor class. More...
 
 PtrList (Istream &)
 Construct from Istream using default Istream constructor class. More...
 
 ~PtrList ()
 Destructor. More...
 
label size () const
 Return the number of elements in the PtrList. More...
 
bool empty () const
 Return true if the PtrList is empty (ie, size() is zero). More...
 
Tfirst ()
 Return reference to the first element of the list. More...
 
const Tfirst () const
 Return reference to first element of the list. More...
 
Tlast ()
 Return reference to the last element of the list. More...
 
const Tlast () const
 Return reference to the last element of the list. More...
 
void setSize (const label)
 Reset size of PtrList. If extending the PtrList, new entries are. More...
 
void resize (const label)
 Alias for setSize(const label) More...
 
void clear ()
 Clear the PtrList, i.e. set size to zero deleting all the. More...
 
void append (T *)
 Append an element at the end of the list. More...
 
void append (const autoPtr< T > &)
 
void append (const tmp< T > &)
 
void transfer (PtrList< T > &)
 Transfer the contents of the argument PtrList into this PtrList. More...
 
Xfer< PtrList< T > > xfer ()
 Transfer contents to the Xfer container. More...
 
bool set (const label) const
 Is element set. More...
 
autoPtr< Tset (const label, T *)
 Set element. Return old element (can be NULL). More...
 
autoPtr< Tset (const label, const autoPtr< T > &)
 
autoPtr< Tset (const label, const tmp< T > &)
 
void reorder (const labelUList &)
 Reorders elements. Ordering does not have to be done in. More...
 
const Toperator[] (const label) const
 Return element const reference. More...
 
Toperator[] (const label)
 Return element reference. More...
 
const Toperator() (const label) const
 Return element const pointer. More...
 
PtrList< T > & operator= (const PtrList< T > &)
 Assignment. More...
 
iterator begin ()
 Return an iterator to begin traversing the PtrList. More...
 
iterator end ()
 Return an iterator to end traversing the PtrList. More...
 
const_iterator cbegin () const
 Return an const_iterator to begin traversing the PtrList. More...
 
const_iterator cend () const
 Return an const_iterator to end traversing the PtrList. More...
 
const_iterator begin () const
 Return an const_iterator to begin traversing the PtrList. More...
 
const_iterator end () const
 Return an const_iterator to end traversing the PtrList. More...
 

Protected Member Functions

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

Friends

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

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

Source files

Definition at line 61 of file List.H.

Member Typedef Documentation

typedef T value_type

Type of values the PtrList contains.

Definition at line 262 of file PtrList.H.

typedef T& reference

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

Definition at line 265 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 269 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 size 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.

References PtrList< T >::transfer().

Here is the call graph for this function:

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

Here is the call graph for this function:

PtrList ( const SLPtrList< T > &  sll)
explicit

Construct as copy of SLPtrList<T>

Definition at line 104 of file PtrList.C.

References LList< SLListBase, T * >::begin(), LList< SLListBase, T * >::end(), and SLListBase::size().

Here is the call graph for this function:

PtrList ( Istream is,
const INew inewt 
)

Construct from Istream using given Istream constructor class.

Definition at line 163 of file PtrListIO.C.

References Foam::read().

Here is the call graph for this function:

PtrList ( Istream is)

Construct from Istream using default Istream constructor class.

Definition at line 170 of file PtrListIO.C.

References PtrList< T >::clear(), forAll, Foam::nl, Foam::operator>>(), Foam::read(), PtrList< T >::read(), and PtrList< T >::size().

Here is the call graph for this function:

~PtrList ( )

Destructor.

Definition at line 127 of file PtrList.C.

References forAll.

Member Function Documentation

void read ( Istream is,
const INew inewt 
)
protected
Foam::label size ( ) const
inline

Return the number of elements in the PtrList.

Definition at line 32 of file PtrListI.H.

Referenced by fvMeshAdder::add(), polyMeshAdder::add(), surfaceZonesInfo::addCellZonesToMesh(), surfaceZonesInfo::addFaceZonesToMesh(), autoLayerDriver::addLayers(), fvMeshTools::addPatch(), meshRefinement::addPatch(), extendedEdgeMesh::allNearestFeatureEdges(), meshRefinement::appendPatch(), attachPolyTopoChanger::attach(), nearWallFields::calcAddressing(), addPatchCellLayer::calcSidePatch(), polyTopoChange::changeMesh(), repatchPolyTopoChanger::changePatchID(), polyBoundaryMesh::checkDefinition(), polyBoundaryMesh::checkParallelSync(), inverseFaceDistanceDiffusivity::correct(), nearWallDistNoSearch::correct(), nearWallDist::correct(), pointPatchDist::correct(), wallDistData< TransferType >::correct(), motionSmootherAlgo::curPoints(), structuredDecomp::decompose(), decompositionMethod::decompose(), displacementInterpolationMotionSolver::displacementInterpolationMotionSolver(), fvMeshDistribute::distribute(), autoLayerDriver::doLayers(), Foam::facePointN(), polyBoundaryMesh::findPatchIDs(), fvFieldReconstructor::fvFieldReconstructor(), surfaceZonesInfo::getAllClosedNamedSurfaces(), surfaceZonesInfo::getClosedNamedSurfaces(), surfaceZonesInfo::getInsidePointNamedSurfaces(), surfaceZonesInfo::getNamedSurfaces(), cellDistFuncs::getPatchIDs(), surfaceZonesInfo::getUnclosedNamedSurfaces(), surfaceZonesInfo::getUnnamedSurfaces(), injectionModelList::info(), interRegionExplicitPorositySource::initialise(), fvBoundaryMesh::interfaces(), meshToMesh::interpolationMethodAMI(), regionModel::interRegionAMI(), layerParameters::layerParameters(), lduPrimitiveMesh::lduPrimitiveMesh(), LUscalarMatrix::LUscalarMatrix(), meshRefinement::makeDisplacementField(), polyTopoChange::makeMesh(), meshToMesh::mapSrcToTgt(), meshToMesh::mapTgtToSrc(), fvMeshAdder::MapVolFields(), MeshedSurface< Face >::MeshedSurface(), meshTriangulation::meshTriangulation(), polyTopoChanger::names(), ZoneMesh< ZoneType, MeshType >::names(), polyBoundaryMesh::names(), regionModel::nbrCoupledPatchID(), extendedEdgeMesh::nearestFeatureEdgeByType(), potential::nPairPotentials(), blockMesh::numZonedBlocks(), ListPlusEqOp< T, Size >::operator()(), procLess::operator()(), listPlusEqOp< T >::operator()(), PtrList< T >::operator=(), polyTopoChanger::operator==(), blockMesh::patchDicts(), patchInjection::patchInjection(), patchDistMethod::patchTypes(), polyBoundaryMesh::physicalTypes(), pointFieldReconstructor::pointFieldReconstructor(), polyBoundaryMesh::polyBoundaryMesh(), polyMesh::polyMesh(), Foam::polyMeshZipUpCells(), polyTopoChange::polyTopoChange(), fvMeshDistribute::printCoupleInfo(), fvMeshDistribute::printMeshInfo(), PtrList< T >::PtrList(), thermalBaffleModel::read(), boundaryMesh::read(), polyMesh::readUpdate(), ensightParts::recalculate(), pointFieldReconstructor::reconstructField(), SloanRenumber::renumber(), structuredRenumber::renumber(), PtrList< T >::reorder(), fvMeshSubset::setCellSubset(), polyBoundaryMesh::setGroup(), fvMeshSubset::setLargeCellSubset(), removeCells::setRefinement(), meshCutAndRemove::setRefinement(), PtrList< T >::setSize(), singleCellFvMesh::singleCellFvMesh(), ensightParts::size(), pairPatchAgglomeration::size(), GAMGAgglomeration::size(), surfacePatchIOList::surfacePatchIOList(), surfZoneIOList::surfZoneIOList(), polyTopoChanger::types(), ZoneMesh< ZoneType, MeshType >::types(), polyBoundaryMesh::types(), GeometricField< Type, PatchField, GeoMesh >::GeometricBoundaryField::types(), valveBank::valveBank(), wallLayerCells::wallLayerCells(), WallLocalSpringSliderDashpot< CloudType >::WallLocalSpringSliderDashpot(), xmgraceSetWriter< Type >::write(), gnuplotSetWriter< Type >::write(), vtkSetWriter< Type >::write(), polyBoundaryMesh::writeData(), cellZoneSet::writeObject(), pointZoneSet::writeObject(), faceZoneSet::writeObject(), fvMeshTools::zeroPatchFields(), ZoneMesh< ZoneType, MeshType >::ZoneMesh(), meshRefinement::zonify(), and externalCoupledMixedFvPatchField< Type >::~externalCoupledMixedFvPatchField().

bool empty ( ) const
inline

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

Definition at line 39 of file PtrListI.H.

Referenced by NamedEnum< Enum, nEnum >::names(), and fvMeshTools::zeroPatchFields().

Here is the caller graph for this function:

T & first ( )
inline

Return reference to the first element of the list.

Definition at line 46 of file PtrListI.H.

const T & first ( ) const
inline

Return reference to first element of the list.

Definition at line 53 of file PtrListI.H.

T & last ( )
inline

Return reference to the last element of the list.

Definition at line 60 of file PtrListI.H.

const T & last ( ) const
inline

Return reference to the last element of the list.

Definition at line 67 of file PtrListI.H.

void setSize ( const label  newSize)

Reset size of PtrList. If extending the PtrList, new entries are.

set to NULL. If truncating the PtrList, removed entries are deleted.

Definition at line 142 of file PtrList.C.

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

Referenced by fvMeshAdder::add(), polyMeshAdder::add(), cellTable::addCellZones(), fvMeshTools::addPatch(), polyMesh::addPatches(), polyMesh::addZones(), meshRefinement::appendPatch(), polyBoundaryMesh::checkParallelSync(), displacementInterpolationMotionSolver::displacementInterpolationMotionSolver(), FacePostProcessing< CloudType >::FacePostProcessing(), lduPrimitiveMesh::gather(), interRegionExplicitPorositySource::initialise(), fvMeshAdder::MapVolFields(), PtrList< T >::operator=(), patchInjection::patchInjection(), polyBoundaryMesh::polyBoundaryMesh(), polyMesh::polyMesh(), Foam::preservePatchTypes(), fvMeshDistribute::printFieldInfo(), PtrList< T >::PtrList(), PtrListDictionary< T >::PtrListDictionary(), functionObjectList::read(), polyMesh::readUpdate(), polyMesh::removeBoundary(), fvMesh::removeFvBoundary(), searchableSurfaces::searchableSurfaces(), decompositionMethod::setConstraints(), GAMGSolver::solve(), WallLocalSpringSliderDashpot< CloudType >::WallLocalSpringSliderDashpot(), cellZoneSet::writeObject(), pointZoneSet::writeObject(), faceZoneSet::writeObject(), fvMeshTools::zeroPatchFields(), and ZoneMesh< ZoneType, MeshType >::ZoneMesh().

Here is the call graph for this function:

Here is the caller graph for this function:

void resize ( const label  newSize)
inline

Alias for setSize(const label)

Definition at line 74 of file PtrListI.H.

References setSize().

Here is the call graph for this function:

void clear ( )

Clear the PtrList, i.e. set size to zero deleting all the.

allocated entries.

Definition at line 185 of file PtrList.C.

References List< T >::clear(), and forAll.

Referenced by functionObjectList::clear(), PtrList< T >::PtrList(), functionObjectList::read(), fvBoundaryMesh::readUpdate(), polyMesh::readUpdate(), polyMesh::removeBoundary(), fvMesh::removeFvBoundary(), decompositionMethod::setConstraints(), PtrList< T >::setSize(), and PtrList< T >::transfer().

Here is the call graph for this function:

Here is the caller graph for this function:

void append ( T ptr)
inline

Append an element at the end of the list.

Definition at line 81 of file PtrListI.H.

References setSize().

Referenced by PtrList< T >::append(), and meshToMesh::interpolationMethodAMI().

Here is the call graph for this function:

Here is the caller graph for this function:

void append ( const autoPtr< T > &  aptr)
inline

Definition at line 90 of file PtrListI.H.

References PtrList< T >::append().

Here is the call graph for this function:

void append ( const tmp< T > &  t)
inline

Definition at line 98 of file PtrListI.H.

void transfer ( PtrList< T > &  a)

Transfer the contents of the argument PtrList into this PtrList.

and annul the argument list.

Definition at line 200 of file PtrList.C.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Transfer contents to the Xfer container.

Definition at line 145 of file PtrListI.H.

References Foam::xferMove().

Here is the call graph for this function:

bool set ( const label  i) const
inline
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 114 of file PtrListI.H.

References PtrList< T >::set().

Here is the call graph for this function:

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

Definition at line 124 of file PtrListI.H.

References PtrList< T >::set().

Here is the call graph for this function:

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

Definition at line 135 of file PtrListI.H.

void reorder ( const labelUList oldToNew)

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

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

Definition at line 208 of file PtrList.C.

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

Referenced by fvMeshTools::addPatch(), meshRefinement::addPatch(), fvMeshAdder::MapVolFields(), polyBoundaryMesh::reorder(), and fvMeshTools::reorderPatches().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Return element const reference.

Definition at line 154 of file PtrListI.H.

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

Referenced by pointBoundaryMesh::findIndices(), pointBoundaryMesh::movePoints(), and pointBoundaryMesh::updateMesh().

Here is the call graph for this function:

Here is the caller graph for this function:

T & operator[] ( const label  i)
inline

Return element reference.

Definition at line 171 of file PtrListI.H.

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

Here is the call graph for this function:

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

Return element const pointer.

Definition at line 188 of file PtrListI.H.

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

Assignment.

Definition at line 261 of file PtrList.C.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Return an iterator to begin traversing the PtrList.

Definition at line 361 of file PtrListI.H.

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

Return an iterator to end traversing the PtrList.

Definition at line 368 of file PtrListI.H.

Foam::PtrList< T >::const_iterator cbegin ( ) const
inline

Return an const_iterator to begin traversing the PtrList.

Definition at line 583 of file PtrListI.H.

Foam::PtrList< T >::const_iterator cend ( ) const
inline

Return an const_iterator to end traversing the PtrList.

Definition at line 591 of file PtrListI.H.

Foam::PtrList< T >::const_iterator begin ( ) const
inline

Return an const_iterator to begin traversing the PtrList.

Definition at line 567 of file PtrListI.H.

Foam::PtrList< T >::const_iterator end ( ) const
inline

Return an const_iterator to end traversing the PtrList.

Definition at line 575 of file PtrListI.H.

Friends And Related Function Documentation

friend class iterator
friend

Definition at line 276 of file PtrList.H.

friend class const_iterator
friend

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