A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers. The operator[] returns a reference to the object, not the pointer. More...
Inherits UPtrList< T >.
Inherited by CloudFunctionObjectList< KinematicCloud< Foam::DSMCCloud > >, CloudFunctionObjectList< KinematicCloud< CloudType > >, CloudFunctionObjectList< KinematicCloud< Cloud< basicKinematicCollidingParcel > > >, DictionaryBase< PtrList< T >, T >, FieldField< PatchField, Type >, FieldField< fvPatchField, symmTensor >, FieldField< fvPatchField, scalar >, FieldField< pointPatchField, Type >, FieldField< fvPatchField, vector >, FieldField< fvPatchField, tensor >, FieldField< Foam::fvPatchField, scalar >, FieldField< Foam::fvPatchField, Foam::Vector >, FieldField< Foam::pointPatchField, Foam::Vector >, FieldField< Field, Foam::Vector >, FieldField< Field, scalar >, FieldField< Foam::Field, scalar >, FieldField< Foam::Field, LUType >, FieldField< fvsPatchField, scalar >, FieldField< pointPatchField, scalar >, FieldField< pointPatchField, vector >, FieldField< faPatchField, scalar >, FieldField< Foam::faPatchField, scalar >, FieldField< Foam::faePatchField, scalar >, FieldField< Foam::faPatchField, Foam::Vector >, FieldField< Foam::faePatchField, Foam::Vector >, FieldField< Foam::faPatchField, Foam::SphericalTensor >, FieldField< Foam::faePatchField, Foam::SphericalTensor >, FieldField< Foam::faPatchField, Foam::SymmTensor >, FieldField< Foam::faePatchField, Foam::SymmTensor >, FieldField< Foam::faPatchField, Foam::Tensor >, FieldField< Foam::faePatchField, Foam::Tensor >, FieldField< Foam::Field, Type >, FieldField< Foam::Field, Foam::Tensor >, FieldField< Foam::fvsPatchField, scalar >, FieldField< Foam::fvsPatchField, Foam::Vector >, FieldField< Foam::fvPatchField, Foam::SphericalTensor >, FieldField< Foam::fvsPatchField, Foam::SphericalTensor >, FieldField< Foam::fvPatchField, Foam::SymmTensor >, FieldField< Foam::fvsPatchField, Foam::SymmTensor >, FieldField< Foam::fvPatchField, Foam::Tensor >, FieldField< Foam::fvsPatchField, Foam::Tensor >, FieldField< Foam::fvPatchField, Type >, FieldField< Foam::pointPatchField, Type >, FieldField< Foam::fvsPatchField, Type >, FieldField< fvsPatchField, vector >, FieldField< Foam::pointPatchField, scalar >, FieldField< Foam::pointPatchField, Foam::SphericalTensor >, FieldField< Foam::pointPatchField, Foam::SymmTensor >, FieldField< Foam::pointPatchField, Foam::Tensor >, FieldField< faPatchField, tensor >, FieldField< faPatchField, vector >, FieldField< faePatchField, scalar >, IOPtrList< Foam::entry >, InjectionModelList< Foam::KinematicCloud< Foam::DSMCCloud > >, ParticleForceList< KinematicCloud< Foam::DSMCCloud > >, ParticleForceList< KinematicCloud< CloudType > >, ParticleForceList< KinematicCloud< Cloud< basicKinematicCollidingParcel > > >, PtrDynList< Foam::Field< label > >, PtrDynList< Foam::Field< scalar > >, PtrDynList< Foam::Field< Foam::Vector > >, PtrDynList< Foam::Field< Foam::SphericalTensor > >, PtrDynList< Foam::Field< Foam::SymmTensor > >, PtrDynList< Foam::Field< Foam::Tensor > >, PtrDynList< Foam::profilingInformation >, ZoneMesh< pointZone, polyMesh >, ZoneMesh< faceZone, polyMesh >, ZoneMesh< cellZone, polyMesh >, IOPtrList< T >, PtrDynList< T, SizeMin >, faBoundaryMesh, fvBoundaryMesh, pointBoundaryMesh, and polyBoundaryMesh.
Public Member Functions | |
constexpr | PtrList () noexcept |
Default construct. More... | |
PtrList (const label len) | |
Construct with specified size, each element initialized to nullptr. More... | |
PtrList (const PtrList< T > &list) | |
Copy construct using 'clone()' method on each element. More... | |
PtrList (PtrList< T > &&list) | |
Move construct. More... | |
PtrList (UList< T * > &list) | |
Take ownership of pointers in the list, set old pointers to null. More... | |
template<class CloneArg > | |
PtrList (const PtrList< T > &list, const CloneArg &cloneArgs) | |
Copy construct using 'clone()' method on each element. More... | |
PtrList (PtrList< T > &list, bool reuse) | |
Construct as copy or re-use as specified. More... | |
PtrList (const SLPtrList< T > &list) | |
Copy construct using 'clone()' on each element of SLPtrList<T> More... | |
template<class INew > | |
PtrList (Istream &is, const INew &inew) | |
Construct from Istream using given Istream constructor class. More... | |
PtrList (Istream &is) | |
Construct from Istream using default Istream constructor class. More... | |
~PtrList () | |
Destructor. More... | |
template<class... Args> | |
PtrList< T > | clone (Args &&... args) const |
Make a copy by cloning each of the list elements. More... | |
const T * | set (const label i) const |
void | clear () |
Clear the PtrList. Delete allocated entries and set size to zero. More... | |
void | resize (const label newLen) |
Adjust size of PtrList. More... | |
void | setSize (const label newLen) |
Same as resize() More... | |
template<class... Args> | |
void | emplace_append (Args &&... args) |
Construct and append an element to the end of the list. More... | |
void | append (T *ptr) |
Append an element to the end of the list. More... | |
void | append (autoPtr< T > &ptr) |
Move append an element to the end of the list. More... | |
void | append (autoPtr< T > &&ptr) |
Move append an element to the end of the list. More... | |
void | append (std::unique_ptr< T > &&ptr) |
Move append an element to the end of the list. More... | |
void | append (const refPtr< T > &ptr) |
Move or clone append a refPtr to the end of the list. More... | |
void | append (const tmp< T > &ptr) |
Move or clone append a tmp to the end of the list. More... | |
void | append (PtrList< T > &&other) |
Move append another list to the end of this list. More... | |
template<class... Args> | |
autoPtr< T > | emplace (const label i, Args &&... args) |
Construct and set an element. More... | |
autoPtr< T > | set (const label i, T *ptr) |
Set element to given pointer and return old element (can be null) More... | |
autoPtr< T > | set (const label i, autoPtr< T > &ptr) |
Set element to given autoPtr and return old element. More... | |
autoPtr< T > | set (const label i, autoPtr< T > &&ptr) |
Set element to given autoPtr and return old element. More... | |
autoPtr< T > | set (const label i, std::unique_ptr< T > &&ptr) |
Set element to given unique_ptr and return old element. More... | |
autoPtr< T > | set (const label i, const refPtr< T > &ptr) |
Set element to given refPtr and return old element. More... | |
autoPtr< T > | set (const label i, const tmp< T > &ptr) |
Set element to given tmp and return old element. More... | |
autoPtr< T > | release (const label i) |
Release ownership of the pointer at the given position. More... | |
void | transfer (PtrList< T > &list) |
Transfer into this list and annul the argument list. More... | |
void | operator= (const PtrList< T > &list) |
Copy assignment. More... | |
void | operator= (PtrList< T > &&list) |
Move assignment. More... | |
template<class... Args> | |
Foam::PtrList< T > | clone (Args &&... args) const |
template<class... Args> | |
Foam::autoPtr< T > | emplace (const label i, Args &&... args) |
![]() | |
constexpr | UPtrList () noexcept |
Default construct. More... | |
UPtrList (const label len) | |
Construct with specified size, each element initialized to nullptr. More... | |
UPtrList (const UPtrList< T > &list) | |
Copy construct (shallow copies addresses) More... | |
UPtrList (UPtrList< T > &&list) | |
Move construct. More... | |
UPtrList (UPtrList< T > &list, bool reuse) | |
Construct as shallow copy or re-use as specified. More... | |
UPtrList (PtrList< T > &list) | |
Shallow copy from PtrList. More... | |
UPtrList (const UList< T * > &list) | |
Construct from UList of pointers (shallow copy) More... | |
UPtrList (UList< T > &list) | |
Construct from UList, taking the address of each list element. More... | |
label | size () const noexcept |
The number of elements in the list. More... | |
bool | empty () const noexcept |
True if the list is empty (ie, size() is zero) More... | |
T & | first () |
Return reference to the first element of the list. More... | |
const T & | first () const |
Return reference to first element of the list. More... | |
T & | last () |
Return reference to the last element of the list. More... | |
const T & | last () const |
Return reference to the last element of the list. More... | |
const T * | test (const label i) const |
T * | get (const label i) |
const T * | get (const label i) const |
const T * | set (const label i) const |
void | clear () |
Set list size to zero. More... | |
void | resize (const label newLen) |
Change the size of the list. More... | |
void | setSize (const label n) |
Alias for resize() More... | |
label | squeezeNull () |
Squeeze out intermediate nullptr entries in the list of pointers. More... | |
void | append (T *ptr) |
Append an element to the end of the list. More... | |
void | append (UPtrList< T > &&other) |
Move append another list to the end of this list. More... | |
void | swap (UPtrList< T > &list) |
Swap content. More... | |
void | transfer (UPtrList< T > &list) |
Transfer contents into this list and annul the argument. More... | |
T * | set (const label i, T *ptr) |
void | reorder (const labelUList &oldToNew, const bool check=false) |
void | sortOrder (const labelUList &order, const bool check=false) |
void | checkNonNull () const |
Check and raise FatalError if any nullptr exists in the list. More... | |
const T & | operator[] (const label i) const |
Return const reference to the element. More... | |
T & | operator[] (const label i) |
Return reference to the element. More... | |
const T * | operator() (const label i) const |
Return const pointer to the element - same as get(). More... | |
void | operator= (const UPtrList< T > &list) |
Copy assignment (shallow copies addresses) More... | |
void | operator= (UPtrList< T > &&list) |
Move assignment. More... | |
T ** | begin_ptr () noexcept |
Iterator to begin of raw pointers traversal (use with caution) More... | |
T ** | end_ptr () noexcept |
Iterator beyond end of raw pointers traversal (use with caution) More... | |
iterator | begin () noexcept |
Return an iterator to begin of UPtrList traversal. More... | |
iterator | end () noexcept |
Return iterator beyond end of UPtrList traversal. More... | |
const_iterator | cbegin () const noexcept |
Return const_iterator to begin of UPtrList traversal. More... | |
const_iterator | cend () const noexcept |
Return const_iterator beyond end of UPtrList traversal. More... | |
const_iterator | begin () const noexcept |
Return const_iterator to begin of UPtrList traversal. More... | |
const_iterator | end () const noexcept |
Return const_iterator beyond end of UPtrList traversal. More... | |
Protected Member Functions | |
template<class INew > | |
void | readIstream (Istream &is, const INew &inew) |
Read from Istream using Istream constructor class. More... | |
void | free () |
Delete the allocated entries, but retain the list size. More... | |
![]() | |
void | setAddressableSize (const label n) noexcept |
Adjust addressable size. More... | |
UPtrList (Detail::PtrListDetail< T > &&ptrs) | |
Low-level move construct. More... | |
Friends | |
Istream & | operator>> (Istream &is, PtrList< T > &list) |
Read from Istream, discarding contents of existing list. More... | |
Additional Inherited Members | |
![]() | |
typedef T | value_type |
Type of values the list contains. More... | |
typedef T & | reference |
A non-const reference to the value_type. More... | |
typedef const T & | const_reference |
A const reference to the value_type. More... | |
![]() | |
Detail::PtrListDetail< T > | ptrs_ |
The list of pointers. More... | |
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers. The operator[] returns a reference to the object, not the pointer.
|
inlineconstexprnoexcept |
Default construct.
Definition at line 45 of file PtrListI.H.
|
inlineexplicit |
Construct with specified size, each element initialized to nullptr.
Definition at line 52 of file PtrListI.H.
Copy construct using 'clone()' method on each element.
Definition at line 59 of file PtrListI.H.
Move construct.
Definition at line 66 of file PtrListI.H.
Take ownership of pointers in the list, set old pointers to null.
Definition at line 73 of file PtrListI.H.
References T.
Copy construct using 'clone()' method on each element.
Definition at line 84 of file PtrListI.H.
Construct as copy or re-use as specified.
Definition at line 36 of file PtrList.C.
References PtrList< T >::clone(), UPtrList< T >::ptrs_, and UPtrList< T >::size().
Copy construct using 'clone()' on each element of SLPtrList<T>
Definition at line 54 of file PtrList.C.
References LPtrList< LListBase, T >::cbegin(), LPtrList< LListBase, T >::cend(), and UPtrList< T >::ptrs_.
Construct from Istream using given Istream constructor class.
Definition at line 145 of file PtrListIO.C.
Construct from Istream using default Istream constructor class.
Definition at line 152 of file PtrListIO.C.
Read from Istream using Istream constructor class.
Definition at line 38 of file PtrListIO.C.
References clear(), IOstream::fatalCheck(), FUNCTION_NAME, token::isLabel(), token::labelToken(), p, Istream::readBeginList(), resize(), and T.
Referenced by IOPtrList< T >::IOPtrList(), and IOPtrList< Foam::entry >::operator=().
|
inlineprotected |
Delete the allocated entries, but retain the list size.
Definition at line 36 of file PtrListI.H.
Make a copy by cloning each of the list elements.
Referenced by attachPolyTopoChanger::attach(), faMeshDistributor::distribute(), fvMeshTools::newMesh(), and PtrList< T >::PtrList().
|
inline |
Return const pointer to element (can be nullptr), without bounds checking - same as get().
The return value can be tested as a bool.
Definition at line 138 of file PtrList.H.
Referenced by isoSurfacePoint::adaptPatchFields(), fvMeshAdder::add(), polyMeshAdder::add(), surfaceZonesInfo::addCellZone(), cellTable::addCellZones(), surfaceZonesInfo::addFaceZone(), phaseSystem::addField(), meshRefinement::addPointZone(), meshRefinement::appendPatch(), viewFactor::calculate(), boundaryMesh::changeFaces(), boundaryMesh::changePatchType(), ZoneMesh< pointZone, polyMesh >::checkDefinition(), adjointSolverManager::constraintSensitivities(), diffusionMulticomponent< ReactionThermo, ThermoType >::correct(), directionalPressureGradientExplicitSource::correct(), cyclicACMIFvPatchField< Type >::cyclicACMIFvPatchField(), MomentumTransferPhaseSystem< BasePhaseSystem >::ddtCorrByAs(), faFieldDecomposer::decomposeField(), fvFieldDecomposer::decomposeField(), pointFieldDecomposer::decomposeField(), boundaryMesh::deletePatch(), faMeshDistributor::distribute(), fvMeshDistribute::distribute(), faMeshDistributor::distributeField(), extrudePatchMesh::extrudePatchMesh(), forAll(), GAMGSolver::GAMGSolver(), lduPrimitiveMesh::gather(), GeometricBoundaryField< Type, PatchField, GeoMesh >::GeometricBoundaryField(), surfaceZonesInfo::getAllClosedNamedSurfaces(), surfaceZonesInfo::getClosedNamedSurfaces(), surfaceZonesInfo::getInsidePointNamedSurfaces(), surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getStandaloneNamedSurfaces(), surfaceZonesInfo::getUnclosedNamedSurfaces(), GAMGProcAgglomeration::globalCellCells(), lduPrimitiveMesh::globalCellCells(), interRegionExplicitPorositySource::initialise(), viewFactor::initialise(), PDRblock::innerMesh(), faMeshSubset::interpolate(), singleCellFvMesh::interpolate(), fvMeshSubset::interpolate(), meshToMesh0::interpolate(), isoSurfacePoint::isoSurfacePoint(), fvMeshTools::loadOrCreateMesh(), faMeshTools::loadOrCreateMesh(), LUscalarMatrix::LUscalarMatrix(), polyTopoChange::makeMesh(), fvMeshAdder::MapDimFields(), meshToMesh::mapSrcToTgt(), fvMeshAdder::MapSurfaceFields(), meshToMesh::mapTgtToSrc(), fvMeshAdder::MapVolFields(), MomentumTransferPhaseSystem< BasePhaseSystem >::momentumTransferf(), multiComponentMixture< ThermoType >::multiComponentMixture(), faMeshTools::newMesh(), MomentumTransferPhaseSystem< BasePhaseSystem >::partialElimination(), MomentumTransferPhaseSystem< BasePhaseSystem >::partialEliminationf(), PDRblock::PDRblock(), pointBoundaryMesh::pointBoundaryMesh(), polyBoundaryMesh::polyBoundaryMesh(), polyMesh::polyMesh(), RecycleInteraction< CloudType >::postEvolve(), powerLawLopesdaCostaZone::powerLawLopesdaCostaZone(), pyrolysisChemistryModel< CompType, SolidThermo, GasThermo >::pyrolysisChemistryModel(), functionObjectList::read(), sampledSurfaces::read(), boundaryMesh::read(), externalCoupled::readDataMaster(), Foam::readLagrangian(), faFieldReconstructor::reconstructAreaField(), faFieldReconstructor::reconstructEdgeField(), faFieldReconstructor::reconstructField(), fvFieldReconstructor::reconstructField(), pointFieldReconstructor::reconstructField(), fvFieldReconstructor::reconstructInternalField(), pointFieldReconstructor::reconstructPointField(), processorMeshes::reconstructPoints(), fvFieldReconstructor::reconstructSurfaceField(), fvFieldReconstructor::reconstructVolumeField(), refinementSurfaces::refinementSurfaces(), refinementFeatures::regionEdgeTrees(), faMeshSubset::reset(), fvMeshSubset::reset(), multiphaseSystem::solve(), multiphaseSystem::solveAlphas(), MultiComponentPhaseModel< BasePhaseModel, phaseThermo >::solveYi(), ZoneMesh< pointZone, polyMesh >::sortedNames(), syncTools::syncFaceList(), blockMesh::topology(), inverseDistance::update(), trackingInverseDistance::update(), optimisationType::updateGradientsAndValues(), OFstreamCollator::write(), externalCoupled::writeDataMaster(), faMeshDecomposition::writeDecomposition(), cellZoneSet::writeObject(), faceZoneSet::writeObject(), pointZoneSet::writeObject(), and streamLineBase::writeToFile().
|
inline |
Clear the PtrList. Delete allocated entries and set size to zero.
Definition at line 97 of file PtrListI.H.
Referenced by Relaxation< CloudType >::cacheFields(), Explicit< CloudType >::cacheFields(), fvMatrix< Type >::clear(), functionObjectList::clear(), PtrDynList< Foam::Field< label > >::emplace_append(), GeometricField< Type, PatchField, GeoMesh >::GeometricField(), GeometricField< Type, PatchField, GeoMesh >::operator=(), GeometricField< Type, PatchField, GeoMesh >::operator==(), functionObjectList::read(), sampledSets::read(), sampledSurfaces::read(), polyMesh::removeBoundary(), and decompositionMethod::setConstraints().
void resize | ( | const label | newLen | ) |
Adjust size of PtrList.
New entries are initialized to nullptr, removed entries are deleted
Definition at line 103 of file PtrList.C.
Referenced by polyTopoChange::addMesh(), fvMeshTools::addPatch(), faMeshDistributor::distribute(), fvMeshTools::loadOrCreateMesh(), faMeshTools::loadOrCreateMesh(), faMeshTools::newMesh(), PDRblock::PDRblock(), polyBoundaryMesh::polyBoundaryMesh(), functionObjectList::read(), sampledSurfaces::read(), fvMeshSubset::reset(), and PtrList< T >::setSize().
|
inline |
Same as resize()
Definition at line 151 of file PtrList.H.
References PtrList< T >::resize().
Referenced by fvMeshAdder::add(), polyMeshAdder::add(), surfaceZonesInfo::addCellZone(), cellTable::addCellZones(), surfaceZonesInfo::addFaceZone(), meshRefinement::addPointZone(), meshRefinement::appendPatch(), SurfaceFilmModel< CloudType >::cacheFilmFields(), lduPrimitiveMesh::gather(), interRegionExplicitPorositySource::initialise(), viewFactor::initialise(), fvMatrix< Type >::mapContributions(), polyMesh::polyMesh(), powerLawLopesdaCostaZone::powerLawLopesdaCostaZone(), polyMesh::readUpdate(), polyMesh::removeBoundary(), searchableSurfaces::searchableSurfaces(), duplicatePoints::setRefinement(), trackingInverseDistance::update(), optimisationType::updateGradientsAndValues(), OFstreamCollator::write(), cellZoneSet::writeObject(), faceZoneSet::writeObject(), and pointZoneSet::writeObject().
|
inline |
Construct and append an element to the end of the list.
Definition at line 106 of file PtrListI.H.
References outputOptions::append(), args, and T.
|
inline |
Append an element to the end of the list.
Definition at line 113 of file PtrListI.H.
References outputOptions::append().
Referenced by singleProcessorFaceSets::add(), FreeStream< CloudType >::FreeStream(), triSurfaceLoader::load(), rigidBodyMeshMotion::rigidBodyMeshMotion(), rigidBodyMeshMotionSolver::rigidBodyMeshMotionSolver(), and streamLineBase::trimToBox().
Move append an element to the end of the list.
Definition at line 120 of file PtrListI.H.
References outputOptions::append(), and autoPtr< T >::release().
Move append an element to the end of the list.
Definition at line 127 of file PtrListI.H.
References outputOptions::append().
|
inline |
Move append an element to the end of the list.
Definition at line 134 of file PtrListI.H.
References outputOptions::append().
Move or clone append a refPtr to the end of the list.
Definition at line 141 of file PtrListI.H.
References outputOptions::append(), and refPtr< T >::ptr().
Move or clone append a tmp to the end of the list.
Definition at line 148 of file PtrListI.H.
References outputOptions::append(), and tmp< T >::ptr().
Move append another list to the end of this list.
Definition at line 155 of file PtrListI.H.
|
inline |
Set element to given pointer and return old element (can be null)
No-op if the new pointer value is identical to the current content.
Definition at line 191 of file PtrListI.H.
|
inline |
Set element to given autoPtr and return old element.
Definition at line 202 of file PtrListI.H.
|
inline |
Set element to given autoPtr and return old element.
Definition at line 213 of file PtrListI.H.
|
inline |
Set element to given unique_ptr and return old element.
Definition at line 224 of file PtrListI.H.
|
inline |
Set element to given refPtr and return old element.
Definition at line 235 of file PtrListI.H.
References refPtr< T >::ptr().
|
inline |
Set element to given tmp and return old element.
Definition at line 246 of file PtrListI.H.
References tmp< T >::ptr().
|
inline |
Release ownership of the pointer at the given position.
Out of bounds addressing is a no-op and returns nullptr.
Definition at line 257 of file PtrListI.H.
Transfer into this list and annul the argument list.
Definition at line 269 of file PtrListI.H.
References kinematicSingleLayer::transfer().
Referenced by faMesh::addFaPatches(), wallDistData< TransferType >::correct(), meshWave::correct(), directionalMeshWave::correct(), IATE::read(), and CompactListList< T >::transfer().
Copy assignment.
For existing list entries, values are copied from the list. For new list entries, pointers are cloned from the list.
Definition at line 133 of file PtrList.C.
References resize(), and UPtrList< T >::size().
Referenced by IOPtrList< Foam::entry >::operator=(), IOPtrList< T >::operator=(), and PtrDynList< T, SizeMin >::operator=().
Move assignment.
Definition at line 279 of file PtrListI.H.
Foam::PtrList< T > clone | ( | Args &&... | args | ) | const |
Definition at line 82 of file PtrList.C.
References args, UPtrList< T >::ptrs_, and T.
|
inline |
Definition at line 180 of file PtrListI.H.
Read from Istream, discarding contents of existing list.