UPtrList< 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< UPtrList< T >, T >, PtrList< Foam::fvMesh >, PtrList< Foam::RBD::joint >, PtrList< Foam::List< char > >, PtrList< Foam::List >, PtrList< polyMeshModifier >, PtrList< pairPotential >, PtrList< functionObject >, PtrList< Foam::ignitionSite >, PtrList< Foam::diameterModels::nucleationModel >, PtrList< Foam::diameterModels::breakupModel >, PtrList< blockEdge >, PtrList< Foam::RBD::restraint >, PtrList< ModelType >, PtrList< extendedFeatureEdgeMesh >, PtrList< Foam::sixDoFRigidBodyMotionConstraint >, PtrList< const Foam::lduInterface >, PtrList< Foam::cellEdgeAddressingData >, PtrList< blockFace >, PtrList< Foam::RBD::subBody >, PtrList< porosityModel >, PtrList< Foam::indexedOctree >, PtrList< Foam::RBD::rigidBody >, PtrList< Foam::UPtrList >, PtrList< profileModel >, PtrList< Foam::fvFieldDecomposer::patchFieldDecomposer >, PtrList< Foam::functionObjects::fieldAverageItem >, PtrList< Foam::FieldField< Foam::Field, scalar > >, PtrList< Foam::Field >, PtrList< searchableSurface >, PtrList< sampledSet >, PtrList< Foam::Time >, PtrList< Foam::liquidProperties >, PtrList< Foam::diameterModels::binaryBreakupModel >, PtrList< Foam::PtrList< Foam::dimensioned > >, PtrList< entry >, PtrList< parcelCloud >, PtrList< Foam::solidProperties >, PtrList< Foam::solver >, PtrList< Foam::DimensionedField >, PtrList< Foam::diameterModels::populationBalanceModel >, PtrList< Foam::fvMatrix >, PtrList< Foam::surfaceZonesInfo >, PtrList< Foam::patchToPatchStabilisation >, PtrList< Foam::diameterModels::IATEsource >, PtrList< sampledSurface >, PtrList< joint >, PtrList< Foam::coupledFacePair >, PtrList< Foam::procLduInterface >, PtrList< Foam::PrimitivePatch >, PtrList< Foam::dictionary >, PtrList< Foam::OFstream >, PtrList< ParticleForce< CloudType > >, PtrList< Foam::radiationModels::radiativeIntensityRay >, PtrList< Foam::sutherlandTransport >, PtrList< InjectionModel< CloudType > >, PtrList< Field< Type > >, PtrList< Foam::patchToPatch >, PtrList< Foam::coordSet >, PtrList< tetherPotential >, PtrList< fvPatchMapper >, PtrList< ZoneType >, PtrList< Foam::waveModel >, PtrList< Foam::sixDoFRigidBodyMotionRestraint >, PtrList< Foam::coordinateSystem >, PtrList< Foam::mappedInternalPatchBase >, PtrList< Foam::solidBodyMotionFunction >, PtrList< Foam::phaseInterface >, PtrList< Foam::decompositionConstraint >, PtrList< Foam::lduMatrix >, PtrList< pointPatchMapper >, PtrList< Foam::repatchPatch >, PtrList< Foam::diameterModels::driftModel >, PtrList< Foam::cellModel >, PtrList< blockVertex >, PtrList< CloudFunctionObject< CloudType > >, PtrList< Foam::indexedOctree< Foam::treeDataPoint > >, PtrList< Foam::pointFieldDecomposer::patchFieldDecomposer >, PtrList< Foam::HashSet >, PtrList< Foam::PtrList< Foam::lduInterfaceField > >, PtrList< Foam::Function2< scalar > >, PtrList< Reaction< ThermoType > >, PtrList< Foam::decompositionMethod >, PtrList< Foam::distributions::normal >, PtrList< Foam::diameterModels::coalescenceModel >, PtrList< Foam::dimensioned >, PtrList< ThermoType >, PtrList< bodyMesh >, PtrList< Foam::indexedOctree< Foam::treeDataEdge > >, PtrList< Foam::ensightPart >, PtrList< Foam::GeometricBoundaryField >, PtrList< Foam::lduPrimitiveMesh >, PtrList< MRFZone >, and PtrList< T >.

Classes

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

Public Types

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

Public Member Functions

 UPtrList ()
 Null Constructor. More...
 
 UPtrList (const label)
 Construct with size specified. More...
 
 UPtrList (UPtrList< T > &, bool reuse)
 Construct as copy or re-use as specified. More...
 
label size () const
 Return the number of elements in the UPtrList. More...
 
bool empty () const
 Return true if the UPtrList 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 UPtrList. This can only be used to set the size. More...
 
void resize (const label)
 Reset size of UPtrList. This can only be used to set the size. More...
 
void clear ()
 Clear the UPtrList, i.e. set size to zero. More...
 
void transfer (UPtrList< T > &)
 Transfer the contents of the argument UPtrList into this. More...
 
bool set (const label) const
 Is element set. More...
 
Tset (const label, T *)
 Set element. Return old element (can be nullptr). More...
 
void reorder (const labelUList &oldToNew)
 Reorders elements. Ordering does not have to be done in. More...
 
void shuffle (const labelUList &newToOld)
 Reorders elements. Ordering does not have to be done in. More...
 
template<class T2 >
UPtrList< T2 > convert ()
 Convert to list of different pointer type. More...
 
template<class T2 >
UPtrList< const T2 > convert () const
 Convert to list of different pointer type. 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...
 
Toperator() (const label)
 Return element const pointer. More...
 
iterator begin ()
 Return an iterator to begin traversing the UPtrList. More...
 
iterator end ()
 Return an iterator to end traversing the UPtrList. More...
 
const_iterator cbegin () const
 Return an const_iterator to begin traversing the UPtrList. More...
 
const_iterator cend () const
 Return an const_iterator to end traversing the UPtrList. More...
 
const_iterator begin () const
 Return an const_iterator to begin traversing the UPtrList. More...
 
const_iterator end () const
 Return an const_iterator to end traversing the UPtrList. More...
 
template<class T2 >
Foam::UPtrList< T2 > convert ()
 
template<class T2 >
Foam::UPtrList< const T2 > convert () const
 

Friends

class PtrList< T >
 Declare friendship with the PtrList class. More...
 
class iterator
 
Ostreamoperator (Ostream &, const UPtrList< T > &)
 Write UPtrList to Ostream. More...
 

Detailed Description

template<class T>
class Foam::UPtrList< 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. Storage is not allocated during construction or use but is supplied to the constructor as an argument.

Source files

Definition at line 65 of file UPtrList.H.

Member Typedef Documentation

◆ value_type

typedef T value_type

Type of values the UPtrList contains.

Definition at line 181 of file UPtrList.H.

◆ reference

typedef T& reference

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

Definition at line 184 of file UPtrList.H.

◆ const_reference

typedef const T& const_reference

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

objects

Definition at line 188 of file UPtrList.H.

Constructor & Destructor Documentation

◆ UPtrList() [1/3]

Null Constructor.

Definition at line 31 of file UPtrList.C.

◆ UPtrList() [2/3]

UPtrList ( const label  s)
explicit

Construct with size specified.

Definition at line 38 of file UPtrList.C.

◆ UPtrList() [3/3]

UPtrList ( UPtrList< T > &  a,
bool  reuse 
)

Construct as copy or re-use as specified.

Definition at line 45 of file UPtrList.C.

Member Function Documentation

◆ size()

Foam::label size
inline

Return the number of elements in the UPtrList.

Definition at line 29 of file UPtrListI.H.

Referenced by singleProcessorFaceSetsConstraint::add(), fvMeshAdder::add(), polyMeshAdder::add(), surfaceZonesInfo::addCellZonesToMesh(), surfaceZonesInfo::addFaceZonesToMesh(), snappyLayerDriver::addLayers(), meshRefinement::addMeshedPatch(), pointMesh::addPatch(), fvMeshTools::addPatch(), GAMGAgglomeration::agglomerateLduAddressing(), extendedEdgeMesh::allNearestFeatureEdges(), MomentumTransferPhaseSystem< BasePhaseSystem >::alphaDByAf(), attachPolyTopoChanger::attach(), AveragingMethod< Type >::AveragingMethod(), nearWallFields::calcAddressing(), addPatchCellLayer::calcSidePatch(), fvMotionSolver::cellMotionBoundaryTypes(), polyTopoChange::changeMesh(), polyBoundaryMesh::checkDefinition(), polyBoundaryMesh::checkParallelSync(), GAMGAgglomeration::compactLevels(), fvMeshStitcher::connect(), pointPatchDist::correct(), epsilonWallFunctionFvPatchScalarField::createAveragingWeights(), omegaWallFunctionFvPatchScalarField::createAveragingWeights(), motionSmootherAlgo::curPoints(), cutPolyIsoSurface::cutPolyIsoSurface(), structuredDecomp::decompose(), decompositionMethod::decompose(), fvMeshDistribute::distribute(), snappyLayerDriver::doLayers(), engine::engine(), polyBoundaryMesh::findPatchIDs(), GAMGSolver::GAMGSolver(), lduPrimitiveMesh::gather(), surfaceZonesInfo::getAllClosedNamedSurfaces(), surfaceZonesInfo::getClosedNamedSurfaces(), surfaceZonesInfo::getInsidePointNamedSurfaces(), surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getUnclosedNamedSurfaces(), surfaceZonesInfo::getUnnamedSurfaces(), GAMGProcAgglomeration::globalCellCells(), basicThermo::heBoundaryBaseTypes(), hexRef8Data::hexRef8Data(), LocalInteraction< CloudType >::info(), lduMatrix::initMatrixInterfaces(), singleCellFvMesh::interpolate(), volPointInterpolation::interpolateUnconstrained(), interRegionExplicitPorositySource::interRegionExplicitPorositySource(), rigidBodyModel::join(), layerParameters::layerParameters(), lduPrimitiveMesh::lduPrimitiveMesh(), Foam::MULES::limitSum(), LUscalarMatrix::LUscalarMatrix(), meshRefinement::makeDisplacementField(), polyTopoChange::makeMesh(), MRFPatchField::MRFzone(), polyTopoChanger::names(), polyBoundaryMesh::names(), MeshZones< ZoneType, MeshType >::names(), extendedEdgeMesh::nearestFeatureEdgeByType(), lduPrimitiveMesh::nonBlockingSchedule(), nonConformalBoundary::nonConformalNonCoupledPatchIDs(), processorRunTimes::nProcs(), Foam::operator<<(), PtrList< T >::operator=(), patchDistMethod::patchTypes(), polyBoundaryMesh::physicalTypes(), polyBoundaryMesh::polyBoundaryMesh(), polyMesh::polyMesh(), Foam::polyMeshUnMergeCyclics(), polyTopoChange::polyTopoChange(), powerLawLopesdaCostaZone::powerLawLopesdaCostaZone(), fvMeshDistribute::printMeshInfo(), PtrListDictionary< T >::PtrListDictionary(), repatchMesh::read(), polyMesh::readUpdate(), ensightParts::recalculate(), refinementHistory::refinementHistory(), refinementSurfaces::refinementSurfaces(), structuredRenumber::renumber(), pointBoundaryMesh::reset(), GeometricBoundaryField< Type, PatchField, GeoMesh >::reset(), filmCloudTransfer::resetFromCloudFields(), lduMatrix::residual(), triSurfaceMesh::sampleField(), sampledSurfaces::sampleType(), fvMeshSubset::setCellSubset(), polyBoundaryMesh::setGroup(), fvMeshSubset::setLargeCellSubset(), meshCutAndRemove::setRefinement(), removeCells::setRefinement(), singleCellFvMesh::singleCellFvMesh(), ensightParts::size(), phaseSystem::solve(), fvMeshToFvMesh::srcToTgt(), surfacePatchIOList::surfacePatchIOList(), surfZoneIOList::surfZoneIOList(), fvMesh::swap(), polyMesh::swap(), polyTopoChanger::types(), GeometricBoundaryField< Type, PatchField, GeoMesh >::types(), polyBoundaryMesh::types(), MeshZones< ZoneType, MeshType >::types(), lduMatrix::updateMatrixInterfaces(), UPtrListDictionary< T >::UPtrListDictionary(), Foam::vertices(), populationBalanceSizeDistribution::write(), OFstreamCollator::write(), polyBoundaryMesh::writeData(), ensightParts::writeField(), cellZoneSet::writeObject(), faceZoneSet::writeObject(), pointZoneSet::writeObject(), meshRefinement::zonify(), and subCycleFields< GeometricField >::~subCycleFields().

◆ empty()

bool empty
inline

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

Definition at line 36 of file UPtrListI.H.

◆ first() [1/2]

T & first
inline

Return reference to the first element of the list.

Definition at line 43 of file UPtrListI.H.

Referenced by blendingMethod::constant().

Here is the caller graph for this function:

◆ first() [2/2]

const T & first
inline

Return reference to first element of the list.

Definition at line 50 of file UPtrListI.H.

◆ last() [1/2]

T & last
inline

Return reference to the last element of the list.

Definition at line 57 of file UPtrListI.H.

◆ last() [2/2]

const T & last
inline

Return reference to the last element of the list.

Definition at line 64 of file UPtrListI.H.

◆ setSize()

void setSize ( const label  newSize)

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

of an empty UPtrList, extend a UPtrList, remove entries from the end of a UPtrList

Definition at line 54 of file UPtrList.C.

References clear().

Referenced by fvMesh::curFields(), lduPrimitiveMesh::lduPrimitiveMesh(), phaseSystem::solve(), and UPtrListDictionary< T >::UPtrListDictionary().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize()

void resize ( const label  newSize)
inline

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

of an empty UPtrList, extend a UPtrList, remove entries from the end of a UPtrList

Definition at line 71 of file UPtrListI.H.

References setSize().

Referenced by phaseSystem::phaseSystem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void clear

Clear the UPtrList, i.e. set size to zero.

Definition at line 80 of file UPtrList.C.

◆ transfer()

void transfer ( UPtrList< T > &  a)

Transfer the contents of the argument UPtrList into this.

UPtrList and annul the argument list

Definition at line 87 of file UPtrList.C.

◆ set() [1/2]

◆ set() [2/2]

T * set ( const label  i,
T ptr 
)
inline

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

No checks on new element

Definition at line 85 of file UPtrListI.H.

References Foam::T().

Here is the call graph for this function:

◆ 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 94 of file UPtrList.C.

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

Here is the call graph for this function:

◆ shuffle()

void shuffle ( const labelUList newToOld)

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

ascending or descending order. Reordering has to be unique. Note: can create unset elements

Definition at line 142 of file UPtrList.C.

◆ convert() [1/4]

UPtrList<T2> convert ( )

Convert to list of different pointer type.

◆ convert() [2/4]

UPtrList<const T2> convert ( ) const

Convert to list of different pointer type.

◆ operator[]() [1/2]

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

Return element const reference.

Definition at line 96 of file UPtrListI.H.

Referenced by sampledSets::sampleLocalType(), and sampledSurfaces::sampleLocalType().

Here is the caller graph for this function:

◆ operator[]() [2/2]

T & operator[] ( const label  i)
inline

Return element reference.

Definition at line 112 of file UPtrListI.H.

◆ operator()() [1/2]

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

Return element const pointer.

Definition at line 128 of file UPtrListI.H.

◆ operator()() [2/2]

T * operator() ( const label  i)
inline

Return element const pointer.

Definition at line 135 of file UPtrListI.H.

◆ begin() [1/2]

Foam::UPtrList< T >::iterator begin
inline

Return an iterator to begin traversing the UPtrList.

Definition at line 299 of file UPtrListI.H.

◆ end() [1/2]

Foam::UPtrList< T >::iterator end
inline

Return an iterator to end traversing the UPtrList.

Definition at line 307 of file UPtrListI.H.

References UList< T >::end().

Here is the call graph for this function:

◆ cbegin()

Foam::UPtrList< T >::const_iterator cbegin
inline

Return an const_iterator to begin traversing the UPtrList.

Definition at line 512 of file UPtrListI.H.

References UList< T >::begin().

Here is the call graph for this function:

◆ cend()

Foam::UPtrList< T >::const_iterator cend
inline

Return an const_iterator to end traversing the UPtrList.

Definition at line 520 of file UPtrListI.H.

References UList< T >::end().

Here is the call graph for this function:

◆ begin() [2/2]

Foam::UPtrList< T >::const_iterator begin
inline

Return an const_iterator to begin traversing the UPtrList.

Definition at line 496 of file UPtrListI.H.

References UList< T >::begin().

Here is the call graph for this function:

◆ end() [2/2]

Return an const_iterator to end traversing the UPtrList.

Definition at line 504 of file UPtrListI.H.

References UList< T >::end().

Here is the call graph for this function:

◆ convert() [3/4]

Foam::UPtrList<T2> convert ( )

Definition at line 162 of file UPtrList.C.

References forAll, and UPtrList< T >::set().

Here is the call graph for this function:

◆ convert() [4/4]

Foam::UPtrList<const T2> convert ( ) const

Definition at line 175 of file UPtrList.C.

References forAll, and UPtrList< T >::set().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ PtrList< T >

friend class PtrList< T >
friend

Declare friendship with the PtrList class.

Definition at line 69 of file UPtrList.H.

◆ iterator

friend class iterator
friend

Definition at line 196 of file UPtrList.H.

Referenced by UPtrList< const lduInterface >::iterator::iterator().

◆ operator

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

Write UPtrList to Ostream.


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