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

@ -1,4 +1,4 @@
EXE_INC = \
EXE_INC = -DCONST_TMP \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels \

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)
{

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
@ -45,7 +45,7 @@ inline void token::clear()
}
else if (type_ == COMPOUND)
{
if (compoundTokenPtr_->okToDelete())
if (compoundTokenPtr_->unique())
{
delete compoundTokenPtr_;
}

View File

@ -390,7 +390,7 @@ operator op \
) \
); \
\
Foam::opFunc(tRes().field(), df1.field(), df2.field()); \
Foam::opFunc(tRes.ref().field(), df1.field(), df2.field()); \
\
return tRes; \
} \
@ -415,7 +415,7 @@ operator op \
df1.dimensions() op df2.dimensions() \
); \
\
Foam::opFunc(tRes().field(), df1.field(), df2.field()); \
Foam::opFunc(tRes.ref().field(), df1.field(), df2.field()); \
\
reuseTmpDimensionedField<productType, Type2, GeoMesh>::clear(tdf2); \
\
@ -442,7 +442,7 @@ operator op \
df1.dimensions() op df2.dimensions() \
); \
\
Foam::opFunc(tRes().field(), df1.field(), df2.field()); \
Foam::opFunc(tRes.ref().field(), df1.field(), df2.field()); \
\
reuseTmpDimensionedField<productType, Type1, GeoMesh>::clear(tdf1); \
\
@ -472,7 +472,7 @@ operator op \
df1.dimensions() op df2.dimensions() \
); \
\
Foam::opFunc(tRes().field(), df1.field(), df2.field()); \
Foam::opFunc(tRes.ref().field(), df1.field(), df2.field()); \
\
reuseTmpTmpDimensionedField \
<productType, Type1, Type1, Type2, GeoMesh>::clear(tdf1, tdf2); \
@ -505,7 +505,7 @@ operator op \
) \
); \
\
Foam::opFunc(tRes().field(), df1.field(), dvs.value()); \
Foam::opFunc(tRes.ref().field(), df1.field(), dvs.value()); \
\
return tRes; \
} \
@ -542,7 +542,7 @@ operator op \
df1.dimensions() op dvs.dimensions() \
); \
\
Foam::opFunc(tRes().field(), df1.field(), dvs.value()); \
Foam::opFunc(tRes.ref().field(), df1.field(), dvs.value()); \
\
reuseTmpDimensionedField<productType, Type, GeoMesh>::clear(tdf1); \
\
@ -585,7 +585,7 @@ operator op \
) \
); \
\
Foam::opFunc(tRes().field(), dvs.value(), df1.field()); \
Foam::opFunc(tRes.ref().field(), dvs.value(), df1.field()); \
\
return tRes; \
} \
@ -621,7 +621,7 @@ operator op \
dvs.dimensions() op df1.dimensions() \
); \
\
Foam::opFunc(tRes().field(), dvs.value(), df1.field()); \
Foam::opFunc(tRes.ref().field(), dvs.value(), df1.field()); \
\
reuseTmpDimensionedField<productType, Type, GeoMesh>::clear(tdf1); \
\

View File

@ -50,7 +50,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \
); \
\
Func(tRes().field(), df1.field()); \
Func(tRes.ref().field(), df1.field()); \
\
return tRes; \
} \
@ -73,7 +73,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \
); \
\
Func(tRes().field(), df1.field()); \
Func(tRes.ref().field(), df1.field()); \
\
reuseTmpDimensionedField<ReturnType, Type1, GeoMesh>::clear(tdf1); \
\
@ -106,7 +106,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes().field(), df1.field()); \
Foam::OpFunc(tRes.ref().field(), df1.field()); \
\
return tRes; \
} \
@ -129,7 +129,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes().field(), df1.field()); \
Foam::OpFunc(tRes.ref().field(), df1.field()); \
\
reuseTmpDimensionedField<ReturnType, Type1, GeoMesh>::clear(tdf1); \
\
@ -163,7 +163,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \
); \
\
Func(tRes().field(), df1.field(), df2.field()); \
Func(tRes.ref().field(), df1.field(), df2.field()); \
\
return tRes; \
} \
@ -187,7 +187,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \
); \
\
Func(tRes().field(), df1.field(), df2.field()); \
Func(tRes.ref().field(), df1.field(), df2.field()); \
\
reuseTmpDimensionedField<ReturnType, Type2, GeoMesh>::clear(tdf2); \
\
@ -213,7 +213,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \
); \
\
Func(tRes().field(), df1.field(), df2.field()); \
Func(tRes.ref().field(), df1.field(), df2.field()); \
\
reuseTmpDimensionedField<ReturnType, Type1, GeoMesh>::clear(tdf1); \
\
@ -242,7 +242,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \
); \
\
Func(tRes().field(), df1.field(), df2.field()); \
Func(tRes.ref().field(), df1.field(), df2.field()); \
\
reuseTmpTmpDimensionedField<ReturnType, Type1, Type1, Type2, GeoMesh> \
::clear(tdf1, tdf2); \
@ -277,7 +277,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \
); \
\
Func(tRes().field(), dt1.value(), df2.field()); \
Func(tRes.ref().field(), dt1.value(), df2.field()); \
\
return tRes; \
} \
@ -312,7 +312,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \
); \
\
Func(tRes().field(), dt1.value(), df2.field()); \
Func(tRes.ref().field(), dt1.value(), df2.field()); \
\
reuseTmpDimensionedField<ReturnType, Type2, GeoMesh>::clear(tdf2); \
\
@ -354,7 +354,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \
); \
\
Func(tRes().field(), df1.field(), dt2.value()); \
Func(tRes.ref().field(), df1.field(), dt2.value()); \
\
return tRes; \
} \
@ -389,7 +389,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \
); \
\
Func(tRes().field(), df1.field(), dt2.value()); \
Func(tRes.ref().field(), df1.field(), dt2.value()); \
\
reuseTmpDimensionedField<ReturnType, Type1, GeoMesh>::clear(tdf1); \
\
@ -438,7 +438,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes().field(), df1.field(), df2.field()); \
Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \
\
return tRes; \
} \
@ -462,7 +462,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes().field(), df1.field(), df2.field()); \
Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \
\
reuseTmpDimensionedField<ReturnType, Type2, GeoMesh>::clear(tdf2); \
\
@ -488,7 +488,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes().field(), df1.field(), df2.field()); \
Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \
\
reuseTmpDimensionedField<ReturnType, Type1, GeoMesh>::clear(tdf1); \
\
@ -517,7 +517,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes().field(), df1.field(), df2.field()); \
Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \
\
reuseTmpTmpDimensionedField<ReturnType, Type1, Type1, Type2, GeoMesh>:: \
clear(tdf1, tdf2); \
@ -552,7 +552,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes().field(), dt1.value(), df2.field()); \
Foam::OpFunc(tRes.ref().field(), dt1.value(), df2.field()); \
\
return tRes; \
} \
@ -587,7 +587,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes().field(), dt1.value(), tdf2().field()); \
Foam::OpFunc(tRes.ref().field(), dt1.value(), tdf2().field()); \
\
reuseTmpDimensionedField<ReturnType, Type2, GeoMesh>::clear(tdf2); \
\
@ -629,7 +629,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes().field(), df1.field(), dt2.value()); \
Foam::OpFunc(tRes.ref().field(), df1.field(), dt2.value()); \
\
return tRes; \
} \
@ -664,7 +664,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes().field(), tdf1().field(), dt2.value()); \
Foam::OpFunc(tRes.ref().field(), tdf1().field(), dt2.value()); \
\
reuseTmpDimensionedField<ReturnType, Type1, GeoMesh>::clear(tdf1); \
\

View File

@ -112,10 +112,7 @@ public:
static void clear(const tmp<DimensionedField<TypeR, GeoMesh>>& tdf1)
{
if (tdf1.isTmp())
{
tdf1.ptr();
}
tdf1.clear();
}
};
@ -212,10 +209,7 @@ public:
)
{
tdf1.clear();
if (tdf2.isTmp())
{
tdf2.ptr();
}
tdf2.clear();
}
};
@ -267,10 +261,7 @@ public:
const tmp<DimensionedField<Type2, GeoMesh>>& tdf2
)
{
if (tdf1.isTmp())
{
tdf1.ptr();
}
tdf1.clear();
tdf2.clear();
}
};
@ -331,16 +322,8 @@ public:
const tmp<DimensionedField<TypeR, GeoMesh>>& tdf2
)
{
if (tdf1.isTmp())
{
tdf1.ptr();
tdf2.clear();
}
else if (tdf2.isTmp())
{
tdf1.clear();
tdf2.ptr();
}
tdf1.clear();
tdf2.clear();
}
};

View File

@ -57,7 +57,7 @@ tmp<DimensionedField<scalar, GeoMesh>> stabilise
)
);
stabilise(tRes().field(), dsf.field(), ds.value());
stabilise(tRes.ref().field(), dsf.field(), ds.value());
return tRes;
}
@ -80,7 +80,7 @@ tmp<DimensionedField<scalar, GeoMesh>> stabilise
dsf.dimensions() + ds.dimensions()
);
stabilise(tRes().field(), dsf.field(), ds.value());
stabilise(tRes.ref().field(), dsf.field(), ds.value());
reuseTmpDimensionedField<scalar, scalar, GeoMesh>::clear(tdsf);
@ -126,7 +126,7 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
)
);
pow(tPow().field(), dsf1.field(), dsf2.field());
pow(tPow.ref().field(), dsf1.field(), dsf2.field());
return tPow;
}
@ -153,7 +153,7 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
)
);
pow(tPow().field(), dsf1.field(), dsf2.field());
pow(tPow.ref().field(), dsf1.field(), dsf2.field());
reuseTmpDimensionedField<scalar, scalar, GeoMesh>::clear(tdsf1);
@ -182,7 +182,7 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
)
);
pow(tPow().field(), dsf1.field(), dsf2.field());
pow(tPow.ref().field(), dsf1.field(), dsf2.field());
reuseTmpDimensionedField<scalar, scalar, GeoMesh>::clear(tdsf2);
@ -213,7 +213,7 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
)
);
pow(tPow().field(), dsf1.field(), dsf2.field());
pow(tPow.ref().field(), dsf1.field(), dsf2.field());
reuseTmpTmpDimensionedField<scalar, scalar, scalar, scalar, GeoMesh>::clear
(
@ -247,7 +247,7 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
)
);
pow(tPow().field(), dsf.field(), ds.value());
pow(tPow.ref().field(), dsf.field(), ds.value());
return tPow;
}
@ -269,7 +269,7 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
pow(dsf.dimensions(), ds)
);
pow(tPow().field(), dsf.field(), ds.value());
pow(tPow.ref().field(), dsf.field(), ds.value());
reuseTmpDimensionedField<scalar, scalar, GeoMesh>::clear(tdsf);
@ -319,7 +319,7 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
)
);
pow(tPow().field(), ds.value(), dsf.field());
pow(tPow.ref().field(), ds.value(), dsf.field());
return tPow;
}
@ -342,7 +342,7 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
pow(ds, dsf.dimensions())
);
pow(tPow().field(), ds.value(), dsf.field());
pow(tPow.ref().field(), ds.value(), dsf.field());
reuseTmpDimensionedField<scalar, scalar, GeoMesh>::clear(tdsf);
@ -394,7 +394,7 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
)
);
atan2(tAtan2().field(), dsf1.field(), dsf2.field());
atan2(tAtan2.ref().field(), dsf1.field(), dsf2.field());
return tAtan2;
}
@ -417,7 +417,7 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
atan2(dsf1.dimensions(), dsf2.dimensions())
);
atan2(tAtan2().field(), dsf1.field(), dsf2.field());
atan2(tAtan2.ref().field(), dsf1.field(), dsf2.field());
reuseTmpDimensionedField<scalar, scalar, GeoMesh>::clear(tdsf1);
@ -442,7 +442,7 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
atan2(dsf1.dimensions(), dsf2.dimensions())
);
atan2(tAtan2().field(), dsf1.field(), dsf2.field());
atan2(tAtan2.ref().field(), dsf1.field(), dsf2.field());
reuseTmpDimensionedField<scalar, scalar, GeoMesh>::clear(tdsf2);
@ -469,7 +469,7 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
atan2(dsf1.dimensions(), dsf2.dimensions())
);
atan2(tAtan2().field(), dsf1.field(), dsf2.field());
atan2(tAtan2.ref().field(), dsf1.field(), dsf2.field());
reuseTmpTmpDimensionedField<scalar, scalar, scalar, scalar, GeoMesh>::clear
(
@ -503,7 +503,7 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
)
);
atan2(tAtan2().field(), dsf.field(), ds.value());
atan2(tAtan2.ref().field(), dsf.field(), ds.value());
return tAtan2;
}
@ -525,7 +525,7 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
atan2(dsf.dimensions(), ds)
);
atan2(tAtan2().field(), dsf.field(), ds.value());
atan2(tAtan2.ref().field(), dsf.field(), ds.value());
reuseTmpDimensionedField<scalar, scalar, GeoMesh>::clear(tdsf);
@ -575,7 +575,7 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
)
);
atan2(tAtan2().field(), ds.value(), dsf.field());
atan2(tAtan2.ref().field(), ds.value(), dsf.field());
return tAtan2;
}
@ -598,7 +598,7 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
atan2(ds, dsf.dimensions())
);
atan2(tAtan2().field(), ds.value(), dsf.field());
atan2(tAtan2.ref().field(), ds.value(), dsf.field());
reuseTmpDimensionedField<scalar, scalar, GeoMesh>::clear(tdsf);
@ -698,7 +698,7 @@ tmp<DimensionedField<scalar, GeoMesh>> func \
) \
); \
\
func(tFunc().field(), n, dsf.field()); \
func(tFunc.ref().field(), n, dsf.field()); \
\
return tFunc; \
} \
@ -729,7 +729,7 @@ tmp<DimensionedField<scalar, GeoMesh>> func \
) \
); \
\
func(tFunc().field(), n, dsf.field()); \
func(tFunc.ref().field(), n, dsf.field()); \
\
reuseTmpDimensionedField<scalar, scalar, GeoMesh>::clear(tdsf); \
\

View File

@ -232,7 +232,7 @@ FieldField<Field, Type>::component
NewCalculatedType(*this)
);
::Foam::component(Component(), *this, d);
::Foam::component(Component.ref(), *this, d);
return Component;
}
@ -274,7 +274,7 @@ tmp<FieldField<Field, Type>> FieldField<Field, Type>::T() const
FieldField<Field, Type>::NewCalculatedType(*this)
);
::Foam::T(transpose(), *this);
::Foam::T(transpose.ref(), *this);
return transpose;
}

View File

@ -86,7 +86,7 @@ pow
(
FieldField<Field, powProductType>::NewCalculatedType(f)
);
pow<Type, r>(tRes(), f);
pow<Type, r>(tRes.ref(), f);
return tRes;
}
@ -102,7 +102,7 @@ pow
(
reuseTmpFieldField<Field, powProductType, Type>::New(tf)
);
pow<Type, r>(tRes(), tf());
pow<Type, r>(tRes.ref(), tf());
reuseTmpFieldField<Field, powProductType, Type>::clear(tf);
return tRes;
}
@ -130,7 +130,7 @@ sqr(const FieldField<Field, Type>& f)
(
FieldField<Field, outerProductType>::NewCalculatedType(f)
);
sqr(tRes(), f);
sqr(tRes.ref(), f);
return tRes;
}
@ -143,7 +143,7 @@ sqr(const tmp<FieldField<Field, Type>>& tf)
(
reuseTmpFieldField<Field, outerProductType, Type>::New(tf)
);
sqr(tRes(), tf());
sqr(tRes.ref(), tf());
reuseTmpFieldField<Field, outerProductType, Type>::clear(tf);
return tRes;
}
@ -166,7 +166,7 @@ tmp<FieldField<Field, scalar>> magSqr(const FieldField<Field, Type>& f)
FieldField<Field, scalar>::NewCalculatedType(f)
);
magSqr(tRes(), f);
magSqr(tRes.ref(), f);
return tRes;
}
@ -178,7 +178,7 @@ tmp<FieldField<Field, scalar>> magSqr(const tmp<FieldField<Field, Type>>& tf)
reuseTmpFieldField<Field, scalar, Type>::New(tf)
);
magSqr(tRes(), tf());
magSqr(tRes.ref(), tf());
reuseTmpFieldField<Field, scalar, Type>::clear(tf);
return tRes;
}
@ -201,7 +201,7 @@ tmp<FieldField<Field, scalar>> mag(const FieldField<Field, Type>& f)
FieldField<Field, scalar>::NewCalculatedType(f)
);
mag(tRes(), f);
mag(tRes.ref(), f);
return tRes;
}
@ -213,7 +213,7 @@ tmp<FieldField<Field, scalar>> mag(const tmp<FieldField<Field, Type>>& tf)
reuseTmpFieldField<Field, scalar, Type>::New(tf)
);
mag(tRes(), tf());
mag(tRes.ref(), tf());
reuseTmpFieldField<Field, scalar, Type>::clear(tf);
return tRes;
}
@ -243,7 +243,7 @@ tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>> cmptMax
(
FieldField<Field, cmptType>::NewCalculatedType(f)
);
cmptMax(tRes(), f);
cmptMax(tRes.ref(), f);
return tRes;
}
@ -258,7 +258,7 @@ tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>> cmptMax
(
reuseTmpFieldField<Field, cmptType, Type>::New(tf)
);
cmptMax(tRes(), tf());
cmptMax(tRes.ref(), tf());
reuseTmpFieldField<Field, cmptType, Type>::clear(tf);
return tRes;
}
@ -288,7 +288,7 @@ tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>> cmptMin
(
FieldField<Field, cmptType>::NewCalculatedType(f)
);
cmptMin(tRes(), f);
cmptMin(tRes.ref(), f);
return tRes;
}
@ -303,7 +303,7 @@ tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>> cmptMin
(
reuseTmpFieldField<Field, cmptType, Type>::New(tf)
);
cmptMin(tRes(), tf());
cmptMin(tRes.ref(), tf());
reuseTmpFieldField<Field, cmptType, Type>::clear(tf);
return tRes;
}
@ -333,7 +333,7 @@ tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>> cmptAv
(
FieldField<Field, cmptType>::NewCalculatedType(f)
);
cmptAv(tRes(), f);
cmptAv(tRes.ref(), f);
return tRes;
}
@ -348,7 +348,7 @@ tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>> cmptAv
(
reuseTmpFieldField<Field, cmptType, Type>::New(tf)
);
cmptAv(tRes(), tf());
cmptAv(tRes.ref(), tf());
reuseTmpFieldField<Field, cmptType, Type>::clear(tf);
return tRes;
}
@ -377,7 +377,7 @@ tmp<FieldField<Field, Type>> cmptMag
(
FieldField<Field, Type>::NewCalculatedType(f)
);
cmptMag(tRes(), f);
cmptMag(tRes.ref(), f);
return tRes;
}
@ -391,7 +391,7 @@ tmp<FieldField<Field, Type>> cmptMag
(
reuseTmpFieldField<Field, Type, Type>::New(tf)
);
cmptMag(tRes(), tf());
cmptMag(tRes.ref(), tf());
reuseTmpFieldField<Field, Type, Type>::clear(tf);
return tRes;
}
@ -667,7 +667,7 @@ operator op \
( \
FieldField<Field1, productType>::NewCalculatedType(f1) \
); \
opFunc(tRes(), f1, f2); \
opFunc(tRes.ref(), f1, f2); \
return tRes; \
} \
\
@ -684,7 +684,7 @@ operator op \
( \
reuseTmpFieldField<Field, productType, Type2>::New(tf2) \
); \
opFunc(tRes(), f1, tf2()); \
opFunc(tRes.ref(), f1, tf2()); \
reuseTmpFieldField<Field, productType, Type2>::clear(tf2); \
return tRes; \
} \
@ -708,7 +708,7 @@ operator op \
( \
FieldField<Field1, productType>::NewCalculatedType(f1) \
); \
opFunc(tRes(), f1, tf2()); \
opFunc(tRes.ref(), f1, tf2()); \
tf2.clear(); \
return tRes; \
} \
@ -732,7 +732,7 @@ operator op \
( \
reuseTmpFieldField<Field1, productType, Type1>::New(tf1) \
); \
opFunc(tRes(), tf1(), f2); \
opFunc(tRes.ref(), tf1(), f2); \
reuseTmpFieldField<Field1, productType, Type1>::clear(tf1); \
return tRes; \
} \
@ -757,7 +757,7 @@ operator op \
reuseTmpTmpFieldField<Field1, productType, Type1, Type1, Type2>::New \
(tf1, tf2) \
); \
opFunc(tRes(), tf1(), tf2()); \
opFunc(tRes.ref(), tf1(), tf2()); \
reuseTmpTmpFieldField<Field1, productType, Type1, Type1, Type2>::clear \
(tf1, tf2); \
return tRes; \
@ -792,7 +792,7 @@ operator op \
( \
FieldField<Field, productType>::NewCalculatedType(f1) \
); \
opFunc(tRes(), f1, static_cast<const Form&>(vs)); \
opFunc(tRes.ref(), f1, static_cast<const Form&>(vs)); \
return tRes; \
} \
\
@ -810,7 +810,7 @@ operator op \
( \
reuseTmpFieldField<Field, productType, Type>::New(tf1) \
); \
opFunc(tRes(), tf1(), static_cast<const Form&>(vs)); \
opFunc(tRes.ref(), tf1(), static_cast<const Form&>(vs)); \
reuseTmpFieldField<Field, productType, Type>::clear(tf1); \
return tRes; \
} \
@ -844,7 +844,7 @@ operator op \
( \
FieldField<Field, productType>::NewCalculatedType(f1) \
); \
opFunc(tRes(), static_cast<const Form&>(vs), f1); \
opFunc(tRes.ref(), static_cast<const Form&>(vs), f1); \
return tRes; \
} \
\
@ -862,7 +862,7 @@ operator op \
( \
reuseTmpFieldField<Field, productType, Type>::New(tf1) \
); \
opFunc(tRes(), static_cast<const Form&>(vs), tf1()); \
opFunc(tRes.ref(), static_cast<const Form&>(vs), tf1()); \
reuseTmpFieldField<Field, productType, Type>::clear(tf1); \
return tRes; \
}

View File

@ -53,7 +53,7 @@ tmp<FieldField<Field, ReturnType>> Func \
( \
FieldField<Field, ReturnType>::NewCalculatedType(f) \
); \
Func(tRes(), f); \
Func(tRes.ref(), f); \
return tRes; \
} \
\
@ -67,7 +67,7 @@ tmp<FieldField<Field, ReturnType>> Func \
( \
reuseTmpFieldField<Field, Type, Type>::New(tf) \
); \
Func(tRes(), tf()); \
Func(tRes.ref(), tf()); \
reuseTmpFieldField<Field, Type, Type>::clear(tf); \
return tRes; \
}
@ -100,7 +100,7 @@ tmp<FieldField<Field, ReturnType>> operator Op \
( \
FieldField<Field, Type>::NewCalculatedType(f) \
); \
OpFunc(tRes(), f); \
OpFunc(tRes.ref(), f); \
return tRes; \
} \
\
@ -114,7 +114,7 @@ tmp<FieldField<Field, ReturnType>> operator Op \
( \
reuseTmpFieldField<Field, Type, Type>::New(tf) \
); \
OpFunc(tRes(), tf()); \
OpFunc(tRes.ref(), tf()); \
reuseTmpFieldField<Field, Type, Type>::clear(tf); \
return tRes; \
}
@ -149,7 +149,7 @@ tmp<FieldField<Field, ReturnType>> Func \
( \
FieldField<Field, Type1>::NewCalculatedType(f1) \
); \
Func(tRes(), f1, f2); \
Func(tRes.ref(), f1, f2); \
return tRes; \
} \
\
@ -164,7 +164,7 @@ tmp<FieldField<Field, ReturnType>> Func \
( \
reuseTmpFieldField<Field, ReturnType, Type2>::New(tf2) \
); \
Func(tRes(), f1, tf2()); \
Func(tRes.ref(), f1, tf2()); \
reuseTmpFieldField<Field, ReturnType, Type2>::clear(tf2); \
return tRes; \
} \
@ -180,7 +180,7 @@ tmp<FieldField<Field, ReturnType>> Func \
( \
reuseTmpFieldField<Field, ReturnType, Type1>::New(tf1) \
); \
Func(tRes(), tf1(), f2); \
Func(tRes.ref(), tf1(), f2); \
reuseTmpFieldField<Field, ReturnType, Type1>::clear(tf1); \
return tRes; \
} \
@ -197,7 +197,7 @@ tmp<FieldField<Field, ReturnType>> Func \
reuseTmpTmpFieldField<Field, ReturnType, Type1, Type1, Type2>:: \
New(tf1, tf2) \
); \
Func(tRes(), tf1(), tf2()); \
Func(tRes.ref(), tf1(), tf2()); \
reuseTmpTmpFieldField<Field, ReturnType, Type1, Type1, Type2>:: \
clear(tf1, tf2); \
return tRes; \
@ -233,7 +233,7 @@ tmp<FieldField<Field, ReturnType>> Func \
( \
FieldField<Field, Type1>::NewCalculatedType(f1) \
); \
Func(tRes(), f1, s); \
Func(tRes.ref(), f1, s); \
return tRes; \
} \
\
@ -248,7 +248,7 @@ tmp<FieldField<Field, ReturnType>> Func \
( \
reuseTmpFieldField<Field, ReturnType, Type1>::New(tf1) \
); \
Func(tRes(), tf1(), s); \
Func(tRes.ref(), tf1(), s); \
reuseTmpFieldField<Field, ReturnType, Type1>::clear(tf1); \
return tRes; \
}
@ -281,7 +281,7 @@ tmp<FieldField<Field, ReturnType>> Func \
( \
FieldField<Field, Type2>::NewCalculatedType(f2) \
); \
Func(tRes(), s, f2); \
Func(tRes.ref(), s, f2); \
return tRes; \
} \
\
@ -296,7 +296,7 @@ tmp<FieldField<Field, ReturnType>> Func \
( \
reuseTmpFieldField<Field, ReturnType, Type2>::New(tf2) \
); \
Func(tRes(), s, tf2()); \
Func(tRes.ref(), s, tf2()); \
reuseTmpFieldField<Field, ReturnType, Type2>::clear(tf2); \
return tRes; \
}
@ -336,7 +336,7 @@ tmp<FieldField<Field, ReturnType>> operator Op \
( \
FieldField<Field, ReturnType>::NewCalculatedType(f1) \
); \
OpFunc(tRes(), f1, f2); \
OpFunc(tRes.ref(), f1, f2); \
return tRes; \
} \
\
@ -351,7 +351,7 @@ tmp<FieldField<Field, ReturnType>> operator Op \
( \
reuseTmpFieldField<Field, ReturnType, Type2>::New(tf2) \
); \
OpFunc(tRes(), f1, tf2()); \
OpFunc(tRes.ref(), f1, tf2()); \
reuseTmpFieldField<Field, ReturnType, Type2>::clear(tf2); \
return tRes; \
} \
@ -367,7 +367,7 @@ tmp<FieldField<Field, ReturnType>> operator Op \
( \
reuseTmpFieldField<Field, ReturnType, Type1>::New(tf1) \
); \
OpFunc(tRes(), tf1(), f2); \
OpFunc(tRes.ref(), tf1(), f2); \
reuseTmpFieldField<Field, ReturnType, Type1>::clear(tf1); \
return tRes; \
} \
@ -384,7 +384,7 @@ tmp<FieldField<Field, ReturnType>> operator Op \
reuseTmpTmpFieldField<Field, ReturnType, Type1, Type1, Type2>:: \
New(tf1, tf2) \
); \
OpFunc(tRes(), tf1(), tf2()); \
OpFunc(tRes.ref(), tf1(), tf2()); \
reuseTmpTmpFieldField<Field, ReturnType, Type1, Type1, Type2>:: \
clear(tf1, tf2); \
return tRes; \
@ -420,7 +420,7 @@ tmp<FieldField<Field, ReturnType>> operator Op \
( \
FieldField<Field, Type2>::NewCalculatedType(f2) \
); \
OpFunc(tRes(), s, f2); \
OpFunc(tRes.ref(), s, f2); \
return tRes; \
} \
\
@ -435,7 +435,7 @@ tmp<FieldField<Field, ReturnType>> operator Op \
( \
reuseTmpFieldField<Field, ReturnType, Type2>::New(tf2) \
); \
OpFunc(tRes(), s, tf2()); \
OpFunc(tRes.ref(), s, tf2()); \
reuseTmpFieldField<Field, ReturnType, Type2>::clear(tf2); \
return tRes; \
}
@ -468,7 +468,7 @@ tmp<FieldField<Field, ReturnType>> operator Op \
( \
FieldField<Field, Type1>::NewCalculatedType(f1) \
); \
OpFunc(tRes(), f1, s); \
OpFunc(tRes.ref(), f1, s); \
return tRes; \
} \
\
@ -483,7 +483,7 @@ tmp<FieldField<Field, ReturnType>> operator Op \
( \
reuseTmpFieldField<Field, ReturnType, Type1>::New(tf1) \
); \
OpFunc(tRes(), tf1(), s); \
OpFunc(tRes.ref(), tf1(), s); \
reuseTmpFieldField<Field, ReturnType, Type1>::clear(tf1); \
return tRes; \
}

View File

@ -80,7 +80,7 @@ public:
if (initRet)
{
rtf() = tf1();
rtf.ref() = tf1();
}
return rtf;
@ -89,10 +89,7 @@ public:
static void clear(const tmp<FieldField<Field, TypeR>>& tf1)
{
if (tf1.isTmp())
{
tf1.ptr();
}
tf1.clear();
}
};
@ -164,10 +161,7 @@ public:
)
{
tf1.clear();
if (tf2.isTmp())
{
tf2.ptr();
}
tf2.clear();
}
};
@ -202,10 +196,7 @@ public:
const tmp<FieldField<Field, Type2>>& tf2
)
{
if (tf1.isTmp())
{
tf1.ptr();
}
tf1.clear();
tf2.clear();
}
};
@ -245,16 +236,8 @@ public:
const tmp<FieldField<Field, TypeR>>& tf2
)
{
if (tf1.isTmp())
{
tf1.ptr();
tf2.clear();
}
else if (tf2.isTmp())
{
tf1.clear();
tf2.ptr();
}
tf1.clear();
tf2.clear();
}
};

View File

@ -690,10 +690,7 @@ void Foam::Field<Type>::operator=(const tmp<Field>& rhs)
<< abort(FatalError);
}
// This is dodgy stuff, don't try it at home.
Field* fieldPtr = rhs.ptr();
List<Type>::transfer(*fieldPtr);
delete fieldPtr;
List<Type>::operator=(rhs());
}

View File

@ -80,10 +80,7 @@ public:
static void clear(const tmp<Field<TypeR>>& tf1)
{
if (tf1.isTmp())
{
tf1.ptr();
}
tf1.clear();
}
};
@ -142,10 +139,7 @@ public:
)
{
tf1.clear();
if (tf2.isTmp())
{
tf2.ptr();
}
tf2.clear();
}
};
@ -177,10 +171,7 @@ public:
const tmp<Field<Type2>>& tf2
)
{
if (tf1.isTmp())
{
tf1.ptr();
}
tf1.clear();
tf2.clear();
}
};
@ -217,16 +208,8 @@ public:
const tmp<Field<TypeR>>& tf2
)
{
if (tf1.isTmp())
{
tf1.ptr();
tf2.clear();
}
else if (tf2.isTmp())
{
tf1.clear();
tf2.ptr();
}
tf1.clear();
tf2.clear();
}
};

View File

@ -992,8 +992,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::T() const
)
);
Foam::T(result().internalField(), internalField());
Foam::T(result().boundaryField(), boundaryField());
Foam::T(result.ref().internalField(), internalField());
Foam::T(result.ref().boundaryField(), boundaryField());
return result;
}
@ -1029,8 +1029,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::component
)
);
Foam::component(Component().internalField(), internalField(), d);
Foam::component(Component().boundaryField(), boundaryField(), d);
Foam::component(Component.ref().internalField(), internalField(), d);
Foam::component(Component.ref().boundaryField(), boundaryField(), d);
return Component;
}

View File

@ -104,7 +104,7 @@ pow
)
);
pow<Type, r, PatchField, GeoMesh>(tPow(), gf);
pow<Type, r, PatchField, GeoMesh>(tPow.ref(), gf);
return tPow;
}
@ -139,7 +139,7 @@ pow
)
);
pow<Type, r, PatchField, GeoMesh>(tPow(), gf);
pow<Type, r, PatchField, GeoMesh>(tPow.ref(), gf);
tgf.clear();
@ -190,7 +190,7 @@ sqr(const GeometricField<Type, PatchField, GeoMesh>& gf)
)
);
sqr(tSqr(), gf);
sqr(tSqr.ref(), gf);
return tSqr;
}
@ -228,7 +228,7 @@ sqr(const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf)
)
);
sqr(tSqr(), gf);
sqr(tSqr.ref(), gf);
tgf.clear();
@ -270,7 +270,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> magSqr
)
);
magSqr(tMagSqr(), gf);
magSqr(tMagSqr.ref(), gf);
return tMagSqr;
}
@ -300,7 +300,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> magSqr
)
);
magSqr(tMagSqr(), gf);
magSqr(tMagSqr.ref(), gf);
tgf.clear();
@ -342,7 +342,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> mag
)
);
mag(tMag(), gf);
mag(tMag.ref(), gf);
return tMag;
}
@ -372,7 +372,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> mag
)
);
mag(tMag(), gf);
mag(tMag.ref(), gf);
tgf.clear();
@ -428,7 +428,7 @@ cmptAv(const GeometricField<Type, PatchField, GeoMesh>& gf)
)
);
cmptAv(CmptAv(), gf);
cmptAv(CmptAv.ref(), gf);
return CmptAv;
}
@ -467,7 +467,7 @@ cmptAv(const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf)
)
);
cmptAv(CmptAv(), gf);
cmptAv(CmptAv.ref(), gf);
tgf.clear();
@ -589,7 +589,7 @@ template \
<class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
tmp \
< \
GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
> \
operator op \
( \
@ -615,7 +615,7 @@ operator op \
) \
); \
\
Foam::opFunc(tRes(), gf1, gf2); \
Foam::opFunc(tRes.ref(), gf1, gf2); \
\
return tRes; \
} \
@ -644,7 +644,7 @@ operator op \
gf1.dimensions() op gf2.dimensions() \
); \
\
Foam::opFunc(tRes(), gf1, gf2); \
Foam::opFunc(tRes.ref(), gf1, gf2); \
\
reuseTmpGeometricField<productType, Type2, PatchField, GeoMesh> \
::clear(tgf2); \
@ -676,7 +676,7 @@ operator op \
gf1.dimensions() op gf2.dimensions() \
); \
\
Foam::opFunc(tRes(), gf1, gf2); \
Foam::opFunc(tRes.ref(), gf1, gf2); \
\
reuseTmpGeometricField<productType, Type1, PatchField, GeoMesh> \
::clear(tgf1); \
@ -711,7 +711,7 @@ operator op \
gf1.dimensions() op gf2.dimensions() \
); \
\
Foam::opFunc(tRes(), gf1, gf2); \
Foam::opFunc(tRes.ref(), gf1, gf2); \
\
reuseTmpTmpGeometricField \
<productType, Type1, Type1, Type2, PatchField, GeoMesh> \
@ -762,7 +762,7 @@ operator op \
) \
); \
\
Foam::opFunc(tRes(), gf1, dvs); \
Foam::opFunc(tRes.ref(), gf1, dvs); \
\
return tRes; \
} \
@ -807,7 +807,7 @@ operator op \
gf1.dimensions() op dvs.dimensions() \
); \
\
Foam::opFunc(tRes(), gf1, dvs); \
Foam::opFunc(tRes.ref(), gf1, dvs); \
\
reuseTmpGeometricField<productType, Type, PatchField, GeoMesh> \
::clear(tgf1); \
@ -875,7 +875,7 @@ operator op \
) \
); \
\
Foam::opFunc(tRes(), dvs, gf1); \
Foam::opFunc(tRes.ref(), dvs, gf1); \
\
return tRes; \
} \
@ -919,7 +919,7 @@ operator op \
dvs.dimensions() op gf1.dimensions() \
); \
\
Foam::opFunc(tRes(), dvs, gf1); \
Foam::opFunc(tRes.ref(), dvs, gf1); \
\
reuseTmpGeometricField<productType, Type, PatchField, GeoMesh> \
::clear(tgf1); \

View File

@ -68,7 +68,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
) \
); \
\
Foam::Func(tRes(), gf1); \
Foam::Func(tRes.ref(), gf1); \
\
return tRes; \
} \
@ -91,7 +91,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
) \
); \
\
Foam::Func(tRes(), gf1); \
Foam::Func(tRes.ref(), gf1); \
\
reuseTmpGeometricField \
<ReturnType, Type1, PatchField, GeoMesh>::clear(tgf1); \
@ -138,7 +138,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes(), gf1); \
Foam::OpFunc(tRes.ref(), gf1); \
\
return tRes; \
} \
@ -161,7 +161,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes(), gf1); \
Foam::OpFunc(tRes.ref(), gf1); \
\
reuseTmpGeometricField \
<ReturnType, Type1, PatchField, GeoMesh>::clear(tgf1); \
@ -210,7 +210,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
) \
); \
\
Foam::Func(tRes(), gf1, gf2); \
Foam::Func(tRes.ref(), gf1, gf2); \
\
return tRes; \
} \
@ -234,7 +234,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
) \
); \
\
Foam::Func(tRes(), gf1, gf2); \
Foam::Func(tRes.ref(), gf1, gf2); \
\
reuseTmpGeometricField \
<ReturnType, Type2, PatchField, GeoMesh>::clear(tgf2); \
@ -261,7 +261,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
) \
); \
\
Foam::Func(tRes(), gf1, gf2); \
Foam::Func(tRes.ref(), gf1, gf2); \
\
reuseTmpGeometricField \
<ReturnType, Type1, PatchField, GeoMesh>::clear(tgf1); \
@ -292,7 +292,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
) \
); \
\
Foam::Func(tRes(), gf1, gf2); \
Foam::Func(tRes.ref(), gf1, gf2); \
\
reuseTmpTmpGeometricField \
<ReturnType, Type1, Type1, Type2, PatchField, GeoMesh> \
@ -341,7 +341,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
) \
); \
\
Foam::Func(tRes(), dt1, gf2); \
Foam::Func(tRes.ref(), dt1, gf2); \
\
return tRes; \
} \
@ -376,7 +376,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
) \
); \
\
Foam::Func(tRes(), dt1, gf2); \
Foam::Func(tRes.ref(), dt1, gf2); \
\
reuseTmpGeometricField \
<ReturnType, Type2, PatchField, GeoMesh>::clear(tgf2); \
@ -433,7 +433,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
) \
); \
\
Foam::Func(tRes(), gf1, dt2); \
Foam::Func(tRes.ref(), gf1, dt2); \
\
return tRes; \
} \
@ -468,7 +468,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
) \
); \
\
Foam::Func(tRes(), gf1, dt2); \
Foam::Func(tRes.ref(), gf1, dt2); \
\
reuseTmpGeometricField \
<ReturnType, Type1, PatchField, GeoMesh>::clear(tgf1); \
@ -534,7 +534,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes(), gf1, gf2); \
Foam::OpFunc(tRes.ref(), gf1, gf2); \
\
return tRes; \
} \
@ -558,7 +558,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes(), gf1, gf2); \
Foam::OpFunc(tRes.ref(), gf1, gf2); \
\
reuseTmpGeometricField \
<ReturnType, Type2, PatchField, GeoMesh>::clear(tgf2); \
@ -585,7 +585,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes(), gf1, gf2); \
Foam::OpFunc(tRes.ref(), gf1, gf2); \
\
reuseTmpGeometricField \
<ReturnType, Type1, PatchField, GeoMesh>::clear(tgf1); \
@ -615,7 +615,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes(), gf1, gf2); \
Foam::OpFunc(tRes.ref(), gf1, gf2); \
\
reuseTmpTmpGeometricField \
<ReturnType, Type1, Type1, Type2, PatchField, GeoMesh> \
@ -627,7 +627,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
\
TEMPLATE \
void OpFunc \
@ -665,7 +665,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes(), dt1, gf2); \
Foam::OpFunc(tRes.ref(), dt1, gf2); \
\
return tRes; \
} \
@ -700,7 +700,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes(), dt1, gf2); \
Foam::OpFunc(tRes.ref(), dt1, gf2); \
\
reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh> \
::clear(tgf2); \
@ -719,7 +719,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
}
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
\
TEMPLATE \
void OpFunc \
@ -757,7 +757,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes(), gf1, dt2); \
Foam::OpFunc(tRes.ref(), gf1, dt2); \
\
return tRes; \
} \
@ -792,7 +792,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
) \
); \
\
Foam::OpFunc(tRes(), gf1, dt2); \
Foam::OpFunc(tRes.ref(), gf1, dt2); \
\
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh> \
::clear(tgf1); \

View File

@ -162,7 +162,7 @@ public:
if (initRet)
{
rtgf() == tgf1();
rtgf.ref() == tgf1();
}
return rtgf;
@ -174,10 +174,7 @@ public:
const tmp<GeometricField<TypeR, PatchField, GeoMesh>>& tgf1
)
{
if (reusable(tgf1))
{
tgf1.ptr();
}
tgf1.clear();
}
};
@ -290,10 +287,7 @@ public:
)
{
tgf1.clear();
if (reusable(tgf2))
{
tgf2.ptr();
}
tgf2.clear();
}
};
@ -351,10 +345,7 @@ public:
const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2
)
{
if (reusable(tgf1))
{
tgf1.ptr();
}
tgf1.clear();
tgf2.clear();
}
};
@ -415,16 +406,8 @@ public:
const tmp<GeometricField<TypeR, PatchField, GeoMesh>>& tgf2
)
{
if (reusable(tgf1))
{
tgf1.ptr();
tgf2.clear();
}
else if (reusable(tgf2))
{
tgf1.clear();
tgf2.ptr();
}
tgf1.clear();
tgf2.clear();
}
};

View File

@ -72,7 +72,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> stabilise
)
);
stabilise(tRes(), gsf, ds);
stabilise(tRes.ref(), gsf, ds);
return tRes;
}
@ -97,7 +97,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> stabilise
)
);
stabilise(tRes(), gsf, ds);
stabilise(tRes.ref(), gsf, ds);
reuseTmpGeometricField<scalar, scalar, PatchField, GeoMesh>::clear(tgsf);
@ -159,7 +159,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> pow
)
);
pow(tPow(), gsf1, gsf2);
pow(tPow.ref(), gsf1, gsf2);
return tPow;
}
@ -188,7 +188,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> pow
)
);
pow(tPow(), gsf1, gsf2);
pow(tPow.ref(), gsf1, gsf2);
reuseTmpGeometricField<scalar, scalar, PatchField, GeoMesh>::clear(tgsf1);
@ -219,7 +219,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> pow
)
);
pow(tPow(), gsf1, gsf2);
pow(tPow.ref(), gsf1, gsf2);
reuseTmpGeometricField<scalar, scalar, PatchField, GeoMesh>::clear(tgsf2);
@ -252,7 +252,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> pow
)
);
pow(tPow(), gsf1, gsf2);
pow(tPow.ref(), gsf1, gsf2);
reuseTmpTmpGeometricField
<scalar, scalar, scalar, scalar, PatchField, GeoMesh>
@ -299,7 +299,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> pow
)
);
pow(tPow(), gsf, ds);
pow(tPow.ref(), gsf, ds);
return tPow;
}
@ -323,7 +323,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> pow
)
);
pow(tPow(), gsf, ds);
pow(tPow.ref(), gsf, ds);
reuseTmpGeometricField<scalar, scalar, PatchField, GeoMesh>::clear(tgsf);
@ -388,7 +388,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> pow
)
);
pow(tPow(), ds, gsf);
pow(tPow.ref(), ds, gsf);
return tPow;
}
@ -413,7 +413,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> pow
)
);
pow(tPow(), ds, gsf);
pow(tPow.ref(), ds, gsf);
reuseTmpGeometricField<scalar, scalar, PatchField, GeoMesh>::clear(tgsf);
@ -480,7 +480,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> atan2
)
);
atan2(tAtan2(), gsf1, gsf2);
atan2(tAtan2.ref(), gsf1, gsf2);
return tAtan2;
}
@ -505,7 +505,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> atan2
)
);
atan2(tAtan2(), gsf1, gsf2);
atan2(tAtan2.ref(), gsf1, gsf2);
reuseTmpGeometricField<scalar, scalar, PatchField, GeoMesh>::clear(tgsf1);
@ -532,7 +532,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> atan2
)
);
atan2(tAtan2(), gsf1, gsf2);
atan2(tAtan2.ref(), gsf1, gsf2);
reuseTmpGeometricField<scalar, scalar, PatchField, GeoMesh>::clear(tgsf2);
@ -561,7 +561,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> atan2
)
);
atan2(tAtan2(), gsf1, gsf2);
atan2(tAtan2.ref(), gsf1, gsf2);
reuseTmpTmpGeometricField
<scalar, scalar, scalar, scalar, PatchField, GeoMesh>
@ -608,7 +608,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> atan2
)
);
atan2(tAtan2(), gsf, ds);
atan2(tAtan2.ref(), gsf, ds);
return tAtan2;
}
@ -632,7 +632,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> atan2
)
);
atan2(tAtan2(), gsf, ds);
atan2(tAtan2.ref(), gsf, ds);
reuseTmpGeometricField<scalar, scalar, PatchField, GeoMesh>::clear(tgsf);
@ -697,7 +697,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> atan2
)
);
atan2(tAtan2(), ds, gsf);
atan2(tAtan2.ref(), ds, gsf);
return tAtan2;
}
@ -722,7 +722,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> atan2
)
);
atan2(tAtan2(), ds, gsf);
atan2(tAtan2.ref(), ds, gsf);
reuseTmpGeometricField<scalar, scalar, PatchField, GeoMesh>::clear(tgsf);
@ -836,7 +836,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> func \
) \
); \
\
func(tFunc(), n, gsf); \
func(tFunc.ref(), n, gsf); \
\
return tFunc; \
} \
@ -867,7 +867,7 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> func \
) \
); \
\
func(tFunc(), n, gsf); \
func(tFunc.ref(), n, gsf); \
\
reuseTmpGeometricField<scalar, scalar, PatchField, GeoMesh> \
::clear(tgsf); \

View File

@ -49,8 +49,7 @@ slicedBoundaryField
(
new FieldField<PatchField, Type>(mesh.boundary().size())
);
FieldField<PatchField, Type>& bf = tbf();
FieldField<PatchField, Type>& bf = tbf.ref();
forAll(mesh.boundary(), patchi)
{
@ -126,8 +125,7 @@ slicedBoundaryField
(
new FieldField<PatchField, Type>(mesh.boundary().size())
);
FieldField<PatchField, Type>& bf = tbf();
FieldField<PatchField, Type>& bf = tbf.ref();
forAll(mesh.boundary(), patchi)
{

View File

@ -40,7 +40,7 @@ Foam::tmp<Foam::Field<Type>> Foam::lduMatrix::H(const Field<Type>& psi) const
if (lowerPtr_ || upperPtr_)
{
Field<Type> & Hpsi = tHpsi();
Field<Type> & Hpsi = tHpsi.ref();
Type* __restrict__ HpsiPtr = Hpsi.begin();
@ -87,7 +87,7 @@ Foam::lduMatrix::faceH(const Field<Type>& psi) const
const labelUList& u = lduAddr().upperAddr();
tmp<Field<Type>> tfaceHpsi(new Field<Type> (Lower.size()));
Field<Type> & faceHpsi = tfaceHpsi();
Field<Type> & faceHpsi = tfaceHpsi.ref();
for (label face=0; face<l.size(); face++)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -79,9 +79,9 @@ public:
//- Return true if the reference count is zero
bool okToDelete() const
bool unique() const
{
return !count_;
return count_ == 0;
}

View File

@ -56,7 +56,6 @@ class tmp
enum type
{
TMP,
REF,
CONST_REF
};
@ -74,15 +73,9 @@ public:
//- Store object pointer
inline explicit tmp(T* = 0);
//- Store object rvalue reference
inline tmp(T&&);
//- Store object const reference
inline tmp(const T&);
//- Construct copy and increment reference count
inline tmp(tmp<T>&&);
//- Construct copy and increment reference count
inline tmp(const tmp<T>&);
@ -90,7 +83,7 @@ public:
inline tmp(const tmp<T>&, bool allowTransfer);
//- Destructor, delete object when reference count == 0
//- Destructor: deletes temporary object when the reference count is 0
inline ~tmp();

View File

@ -36,14 +36,6 @@ inline Foam::tmp<T>::tmp(T* tPtr)
{}
template<class T>
inline Foam::tmp<T>::tmp(T&& tRef)
:
type_(REF),
ptr_(&tRef)
{}
template<class T>
inline Foam::tmp<T>::tmp(const T& tRef)
:
@ -52,29 +44,6 @@ inline Foam::tmp<T>::tmp(const T& tRef)
{}
template<class T>
inline Foam::tmp<T>::tmp(tmp<T>&& t)
:
type_(t.type_),
ptr_(t.ptr_)
{
if (isTmp())
{
if (ptr_)
{
ptr_->operator++();
}
else
{
FatalErrorInFunction
<< "Attempted copy of a deallocated temporary"
<< " of type " << typeid(T).name()
<< abort(FatalError);
}
}
}
template<class T>
inline Foam::tmp<T>::tmp(const tmp<T>& t)
:
@ -95,10 +64,6 @@ inline Foam::tmp<T>::tmp(const tmp<T>& t)
<< abort(FatalError);
}
}
else if (type_ == REF)
{
type_ = CONST_REF;
}
}
@ -137,7 +102,7 @@ inline Foam::tmp<T>::~tmp()
{
if (isTmp() && ptr_)
{
if (ptr_->okToDelete())
if (ptr_->unique())
{
delete ptr_;
ptr_ = 0;
@ -187,13 +152,10 @@ inline T& Foam::tmp<T>::ref()
return *ptr_;
}
else if (type_ == REF)
{
return *ptr_;
}
else
{
FatalErrorInFunction << "Const object cast to non-const"
FatalErrorInFunction
<< "Attempt to acquire non-const reference to const object"
<< abort(FatalError);
return *ptr_;
}
@ -205,19 +167,25 @@ inline T* Foam::tmp<T>::ptr() const
{
if (isTmp())
{
if (!ptr_)
{
FatalErrorInFunction
<< "Temporary of type " << typeid(T).name() << " deallocated"
<< abort(FatalError);
}
if (!ptr_)
{
FatalErrorInFunction
<< "Temporary of type " << typeid(T).name() << " deallocated"
<< abort(FatalError);
}
T* ptr = ptr_;
ptr_ = 0;
if (!ptr_->unique())
{
FatalErrorInFunction
<< "Attempt to acquire pointer to object referred to"
" by multiple 'tmp's"
<< abort(FatalError);
}
ptr->resetRefCount();
T* ptr = ptr_;
ptr_ = 0;
return ptr;
return ptr;
}
else
{
@ -229,10 +197,18 @@ inline T* Foam::tmp<T>::ptr() const
template<class T>
inline void Foam::tmp<T>::clear() const
{
if (isTmp() && ptr_) // Skip this bit: && ptr_->okToDelete())
if (isTmp() && ptr_)
{
delete ptr_;
ptr_ = 0;
if (ptr_->unique())
{
delete ptr_;
ptr_ = 0;
}
else
{
ptr_->operator--();
ptr_ = 0;
}
}
}
@ -307,10 +283,6 @@ inline T* Foam::tmp<T>::operator->()
return ptr_;
}
else if (type_ == REF)
{
return ptr_;
}
else
{
FatalErrorInFunction << "Const object cast to non-const"
@ -346,7 +318,7 @@ inline void Foam::tmp<T>::operator=(T* tPtr)
{
if (isTmp() && ptr_)
{
if (ptr_->okToDelete())
if (ptr_->unique())
{
delete ptr_;
ptr_ = 0;
@ -377,7 +349,7 @@ inline void Foam::tmp<T>::operator=(const tmp<T>& t)
{
if (isTmp() && ptr_)
{
if (ptr_->okToDelete())
if (ptr_->unique())
{
delete ptr_;
ptr_ = 0;
@ -401,8 +373,8 @@ inline void Foam::tmp<T>::operator=(const tmp<T>& t)
}
ptr_ = t.ptr_;
const_cast<tmp<T>&>(t).ptr_ = 0;
ptr_->resetRefCount();
ptr_->operator++();
}
else
{

View File

@ -1,4 +1,4 @@
EXE_INC = \
EXE_INC = -DCONST_TMP \
-I../turbulenceModels/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/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
@ -257,7 +257,7 @@ baffleThickness() const
(
new scalarField(nbrField.baffleThickness())
);
scalarField& thickness = tthickness();
scalarField& thickness = tthickness.ref();
mapDist.distribute(thickness);
return tthickness;
}
@ -285,7 +285,7 @@ tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::Qs() const
);
tmp<scalarField> tQs(new scalarField(nbrField.Qs()));
scalarField& Qs = tQs();
scalarField& Qs = tQs.ref();
mapDist.distribute(Qs);
return tQs;
}

View File

@ -195,17 +195,17 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
if (contactRes_ == 0.0)
{
nbrIntFld() = nbrField.patchInternalField();
nbrKDelta() = nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs();
nbrIntFld.ref() = nbrField.patchInternalField();
nbrKDelta.ref() = nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs();
}
else
{
nbrIntFld() = nbrField;
nbrKDelta() = contactRes_;
nbrIntFld.ref() = nbrField;
nbrKDelta.ref() = contactRes_;
}
mpp.distribute(nbrIntFld());
mpp.distribute(nbrKDelta());
mpp.distribute(nbrIntFld.ref());
mpp.distribute(nbrKDelta.ref());
tmp<scalarField> myKDelta = kappa(*this)*patch().deltaCoeffs();

View File

@ -1,4 +1,4 @@
EXE_INC = \
EXE_INC = -DCONST_TMP \
-I../turbulenceModels/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/finiteVolume/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
@ -235,8 +235,8 @@ void LamBremhorstKE::correct()
- fvm::Sp(Ceps2_*f2(Rt)*epsilon_/k_, epsilon_)
);
epsEqn().relax();
epsEqn().boundaryManipulate(epsilon_.boundaryField());
epsEqn.ref().relax();
epsEqn.ref().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
bound(epsilon_, epsilonMin_);
@ -250,7 +250,7 @@ void LamBremhorstKE::correct()
G - fvm::Sp(epsilon_/k_, k_)
);
kEqn().relax();
kEqn.ref().relax();
solve(kEqn);
bound(k_, kMin_);

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
@ -404,8 +404,8 @@ void LienCubicKE::correct()
+ E(f2)
);
epsEqn().relax();
epsEqn().boundaryManipulate(epsilon_.boundaryField());
epsEqn.ref().relax();
epsEqn.ref().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
bound(epsilon_, epsilonMin_);
@ -421,7 +421,7 @@ void LienCubicKE::correct()
- fvm::Sp(epsilon_/k_, k_)
);
kEqn().relax();
kEqn.ref().relax();
solve(kEqn);
bound(k_, kMin_);

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
@ -288,8 +288,8 @@ void LienLeschziner::correct()
+ E(f2)
);
epsEqn().relax();
epsEqn().boundaryManipulate(epsilon_.boundaryField());
epsEqn.ref().relax();
epsEqn.ref().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
bound(epsilon_, epsilonMin_);
@ -305,7 +305,7 @@ void LienLeschziner::correct()
- fvm::Sp(epsilon_/k_, k_)
);
kEqn().relax();
kEqn.ref().relax();
solve(kEqn);
bound(k_, kMin_);

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
@ -286,8 +286,8 @@ void ShihQuadraticKE::correct()
- fvm::Sp(Ceps2_*epsilon_/k_, epsilon_)
);
epsEqn().relax();
epsEqn().boundaryManipulate(epsilon_.boundaryField());
epsEqn.ref().relax();
epsEqn.ref().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
bound(epsilon_, epsilonMin_);
@ -303,7 +303,7 @@ void ShihQuadraticKE::correct()
- fvm::Sp(epsilon_/k_, k_)
);
kEqn().relax();
kEqn.ref().relax();
solve(kEqn);
bound(k_, kMin_);

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
@ -698,8 +698,8 @@ void kkLOmega::correct()
)().dimensionedInternalField()/pow3(y_.dimensionedInternalField())
);
omegaEqn().relax();
omegaEqn().boundaryManipulate(omega_.boundaryField());
omegaEqn.ref().relax();
omegaEqn.ref().boundaryManipulate(omega_.boundaryField());
solve(omegaEqn);
bound(omega_, omegaMin_);
@ -718,8 +718,8 @@ void kkLOmega::correct()
- fvm::Sp(Rbp + Rnat + Dl/(kl_ + kMin_), kl_)
);
klEqn().relax();
klEqn().boundaryManipulate(kl_.boundaryField());
klEqn.ref().relax();
klEqn.ref().boundaryManipulate(kl_.boundaryField());
solve(klEqn);
bound(kl_, kMin_);
@ -739,8 +739,8 @@ void kkLOmega::correct()
- fvm::Sp(omega_ + Dt/(kt_+ kMin_), kt_)
);
ktEqn().relax();
ktEqn().boundaryManipulate(kt_.boundaryField());
ktEqn.ref().relax();
ktEqn.ref().boundaryManipulate(kt_.boundaryField());
solve(ktEqn);
bound(kt_, kMin_);

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
@ -260,7 +260,7 @@ void qZeta::correct()
+ E
);
zetaEqn().relax();
zetaEqn.ref().relax();
solve(zetaEqn);
bound(zeta_, zetaMin_);
@ -275,7 +275,7 @@ void qZeta::correct()
G - fvm::Sp(zeta_/q_, q_)
);
qEqn().relax();
qEqn.ref().relax();
solve(qEqn);
bound(q_, qMin_);

View File

@ -615,7 +615,7 @@ void mixtureKEpsilon<BasicTurbulenceModel>::correct()
kl.boundaryField().updateCoeffs();
epsilonl.boundaryField().updateCoeffs();
Gc().checkOut();
Gc.ref().checkOut();
}
tmp<volScalarField> Gd;
@ -635,7 +635,7 @@ void mixtureKEpsilon<BasicTurbulenceModel>::correct()
kg.boundaryField().updateCoeffs();
epsilong.boundaryField().updateCoeffs();
Gd().checkOut();
Gd.ref().checkOut();
}
// Mixture turbulence generation
@ -665,9 +665,9 @@ void mixtureKEpsilon<BasicTurbulenceModel>::correct()
+ fvOptions(epsilonm)
);
epsEqn().relax();
fvOptions.constrain(epsEqn());
epsEqn().boundaryManipulate(epsilonm.boundaryField());
epsEqn.ref().relax();
fvOptions.constrain(epsEqn.ref());
epsEqn.ref().boundaryManipulate(epsilonm.boundaryField());
solve(epsEqn);
fvOptions.correct(epsilonm);
bound(epsilonm, this->epsilonMin_);
@ -688,8 +688,8 @@ void mixtureKEpsilon<BasicTurbulenceModel>::correct()
+ fvOptions(km)
);
kmEqn().relax();
fvOptions.constrain(kmEqn());
kmEqn.ref().relax();
fvOptions.constrain(kmEqn.ref());
solve(kmEqn);
fvOptions.correct(km);
bound(km, this->kMin_);

View File

@ -202,9 +202,9 @@ void DeardorffDiffStress<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, R)
);
REqn().relax();
fvOptions.constrain(REqn());
REqn().solve();
REqn.ref().relax();
fvOptions.constrain(REqn.ref());
REqn.ref().solve();
fvOptions.correct(R);
this->boundNormalStress(R);

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
@ -66,7 +66,7 @@ void Foam::LESModels::IDDESDelta::calcDelta()
)
);
scalarField& faceToFacenMax = tfaceToFacenMax().internalField();
scalarField& faceToFacenMax = tfaceToFacenMax.ref().internalField();
const cellList& cells = mesh.cells();
const vectorField& faceCentres = mesh.faceCentres();

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
@ -46,24 +46,8 @@ void Foam::LESModels::maxDeltaxyz::calcDelta()
label nD = mesh.nGeometricD();
tmp<volScalarField> hmax
(
new volScalarField
(
IOobject
(
"hmax",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zrero", dimLength, 0.0)
)
);
const cellList& cells = mesh.cells();
scalarField hmax(cells.size());
forAll(cells,cellI)
{
@ -81,12 +65,13 @@ void Foam::LESModels::maxDeltaxyz::calcDelta()
deltaMaxTmp = tmp;
}
}
hmax()[cellI] = deltaCoeff_*deltaMaxTmp;
hmax[cellI] = deltaCoeff_*deltaMaxTmp;
}
if (nD == 3)
{
delta_.internalField() = hmax();
delta_.internalField() = hmax;
}
else if (nD == 2)
{
@ -94,7 +79,7 @@ void Foam::LESModels::maxDeltaxyz::calcDelta()
<< "Case is 2D, LES is not strictly applicable\n"
<< endl;
delta_.internalField() = hmax();
delta_.internalField() = hmax;
}
else
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -190,7 +190,7 @@ Foam::tmp<Foam::volSymmTensorField> Foam::anisotropicFilter::operator()
for (direction d=0; d<symmTensor::nComponents; d++)
{
tmpFilteredField().replace
tmpFilteredField.ref().replace
(
d, anisotropicFilter::operator()(unFilteredField().component(d))
);
@ -224,7 +224,7 @@ Foam::tmp<Foam::volTensorField> Foam::anisotropicFilter::operator()
for (direction d=0; d<tensor::nComponents; d++)
{
tmpFilteredField().replace
tmpFilteredField.ref().replace
(
d, anisotropicFilter::operator()(unFilteredField().component(d))
);

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
@ -56,7 +56,7 @@ tmp<volScalarField> SpalartAllmarasDDES<BasicTurbulenceModel>::rd
scalar(10)
)
);
tr().boundaryField() == 0.0;
tr.ref().boundaryField() == 0.0;
return tr;
}

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
@ -129,7 +129,7 @@ tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::r
scalar(10)
)
);
tr().boundaryField() == 0.0;
tr.ref().boundaryField() == 0.0;
return tr;
}
@ -158,7 +158,7 @@ tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::dTilda
) const
{
tmp<volScalarField> tdTilda(CDES_*this->delta());
min(tdTilda().dimensionedInternalField(), tdTilda(), y_);
min(tdTilda.ref().dimensionedInternalField(), tdTilda(), y_);
return tdTilda;
}
@ -442,8 +442,8 @@ void SpalartAllmarasDES<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, nuTilda_)
);
nuTildaEqn().relax();
fvOptions.constrain(nuTildaEqn());
nuTildaEqn.ref().relax();
fvOptions.constrain(nuTildaEqn.ref());
solve(nuTildaEqn);
fvOptions.correct(nuTilda_);
bound(nuTilda_, dimensionedScalar("0", nuTilda_.dimensions(), 0.0));

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
@ -274,8 +274,8 @@ void dynamicKEqn<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, k_)
);
kEqn().relax();
fvOptions.constrain(kEqn());
kEqn.ref().relax();
fvOptions.constrain(kEqn.ref());
solve(kEqn);
fvOptions.correct(k_);
bound(k_, this->kMin_);

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
@ -196,8 +196,8 @@ void kEqn<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, k_)
);
kEqn().relax();
fvOptions.constrain(kEqn());
kEqn.ref().relax();
fvOptions.constrain(kEqn.ref());
solve(kEqn);
fvOptions.correct(k_);
bound(k_, this->kMin_);

View File

@ -1,4 +1,4 @@
EXE_INC = \
EXE_INC = -DCONST_TMP \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude

View File

@ -307,9 +307,9 @@ void LRR<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, epsilon_)
);
epsEqn().relax();
fvOptions.constrain(epsEqn());
epsEqn().boundaryManipulate(epsilon_.boundaryField());
epsEqn.ref().relax();
fvOptions.constrain(epsEqn.ref());
epsEqn.ref().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
fvOptions.correct(epsilon_);
bound(epsilon_, this->epsilonMin_);
@ -362,13 +362,13 @@ void LRR<BasicTurbulenceModel>::correct()
Cref1_*R - ((Cref2_*C2_)*(k_/epsilon_))*dev(P)
);
REqn() +=
REqn.ref() +=
((3*pow(Cmu_, 0.75)/kappa_)*(alpha*rho*sqrt(k_)/y_))
*dev(symm((n_ & reflect)*n_));
}
REqn().relax();
fvOptions.constrain(REqn());
REqn.ref().relax();
fvOptions.constrain(REqn.ref());
solve(REqn);
fvOptions.correct(R);

View File

@ -280,9 +280,9 @@ void LaunderSharmaKE<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, epsilon_)
);
epsEqn().relax();
fvOptions.constrain(epsEqn());
epsEqn().boundaryManipulate(epsilon_.boundaryField());
epsEqn.ref().relax();
fvOptions.constrain(epsEqn.ref());
epsEqn.ref().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
fvOptions.correct(epsilon_);
bound(epsilon_, this->epsilonMin_);
@ -301,8 +301,8 @@ void LaunderSharmaKE<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, k_)
);
kEqn().relax();
fvOptions.constrain(kEqn());
kEqn.ref().relax();
fvOptions.constrain(kEqn.ref());
solve(kEqn);
fvOptions.correct(k_);
bound(k_, this->kMin_);

View File

@ -288,9 +288,9 @@ void RNGkEpsilon<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, epsilon_)
);
epsEqn().relax();
fvOptions.constrain(epsEqn());
epsEqn().boundaryManipulate(epsilon_.boundaryField());
epsEqn.ref().relax();
fvOptions.constrain(epsEqn.ref());
epsEqn.ref().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
fvOptions.correct(epsilon_);
bound(epsilon_, this->epsilonMin_);
@ -311,8 +311,8 @@ void RNGkEpsilon<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, k_)
);
kEqn().relax();
fvOptions.constrain(kEqn());
kEqn.ref().relax();
fvOptions.constrain(kEqn.ref());
solve(kEqn);
fvOptions.correct(k_);
bound(k_, this->kMin_);

View File

@ -317,9 +317,9 @@ void SSG<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, epsilon_)
);
epsEqn().relax();
fvOptions.constrain(epsEqn());
epsEqn().boundaryManipulate(epsilon_.boundaryField());
epsEqn.ref().relax();
fvOptions.constrain(epsEqn.ref());
epsEqn.ref().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
fvOptions.correct(epsilon_);
bound(epsilon_, this->epsilonMin_);
@ -371,8 +371,8 @@ void SSG<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, R)
);
REqn().relax();
fvOptions.constrain(REqn());
REqn.ref().relax();
fvOptions.constrain(REqn.ref());
solve(REqn);
fvOptions.correct(R);

View File

@ -377,8 +377,8 @@ void SpalartAllmaras<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, nuTilda_)
);
nuTildaEqn().relax();
fvOptions.constrain(nuTildaEqn());
nuTildaEqn.ref().relax();
fvOptions.constrain(nuTildaEqn.ref());
solve(nuTildaEqn);
fvOptions.correct(nuTilda_);
bound(nuTilda_, dimensionedScalar("0", nuTilda_.dimensions(), 0.0));

View File

@ -258,9 +258,9 @@ void kEpsilon<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, epsilon_)
);
epsEqn().relax();
fvOptions.constrain(epsEqn());
epsEqn().boundaryManipulate(epsilon_.boundaryField());
epsEqn.ref().relax();
fvOptions.constrain(epsEqn.ref());
epsEqn.ref().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
fvOptions.correct(epsilon_);
bound(epsilon_, this->epsilonMin_);
@ -279,8 +279,8 @@ void kEpsilon<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, k_)
);
kEqn().relax();
fvOptions.constrain(kEqn());
kEqn.ref().relax();
fvOptions.constrain(kEqn.ref());
solve(kEqn);
fvOptions.correct(k_);
bound(k_, this->kMin_);

View File

@ -221,9 +221,9 @@ void kOmega<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, omega_)
);
omegaEqn().relax();
fvOptions.constrain(omegaEqn());
omegaEqn().boundaryManipulate(omega_.boundaryField());
omegaEqn.ref().relax();
fvOptions.constrain(omegaEqn.ref());
omegaEqn.ref().boundaryManipulate(omega_.boundaryField());
solve(omegaEqn);
fvOptions.correct(omega_);
bound(omega_, this->omegaMin_);
@ -242,8 +242,8 @@ void kOmega<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, k_)
);
kEqn().relax();
fvOptions.constrain(kEqn());
kEqn.ref().relax();
fvOptions.constrain(kEqn.ref());
solve(kEqn);
fvOptions.correct(k_);
bound(k_, this->kMin_);

View File

@ -101,7 +101,7 @@ tmp<volScalarField> kOmegaSST<BasicTurbulenceModel>::kOmegaSST::F23() const
if (F3_)
{
f23() *= F3();
f23.ref() *= F3();
}
return f23;
@ -452,9 +452,9 @@ void kOmegaSST<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, omega_)
);
omegaEqn().relax();
fvOptions.constrain(omegaEqn());
omegaEqn().boundaryManipulate(omega_.boundaryField());
omegaEqn.ref().relax();
fvOptions.constrain(omegaEqn.ref());
omegaEqn.ref().boundaryManipulate(omega_.boundaryField());
solve(omegaEqn);
fvOptions.correct(omega_);
bound(omega_, this->omegaMin_);
@ -474,8 +474,8 @@ void kOmegaSST<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, k_)
);
kEqn().relax();
fvOptions.constrain(kEqn());
kEqn.ref().relax();
fvOptions.constrain(kEqn.ref());
solve(kEqn);
fvOptions.correct(k_);
bound(k_, this->kMin_);

View File

@ -304,9 +304,9 @@ void realizableKE<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, epsilon_)
);
epsEqn().relax();
fvOptions.constrain(epsEqn());
epsEqn().boundaryManipulate(epsilon_.boundaryField());
epsEqn.ref().relax();
fvOptions.constrain(epsEqn.ref());
epsEqn.ref().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
fvOptions.correct(epsilon_);
bound(epsilon_, this->epsilonMin_);
@ -327,8 +327,8 @@ void realizableKE<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, k_)
);
kEqn().relax();
fvOptions.constrain(kEqn());
kEqn.ref().relax();
fvOptions.constrain(kEqn.ref());
solve(kEqn);
fvOptions.correct(k_);
bound(k_, this->kMin_);

View File

@ -329,9 +329,9 @@ void v2f<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, epsilon_)
);
epsEqn().relax();
fvOptions.constrain(epsEqn());
epsEqn().boundaryManipulate(epsilon_.boundaryField());
epsEqn.ref().relax();
fvOptions.constrain(epsEqn.ref());
epsEqn.ref().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
fvOptions.correct(epsilon_);
bound(epsilon_, this->epsilonMin_);
@ -350,8 +350,8 @@ void v2f<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, k_)
);
kEqn().relax();
fvOptions.constrain(kEqn());
kEqn.ref().relax();
fvOptions.constrain(kEqn.ref());
solve(kEqn);
fvOptions.correct(k_);
bound(k_, this->kMin_);
@ -366,8 +366,8 @@ void v2f<BasicTurbulenceModel>::correct()
- 1.0/L2/k_*(v2fAlpha - C2_*G)
);
fEqn().relax();
fvOptions.constrain(fEqn());
fEqn.ref().relax();
fvOptions.constrain(fEqn.ref());
solve(fEqn);
fvOptions.correct(f_);
bound(f_, fMin_);
@ -385,8 +385,8 @@ void v2f<BasicTurbulenceModel>::correct()
+ fvOptions(alpha, rho, v2_)
);
v2Eqn().relax();
fvOptions.constrain(v2Eqn());
v2Eqn.ref().relax();
fvOptions.constrain(v2Eqn.ref());
solve(v2Eqn);
fvOptions.correct(v2_);
bound(v2_, v2Min_);

View File

@ -198,7 +198,7 @@ Foam::tmp<Foam::volScalarField>
Foam::ReynoldsStress<BasicTurbulenceModel>::k() const
{
tmp<Foam::volScalarField> tk(0.5*tr(R_));
tk().rename("k");
tk.ref().rename("k");
return tk;
}

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
@ -57,10 +57,10 @@ tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcNut() const
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
tmp<scalarField> tyPlus = calcYPlus(magUp);
scalarField& yPlus = tyPlus();
scalarField& yPlus = tyPlus.ref();
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
scalarField& nutw = tnutw.ref();
forAll(yPlus, facei)
{
@ -95,7 +95,7 @@ tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcYPlus
const scalarField& nuw = tnuw();
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
scalarField& yPlus = tyPlus();
scalarField& yPlus = tyPlus.ref();
if (roughnessHeight_ > 0.0)
{

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
@ -87,7 +87,7 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau
const scalarField& nutw = *this;
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
scalarField& uTau = tuTau();
scalarField& uTau = tuTau.ref();
forAll(uTau, 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
@ -72,7 +72,7 @@ tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::calcUPlus
) const
{
tmp<scalarField> tuPlus(new scalarField(patch().size(), 0.0));
scalarField& uPlus = tuPlus();
scalarField& uPlus = tuPlus.ref();
forAll(uPlus, 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
@ -54,10 +54,10 @@ tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcNut() const
const scalarField& nuw = tnuw();
tmp<scalarField> tyPlus = calcYPlus(magUp);
scalarField& yPlus = tyPlus();
scalarField& yPlus = tyPlus.ref();
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
scalarField& nutw = tnutw.ref();
forAll(yPlus, facei)
{
@ -92,7 +92,7 @@ tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcYPlus
const scalarField& nuw = tnuw();
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
scalarField& yPlus = tyPlus();
scalarField& yPlus = tyPlus.ref();
forAll(yPlus, 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
@ -57,7 +57,7 @@ tmp<scalarField> nutkAtmRoughWallFunctionFvPatchScalarField::calcNut() const
const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tnutw(new scalarField(*this));
scalarField& nutw = tnutw();
scalarField& nutw = tnutw.ref();
forAll(nutw, 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
@ -80,7 +80,7 @@ tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const
const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tnutw(new scalarField(*this));
scalarField& nutw = tnutw();
scalarField& nutw = tnutw.ref();
forAll(nutw, 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
@ -59,7 +59,7 @@ tmp<scalarField> nutkWallFunctionFvPatchScalarField::calcNut() const
const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
scalarField& nutw = tnutw.ref();
forAll(nutw, faceI)
{

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 @@ Foam::nonlinearEddyViscosity<BasicTurbulenceModel>::R() const
(
eddyViscosity<BasicTurbulenceModel>::R()
);
tR() += nonlinearStress_;
tR.ref() += nonlinearStress_;
return tR;
}
@ -96,7 +96,7 @@ Foam::nonlinearEddyViscosity<BasicTurbulenceModel>::devRhoReff() const
(
eddyViscosity<BasicTurbulenceModel>::devRhoReff()
);
tdevRhoReff() += this->rho_*nonlinearStress_;
tdevRhoReff.ref() += this->rho_*nonlinearStress_;
return tdevRhoReff;
}

View File

@ -1,4 +1,4 @@
EXE_INC = \
EXE_INC = -DCONST_TMP \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \

View File

@ -180,7 +180,7 @@ Foam::tmp<Foam::volVectorField> Foam::MRFZoneList::DDt
dimensionedVector("0", U.dimensions()/dimTime, vector::zero)
)
);
volVectorField& acceleration = tacceleration();
volVectorField& acceleration = tacceleration.ref();
forAll(*this, i)
{
@ -238,7 +238,7 @@ Foam::tmp<Foam::surfaceScalarField> Foam::MRFZoneList::relative
)
);
makeRelative(rphi());
makeRelative(rphi.ref());
reuseTmpGeometricField<scalar, scalar, fvsPatchField, surfaceMesh>
::clear(tphi);
@ -267,7 +267,7 @@ Foam::MRFZoneList::relative
forAll(*this, i)
{
operator[](i).makeRelative(rphi());
operator[](i).makeRelative(rphi.ref());
}
reuseTmpFieldField<fvsPatchField, scalar, scalar>::clear(tphi);
@ -297,7 +297,7 @@ Foam::MRFZoneList::relative
forAll(*this, i)
{
operator[](i).makeRelative(rphi(), patchi);
operator[](i).makeRelative(rphi.ref(), patchi);
}
reuseTmp<scalar, scalar>::clear(tphi);
@ -361,7 +361,7 @@ Foam::tmp<Foam::surfaceScalarField> Foam::MRFZoneList::absolute
)
);
makeAbsolute(rphi());
makeAbsolute(rphi.ref());
reuseTmpGeometricField<scalar, scalar, fvsPatchField, surfaceMesh>
::clear(tphi);

View File

@ -226,7 +226,7 @@ Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::Uabs() const
);
// Add SRF contribution to internal field
tUabs().internalField() += Urel_.internalField();
tUabs.ref().internalField() += Urel_.internalField();
// Add Urel boundary contributions
const volVectorField::GeometricBoundaryField& bvf = Urel_.boundaryField();
@ -241,12 +241,12 @@ Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::Uabs() const
refCast<const SRFVelocityFvPatchVectorField>(bvf[i]);
if (UrelPatch.relative())
{
tUabs().boundaryField()[i] += Urel_.boundaryField()[i];
tUabs.ref().boundaryField()[i] += Urel_.boundaryField()[i];
}
}
else
{
tUabs().boundaryField()[i] += Urel_.boundaryField()[i];
tUabs.ref().boundaryField()[i] += Urel_.boundaryField()[i];
}
}

View File

@ -40,16 +40,15 @@ Foam::tmp<Foam::volVectorField> Foam::constrainHbyA
if (tHbyA.isTmp())
{
volVectorField* HbyAPtr = tHbyA.ptr();
HbyAPtr->rename("HbyA");
tHbyANew = HbyAPtr;
tHbyANew = tHbyA;
tHbyANew.ref().rename("HbyA");
}
else
{
tHbyANew = new volVectorField("HbyA", tHbyA);
}
volVectorField& HbyA = tHbyANew();
volVectorField& HbyA = tHbyANew.ref();
forAll(U.boundaryField(), patchi)
{

View File

@ -47,7 +47,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator()
const dimensionSet ds = field.dimensions()/dimTime*dimVolume;
tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds));
fvMatrix<Type>& mtx = tmtx();
fvMatrix<Type>& mtx = tmtx.ref();
forAll(*this, i)
{
@ -103,7 +103,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator()
);
tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds));
fvMatrix<Type>& mtx = tmtx();
fvMatrix<Type>& mtx = tmtx.ref();
forAll(*this, i)
{
@ -162,7 +162,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator()
);
tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds));
fvMatrix<Type>& mtx = tmtx();
fvMatrix<Type>& mtx = tmtx.ref();
forAll(*this, i)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -158,7 +158,7 @@ Foam::tmp<Foam::vectorField> Foam::porosityModel::porosityModel::force
if (!cellZoneIDs_.empty())
{
this->calcForce(U, rho, mu, tforce());
this->calcForce(U, rho, mu, tforce.ref());
}
return tforce;

View File

@ -127,7 +127,7 @@ Foam::cyclicFvPatchField<Type>::patchNeighbourField() const
cyclicPatch().cyclicPatch().neighbPatch().faceCells();
tmp<Field<Type>> tpnf(new Field<Type>(this->size()));
Field<Type>& pnf = tpnf();
Field<Type>& pnf = tpnf.ref();
if (doTransform())

View File

@ -159,7 +159,7 @@ Foam::cyclicACMIFvPatchField<Type>::patchNeighbourField() const
if (doTransform())
{
tpnf() = transform(forwardT(), tpnf());
tpnf.ref() = transform(forwardT(), tpnf());
}
return tpnf;

View File

@ -151,7 +151,7 @@ Foam::cyclicAMIFvPatchField<Type>::patchNeighbourField() const
if (doTransform())
{
tpnf() = transform(forwardT(), tpnf());
tpnf.ref() = transform(forwardT(), tpnf());
}
return tpnf;

View File

@ -98,7 +98,7 @@ Foam::jumpCyclicFvPatchField<Type>::patchNeighbourField() const
this->cyclicPatch().neighbFvPatch().faceCells();
tmp<Field<Type>> tpnf(new Field<Type>(this->size()));
Field<Type>& pnf = tpnf();
Field<Type>& pnf = tpnf.ref();
Field<Type> jf(this->jump());
if (!this->cyclicPatch().owner())

View File

@ -180,7 +180,7 @@ tmp<Field<Type>> mappedPatchFieldBase<Type>::mappedField() const
// Result of obtaining remote values
tmp<Field<Type>> tnewValues(new Field<Type>(0));
Field<Type>& newValues = tnewValues();
Field<Type>& newValues = tnewValues.ref();
switch (mapper_.mode())
{

View File

@ -80,7 +80,7 @@ Foam::tmp<Foam::fvPatchField<Type>> Foam::fvPatchField<Type>::New
// Check if constraint type override and store patchType if so
if ((patchTypeCstrIter != patchConstructorTablePtr_->end()))
{
tfvp().patchType() = actualPatchType;
tfvp.ref().patchType() = actualPatchType;
}
return tfvp;
}

View File

@ -90,7 +90,7 @@ gaussConvectionScheme<Type>::fvmDiv
faceFlux.dimensions()*vf.dimensions()
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
fvm.lower() = -weights.internalField()*faceFlux.internalField();
fvm.upper() = fvm.lower() + faceFlux.internalField();
@ -128,7 +128,7 @@ gaussConvectionScheme<Type>::fvcDiv
fvc::surfaceIntegrate(flux(faceFlux, vf))
);
tConvection().rename
tConvection.ref().rename
(
"convection(" + faceFlux.name() + ',' + vf.name() + ')'
);

View File

@ -247,7 +247,7 @@ EulerD2dt2Scheme<Type>::fvmD2dt2
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
@ -308,7 +308,7 @@ EulerD2dt2Scheme<Type>::fvmD2dt2
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
@ -368,7 +368,7 @@ EulerD2dt2Scheme<Type>::fvmD2dt2
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();

View File

@ -61,7 +61,7 @@ tmp<volScalarField> CoEulerDdtScheme<Type>::CorDeltaT() const
)
);
volScalarField& corDeltaT = tcorDeltaT();
volScalarField& corDeltaT = tcorDeltaT.ref();
const labelUList& owner = mesh().owner();
const labelUList& neighbour = mesh().neighbour();
@ -183,7 +183,7 @@ CoEulerDdtScheme<Type>::fvcDdt
)
);
tdtdt().internalField() =
tdtdt.ref().internalField() =
rDeltaT.internalField()*dt.value()
*(1.0 - mesh().Vsc0()/mesh().Vsc());
@ -453,7 +453,7 @@ CoEulerDdtScheme<Type>::fvmDdt
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalarField rDeltaT(CorDeltaT()().internalField());
@ -488,7 +488,7 @@ CoEulerDdtScheme<Type>::fvmDdt
rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalarField rDeltaT(CorDeltaT()().internalField());
@ -525,7 +525,7 @@ CoEulerDdtScheme<Type>::fvmDdt
rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalarField rDeltaT(CorDeltaT()().internalField());
@ -565,7 +565,7 @@ CoEulerDdtScheme<Type>::fvmDdt
alpha.dimensions()*rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalarField rDeltaT(CorDeltaT()().internalField());

View File

@ -330,7 +330,7 @@ CrankNicolsonDdtScheme<Type>::fvcDdt
)/mesh().V0();
}
tdtdt().dimensionedInternalField() =
tdtdt.ref().dimensionedInternalField() =
(
(rDtCoef*dt)*(mesh().V() - mesh().V0())
- mesh().V0()*offCentre_(ddt0.dimensionedInternalField())
@ -773,7 +773,7 @@ CrankNicolsonDdtScheme<Type>::fvmDdt
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar rDtCoef = rDtCoef_(ddt0).value();
fvm.diag() = rDtCoef*mesh().V();
@ -855,7 +855,7 @@ CrankNicolsonDdtScheme<Type>::fvmDdt
rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar rDtCoef = rDtCoef_(ddt0).value();
fvm.diag() = rDtCoef*rho.value()*mesh().V();
@ -937,7 +937,7 @@ CrankNicolsonDdtScheme<Type>::fvmDdt
rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar rDtCoef = rDtCoef_(ddt0).value();
fvm.diag() = rDtCoef*rho.internalField()*mesh().V();
@ -1028,7 +1028,7 @@ CrankNicolsonDdtScheme<Type>::fvmDdt
alpha.dimensions()*rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar rDtCoef = rDtCoef_(ddt0).value();
fvm.diag() = rDtCoef*alpha.internalField()*rho.internalField()*mesh().V();

View File

@ -73,7 +73,7 @@ EulerDdtScheme<Type>::fvcDdt
)
);
tdtdt().internalField() =
tdtdt.ref().internalField() =
rDeltaT.value()*dt.value()*(1.0 - mesh().Vsc0()/mesh().Vsc());
return tdtdt;
@ -342,7 +342,7 @@ EulerDdtScheme<Type>::fvmDdt
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar rDeltaT = 1.0/mesh().time().deltaTValue();
@ -377,7 +377,7 @@ EulerDdtScheme<Type>::fvmDdt
rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar rDeltaT = 1.0/mesh().time().deltaTValue();
@ -414,7 +414,7 @@ EulerDdtScheme<Type>::fvmDdt
rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar rDeltaT = 1.0/mesh().time().deltaTValue();
@ -454,7 +454,7 @@ EulerDdtScheme<Type>::fvmDdt
alpha.dimensions()*rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar rDeltaT = 1.0/mesh().time().deltaTValue();

View File

@ -111,7 +111,7 @@ tmp<volScalarField> SLTSDdtScheme<Type>::SLrDeltaT() const
)
);
volScalarField& rDeltaT = trDeltaT();
volScalarField& rDeltaT = trDeltaT.ref();
relaxedDiag(rDeltaT, phi);
@ -183,7 +183,7 @@ SLTSDdtScheme<Type>::fvcDdt
)
);
tdtdt().internalField() =
tdtdt.ref().internalField() =
rDeltaT.internalField()*dt.value()*(1.0 - mesh().V0()/mesh().V());
return tdtdt;
@ -452,7 +452,7 @@ SLTSDdtScheme<Type>::fvmDdt
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalarField rDeltaT(SLrDeltaT()().internalField());
@ -487,7 +487,7 @@ SLTSDdtScheme<Type>::fvmDdt
rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalarField rDeltaT(SLrDeltaT()().internalField());
@ -524,7 +524,7 @@ SLTSDdtScheme<Type>::fvmDdt
rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalarField rDeltaT(SLrDeltaT()().internalField());
@ -564,7 +564,7 @@ SLTSDdtScheme<Type>::fvmDdt
alpha.dimensions()*rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalarField rDeltaT(SLrDeltaT()().internalField());

View File

@ -111,7 +111,7 @@ backwardDdtScheme<Type>::fvcDdt
)
);
tdtdt().internalField() = rDeltaT.value()*dt.value()*
tdtdt.ref().internalField() = rDeltaT.value()*dt.value()*
(
coefft - (coefft0*mesh().V0() - coefft00*mesh().V00())/mesh().V()
);
@ -467,7 +467,7 @@ backwardDdtScheme<Type>::fvmDdt
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar rDeltaT = 1.0/deltaT_();
@ -518,7 +518,7 @@ backwardDdtScheme<Type>::fvmDdt
rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar rDeltaT = 1.0/deltaT_();
@ -569,7 +569,7 @@ backwardDdtScheme<Type>::fvmDdt
rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar rDeltaT = 1.0/deltaT_();
@ -624,7 +624,7 @@ backwardDdtScheme<Type>::fvmDdt
alpha.dimensions()*rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
scalar rDeltaT = 1.0/deltaT_();

View File

@ -48,7 +48,7 @@ boundedDdtScheme<Type>::fvcDdt
const dimensioned<Type>& dt
)
{
return scheme_().fvcDdt(dt);
return scheme_.ref().fvcDdt(dt);
}
@ -59,7 +59,7 @@ boundedDdtScheme<Type>::fvcDdt
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return scheme_().fvcDdt(vf);
return scheme_.ref().fvcDdt(vf);
}
@ -71,7 +71,7 @@ boundedDdtScheme<Type>::fvcDdt
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return scheme_().fvcDdt(rho, vf);
return scheme_.ref().fvcDdt(rho, vf);
}
@ -83,7 +83,7 @@ boundedDdtScheme<Type>::fvcDdt
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return scheme_().fvcDdt(rho, vf) - fvc::ddt(rho)*vf;
return scheme_.ref().fvcDdt(rho, vf) - fvc::ddt(rho)*vf;
}
@ -96,7 +96,7 @@ boundedDdtScheme<Type>::fvcDdt
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return scheme_().fvcDdt(alpha, rho, vf) - fvc::ddt(alpha, rho)*vf;
return scheme_.ref().fvcDdt(alpha, rho, vf) - fvc::ddt(alpha, rho)*vf;
}
@ -107,7 +107,7 @@ boundedDdtScheme<Type>::fvmDdt
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return scheme_().fvmDdt(vf);
return scheme_.ref().fvmDdt(vf);
}
@ -119,7 +119,7 @@ boundedDdtScheme<Type>::fvmDdt
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return scheme_().fvmDdt(rho, vf);
return scheme_.ref().fvmDdt(rho, vf);
}
@ -131,7 +131,7 @@ boundedDdtScheme<Type>::fvmDdt
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return scheme_().fvmDdt(rho, vf) - fvm::Sp(fvc::ddt(rho), vf);
return scheme_.ref().fvmDdt(rho, vf) - fvm::Sp(fvc::ddt(rho), vf);
}
@ -144,7 +144,9 @@ boundedDdtScheme<Type>::fvmDdt
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return scheme_().fvmDdt(alpha, rho, vf) - fvm::Sp(fvc::ddt(alpha, rho), vf);
return
scheme_.ref().fvmDdt(alpha, rho, vf)
- fvm::Sp(fvc::ddt(alpha, rho), vf);
}
@ -156,7 +158,7 @@ boundedDdtScheme<Type>::fvcDdtUfCorr
const GeometricField<Type, fvsPatchField, surfaceMesh>& Uf
)
{
return scheme_().fvcDdtUfCorr(U, Uf);
return scheme_.ref().fvcDdtUfCorr(U, Uf);
}
@ -168,7 +170,7 @@ boundedDdtScheme<Type>::fvcDdtPhiCorr
const fluxFieldType& phi
)
{
return scheme_().fvcDdtPhiCorr(U, phi);
return scheme_.ref().fvcDdtPhiCorr(U, phi);
}
@ -181,7 +183,7 @@ boundedDdtScheme<Type>::fvcDdtUfCorr
const GeometricField<Type, fvsPatchField, surfaceMesh>& Uf
)
{
return scheme_().fvcDdtUfCorr(rho, U, Uf);
return scheme_.ref().fvcDdtUfCorr(rho, U, Uf);
}
@ -194,7 +196,7 @@ boundedDdtScheme<Type>::fvcDdtPhiCorr
const fluxFieldType& phi
)
{
return scheme_().fvcDdtPhiCorr(rho, U, phi);
return scheme_.ref().fvcDdtPhiCorr(rho, U, phi);
}
@ -204,7 +206,7 @@ tmp<surfaceScalarField> boundedDdtScheme<Type>::meshPhi
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return scheme_().meshPhi(vf);
return scheme_.ref().meshPhi(vf);
}

View File

@ -148,7 +148,7 @@ tmp<surfaceScalarField> ddtScheme<Type>::fvcDdtPhiCoeff
scalar(1)
);
surfaceScalarField& ddtCouplingCoeff = tddtCouplingCoeff();
surfaceScalarField& ddtCouplingCoeff = tddtCouplingCoeff.ref();
forAll(U.boundaryField(), patchi)
{

View File

@ -79,7 +79,7 @@ localEulerDdtScheme<Type>::fvcDdt
)
);
tdtdt().internalField() =
tdtdt.ref().internalField() =
rDeltaT.internalField()*dt.value()
*(1.0 - mesh().Vsc0()/mesh().Vsc());
@ -349,7 +349,7 @@ localEulerDdtScheme<Type>::fvmDdt
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
const scalarField& rDeltaT = localRDeltaT().internalField();
@ -384,7 +384,7 @@ localEulerDdtScheme<Type>::fvmDdt
rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
const scalarField& rDeltaT = localRDeltaT().internalField();
@ -421,7 +421,7 @@ localEulerDdtScheme<Type>::fvmDdt
rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
const scalarField& rDeltaT = localRDeltaT().internalField();
@ -461,7 +461,7 @@ localEulerDdtScheme<Type>::fvmDdt
alpha.dimensions()*rho.dimensions()*vf.dimensions()*dimVol/dimTime
)
);
fvMatrix<Type>& fvm = tfvm();
fvMatrix<Type>& fvm = tfvm.ref();
const scalarField& rDeltaT = localRDeltaT().internalField();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -62,7 +62,7 @@ gaussDivScheme<Type>::fvcDiv
)
);
tDiv().rename("div(" + vf.name() + ')');
tDiv.ref().rename("div(" + vf.name() + ')');
return tDiv;
}

View File

@ -65,8 +65,7 @@ average
ssf.dimensions()
)
);
GeometricField<Type, fvPatchField, volMesh>& av = taverage();
GeometricField<Type, fvPatchField, volMesh>& av = taverage.ref();
av.internalField() =
(

View File

@ -51,7 +51,7 @@ ddt
(
mesh,
mesh.ddtScheme("ddt(" + dt.name() + ')')
)().fvcDdt(dt);
).ref().fvcDdt(dt);
}
@ -66,7 +66,7 @@ ddt
(
vf.mesh(),
vf.mesh().ddtScheme("ddt(" + vf.name() + ')')
)().fvcDdt(vf);
).ref().fvcDdt(vf);
}
@ -82,7 +82,7 @@ ddt
(
vf.mesh(),
vf.mesh().ddtScheme("ddt(" + rho.name() + ',' + vf.name() + ')')
)().fvcDdt(rho, vf);
).ref().fvcDdt(rho, vf);
}
@ -98,7 +98,7 @@ ddt
(
vf.mesh(),
vf.mesh().ddtScheme("ddt(" + rho.name() + ',' + vf.name() + ')')
)().fvcDdt(rho, vf);
).ref().fvcDdt(rho, vf);
}
@ -121,7 +121,7 @@ ddt
+ rho.name() + ','
+ vf.name() + ')'
)
)().fvcDdt(alpha, rho, vf);
).ref().fvcDdt(alpha, rho, vf);
}
@ -161,7 +161,7 @@ ddtCorr
(
U.mesh(),
U.mesh().ddtScheme("ddt(" + U.name() + ')')
)().fvcDdtUfCorr(U, Uf);
).ref().fvcDdtUfCorr(U, Uf);
}
@ -182,7 +182,7 @@ ddtCorr
(
U.mesh(),
U.mesh().ddtScheme("ddt(" + U.name() + ')')
)().fvcDdtPhiCorr(U, phi);
).ref().fvcDdtPhiCorr(U, phi);
}
@ -199,7 +199,7 @@ ddtCorr
(
U.mesh(),
U.mesh().ddtScheme("ddt(" + U.name() + ')')
)().fvcDdtUfCorr(rho, U, Uf);
).ref().fvcDdtUfCorr(rho, U, Uf);
}
@ -221,7 +221,7 @@ ddtCorr
(
U.mesh(),
U.mesh().ddtScheme("ddt(" + rho.name() + ',' + U.name() + ')')
)().fvcDdtPhiCorr(rho, U, phi);
).ref().fvcDdtPhiCorr(rho, U, phi);
}

View File

@ -89,7 +89,7 @@ div
return fv::divScheme<Type>::New
(
vf.mesh(), vf.mesh().divScheme(name)
)().fvcDiv(vf);
).ref().fvcDiv(vf);
}
@ -167,7 +167,7 @@ div
vf.mesh(),
flux,
vf.mesh().divScheme(name)
)().fvcDiv(flux, vf);
).ref().fvcDiv(flux, vf);
}

View File

@ -51,7 +51,7 @@ laplacian
(
vf.mesh(),
vf.mesh().laplacianScheme(name)
)().fvcLaplacian(vf);
).ref().fvcLaplacian(vf);
}
@ -202,7 +202,7 @@ laplacian
(
vf.mesh(),
vf.mesh().laplacianScheme(name)
)().fvcLaplacian(gamma, vf);
).ref().fvcLaplacian(gamma, vf);
}
@ -344,7 +344,7 @@ laplacian
(
vf.mesh(),
vf.mesh().laplacianScheme(name)
)().fvcLaplacian(gamma, vf);
).ref().fvcLaplacian(gamma, vf);
}

View File

@ -53,7 +53,8 @@ tmp<volScalarField> magSqrGradGrad
// Loop over other vector field components
for (direction cmpt = 1; cmpt < pTraits<Type>::nComponents; cmpt++)
{
tMagSqrGradGrad() += magSqr(fvc::grad(fvc::grad(vf.component(cmpt))))();
tMagSqrGradGrad.ref() +=
magSqr(fvc::grad(fvc::grad(vf.component(cmpt))))();
}
return tMagSqrGradGrad;

Some files were not shown because too many files have changed in this diff Show More