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

Inheritance diagram for UPtrList< 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 reuse 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 append (T *)
 Append an element at the end of the list. 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 184 of file UPtrList.H.

◆ reference

typedef T& reference

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

Definition at line 187 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 191 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 reuse 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(), AveragingMethod< Type >::AveragingMethod(), nearWallFields::calcAddressing(), addPatchCellLayer::calcSidePatch(), fvMotionSolver::cellMotionBoundaryTypes(), polyTopoChange::changeMesh(), polyBoundaryMesh::checkParallelSync(), Foam::meshCheck::checkTopology(), GAMGAgglomeration::compactLevels(), pointDist::correct(), motionSmootherAlgo::curPoints(), cutPolyIsoSurface::cutPolyIsoSurface(), structured::decompose(), decompositionMethod::decompose(), fvMeshDistribute::distribute(), snappyLayerDriver::doLayers(), polyBoundaryMesh::findIndices(), 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(), faceZoneList::insert(), singleCellFvMesh::interpolate(), volPointInterpolation::interpolateUnconstrained(), MomentumTransferPhaseSystem< BasePhaseSystem >::invADVfs(), MomentumTransferPhaseSystem< BasePhaseSystem >::invADVs(), rigidBodyModel::join(), layerParameters::layerParameters(), lduPrimitiveMesh::lduPrimitiveMesh(), Foam::MULES::limitSum(), LUscalarMatrix::LUscalarMatrix(), meshRefinement::makeDisplacementField(), polyTopoChange::makeMesh(), MRFPatchField::MRFzone(), extendedEdgeMesh::nearestFeatureEdgeByType(), lduPrimitiveMesh::nonBlockingSchedule(), nonConformalBoundary::nonConformalOtherPatchIndices(), processorRunTimes::nProcs(), populationBalanceModel::groups::nSizeGroups(), Foam::operator<<(), PtrList< T >::operator=(), patchDistMethod::patchTypes(), polyBoundaryMesh::physicalTypes(), polyBoundaryMesh::polyBoundaryMesh(), polyMesh::polyMesh(), Foam::polyMeshUnMergeCyclics(), fvMeshDistribute::printMeshInfo(), Foam::meshCheck::printMeshStats(), PtrListDictionary< T >::PtrListDictionary(), Fickian< BasicThermophysicalTransportModel >::q(), MaxwellStefan< BasicThermophysicalTransportModel >::q(), nonUnityLewisEddyDiffusivity< TurbulenceThermophysicalTransportModel >::q(), 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(), GeometricFieldListSlicer< Type, PatchField, GeoMesh >::set(), fvMeshSubset::setCellSubset(), polyBoundaryMesh::setGroup(), fvMeshSubset::setLargeCellSubset(), removeCells::setRefinement(), singleCellFvMesh::singleCellFvMesh(), ensightParts::size(), FieldListSlice< Type >::size(), phaseSystem::solve(), fvMeshToFvMesh::srcToTgt(), phaseSystem::sumAlphaMoving(), surfacePatchIOList::surfacePatchIOList(), surfZoneIOList::surfZoneIOList(), fvMesh::swap(), polyMesh::swap(), polyBoundaryMesh::toc(), GeometricBoundaryField< Type, PatchField, GeoMesh >::types(), polyBoundaryMesh::types(), conformedFvsPatchField< Type >::unconform(), lduMatrix::updateMatrixInterfaces(), UPtrListDictionary< T >::UPtrListDictionary(), Foam::vertices(), volPointInterpolation::volPointInterpolation(), populationBalanceSizeDistribution::write(), OFstreamCollator::write(), polyBoundaryMesh::writeData(), ensightParts::writeField(), cellZoneSet::writeObject(), faceZoneSet::writeObject(), pointZoneSet::writeObject(), meshRefinement::zonify(), and subCycleFields< GeometricField >::~subCycleFields().

Here is the caller graph for this function:

◆ 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(), fvMesh::fields(), 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 populationBalanceModel::groups::insert(), phaseSystem::phaseSystem(), and GeometricFieldListSlicer< Type, PatchField, GeoMesh >::set().

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.

◆ append()

void append ( T ptr)
inline

Append an element at the end of the list.

Definition at line 78 of file UPtrListI.H.

References setSize().

Here is the call graph for this function:

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

Referenced by populationBalanceModel::groups::retrieve().

Here is the caller graph for this function:

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

References forAll, UList< T >::size(), and Foam::T().

Here is the call graph for this function:

◆ 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 105 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 121 of file UPtrListI.H.

◆ operator()() [1/2]

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

Return element const pointer.

Definition at line 137 of file UPtrListI.H.

◆ operator()() [2/2]

T * operator() ( const label  i)
inline

Return element const pointer.

Definition at line 144 of file UPtrListI.H.

◆ begin() [1/2]

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

Return an iterator to begin traversing the UPtrList.

Definition at line 308 of file UPtrListI.H.

◆ end() [1/2]

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

Return an iterator to end traversing the UPtrList.

Definition at line 316 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 521 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 529 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 505 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 513 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 199 of file UPtrList.H.

◆ operator

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

Write UPtrList to Ostream.


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