tmp< T > Class Template Reference

A class for managing temporary objects. More...

Inheritance diagram for tmp< T >:

Public Types

typedef T Type
 
typedef Foam::refCount refCount
 

Public Member Functions

 tmp (T *=0, bool nonReusable=false)
 Store object pointer of a non-reusable or reusable temporary object. More...
 
 tmp (const T &)
 Store object const reference. More...
 
 tmp (const tmp< T > &)
 Construct copy and increment reference count. More...
 
 tmp (const tmp< T > &&)
 Construct copy moving content, does not increment reference count. More...
 
 tmp (const tmp< T > &, bool allowTransfer)
 Construct copy transferring content of temporary if required. More...
 
 ~tmp ()
 Destructor: deletes temporary object when the reference count is 0. More...
 
bool isTmp () const
 Return true if this is really a temporary object. More...
 
bool empty () const
 Return true if this temporary object empty,. More...
 
bool valid () const
 Is this temporary object valid,. More...
 
word typeName () const
 Return the type name of the tmp. More...
 
Tref () const
 Return non-const reference or generate a fatal error. More...
 
Tptr () const
 Return tmp pointer for reuse. More...
 
void clear () const
 If object pointer points to valid object: More...
 
const Toperator() () const
 Const dereference operator. More...
 
 operator const T & () const
 Const cast to the underlying type reference. More...
 
Toperator-> ()
 Return object pointer. More...
 
const Toperator-> () const
 Return const object pointer. More...
 
void operator= (T *)
 Assignment to pointer changing this tmp to a temporary T. More...
 
void operator= (const tmp< T > &)
 Assignment transferring the temporary T to this tmp. More...
 
void operator= (const tmp< T > &&)
 Move assignment transferring the temporary T to this tmp. More...
 

Detailed Description

template<class T>
class Foam::tmp< T >

A class for managing temporary objects.

Source files
See also
Foam::refCount Foam::autoPtr

Definition at line 54 of file tmp.H.

Member Typedef Documentation

◆ Type

typedef T Type

Definition at line 83 of file tmp.H.

◆ refCount

Definition at line 84 of file tmp.H.

Constructor & Destructor Documentation

◆ tmp() [1/5]

tmp ( T tPtr = 0,
bool  nonReusable = false 
)
inlineexplicit

Store object pointer of a non-reusable or reusable temporary object.

Definition at line 49 of file tmpI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and tmp< T >::typeName().

Here is the call graph for this function:

◆ tmp() [2/5]

tmp ( const T tRef)
inline

Store object const reference.

Definition at line 65 of file tmpI.H.

◆ tmp() [3/5]

tmp ( const tmp< T > &  t)
inline

Construct copy and increment reference count.

Definition at line 73 of file tmpI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and tmp< T >::typeName().

Here is the call graph for this function:

◆ tmp() [4/5]

tmp ( const tmp< T > &&  t)
inline

Construct copy moving content, does not increment reference count.

Definition at line 95 of file tmpI.H.

◆ tmp() [5/5]

tmp ( const tmp< T > &  t,
bool  allowTransfer 
)
inline

Construct copy transferring content of temporary if required.

Definition at line 108 of file tmpI.H.

◆ ~tmp()

~tmp
inline

Destructor: deletes temporary object when the reference count is 0.

Definition at line 137 of file tmpI.H.

Member Function Documentation

◆ isTmp()

bool isTmp
inline

◆ empty()

bool empty
inline

Return true if this temporary object empty,.

ie, a temporary without allocation

Definition at line 160 of file tmpI.H.

◆ valid()

bool valid
inline

◆ typeName()

Foam::word typeName
inline

Return the type name of the tmp.

constructed from the type name of T

Definition at line 174 of file tmpI.H.

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

Referenced by tmp< T >::tmp(), and tmp< Foam::fvPatchField >::typeName().

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

◆ ref()

T & ref
inline

Return non-const reference or generate a fatal error.

if the object is const.

Definition at line 181 of file tmpI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Referenced by fvMatrix< Type >::A(), MRFZoneList::absolute(), greyMean::aCont(), wideBand::aCont(), coupledTemperatureFvPatchScalarField::add(), interRegionHeatTransfer::addSup(), MomentumTransferPhaseSystem< BasePhaseSystem >::addTmpField(), phaseChange::addToDriftRate(), cloud::aDisp(), pairGAMGAgglomeration::agglomerate(), GAMGInterface::agglomerateCoeffs(), MomentumCloud< CloudType >::alpha(), blendingMethod::alpha(), compressibleMultiphaseVoFMixture::alphaEff(), waveAlphaFvPatchScalarField::alphan(), twoPhaseSolver::alphaPredictor(), alphatJayatillekeWallFunctionFvPatchScalarField::alphat(), ThermoCloud< CloudType >::ap(), parcelCloudList::ap(), patchCutLayerAverage::applyWeights(), Foam::atan2(), velocityGroup::Av(), Foam::fvc::average(), motionSmootherAlgo::avg(), snappySnapDriver::avgCellCentres(), GeometricBoundaryField< Type, PatchField, GeoMesh >::boundaryInternalField(), GeometricBoundaryField< Type, PatchField, GeoMesh >::boundaryNeighbourField(), cellMDLimitedGrad< Type >::calcGrad(), faceLimitedGrad< Type >::calcGrad(), faceMDLimitedGrad< Type >::calcGrad(), phaseSystem::calcPhi(), nutUSpaldingWallFunctionFvPatchScalarField::calcUTau(), primitiveMeshTools::cellDeterminant(), heThermo< BasicThermo, MixtureType >::cellSetProperty(), MRFZoneList::centrifugalAcceleration(), polyMesh::checkCellDeterminant(), polyMesh::checkFaceOrthogonality(), polyMesh::checkFaceSkewness(), polyMesh::checkFaceWeight(), polyMesh::checkVolRatio(), filmCloudTransfer::CloudToFilmTransferRate(), Foam::cmptAv(), Foam::cmptMag(), Foam::cmptMax(), Foam::cmptMin(), fvPatch::Cn(), FieldField< Field, Type >::component(), Field< Type >::component(), fvMeshStitcher::conformalNccBoundaryField(), fvMeshStitcher::conformalOrigBoundaryField(), isothermalFilm::constrainedField(), Foam::constrainH(), Foam::constrainHbyA(), Foam::constrainPhid(), Foam::constrainPhiHbyA(), searchableBox::coordinates(), searchableSurfaceCollection::coordinates(), triSurfaceMesh::coordinates(), PDRkEpsilon::correct(), kEpsilonLopesdaCosta< BasicMomentumTransportModel >::correct(), kOmegaSST< MomentumTransportModel, BasicMomentumTransportModel >::correct(), lambdaThixotropic< BasicMomentumTransportModel >::correct(), DeardorffDiffStress< BasicMomentumTransportModel >::correct(), SpalartAllmarasDES< BasicMomentumTransportModel >::correct(), kEpsilon< BasicMomentumTransportModel >::correct(), kOmega< BasicMomentumTransportModel >::correct(), kOmega2006< BasicMomentumTransportModel >::correct(), LaunderSharmaKE< BasicMomentumTransportModel >::correct(), LRR< BasicMomentumTransportModel >::correct(), realizableKE< BasicMomentumTransportModel >::correct(), RNGkEpsilon< BasicMomentumTransportModel >::correct(), SpalartAllmaras< BasicMomentumTransportModel >::correct(), SSG< BasicMomentumTransportModel >::correct(), v2f< BasicMomentumTransportModel >::correct(), mixtureKEpsilon< BasicMomentumTransportModel >::correct(), InterfaceCompositionPhaseChangePhaseSystem< BasePhaseSystem >::correctInterfaceThermo(), correctedSnGrad< Type >::correction(), faceCorrectedSnGrad< Type >::correction(), linearUpwindV< Type >::correction(), CentredFitSnGradScheme< Type, Polynomial, Stencil >::correction(), cubic< Type >::correction(), outletStabilised< Type >::correction(), pointLinear< Type >::correction(), linearUpwind< Type >::correction(), basicSpecieMixture::correctMassFractions(), kOmegaSSTLM< BasicMomentumTransportModel >::correctReThetatGammaInt(), Foam::fvc::curl(), motionSmootherAlgo::curPoints(), displacementLinearMotionMotionSolver::curPoints(), interpolatingSolidBodyMotionSolver::curPoints(), multiSolidBodyMotionSolver::curPoints(), solidBodyMotionSolver::curPoints(), displacementComponentLaplacianFvMotionSolver::curPoints(), velocityComponentLaplacianFvMotionSolver::curPoints(), displacementLaplacianFvMotionSolver::curPoints(), displacementSBRStressFvMotionSolver::curPoints(), velocityLaplacianFvMotionSolver::curPoints(), triSurface::curvature(), fvMatrix< Type >::D(), cavitation::d2mdtdpf(), wallDampingModel::damping(), basic::Dcu(), fvMatrix< Type >::DD(), MRFZoneList::DDt(), fvMesh::delta(), blackBodyEmission::deltaLambdaT(), nonlinearEddyViscosity< BasicMomentumTransportModel >::devTau(), mappedInternalPatchBase::distribute(), Foam::fvm::divc(), regionSizeDistribution::divide(), Fickian< BasicThermophysicalTransportModel >::divq(), MaxwellStefan< BasicThermophysicalTransportModel >::divq(), nonUnityLewisEddyDiffusivity< TurbulenceThermophysicalTransportModel >::divq(), cavitation::dmdtf(), InterfaceCompositionPhaseChangePhaseSystem< BasePhaseSystem >::dmdtf(), PhaseTransferPhaseSystem< BasePhaseSystem >::dmdtf(), PopulationBalancePhaseSystem< BasePhaseSystem >::dmdtf(), ThermalPhaseChangePhaseSystem< BasePhaseSystem >::dmdtf(), blackBodyEmission::EbDeltaLambdaT(), greyMeanCombustion::ECont(), wideBandCombustion::ECont(), PatchTools::edgeNormals(), cloud::EDisp(), ThermoCloud< CloudType >::Ep(), parcelCloudList::Ep(), atmBoundaryLayer::epsilon(), age::execute(), wallHeatTransferCoeff::execute(), polyPatch::faceCellCentres(), primitiveMeshTools::faceConcavity(), primitiveMeshTools::faceFlatness(), lduMatrix::faceH(), cellQuality::faceNonOrthogonality(), polyMeshTools::faceOrthogonality(), primitiveMeshTools::faceOrthogonality(), cellQuality::faceSkewness(), polyMeshTools::faceSkewness(), primitiveMeshTools::faceSkewness(), PrimitivePatchInterpolation< Patch >::faceToEdgeInterpolate(), PrimitivePatchInterpolation< Patch >::faceToPointInterpolate(), polyMeshTools::faceWeights(), fvMeshStitcher::fieldRMapSum(), VoFFilmTransfer::filmVoFTransferRate(), zoneCombustion::filter(), surfaceFieldValue::filterField(), kOmegaSSTLM< BasicMomentumTransportModel >::Flength(), fvMatrix< Type >::flux(), forcing::forceCoeff(), fft::forwardTransform(), mappedPatchBase::fromNeighbour(), correctedSnGrad< Type >::fullGradCorrection(), faceCorrectedSnGrad< Type >::fullGradCorrection(), backwardDdtScheme< Type >::fvcDdt(), CoEulerDdtScheme< Type >::fvcDdt(), CrankNicolsonDdtScheme< Type >::fvcDdt(), EulerDdtScheme< Type >::fvcDdt(), SLTSDdtScheme< Type >::fvcDdt(), ddtScheme< Type >::fvcDdtPhiCoeff(), gaussConvectionScheme< Type >::fvcDiv(), gaussDivScheme< Type >::fvcDiv(), gaussLaplacianScheme< Type, GType >::fvcLaplacian(), EulerD2dt2Scheme< Type >::fvmD2dt2(), backwardDdtScheme< Type >::fvmDdt(), CoEulerDdtScheme< Type >::fvmDdt(), EulerDdtScheme< Type >::fvmDdt(), localEulerDdtScheme< Type >::fvmDdt(), SLTSDdtScheme< Type >::fvmDdt(), gaussConvectionScheme< Type >::fvmDiv(), gaussLaplacianScheme< Type, GType >::fvmLaplacian(), gaussLaplacianScheme< Type, GType >::fvmLaplacianUncorrected(), surfaceFieldValue::getFieldValues(), coupledMultiphaseTemperatureFvPatchScalarField::getNbr(), fvMeshStitcher::getOrigNccMagSfb(), basic::Gk(), fvMatrix< Type >::H(), lduMatrix::H(), fvMatrix< Type >::H1(), lduMatrix::H1(), heThermo< BasicPsiThermo, MixtureType >::heBoundaryCorrection(), AnisothermalPhaseModel< BasePhaseModel >::heEqn(), parcelCloudList::hsCoeff(), parcelCloudList::hsTrans(), kappaEff::htcByRhoCp(), ReynoldsAnalogy::htcByRhoCp(), FieldFunction1< Type, Function1Type >::integral(), unintegrable::integrate(), unintegrable::integrateX(), twoPhaseMixture::interfaceFraction(), GAMGInterface::interfaceInternalField(), cyclicGAMGInterface::internalFieldTransfer(), fieldInterpolation< Type, InterpolationType >::interpolate(), cutPolyIsoSurface::interpolate(), pointToPointPlanarInterpolation::interpolate(), vtkMesh::interpolate(), surfaceInterpolationScheme< scalar >::interpolate(), singleCellFvMesh::interpolate(), surfaceInterpolationScheme< Type >::interpolate(), localMax< Type >::interpolate(), localMin< Type >::interpolate(), fvMeshSubset::interpolate(), volPointInterpolation::interpolate(), interfaceCompressionNew::interpolate(), PLIC::interpolate(), PLICU::interpolate(), patch::interpolateField(), thresholdCellFaces::interpolateField(), triSurfaceMesh::interpolateField(), interpolation< Foam::Vector >::interpolation(), Foam::inv(), MaxwellStefan< BasicThermophysicalTransportModel >::j(), segregated::K(), SpalartAllmarasDES< BasicMomentumTransportModel >::k(), ReynoldsStress< BasicMomentumTransportModel >::k(), phaseSystem::K(), atmBoundaryLayer::k(), multiphaseVoFMixture::K(), Foam::levelSetFraction(), LimitedScheme< Type, Limiter, LimitFunc >::limiter(), PhiScheme< Type, PhiLimiter >::limiter(), Foam::mag(), Foam::magSqr(), Foam::fvc::magSqrGradGrad(), main(), timeVaryingMappedFvPatchField< Type >::map(), mappedFvPatchField< Type >::mappedValues(), momentOfInertia::meshInertia(), fvMesh::movePoints(), primitiveMesh::movePoints(), phaseSystem::nearInterface(), multiphaseVoFMixture::nearInterface(), Foam::New(), fvMeshStitcher::nonConformalBoundaryField(), nonlinearEddyViscosity< incompressible::RASModel >::nonlinearEddyViscosity(), cellQuality::nonOrthogonality(), basicSpecieMixture::normalise(), JohnsonJacksonSchaeffer::nu(), Schaeffer::nu(), strainRateFunction::nu(), nutkAtmRoughWallFunctionFvPatchScalarField::nut(), nutkRoughWallFunctionFvPatchScalarField::nut(), nutkWallFunctionFvPatchScalarField::nut(), nutURoughWallFunctionFvPatchScalarField::nut(), nutUWallFunctionFvPatchScalarField::nut(), consumptionSpeed::omega0Sigma(), inversePointDistanceDiffusivity::operator()(), RaviPetersen::operator()(), anisotropicFilter::operator()(), blendingMethod::parameter(), fvPatch::patchInternalField(), cyclicFvPatchField< Type >::patchNeighbourField(), cyclicFvsPatchField< Type >::patchNeighbourField(), jumpCyclicFvPatchField< Type >::patchNeighbourField(), fixedValue::PDF(), tabulatedCumulative::PDF(), tabulatedDensity::PDF(), noiseFFT::Pf(), specieTransferTemperatureFvPatchScalarField::phiHep(), specieTransferVelocityFvPatchVectorField::phip(), PatchTools::pointNormals(), searchableCylinder::points(), searchablePlate::points(), searchableSurfaceCollection::points(), boundBox::points(), treeBoundBox::points(), PrimitivePatchInterpolation< Patch >::pointToFaceInterpolate(), blockEdge::position(), projectCurveEdge::position(), projectEdge::position(), Foam::pow(), kineticTheoryModel::pPrime(), phasePressureModel::pPrime(), phasePressureModel::pPrimef(), compressibleMultiphaseVoF::pressureCorrector(), compressibleVoF::pressureCorrector(), sampledSurface::project(), compressibleMultiphaseVoFMixture::psiByRho(), Fickian< BasicThermophysicalTransportModel >::q(), MaxwellStefan< BasicThermophysicalTransportModel >::q(), nonUnityLewisEddyDiffusivity< TurbulenceThermophysicalTransportModel >::q(), chemistryModel< ThermoType >::Qdot(), EDC::R(), laminar::R(), compressibleMultiphaseVoFMixture::rCv(), Foam::fvc::reconstruct(), Foam::fvc::reconstructMag(), MRFZoneList::relative(), fvMatrix< Type >::residual(), LduMatrix< Type, DType, LUType >::residual(), lduMatrix::residual(), kOmegaSSTLM< BasicMomentumTransportModel >::ReThetac(), kOmegaSSTLM< BasicMomentumTransportModel >::ReThetat0(), fft::reverseTransform(), MomentumCloud< CloudType >::rhoEff(), fvDOM::Rp(), fvDOM::Ru(), FieldDistribution< Base, Derived >::sample(), patchProbes::sample(), probes::sample(), patch::sampleField(), patchInternalField::sampleField(), triSurfaceMesh::sampleField(), sampledSets::sampleLocalType(), mappedInternalPatchBase::samplePoints(), forcing::scale(), waveSuperposition::scale(), ThermoCloud< CloudType >::Sh(), parcelCloudList::Sh(), temperatureDependent::sigma(), cloud::sigmaEff(), ThermoCloud< CloudType >::sigmap(), parcelCloudList::sigmap(), skewCorrected< Type >::skewCorrection(), cellQuality::skewness(), snGradScheme< Type >::snGrad(), QRMatrix< MatrixType >::solve(), LLTMatrix< Type >::solve(), LUscalarMatrix::solve(), fvModels::source(), fvModel::source(), SlicedGeometricField< Type, PatchField, SlicedPatchField, GeoMesh >::splice(), Foam::sqr(), fvMeshToFvMesh::srcToTgt(), ReactingCloud< CloudType >::Srho(), parcelCloudList::Srho(), Foam::stabilise(), regionFunctionObject::store(), MomentumCloud< CloudType >::SU(), parcelCloudList::SU(), phaseSystem::sumAlphaMoving(), MPLIC::surfaceAlpha(), Foam::fvc::surfaceIntegrate(), Foam::fvc::surfaceSum(), phaseSystem::surfaceTension(), multiphaseVoFMixture::surfaceTensionForce(), ReactingCloud< CloudType >::SYi(), parcelCloudList::SYi(), fvMeshStitcher::synchronisedBoundaryField(), DimensionedField< Type, GeoMesh >::T(), FieldField< Field, Type >::T(), Field< Type >::T(), GeometricField< Type, PatchField, GeoMesh >::T(), KochFriedlander::tau(), chemistryModel< ThermoType >::tc(), MomentumCloud< CloudType >::theta(), parcelCloudList::theta(), targetCoeffTrim::thetag(), mappedPatchBase::toNeighbour(), sixDoFRigidBodyMotion::transform(), Foam::transform(), axesRotation::transformDiagTensor(), cylindrical::transformDiagTensor(), EulerCoordinateRotation::transformDiagTensor(), STARCDCoordinateRotation::transformDiagTensor(), Foam::transformPoints(), function1Temperature::Tsat(), polynomialTemperature::Tsat(), parcelCloudList::UCoeff(), waveAtmBoundaryLayerSuperposition::UGas(), waveVelocityFvPatchVectorField::Un(), parcelCloudList::UTrans(), FieldFunction1< Type, Function1Type >::value(), FieldFunction2< Type, Function2Type >::value(), MomentumCloud< CloudType >::vDotSweep(), filmVoFTransfer::VoFToFilmTransferRate(), polyMeshTools::volRatio(), heThermo< BasicThermo, MixtureType >::volScalarFieldProperty(), extendedFaceToCellStencil::weightedSum(), extendedCellToFaceStencil::weightedSum(), extendedUpwindCellToFaceStencil::weightedSum(), clippedLinear< Type >::weights(), midPoint< Type >::weights(), reverseLinear< Type >::weights(), limitedSurfaceInterpolationScheme< Type >::weights(), outletStabilised< Type >::weights(), noiseFFT::window(), Table< Type >::x(), distribution::x(), exponential::x(), fixedValue::x(), normal::x(), RosinRammler::x(), tabulatedCumulative::x(), tabulatedDensity::x(), SCOPEXiEq::XiEq(), Table< Type >::y(), nutURoughWallFunctionFvPatchScalarField::yPlus(), nutUWallFunctionFvPatchScalarField::yPlus(), alphatJayatillekeWallFunctionFvPatchScalarField::yPlusTherm(), wallLubricationModel::zeroGradWalls(), and Foam::zip().

Here is the call graph for this function:

◆ ptr()

◆ clear()

◆ operator()()

const T & operator()
inline

Const dereference operator.

Definition at line 279 of file tmpI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ operator const T &()

operator const T &
inline

Const cast to the underlying type reference.

Definition at line 297 of file tmpI.H.

◆ operator->() [1/2]

T * operator->
inline

Return object pointer.

Definition at line 304 of file tmpI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ operator->() [2/2]

const T * operator->
inline

Return const object pointer.

Definition at line 327 of file tmpI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ operator=() [1/3]

void operator= ( T tPtr)
inline

Assignment to pointer changing this tmp to a temporary T.

Definition at line 341 of file tmpI.H.

References Foam::abort(), clear(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ operator=() [2/3]

void operator= ( const tmp< T > &  t)
inline

Assignment transferring the temporary T to this tmp.

Definition at line 366 of file tmpI.H.

References Foam::abort(), clear(), Foam::FatalError, FatalErrorInFunction, Foam::name(), and Foam::T().

Here is the call graph for this function:

◆ operator=() [3/3]

void operator= ( const tmp< T > &&  t)
inline

Move assignment transferring the temporary T to this tmp.

Definition at line 395 of file tmpI.H.

References clear().

Here is the call graph for this function:

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