tmp: Improved reference count checks to provide better error diagnostics

in case of tmp misuse.

Simplified tmp reuse pattern in field algebra to use tmp copy and
assignment rather than the complex delayed call to 'ptr()'.

Removed support for unused non-const 'REF' storage of non-tmp objects due to C++
limitation in constructor overloading: if both tmp(T&) and tmp(const T&)
constructors are provided resolution is ambiguous.

The turbulence libraries have been upgraded and '-DCONST_TMP' option
specified in the 'options' file to switch to the new 'tmp' behavior.
This commit is contained in:
Henry Weller
2016-02-24 12:47:36 +00:00
parent 5a74397fe4
commit c02bf70ea7
152 changed files with 677 additions and 789 deletions

View File

@ -201,7 +201,7 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::Kd
{
if (phase1 == &phase)
{
tKd() += K;
tKd.ref() += K;
}
Swap(phase1, phase2);

View File

@ -1,4 +1,4 @@
EXE_INC = \
EXE_INC = -DCONST_TMP \
-I../multiphaseSystem/lnInclude \
-I../../phaseSystems/lnInclude \
-I../../interfacialModels/lnInclude\

View File

@ -1,4 +1,4 @@
EXE_INC = \
EXE_INC = -DCONST_TMP \
-I../twoPhaseSystem/lnInclude \
-I../../phaseSystems/lnInclude \
-I../../interfacialModels/lnInclude\

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -83,7 +83,7 @@ alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::yPlusTherm
) const
{
tmp<scalarField> typsf(new scalarField(this->size()));
scalarField& ypsf = typsf();
scalarField& ypsf = typsf.ref();
forAll(ypsf, faceI)
{
@ -197,7 +197,7 @@ alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::calcAlphat
scalarField yPlusTherm(this->yPlusTherm(P, Prat));
tmp<scalarField> talphatConv(new scalarField(this->size()));
scalarField& alphatConv = talphatConv();
scalarField& alphatConv = talphatConv.ref();
// Populate boundary values
forAll(alphatConv, faceI)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -132,7 +132,7 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu
)
);
volScalarField& nuf = tnu();
volScalarField& nuf = tnu.ref();
forAll(D, celli)
{

View File

@ -273,7 +273,8 @@ Foam::RASModels::kineticTheoryModel::pPrime() const
)
);
volScalarField::GeometricBoundaryField& bpPrime = tpPrime().boundaryField();
volScalarField::GeometricBoundaryField& bpPrime =
tpPrime.ref().boundaryField();
forAll(bpPrime, patchi)
{

View File

@ -164,7 +164,8 @@ Foam::RASModels::phasePressureModel::pPrime() const
)
);
volScalarField::GeometricBoundaryField& bpPrime = tpPrime().boundaryField();
volScalarField::GeometricBoundaryField& bpPrime =
tpPrime.ref().boundaryField();
forAll(bpPrime, patchi)
{
@ -192,7 +193,7 @@ Foam::RASModels::phasePressureModel::pPrimef() const
);
surfaceScalarField::GeometricBoundaryField& bpPrime =
tpPrime().boundaryField();
tpPrime.ref().boundaryField();
forAll(bpPrime, patchi)
{

View File

@ -1,4 +1,4 @@
EXE_INC = \
EXE_INC = -DCONST_TMP \
-I../twoPhaseSystem/lnInclude \
-I../interfacialModels/lnInclude\
-I$(LIB_SRC)/transportModels/compressible/lnInclude \

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -132,7 +132,7 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu
)
);
volScalarField& nuf = tnu();
volScalarField& nuf = tnu.ref();
forAll(D, celli)
{

View File

@ -278,7 +278,8 @@ Foam::RASModels::kineticTheoryModel::pPrime() const
)
);
volScalarField::GeometricBoundaryField& bpPrime = tpPrime().boundaryField();
volScalarField::GeometricBoundaryField& bpPrime =
tpPrime.ref().boundaryField();
forAll(bpPrime, patchi)
{

View File

@ -170,7 +170,8 @@ Foam::RASModels::phasePressureModel::pPrime() const
)
);
volScalarField::GeometricBoundaryField& bpPrime = tpPrime().boundaryField();
volScalarField::GeometricBoundaryField& bpPrime =
tpPrime.ref().boundaryField();
forAll(bpPrime, patchi)
{
@ -198,7 +199,7 @@ Foam::RASModels::phasePressureModel::pPrimef() const
);
surfaceScalarField::GeometricBoundaryField& bpPrime =
tpPrime().boundaryField();
tpPrime.ref().boundaryField();
forAll(bpPrime, patchi)
{