Data Structures | Public Types | Public Member Functions | Data Fields | Protected Member Functions | Private Attributes | Friends
PtrList Class 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 blockMesh, fvBoundaryMesh, pointBoundaryMesh, and polyBoundaryMesh.

Collaboration diagram for PtrList:
Collaboration graph
[legend]

Data Structures

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

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...
 
template<class T >
 PtrList ()
 
template<class T >
 PtrList (const label s)
 
template<class T >
 PtrList (const PtrList< T > &a)
 
template<class T >
 PtrList (const Xfer< PtrList< T > > &lst)
 
template<class T >
 PtrList (PtrList< T > &a, bool reUse)
 
template<class T >
 PtrList (const SLPtrList< T > &sll)
 
template<class T >
 PtrList (Istream &is)
 

Data Fields

const typedef Tconst_reference
 Type that can be used for storing into constant PtrList::value_type. More...
 

Protected Member Functions

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

Private Attributes

List< T * > ptrs_
 

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

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

◆ value_type

typedef T value_type

Type of values the PtrList contains.

Definition at line 262 of file PtrList.H.

◆ reference

typedef T& reference

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

Definition at line 265 of file PtrList.H.

Constructor & Destructor Documentation

◆ PtrList() [1/16]

PtrList ( )

Null Constructor.

◆ PtrList() [2/16]

PtrList ( const  label)
explicit

Construct with size specified.

◆ PtrList() [3/16]

PtrList ( const PtrList< T > &  )

Copy constructor.

◆ PtrList() [4/16]

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

Copy constructor with additional argument for clone.

Definition at line 61 of file PtrList.C.

◆ PtrList() [5/16]

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

Construct by transferring the parameter contents.

◆ PtrList() [6/16]

PtrList ( PtrList< T > &  ,
bool  reUse 
)

Construct as copy or re-use as specified.

◆ PtrList() [7/16]

PtrList ( const SLPtrList< T > &  )
explicit

Construct as copy of SLPtrList<T>

◆ PtrList() [8/16]

PtrList ( Istream is,
const INew inewt 
)

Construct from Istream using given Istream constructor class.

Definition at line 160 of file PtrListIO.C.

◆ PtrList() [9/16]

PtrList ( Istream )

Construct from Istream using default Istream constructor class.

◆ ~PtrList()

~PtrList ( )

Destructor.

Definition at line 127 of file PtrList.C.

◆ PtrList() [10/16]

PtrList ( )

Definition at line 34 of file PtrList.C.

◆ PtrList() [11/16]

PtrList ( const label  s)

Definition at line 41 of file PtrList.C.

◆ PtrList() [12/16]

PtrList ( const PtrList< T > &  a)

Definition at line 48 of file PtrList.C.

◆ PtrList() [13/16]

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

Definition at line 73 of file PtrList.C.

◆ PtrList() [14/16]

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

Definition at line 80 of file PtrList.C.

◆ PtrList() [15/16]

PtrList ( const SLPtrList< T > &  sll)

Definition at line 104 of file PtrList.C.

◆ PtrList() [16/16]

PtrList ( Istream is)

Definition at line 167 of file PtrListIO.C.

Member Function Documentation

◆ read()

void read ( Istream is,
const INew inewt 
)
protected

Read from Istream using given Istream constructor class.

Definition at line 36 of file PtrListIO.C.

◆ size()

Foam::label size ( ) const
inline

Return the number of elements in the PtrList.

Definition at line 32 of file PtrListI.H.

Referenced by singleProcessorFaceSetsConstraint::add(), polyMeshAdder::add(), surfaceZonesInfo::addCellZonesToMesh(), surfaceZonesInfo::addFaceZonesToMesh(), boundaryLayers::addLayerForPatch(), autoLayerDriver::addLayers(), fvMeshTools::addPatch(), meshRefinement::addPatch(), fvBoundaryMesh::addPatches(), polyMeshGenModifier::addProcessorFaces(), linearValveLayersFvMesh::addZonesAndModifiers(), linearValveFvMesh::addZonesAndModifiers(), mixerFvMesh::addZonesAndModifiers(), movingConeTopoFvMesh::addZonesAndModifiers(), singleCellFvMesh::agglomerateMesh(), extendedEdgeMesh::allNearestFeatureEdges(), detectBoundaryLayers::analyseLayers(), meshRefinement::appendPatch(), attachPolyTopoChanger::attach(), boundaryLayers::boundaryLayers(), meshSurfaceEngine::calcGlobalBoundaryEdgeLabels(), polyMeshGenAddressing::calcGlobalFaceLabels(), polyMeshGenAddressing::calcGlobalPointLabels(), blockMesh::calcMergeInfo(), blockMesh::calcMergeInfoFast(), autoSnapDriver::calcNearestSurface(), meshSurfaceEngine::calculateBoundaryFaces(), polyTopoChange::changeMesh(), motionSmootherAlgo::checkConstraints(), polyBoundaryMesh::checkDefinition(), Foam::polyMeshGenChecks::checkFaceFlatness(), coordinateModifier::checkForValidInverse(), checkMeshDict::checkObjectRefinements(), polyBoundaryMesh::checkParallelSync(), polyMeshAdder::combinePatches(), polyTopoChange::compactAndReorder(), meshToMesh::constructNoCuttingPatches(), LUscalarMatrix::convert(), inverseFaceDistanceDiffusivity::correct(), nearWallDist::correct(), pointPatchDist::correct(), directionalPressureGradientExplicitSource::correct(), blockMesh::createCellShapes(), createFundamentalSheetsJFS::createInitialSheet(), createFundamentalSheetsFJ::createInitialSheet(), blockMesh::createPatches(), parFvFieldReconstructor::createPatchFaceMaps(), blockMesh::createPatchFaces(), createReconstructMap(), createRefinementSurfaces(), createFundamentalSheetsJFS::createSheetsAtFeatureEdges(), blockMesh::createTopology(), motionSmootherAlgo::curPoints(), structuredDecomp::decompose(), decompositionMethod::decompose(), autoLayerDriver::determineSidePatches(), fvMeshDistribute::distribute(), autoLayerDriver::doLayers(), autoSnapDriver::featureAttractionUsingFeatureEdges(), checkNonMappableCellConnections::findCells(), patchProbes::findElements(), polyBoundaryMesh::findPatchIDs(), fvFieldReconstructor::fvFieldReconstructor(), GAMGSolver::GAMGSolver(), surfaceZonesInfo::getAllClosedNamedSurfaces(), surfaceZonesInfo::getClosedNamedSurfaces(), surfaceZonesInfo::getInsidePointNamedSurfaces(), surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getStandaloneNamedSurfaces(), surfaceZonesInfo::getUnclosedNamedSurfaces(), surfaceZonesInfo::getUnnamedSurfaces(), immersedBoundarySolidBodyMotionFvMesh::immersedBoundarySolidBodyMotionFvMesh(), injectionModelList::info(), thermalBaffleModel::init(), viewFactor::initialise(), streamLineBase::initInterpolations(), globalMeshData::initProcAddr(), regionModel::interRegionAMI(), createFundamentalSheetsJFS::isTopologyOk(), lduPrimitiveMesh::lduPrimitiveMesh(), Foam::loadOrCreateMesh(), LUscalarMatrix::LUscalarMatrix(), main(), meshRefinement::makeDisplacementField(), autoLayerDriver::makeLayerDisplacementField(), polyTopoChange::makeMesh(), meshToMesh::mapSrcToTgt(), meshToMesh::mapTgtToSrc(), polyMeshAdder::mergePatchNames(), polyMeshAdder::mergePrimitives(), MeshedSurface< Foam::face >::MeshedSurface(), polyTopoChanger::names(), ZoneMesh< cellZone, polyMesh >::names(), regionModel::nbrCoupledPatchID(), extendedEdgeMesh::nearestFeatureEdgeByType(), fvMeshTools::newMesh(), PtrList< injectionModel >::operator=(), blockMesh::patchDicts(), patchInjection::patchInjection(), pointFieldReconstructor::pointFieldReconstructor(), polyBoundaryMesh::polyBoundaryMesh(), polyTopoChange::polyTopoChange(), print(), printMesh(), ZoneMesh< cellZone, polyMesh >::read(), functionObjectList::read(), boundaryMesh::read(), blockMesh::readBoundary(), polyTopoChanger::readModifiers(), readProcAddressing(), polyMesh::readUpdate(), ensightParts::recalculate(), fvMeshDistribute::receiveMesh(), pointFieldReconstructor::reconstructField(), parFvFieldReconstructor::reconstructFvSurfaceField(), parFvFieldReconstructor::reconstructFvVolumeField(), redistributeLagrangian(), meshOctreeCreator::refineBoxesContainedInObjects(), fvMeshTools::removeEmptyPatches(), polyMeshGenModifier::removeEmptyProcessorPatches(), polyMeshGenModifier::removeFaces(), structuredRenumber::renumber(), polyMeshGenModifier::reorderBoundaryFaces(), polyMeshGenModifier::reorderProcBoundaryFaces(), polyMeshGenModifier::replaceBoundary(), sampledSets::sampleAndWrite(), fvMeshDistribute::sendMesh(), fvMeshSubset::setCellSubset(), fvMeshSubset::setLargeCellSubset(), singleCellFvMesh::singleCellFvMesh(), surfacePatchIOList::surfacePatchIOList(), surfZoneIOList::surfZoneIOList(), lduPrimitiveMesh::totalSize(), fvMeshTools::trimPatches(), streamLineBase::trimToBox(), polyTopoChanger::types(), ZoneMesh< cellZone, polyMesh >::types(), valveBank::valveBank(), vtkSetWriter< Type >::write(), xmgraceSetWriter< Type >::write(), gnuplotSetWriter< Type >::write(), domainDecomposition::writeDecomposition(), externalCoupledFunctionObject::writeGeometry(), writeProcAddressing(), Foam::writeSurfFields(), and meshRefinement::zonify().

◆ empty()

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 fvMeshTools::trimPatches().

Here is the caller graph for this function:

◆ first() [1/2]

T & first ( )
inline

Return reference to the first element of the list.

Definition at line 46 of file PtrListI.H.

Referenced by symmetryPlaneOptimisation::detectSymmetryPlanes().

Here is the caller graph for this function:

◆ first() [2/2]

const T & first ( ) const
inline

Return reference to first element of the list.

Definition at line 53 of file PtrListI.H.

◆ last() [1/2]

T & last ( )
inline

Return reference to the last element of the list.

Definition at line 60 of file PtrListI.H.

Referenced by main().

Here is the caller graph for this function:

◆ last() [2/2]

const T & last ( ) const
inline

Return reference to the last element of the list.

Definition at line 67 of file PtrListI.H.

◆ setSize()

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.

Referenced by fvMeshAdder::add(), polyMeshAdder::add(), fvMeshTools::addPatch(), fvBoundaryMesh::addPatches(), polyMeshGenModifier::addProcessorPatch(), linearValveFvMesh::addZonesAndModifiers(), mixerFvMesh::addZonesAndModifiers(), singleCellFvMesh::agglomerateMesh(), meshRefinement::appendPatch(), boundaryLayers::boundaryLayers(), planeScaling::boundingPlanes(), boxScaling::boundingPlanes(), renameBoundaryPatches::calculateNewBoundary(), checkMeshDict::checkAnisotropicSources(), checkMeshDict::checkObjectRefinements(), polyTopoChange::compactAndReorder(), coordinateModifier::coordinateModifier(), cartesianMeshExtractor::createPolyMesh(), blockMesh::createTopology(), lduPrimitiveMesh::gather(), GAMGSolver::gatherMatrices(), GAMGSolver::initVcycle(), main(), patchInjection::patchInjection(), GAMGSolver::procAgglomerateMatrix(), PtrList< injectionModel >::PtrList(), ZoneMesh< cellZone, polyMesh >::read(), functionObjectList::read(), polyTopoChanger::readModifiers(), meshOctreeCreator::refineBoxesContainedInObjects(), polyMesh::removeBoundary(), meshSurfaceEdgeExtractor::removeOldBoundaryFaces(), polyMeshGenModifier::reorderBoundaryFaces(), polyMeshGenModifier::reorderProcBoundaryFaces(), polyMeshGenModifier::replaceBoundary(), searchableSurfaces::searchableSurfaces(), MGridGenGAMGAgglomeration::swap(), and fvMeshTools::trimPatches().

Here is the caller graph for this function:

◆ resize()

void resize ( const label  newSize)
inline

Alias for setSize(const label)

Definition at line 74 of file PtrListI.H.

◆ clear()

void clear ( )

◆ append() [1/3]

void append ( T )
inline

◆ append() [2/3]

void append ( const autoPtr< T > &  )
inline

◆ append() [3/3]

void append ( const tmp< T > &  )
inline

◆ transfer()

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.

Referenced by renameBoundaryPatches::calculateNewBoundary(), main(), functionObjectList::read(), polyMeshGenModifier::removeEmptyProcessorPatches(), and streamLineBase::write().

Here is the caller graph for this function:

◆ xfer()

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

Transfer contents to the Xfer container.

Definition at line 145 of file PtrListI.H.

Referenced by main().

Here is the caller graph for this function:

◆ set() [1/4]

bool set ( const  label) const
inline

Is element set.

Referenced by fvMeshAdder::add(), polyMeshAdder::add(), fvMeshTools::addPatch(), fvBoundaryMesh::addPatches(), polyMeshGenModifier::addProcessorPatch(), linearValveFvMesh::addZonesAndModifiers(), mixerFvMesh::addZonesAndModifiers(), GAMGSolver::agglomerateInterfaceCoefficients(), GAMGSolver::agglomerateMatrix(), meshRefinement::appendPatch(), planeScaling::boundingPlanes(), boxScaling::boundingPlanes(), renameBoundaryPatches::calculateNewBoundary(), displacementLayeredMotionMotionSolver::cellZoneSolve(), boundaryMesh::changeFaces(), boundaryMesh::changePatchType(), checkMeshDict::checkAnisotropicSources(), checkMeshDict::checkObjectRefinements(), Foam::checkTopology(), sampledSets::combineSampledSets(), vtkPV4Foam::convertDimFields(), coordinateModifier::coordinateModifier(), diffusionMulticomponent< CombThermoType, ThermoType >::correct(), cartesianMeshExtractor::createPolyMesh(), createRefinementSurfaces(), blockMesh::createTopology(), pointFieldDecomposer::decomposeField(), fvFieldDecomposer::decomposeField(), boundaryMesh::deletePatch(), extrudePatchMesh::extrudePatchMesh(), forAll(), GAMGSolver::GAMGSolver(), lduPrimitiveMesh::gather(), GAMGSolver::gatherMatrices(), surfaceZonesInfo::getAllClosedNamedSurfaces(), surfaceZonesInfo::getClosedNamedSurfaces(), surfaceZonesInfo::getInsidePointNamedSurfaces(), surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getStandaloneNamedSurfaces(), surfaceZonesInfo::getUnclosedNamedSurfaces(), GAMGProcAgglomeration::globalCellCells(), GAMGSolver::initVcycle(), singleCellFvMesh::interpolate(), fvMeshSubset::interpolate(), meshToMesh0::interpolate(), LUscalarMatrix::LUscalarMatrix(), main(), immersedBoundaryFvPatch::makeInvDirichletMatrices(), immersedBoundaryFvPatch::makeInvNeumannMatrices(), meshToMesh::mapSrcToTgt(), meshToMesh::mapTgtToSrc(), pointBoundaryMesh::pointBoundaryMesh(), procAddressing(), GAMGSolver::procAgglomerateMatrix(), ZoneMesh< cellZone, polyMesh >::read(), functionObjectList::read(), boundaryMesh::read(), readLagrangian(), polyTopoChanger::readModifiers(), ensightParts::recalculate(), pointFieldReconstructor::reconstructField(), parFvFieldReconstructor::reconstructFvSurfaceField(), fvFieldReconstructor::reconstructFvSurfaceField(), parFvFieldReconstructor::reconstructFvVolumeField(), fvFieldReconstructor::reconstructFvVolumeField(), fvFieldReconstructor::reconstructFvVolumeInternalField(), processorMeshes::reconstructPoints(), meshOctreeCreator::refineBoxesContainedInObjects(), meshOctreeCreator::refineBoxesIntersectingEdgeMeshes(), meshOctreeCreator::refineBoxesIntersectingSurfaces(), refinementSurfaces::refinementSurfaces(), refinementFeatures::regionEdgeTrees(), polyMeshGenModifier::removeEmptyProcessorPatches(), polyMeshGenModifier::reorderBoundaryFaces(), polyMeshGenModifier::reorderProcBoundaryFaces(), polyMeshGenModifier::replaceBoundary(), sampledSets::sampleAndWrite(), MGridGenGAMGAgglomeration::swap(), isoSurface::trimToBox(), GAMGSolver::Vcycle(), polyMeshGenFaces::write(), and streamLineBase::write().

◆ set() [2/4]

autoPtr<T> set ( const  label,
T  
)
inline

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

No checks on new element.

◆ set() [3/4]

autoPtr<T> set ( const  label,
const autoPtr< T > &   
)
inline

◆ set() [4/4]

autoPtr<T> set ( const  label,
const tmp< T > &   
)
inline

◆ reorder()

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.

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

Here is the caller graph for this function:

◆ operator[]() [1/2]

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

Return element const reference.

◆ operator[]() [2/2]

T& operator[] ( const  label)
inline

Return element reference.

◆ operator()()

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

Return element const pointer.

Definition at line 188 of file PtrListI.H.

◆ operator=()

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

Assignment.

Definition at line 261 of file PtrList.C.

◆ begin() [1/2]

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

Return an iterator to begin traversing the PtrList.

Definition at line 361 of file PtrListI.H.

◆ end() [1/2]

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

Return an iterator to end traversing the PtrList.

Definition at line 368 of file PtrListI.H.

◆ cbegin()

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.

◆ cend()

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.

◆ begin() [2/2]

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.

◆ end() [2/2]

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

◆ iterator

friend class iterator
friend

Definition at line 276 of file PtrList.H.

◆ const_iterator

friend class const_iterator
friend

Definition at line 278 of file PtrList.H.

◆ operator>>

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

Read List from Istream, discarding contents of existing List.

◆ operator

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

Field Documentation

◆ const_reference

const typedef T& const_reference

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

objects.

Definition at line 269 of file PtrList.H.

◆ ptrs_

List<T*> ptrs_
private

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