Loading...
Searching...
No Matches
UPtrList< T > Class Template Reference

A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers - this is to be done elsewhere. The operator[] returns a reference to the object (not the pointer). More...

#include <UPtrList.H>

Inherited by PtrList< faPatch >, PtrList< fvPatch >, PtrList< blockEdge >, PtrList< blockFace >, PtrList< block >, PtrList< blockVertex >, PtrList< pointPatch >, PtrList< polyPatch >, and PtrList< T >.

Classes

struct  value_compare
 A wrapper for a binary comparison of values that interjects pointer dereferencing with null pointer guards. More...
struct  less
 A UPtrList compare binary predicate for normal sort order. Null entries (if any) sort to the end. More...
struct  greater
 A UPtrList compare binary predicate for reverse sort order. More...
class  Iterator
 Internally used base for iterator and const_iterator. More...
class  iterator
 Forward iterator with non-const access. More...
class  const_iterator
 Forward iterator with const access. More...

Public Types

typedef T value_type
 Type of values the list contains.
typedef Treference
 A non-const reference to the value_type.
typedef const Tconst_reference
 A const reference to the value_type.

Public Member Functions

constexpr UPtrList () noexcept=default
 Default construct.
 UPtrList (const label len)
 Construct with specified size and set all entries to nullptr.
 UPtrList (const UPtrList< T > &list)
 Copy construct (shallow copies addresses).
 UPtrList (UPtrList< T > &&list) noexcept
 Move construct.
 UPtrList (UPtrList< T > &list, bool reuse)
 Construct as shallow copy or re-use as specified.
 UPtrList (PtrList< T > &list)
 Shallow copy from PtrList.
 UPtrList (const UList< T * > &list)
 Construct from UList of pointers (shallow copy).
 UPtrList (UList< T > &list)
 Construct from UList, taking the address of each list element.
bool empty () const noexcept
 True if the list is empty (ie, size() is zero).
label size () const noexcept
 The number of entries in the list.
label capacity () const noexcept
 Size of the underlying storage.
label count_nonnull () const noexcept
 The number of non-nullptr entries in the list.
Tfront ()
 Reference to the first element of the list.
const Tfront () const
 Reference to first element of the list.
Tback ()
 Reference to the last element of the list.
const Tback () const
 Reference to the last element of the list.
const Ttest (const label i) const
 Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie, with bounds checking).
const Tget (const label i) const
 Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie, with bounds checking).
Tget (const label i)
 Return pointer to element (can be nullptr), or nullptr for out-of-range access (ie, with bounds checking).
const Tset (const label i) const
 Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie, with bounds checking).
void clear ()
 Set list size to zero.
void free ()
 Nullify all entries. Does not change the list size.
void resize (const label newLen)
 Change the size of the list. Any new entries are nullptr.
void resize_null (const label newLen)
 Set the list to the given size and set all entries to nullptr.
label squeezeNull ()
 Squeeze out nullptr entries in the list of pointers after which any null pointers will be at the end of the list.
void push_back (T *ptr)
 Append an element to the end of the list.
void push_back (UPtrList< T > &&other)
 Move append another list to the end of this list.
void swap (UPtrList< T > &list) noexcept
 Swap content.
void transfer (UPtrList< T > &list)
 Transfer contents into this list and annul the argument.
Tset (const label i, T *ptr)
 Set element to specified pointer and return the old list element, which can be a nullptr.
void reorder (const labelUList &oldToNew, const bool check=false)
 Reorder elements. Reordering must be unique (ie, shuffle).
void sortOrder (const labelUList &order, const bool check=false)
 Reorder elements according to new order mapping (newToOld). Reordering must be unique (ie, shuffle).
void checkNonNull () const
 Check and raise FatalError if any nullptr exists in the list.
const Tat (const label i) const
 Return const reference to the element at given position. FatalError for bounds problem or nullptr.
Tat (const label i)
 Return reference to the element at given position. FatalError for bounds problem or nullptr.
const Toperator[] (const label i) const
 Return const reference to the element at given position. FatalError for bounds problem or nullptr. Same as at().
Toperator[] (const label i)
 Return reference to the element at given position. FatalError for bounds problem or nullptr. Same as at().
 FOAM_DEPRECATED_FOR (2022-09, "get(), set() or test() methods") const T *operator()(const label i) const
 Deprecated(2022-09) - same as get().
void operator= (const UPtrList< T > &list)
 Copy assignment (shallow copies addresses).
void operator= (UPtrList< T > &&list)
 Move assignment.
OstreamprintAddresses (Ostream &os) const
 Print pointer addresses to Ostream (debugging only).
OstreamwriteList (Ostream &os, const bool trimNull=false) const
 Write UPtrList to Ostream, optionally ignoring null entries.
T ** begin_ptr () noexcept
 Iterator to begin of raw pointers traversal (use with caution).
T ** end_ptr () noexcept
 Iterator beyond end of raw pointers traversal (use with caution).
iterator begin ()
 Return iterator to begin traversal of non-nullptr entries.
iterator end () noexcept
 Return iterator beyond end of UPtrList traversal.
const_iterator cbegin () const
 Return const_iterator to begin traversal of non-nullptr entries.
const_iterator cend () const noexcept
 Return const_iterator beyond end of UPtrList traversal.
const_iterator begin () const
 Return const_iterator to begin traversal of non-nullptr entries.
const_iterator end () const noexcept
 Return const_iterator beyond end of UPtrList traversal.
void setSize (const label n)
 Alias for resize().
Tfirst ()
 Reference to the first element of the list.
const Tfirst () const
 Return reference to first element of the list.
Tlast ()
 Return reference to the last element of the list.
const Tlast () const
 Return reference to the last element of the list.
void append (T *ptr)
 Append an element to the end of the list.
void append (UPtrList< T > &&other)
 Move append another list to the end of this list.
label count () const noexcept
 The number of non-nullptr entries in the list.

Protected Member Functions

void setAddressableSize (const label n) noexcept
 Adjust addressable size.
label find_next (label pos) const
 The next non-null entry after the specified position.
 UPtrList (Detail::PtrListDetail< T > &&ptrs) noexcept
 Low-level move construct.

Protected Attributes

Detail::PtrListDetail< Tptrs_
 The list of pointers.

Friends

class Iterator< true >
 Allow iterator access to internals.
class Iterator< false >
 Allow iterator access to internals.
Ostreamoperator<< (Ostream &os, const UPtrList< T > &list)
 Write UPtrList to Ostream. Does not ignore null entries.

Detailed Description

template<class T>
class Foam::UPtrList< T >

A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers - this is to be done elsewhere. The operator[] returns a reference to the object (not the pointer).

The iterators are similar to bitSet in that they skip nullptr entries, and also return a value (like the list operator[] does).

When traversing lists, it possible to test the validity directly:

forAll(interfaces, i)
{
if (interfaces.test(i))
{
// Interface is set, do something
const auto& intf = interfaces[i];
...
}
}
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299

The lists can also be traversed with a for-range (in OpenFOAM-v2212 and earlier this would have failed on nullptr entries):

for (const auto& intf : interfaces)
{
// Do something
...
}

It is also possible to traverse with non-null entries and use key/val access (like HashTable naming):

forAllConstIters(interfaces, iter)
{
Info<< "entry " << iter.key() << " : " << iter.val() << nl;
}
messageStream Info
Information stream (stdout output on master, null elsewhere).
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
Definition stdFoam.H:235
Note
The class definition is such that it contains a list of pointers, but itself does not inherit from a list of pointers since this would wreak havoc later with inheritance resolution.
See also
Foam::PtrList Foam::PtrDynList
Source files

Definition at line 100 of file UPtrList.H.

Member Typedef Documentation

◆ value_type

template<class T>
typedef T value_type

Type of values the list contains.

Definition at line 140 of file UPtrList.H.

◆ reference

template<class T>
typedef T& reference

A non-const reference to the value_type.

Definition at line 145 of file UPtrList.H.

◆ const_reference

template<class T>
typedef const T& const_reference

A const reference to the value_type.

Definition at line 150 of file UPtrList.H.

Constructor & Destructor Documentation

◆ UPtrList() [1/9]

◆ UPtrList() [2/9]

template<class T>
UPtrList ( )
constexprdefaultnoexcept

Default construct.

◆ UPtrList() [3/9]

template<class T>
UPtrList ( const label len)
inlineexplicit

Construct with specified size and set all entries to nullptr.

Definition at line 41 of file UPtrListI.H.

References ptrs_.

◆ UPtrList() [4/9]

template<class T>
UPtrList ( const UPtrList< T > & list)
inline

Copy construct (shallow copies addresses).

Definition at line 55 of file UPtrListI.H.

References ptrs_, and UPtrList().

Here is the call graph for this function:

◆ UPtrList() [5/9]

template<class T>
UPtrList ( UPtrList< T > && list)
inlinenoexcept

Move construct.

Definition at line 62 of file UPtrListI.H.

References Foam::noexcept, ptrs_, and UPtrList().

Here is the call graph for this function:

◆ UPtrList() [6/9]

template<class T>
UPtrList ( UPtrList< T > & list,
bool reuse )
inline

Construct as shallow copy or re-use as specified.

Definition at line 69 of file UPtrListI.H.

References ptrs_, and UPtrList().

Here is the call graph for this function:

◆ UPtrList() [7/9]

template<class T>
UPtrList ( PtrList< T > & list)
explicit

Shallow copy from PtrList.

The argument is non-const to reflect that the UPtrList can change the values (not the addresses) within the original list.

Definition at line 29 of file UPtrList.C.

References ptrs_.

◆ UPtrList() [8/9]

template<class T>
UPtrList ( const UList< T * > & list)
inlineexplicit

Construct from UList of pointers (shallow copy).

Definition at line 76 of file UPtrListI.H.

References ptrs_.

◆ UPtrList() [9/9]

template<class T>
UPtrList ( UList< T > & list)
inlineexplicit

Construct from UList, taking the address of each list element.

The argument is non-const to reflect that the UPtrList can change the values of the original list.

Definition at line 83 of file UPtrListI.H.

References ptrs_, and size().

Here is the call graph for this function:

Member Function Documentation

◆ setAddressableSize()

◆ find_next()

template<class T>
Foam::label find_next ( label pos) const
inlineprotected

The next non-null entry after the specified position.

Definition at line 32 of file UPtrListI.H.

References Foam::pos(), and ptrs_.

Here is the call graph for this function:

◆ empty()

◆ size()

template<class T>
Foam::label size ( ) const
inlinenoexcept

The number of entries in the list.

Definition at line 106 of file UPtrListI.H.

References Foam::noexcept, and ptrs_.

Referenced by singleProcessorFaceSets::add(), fvMeshAdder::add(), polyMeshAdder::add(), polyMeshAdder::add(), surfaceZonesInfo::addCellZone(), surfaceZonesInfo::addCellZonesToMesh(), surfaceZonesInfo::addFaceZone(), surfaceZonesInfo::addFaceZonesToMesh(), topOZones::addIOcellsZone(), meshRefinement::addPatch(), meshRefinement::addPointZone(), GAMGAgglomeration::agglomerateLduAddressing(), extendedEdgeMesh::allNearestFeatureEdges(), meshRefinement::appendPatch(), Foam::FieldOps::assign(), Foam::FieldOps::assign(), at(), at(), attachPolyTopoChanger::attach(), back(), back(), meshRefinement::blockLeakFaces(), snappySnapDriver::calcNearestSurface(), viewFactor::calculate(), polyBoundaryMesh::checkDefinition(), faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), PtrList< faPatch >::clone(), inverseFaceDistanceDiffusivity::correct(), nearWallDist::correct(), injectionModelList::correct(), cellDistFuncs::correctBoundaryCells(), epsilonWallFunctionFvPatchScalarField::createAveragingWeights(), omegaWallFunctionFvPatchScalarField::createAveragingWeights(), Foam::createReconstructMap(), Foam::createZeroBoundaryPtr(), motionSmootherAlgo::curPoints(), volumetricBSplinesMotionSolver::curPoints(), cyclicACMIGAMGInterface::cyclicACMIGAMGInterface(), cyclicAMIGAMGInterface::cyclicAMIGAMGInterface(), fvMeshDistribute::distribute(), snappyLayerDriver::doLayers(), PtrDynList< T, SizeMin >::emplace_set(), Foam::extract(), extrudePatchMesh::extrudePatchMesh(), faBoundaryMesh::faBoundaryMesh(), faBoundaryMesh::faBoundaryMesh(), patchFieldProbe::findElements(), volPointInterpolationAdjoint::flatBoundaryField(), GAMGSolver::GAMGSolver(), surfaceZonesInfo::getAllClosedNamedSurfaces(), surfaceZonesInfo::getClosedNamedSurfaces(), surfaceZonesInfo::getInsidePointNamedSurfaces(), surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getStandaloneNamedSurfaces(), surfaceZonesInfo::getUnclosedNamedSurfaces(), surfaceZonesInfo::getUnnamedSurfaces(), meshRefinement::getZones(), GAMGProcAgglomeration::globalCellCells(), basicThermo::heBoundaryBaseTypes(), hexRef8Data::hexRef8Data(), faBoundaryMesh::indices(), faBoundaryMesh::indices(), faBoundaryMesh::indices(), pointBoundaryMesh::indices(), pointBoundaryMesh::indices(), polyBoundaryMesh::indices(), polyBoundaryMesh::indices(), interRegionExplicitPorositySource::initialise(), viewFactor::initialise(), lduMatrix::initMatrixInterfaces(), singleCellFvMesh::interpolate(), rigidBodyModel::join(), lduPrimitiveMesh::lduPrimitiveMesh(), Foam::MULES::limitSum(), Foam::MULES::limitSum(), meshRefinement::makeDisplacementField(), polyTopoChange::makeMesh(), mapDistributeBase::mapDistributeBase(), meshToMesh::mapSrcToTgt(), meshToMesh::mapTgtToSrc(), blockMesh::mesh(), extendedEdgeMesh::nearestFeatureEdgeByType(), polyBoundaryMesh::neighbourEdges(), fvMeshTools::newMesh(), Foam::operator<<(), Foam::operator<<(), faBoundaryMesh::operator=(), polyBoundaryMesh::operator=(), PtrDynList< T, SizeMin >::operator=(), PtrDynList< T, SizeMin >::operator=(), PtrDynList< T, SizeMin >::operator=(), blockMesh::patchDicts(), polyBoundaryMesh::patchID(), lumpedPointDisplacementPointPatchVectorField::patchIds(), boundaryMesh::patchify(), pointBoundaryMesh::pointBoundaryMesh(), polyBoundaryMesh::polyBoundaryMesh(), polyBoundaryMesh::polyBoundaryMesh(), PtrDynList< T, SizeMin >::pop_back(), powerLawLopesdaCostaZone::powerLawLopesdaCostaZone(), foamToVtkReportFields::print(), GAMGAgglomeration::printLevels(), GAMGAgglomeration::procAgglomerateLduAddressing(), PtrDynList< T, SizeMin >::PtrDynList(), PtrDynList< T, SizeMin >::PtrDynList(), PtrDynList< T, SizeMin >::PtrDynList(), PtrDynList< T, SizeMin >::PtrDynList(), PtrList< T >::PtrList(), PtrDynList< T, SizeMin >::push_back(), PtrDynList< T, SizeMin >::push_back(), PtrDynList< T, SizeMin >::push_back(), PtrDynList< Foam::Field< label > >::push_back(), PtrList< T >::push_back(), multiphaseInterHtcModel::q(), reactingEulerHtcModel::q(), sampledSurfaces::read(), Foam::readFields(), Foam::readUniformFields(), polyMesh::readUpdate(), refinementHistory::refinementHistory(), PtrList< T >::release(), faBoundaryMeshEntries::removeProcPatches(), polyBoundaryMeshEntries::removeProcPatches(), reorder(), PtrDynList< T, SizeMin >::reserve(), PtrDynList< T, SizeMin >::reserve_exact(), fvMeshSubset::reset(), fvMeshSubset::reset(), PtrList< T >::resize(), sampledPatchInternalField::sampleOnPoints(), PtrDynList< T, SizeMin >::set(), ZoneMesh< ZoneType, MeshType >::setGroup(), coordSetWriter::setTracks(), Foam::shuffle(), singleCellFvMesh::singleCellFvMesh(), Foam::sortedOrder(), sortOrder(), squeezeNull(), Foam::fvc::surfaceSum(), Foam::FieldOps::ternary(), Foam::FieldOps::ternarySelect(), blockMesh::topology(), PtrDynList< T, SizeMin >::transfer(), streamLineBase::trimToBox(), PtrDynList< T, SizeMin >::try_emplace(), GeometricBoundaryField< Type, PatchField, GeoMesh >::types(), cellVolumeWeight::update(), inverseDistance::update(), trackingInverseDistance::update(), sampledFaceZone::update(), oversetFvMeshBase::updateAddressing(), designVariablesUpdate::updateGradientsAndValues(), lduMatrix::updateMatrixInterfaces(), UPtrList(), Foam::vertices(), faBoundaryMesh::whichPatch(), faBoundaryMeshEntries::writeEntries(), polyBoundaryMeshEntries::writeEntries(), faBoundaryMesh::writeEntry(), polyBoundaryMesh::writeEntry(), ZoneMesh< ZoneType, MeshType >::writeEntry(), ZoneMesh< ZoneType, MeshType >::ZoneMesh(), and ZoneMesh< faFaceZone, faMesh >::ZoneMesh().

◆ capacity()

template<class T>
Foam::label capacity ( ) const
inlinenoexcept

Size of the underlying storage.

Definition at line 113 of file UPtrListI.H.

References Foam::noexcept, and ptrs_.

◆ count_nonnull()

template<class T>
Foam::label count_nonnull ( ) const
inlinenoexcept

The number of non-nullptr entries in the list.

Definition at line 120 of file UPtrListI.H.

References Foam::noexcept.

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

Here is the caller graph for this function:

◆ front() [1/2]

template<class T>
T & front ( )
inline

Reference to the first element of the list.

Definition at line 223 of file UPtrListI.H.

References at(), and Foam::T().

Referenced by UPtrList< const lduInterface >::first(), and UPtrList< const lduInterface >::first().

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

◆ front() [2/2]

template<class T>
const T & front ( ) const
inline

Reference to first element of the list.

Definition at line 230 of file UPtrListI.H.

References at(), and Foam::T().

Here is the call graph for this function:

◆ back() [1/2]

template<class T>
T & back ( )
inline

Reference to the last element of the list.

Definition at line 237 of file UPtrListI.H.

References at(), size(), and Foam::T().

Referenced by UPtrList< const lduInterface >::last(), and UPtrList< const lduInterface >::last().

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

◆ back() [2/2]

template<class T>
const T & back ( ) const
inline

Reference to the last element of the list.

Definition at line 244 of file UPtrListI.H.

References at(), size(), and Foam::T().

Here is the call graph for this function:

◆ test()

template<class T>
const T * test ( const label i) const
inline

Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie, with bounds checking).

The return value can be tested as a bool.

Definition at line 127 of file UPtrListI.H.

References ptrs_, and Foam::T().

Referenced by coordinateSystems::cfind(), and procLduMatrix::procLduMatrix().

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

◆ get() [1/2]

template<class T>
const T * get ( const label i) const
inline

Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie, with bounds checking).

The return value can be tested as a bool.

Definition at line 134 of file UPtrListI.H.

References ptrs_, and Foam::T().

Referenced by fvMeshAdder::add(), UPtrList< const lduInterface >::FOAM_DEPRECATED_FOR(), RecycleInteraction< CloudType >::postEvolve(), PtrList< CloudFunctionObject< CloudType > >::push_back(), UPtrList< const lduInterface >::set(), coordSetWriter::setTracks(), lduPrimitiveMeshAssembly::update(), and lduMatrix::updateMatrixInterfaces().

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

◆ get() [2/2]

template<class T>
T * get ( const label i)
inline

Return pointer to element (can be nullptr), or nullptr for out-of-range access (ie, with bounds checking).

The return value can be tested as a bool.

Definition at line 141 of file UPtrListI.H.

References ptrs_, and Foam::T().

Here is the call graph for this function:

◆ set() [1/2]

template<class T>
const T * set ( const label i) const
inline

Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie, with bounds checking).

The return value can be tested as a bool.

Definition at line 366 of file UPtrList.H.

Referenced by fvMeshAdder::add(), GAMGAgglomeration::agglomerateLduAddressing(), GAMGAgglomeration::combineLevels(), directionalMeshWave::correct(), meshWave::correct(), wallDistData< TransferType >::correct(), fvMatrix< Type >::createOrUpdateLduPrimitiveAssembly(), HashTable< T, Key, Hash >::csorted(), cyclicACMIGAMGInterface::cyclicACMIGAMGInterface(), cyclicAMIGAMGInterface::cyclicAMIGAMGInterface(), fvMeshDistribute::distribute(), faBoundaryMesh::edgeFaces(), faBoundaryMesh::edgeLabels(), PtrList< T >::emplace_set(), fvBoundaryMesh::faceCells(), polyBoundaryMesh::faceCells(), GAMGSolver::GAMGSolver(), lduPrimitiveMesh::gather(), GAMGProcAgglomeration::globalCellCells(), hexRef8Data::hexRef8Data(), viewFactor::initialise(), lduMatrix::initMatrixInterfaces(), faBoundaryMesh::interfaces(), fvBoundaryMesh::interfaces(), GeometricBoundaryField< Type, PatchField, GeoMesh >::interfaces(), lduPrimitiveMesh::lduPrimitiveMesh(), Foam::MULES::limitSum(), Foam::MULES::limitSum(), fvMeshAdder::MapDimFields(), mapDistributeBase::mapDistributeBase(), fvMeshAdder::MapSurfaceFields(), fvMeshAdder::MapVolFields(), faceAreaPairGAMGAgglomeration::movePoints(), IOobjectList::objectsTypeImpl(), objectRegistry::objectsTypeImpl(), Foam::operator<<(), GAMGAgglomeration::printLevels(), PtrList< T >::release(), coordSetWriter::repackageFields(), coordSetWriter::repackageFields(), GeometricBoundaryField< Type, PatchField, GeoMesh >::scalarInterfaces(), PtrDynList< T, SizeMin >::set(), PtrList< T >::set(), PtrList< faPatch >::set(), fvMatrix< Type >::setInterfaces(), HashTable< T, Key, Hash >::sorted(), lduMatrix::sumA(), lduPrimitiveMeshAssembly::update(), oversetFvMeshBase::updateAddressing(), lduMatrix::updateMatrixInterfaces(), and oversetFvMeshBase::write().

◆ clear()

template<class T>
void clear ( )
inline

Set list size to zero.

Definition at line 195 of file UPtrListI.H.

References ptrs_.

Referenced by PtrList< T >::clear().

Here is the caller graph for this function:

◆ free()

template<class T>
void free ( )
inline

Nullify all entries. Does not change the list size.

Definition at line 202 of file UPtrListI.H.

References ptrs_.

◆ resize()

template<class T>
void resize ( const label newLen)
inline

Change the size of the list. Any new entries are nullptr.

Definition at line 251 of file UPtrListI.H.

References ptrs_.

Referenced by IOobjectList::objectsTypeImpl(), objectRegistry::objectsTypeImpl(), and UPtrList< const lduInterface >::setSize().

Here is the caller graph for this function:

◆ resize_null()

template<class T>
void resize_null ( const label newLen)
inline

Set the list to the given size and set all entries to nullptr.

Definition at line 258 of file UPtrListI.H.

References ptrs_.

Referenced by PtrList< T >::resize_null().

Here is the caller graph for this function:

◆ squeezeNull()

template<class T>
Foam::label squeezeNull ( )

Squeeze out nullptr entries in the list of pointers after which any null pointers will be at the end of the list.

Returns
the number of non-null entries

Definition at line 38 of file UPtrList.C.

References ptrs_, size(), and Foam::T().

Referenced by PtrDynList< T, SizeMin >::squeezeNull().

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

◆ push_back() [1/2]

template<class T>
void push_back ( T * ptr)
inline

Append an element to the end of the list.

Definition at line 265 of file UPtrListI.H.

References ptrs_, and Foam::T().

Referenced by UPtrList< const lduInterface >::append(), UPtrList< const lduInterface >::append(), PtrList< T >::emplace_back(), PtrList< T >::push_back(), PtrList< T >::push_back(), PtrList< T >::push_back(), PtrList< T >::push_back(), and PtrList< T >::push_back().

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

◆ push_back() [2/2]

template<class T>
void push_back ( UPtrList< T > && other)
inline

Move append another list to the end of this list.

Definition at line 272 of file UPtrListI.H.

References ptrs_, and UPtrList().

Here is the call graph for this function:

◆ swap()

template<class T>
void swap ( UPtrList< T > & list)
inlinenoexcept

Swap content.

Definition at line 209 of file UPtrListI.H.

References ptrs_, and UPtrList().

Here is the call graph for this function:

◆ transfer()

template<class T>
void transfer ( UPtrList< T > & list)
inline

Transfer contents into this list and annul the argument.

Definition at line 216 of file UPtrListI.H.

References ptrs_, and UPtrList().

Here is the call graph for this function:

◆ set() [2/2]

template<class T>
T * set ( const label i,
T * ptr )
inline

Set element to specified pointer and return the old list element, which can be a nullptr.

No-op if the new pointer value is identical to the current content.

Definition at line 182 of file UPtrListI.H.

References ptrs_, and Foam::T().

Here is the call graph for this function:

◆ reorder()

template<class T>
void reorder ( const labelUList & oldToNew,
const bool check = false )

Reorder elements. Reordering must be unique (ie, shuffle).

Optionally check that all pointers have been set.

Definition at line 62 of file UPtrList.C.

References Foam::abort(), Foam::check(), PtrListDetail< T >::checkNonNull(), Foam::FatalError, FatalErrorInFunction, name, Foam::nl, ptrs_, UList< T >::size(), size(), and Foam::T().

Referenced by meshRefinement::addPatch(), LBFGS::pivotFields(), pointBoundaryMesh::reorder(), polyBoundaryMesh::reorder(), fvMeshTools::reorderPatches(), and fvMeshSubset::reset().

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

◆ sortOrder()

template<class T>
void sortOrder ( const labelUList & order,
const bool check = false )

Reorder elements according to new order mapping (newToOld). Reordering must be unique (ie, shuffle).

Optionally check that all pointers have been set.

Definition at line 112 of file UPtrList.C.

References Foam::abort(), Foam::check(), PtrListDetail< T >::checkNonNull(), Foam::FatalError, FatalErrorInFunction, name, Foam::nl, ptrs_, UList< T >::size(), size(), and Foam::T().

Referenced by Foam::shuffle().

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

◆ checkNonNull()

template<class T>
void checkNonNull ( ) const
inline

Check and raise FatalError if any nullptr exists in the list.

Definition at line 280 of file UPtrListI.H.

References ptrs_.

◆ at() [1/2]

template<class T>
const T & at ( const label i) const
inline

Return const reference to the element at given position. FatalError for bounds problem or nullptr.

Definition at line 148 of file UPtrListI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, ptrs_, size(), and Foam::T().

Referenced by back(), back(), front(), front(), operator[](), and operator[]().

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

◆ at() [2/2]

template<class T>
T & at ( const label i)
inline

Return reference to the element at given position. FatalError for bounds problem or nullptr.

Definition at line 165 of file UPtrListI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, ptrs_, size(), and Foam::T().

Here is the call graph for this function:

◆ operator[]() [1/2]

template<class T>
const T & operator[] ( const label i) const
inline

Return const reference to the element at given position. FatalError for bounds problem or nullptr. Same as at().

Definition at line 289 of file UPtrListI.H.

References at(), and Foam::T().

Referenced by faBoundaryMesh::calcGeometry(), faBoundaryMesh::movePoints(), pointBoundaryMesh::movePoints(), faBoundaryMesh::updateMesh(), pointBoundaryMesh::updateMesh(), and faBoundaryMesh::whichPatch().

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

◆ operator[]() [2/2]

template<class T>
T & operator[] ( const label i)
inline

Return reference to the element at given position. FatalError for bounds problem or nullptr. Same as at().

Definition at line 296 of file UPtrListI.H.

References at(), and Foam::T().

Here is the call graph for this function:

◆ FOAM_DEPRECATED_FOR()

template<class T>
FOAM_DEPRECATED_FOR ( 2022- 09,
" get(),
set() or test() methods"  ) const
inline

Deprecated(2022-09) - same as get().

Deprecated
(2022-09) - use get(), set() or test() methods

Definition at line 485 of file UPtrList.H.

◆ operator=() [1/2]

template<class T>
void operator= ( const UPtrList< T > & list)
inline

Copy assignment (shallow copies addresses).

Definition at line 465 of file UPtrListI.H.

References ptrs_, and UPtrList().

Here is the call graph for this function:

◆ operator=() [2/2]

template<class T>
void operator= ( UPtrList< T > && list)
inline

Move assignment.

Definition at line 472 of file UPtrListI.H.

References ptrs_, and UPtrList().

Here is the call graph for this function:

◆ printAddresses()

template<class T>
Foam::Ostream & printAddresses ( Ostream & os) const

Print pointer addresses to Ostream (debugging only).

Definition at line 167 of file UPtrList.C.

References os(), and ptrs_.

Referenced by PtrDynList< T, SizeMin >::printAddresses().

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

◆ writeList()

template<class T>
Foam::Ostream & writeList ( Ostream & os,
const bool trimNull = false ) const

Write UPtrList to Ostream, optionally ignoring null entries.

Definition at line 174 of file UPtrList.C.

References os(), and ptrs_.

Here is the call graph for this function:

◆ begin_ptr()

template<class T>
T ** begin_ptr ( )
inlinenoexcept

Iterator to begin of raw pointers traversal (use with caution).

Definition at line 798 of file UPtrList.H.

Referenced by Foam::sort(), and Foam::sort().

Here is the caller graph for this function:

◆ end_ptr()

template<class T>
T ** end_ptr ( )
inlinenoexcept

Iterator beyond end of raw pointers traversal (use with caution).

Definition at line 803 of file UPtrList.H.

Referenced by Foam::sort(), and Foam::sort().

Here is the caller graph for this function:

◆ begin() [1/2]

template<class T>
Foam::UPtrList< T >::iterator begin ( )
inline

Return iterator to begin traversal of non-nullptr entries.

Definition at line 416 of file UPtrListI.H.

Referenced by ZoneMesh< ZoneType, MeshType >::cfindZone().

Here is the caller graph for this function:

◆ end() [1/2]

template<class T>
Foam::UPtrList< T >::iterator end ( )
inlinenoexcept

Return iterator beyond end of UPtrList traversal.

Definition at line 440 of file UPtrListI.H.

References Foam::noexcept.

Referenced by ZoneMesh< ZoneType, MeshType >::cfindZone().

Here is the caller graph for this function:

◆ cbegin()

template<class T>
Foam::UPtrList< T >::const_iterator cbegin ( ) const
inline

Return const_iterator to begin traversal of non-nullptr entries.

Definition at line 432 of file UPtrListI.H.

◆ cend()

template<class T>
Foam::UPtrList< T >::const_iterator cend ( ) const
inlinenoexcept

Return const_iterator beyond end of UPtrList traversal.

Definition at line 456 of file UPtrListI.H.

References Foam::noexcept.

◆ begin() [2/2]

template<class T>
Foam::UPtrList< T >::const_iterator begin ( ) const
inline

Return const_iterator to begin traversal of non-nullptr entries.

Definition at line 424 of file UPtrListI.H.

◆ end() [2/2]

template<class T>
Foam::UPtrList< T >::const_iterator end ( ) const
inlinenoexcept

Return const_iterator beyond end of UPtrList traversal.

Definition at line 448 of file UPtrListI.H.

References Foam::noexcept.

◆ setSize()

template<class T>
void setSize ( const label n)
inline

Alias for resize().

Definition at line 842 of file UPtrList.H.

Referenced by fvMatrix< Type >::setInterfaces(), lduPrimitiveMeshAssembly::update(), and oversetFvMeshBase::updateAddressing().

Here is the caller graph for this function:

◆ first() [1/2]

template<class T>
T & first ( )
inline

Reference to the first element of the list.

FOAM_DEPRECATED_FOR(2022-10, "front()")

Definition at line 849 of file UPtrList.H.

Referenced by PtrDynList< T, SizeMin >::PtrDynList().

Here is the caller graph for this function:

◆ first() [2/2]

template<class T>
const T & first ( ) const
inline

Return reference to first element of the list.

FOAM_DEPRECATED_FOR(2022-10, "front()")

Definition at line 856 of file UPtrList.H.

◆ last() [1/2]

template<class T>
T & last ( )
inline

Return reference to the last element of the list.

FOAM_DEPRECATED_FOR(2022-10, "back()")

Definition at line 863 of file UPtrList.H.

Referenced by fvMatrix< Type >::setInterfaces().

Here is the caller graph for this function:

◆ last() [2/2]

template<class T>
const T & last ( ) const
inline

Return reference to the last element of the list.

FOAM_DEPRECATED_FOR(2022-10, "back()")

Definition at line 870 of file UPtrList.H.

◆ append() [1/2]

template<class T>
void append ( T * ptr)
inline

Append an element to the end of the list.

FOAM_DEPRECATED_FOR(2022-10, "push_back()")

Definition at line 877 of file UPtrList.H.

◆ append() [2/2]

template<class T>
void append ( UPtrList< T > && other)
inline

Move append another list to the end of this list.

FOAM_DEPRECATED_FOR(2022-10, "push_back()")

Definition at line 884 of file UPtrList.H.

◆ count()

◆ Iterator< true >

template<class T>
friend class Iterator< true >
friend

Allow iterator access to internals.

Definition at line 517 of file UPtrList.H.

◆ Iterator< false >

template<class T>
friend class Iterator< false >
friend

Allow iterator access to internals.

Definition at line 517 of file UPtrList.H.

◆ operator<<

template<class T>
Ostream & operator<< ( Ostream & os,
const UPtrList< T > & list )
friend

Write UPtrList to Ostream. Does not ignore null entries.

Member Data Documentation

◆ ptrs_


The documentation for this class was generated from the following files:
  • src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
  • src/OpenFOAM/containers/PtrLists/UPtrList/UPtrList.H
  • src/OpenFOAM/containers/PtrLists/UPtrList/UPtrList.C
  • src/OpenFOAM/containers/PtrLists/UPtrList/UPtrListI.H