Commit 15b7e87d authored by Henry Weller's avatar Henry Weller
Browse files

tmp: Updated to store and preserve the const-ness of the reference to a constant object

This change requires that the de-reference operator '()' returns a
const-reference to the object stored irrespective of the const-ness of
object stored and the new member function 'ref()' is provided to return
an non-const reference to stored object which throws a fatal error if the
stored object is const.

In order to smooth the transition to this new safer 'tmp' the now
deprecated and unsafe non-const de-reference operator '()' is still
provided by default but may be switched-off with the compilation switch
'CONST_TMP'.

The main OpenFOAM library has already been upgraded and '-DCONST_TMP'
option specified in the 'options' file to switch to the new 'tmp'
behavior.  The rest of OpenFOAM-dev will be upgraded over the following
few weeks.

Henry G. Weller
CFD Direct
parent 96b0f62d
......@@ -36,13 +36,13 @@ void Foam::BlendedInterfacialModel<ModelType>::correctFixedFluxBCs
GeometricField& field
) const
{
forAll(phase1_.phi()->boundaryField(), patchI)
forAll(phase1_.phi()().boundaryField(), patchI)
{
if
(
isA<fixedValueFvsPatchScalarField>
(
phase1_.phi()->boundaryField()[patchI]
phase1_.phi()().boundaryField()[patchI]
)
)
{
......
EXE_INC = -I$(OBJECTS_DIR)
EXE_INC = -DCONST_TMP -I$(OBJECTS_DIR)
LIB_LIBS = \
$(FOAM_LIBBIN)/libOSspecific.o \
......
......@@ -564,7 +564,7 @@ Foam::Field<Type>::component
) const
{
tmp<Field<cmptType>> Component(new Field<cmptType>(this->size()));
::Foam::component(Component(), *this, d);
::Foam::component(Component.ref(), *this, d);
return Component;
}
......
......@@ -87,7 +87,7 @@ pow
(
new Field<powProductType>(f.size())
);
pow<Type, r>(tRes(), f);
pow<Type, r>(tRes.ref(), f);
return tRes;
}
......@@ -101,7 +101,7 @@ pow
{
typedef typename powProduct<Type, r>::type powProductType;
tmp<Field<powProductType>> tRes = reuseTmp<powProductType, Type>::New(tf);
pow<Type, r>(tRes(), tf());
pow<Type, r>(tRes.ref(), tf());
reuseTmp<powProductType, Type>::clear(tf);
return tRes;
}
......@@ -127,7 +127,7 @@ sqr(const UList<Type>& f)
(
new Field<outerProductType>(f.size())
);
sqr(tRes(), f);
sqr(tRes.ref(), f);
return tRes;
}
......@@ -138,7 +138,7 @@ sqr(const tmp<Field<Type>>& tf)
typedef typename outerProduct<Type, Type>::type outerProductType;
tmp<Field<outerProductType>> tRes =
reuseTmp<outerProductType, Type>::New(tf);
sqr(tRes(), tf());
sqr(tRes.ref(), tf());
reuseTmp<outerProductType, Type>::clear(tf);
return tRes;
}
......@@ -154,7 +154,7 @@ template<class Type>
tmp<Field<scalar>> magSqr(const UList<Type>& f)
{
tmp<Field<scalar>> tRes(new Field<scalar>(f.size()));
magSqr(tRes(), f);
magSqr(tRes.ref(), f);
return tRes;
}
......@@ -162,7 +162,7 @@ template<class Type>
tmp<Field<scalar>> magSqr(const tmp<Field<Type>>& tf)
{
tmp<Field<scalar>> tRes = reuseTmp<scalar, Type>::New(tf);
magSqr(tRes(), tf());
magSqr(tRes.ref(), tf());
reuseTmp<scalar, Type>::clear(tf);
return tRes;
}
......@@ -178,7 +178,7 @@ template<class Type>
tmp<Field<scalar>> mag(const UList<Type>& f)
{
tmp<Field<scalar>> tRes(new Field<scalar>(f.size()));
mag(tRes(), f);
mag(tRes.ref(), f);
return tRes;
}
......@@ -186,7 +186,7 @@ template<class Type>
tmp<Field<scalar>> mag(const tmp<Field<Type>>& tf)
{
tmp<Field<scalar>> tRes = reuseTmp<scalar, Type>::New(tf);
mag(tRes(), tf());
mag(tRes.ref(), tf());
reuseTmp<scalar, Type>::clear(tf);
return tRes;
}
......@@ -204,7 +204,7 @@ tmp<Field<typename Field<Type>::cmptType>> cmptMax(const UList<Type>& f)
{
typedef typename Field<Type>::cmptType cmptType;
tmp<Field<cmptType>> tRes(new Field<cmptType>(f.size()));
cmptMax(tRes(), f);
cmptMax(tRes.ref(), f);
return tRes;
}
......@@ -213,7 +213,7 @@ tmp<Field<typename Field<Type>::cmptType>> cmptMax(const tmp<Field<Type>>& tf)
{
typedef typename Field<Type>::cmptType cmptType;
tmp<Field<cmptType>> tRes = reuseTmp<cmptType, Type>::New(tf);
cmptMax(tRes(), tf());
cmptMax(tRes.ref(), tf());
reuseTmp<cmptType, Type>::clear(tf);
return tRes;
}
......@@ -231,7 +231,7 @@ tmp<Field<typename Field<Type>::cmptType>> cmptMin(const UList<Type>& f)
{
typedef typename Field<Type>::cmptType cmptType;
tmp<Field<cmptType>> tRes(new Field<cmptType>(f.size()));
cmptMin(tRes(), f);
cmptMin(tRes.ref(), f);
return tRes;
}
......@@ -240,7 +240,7 @@ tmp<Field<typename Field<Type>::cmptType>> cmptMin(const tmp<Field<Type>>& tf)
{
typedef typename Field<Type>::cmptType cmptType;
tmp<Field<cmptType>> tRes = reuseTmp<cmptType, Type>::New(tf);
cmptMin(tRes(), tf());
cmptMin(tRes.ref(), tf());
reuseTmp<cmptType, Type>::clear(tf);
return tRes;
}
......@@ -258,7 +258,7 @@ tmp<Field<typename Field<Type>::cmptType>> cmptAv(const UList<Type>& f)
{
typedef typename Field<Type>::cmptType cmptType;
tmp<Field<cmptType>> tRes(new Field<cmptType>(f.size()));
cmptAv(tRes(), f);
cmptAv(tRes.ref(), f);
return tRes;
}
......@@ -267,7 +267,7 @@ tmp<Field<typename Field<Type>::cmptType>> cmptAv(const tmp<Field<Type>>& tf)
{
typedef typename Field<Type>::cmptType cmptType;
tmp<Field<cmptType>> tRes = reuseTmp<cmptType, Type>::New(tf);
cmptAv(tRes(), tf());
cmptAv(tRes.ref(), tf());
reuseTmp<cmptType, Type>::clear(tf);
return tRes;
}
......@@ -283,7 +283,7 @@ template<class Type>
tmp<Field<Type>> cmptMag(const UList<Type>& f)
{
tmp<Field<Type>> tRes(new Field<Type>(f.size()));
cmptMag(tRes(), f);
cmptMag(tRes.ref(), f);
return tRes;
}
......@@ -291,7 +291,7 @@ template<class Type>
tmp<Field<Type>> cmptMag(const tmp<Field<Type>>& tf)
{
tmp<Field<Type>> tRes = reuseTmp<Type, Type>::New(tf);
cmptMag(tRes(), tf());
cmptMag(tRes.ref(), tf());
reuseTmp<Type, Type>::clear(tf);
return tRes;
}
......@@ -653,7 +653,7 @@ operator Op(const UList<Type1>& f1, const UList<Type2>& f2) \
{ \
typedef typename product<Type1, Type2>::type productType; \
tmp<Field<productType>> tRes(new Field<productType>(f1.size())); \
OpFunc(tRes(), f1, f2); \
OpFunc(tRes.ref(), f1, f2); \
return tRes; \
} \
\
......@@ -663,7 +663,7 @@ operator Op(const UList<Type1>& f1, const tmp<Field<Type2>>& tf2) \
{ \
typedef typename product<Type1, Type2>::type productType; \
tmp<Field<productType>> tRes = reuseTmp<productType, Type2>::New(tf2); \
OpFunc(tRes(), f1, tf2()); \
OpFunc(tRes.ref(), f1, tf2()); \
reuseTmp<productType, Type2>::clear(tf2); \
return tRes; \
} \
......@@ -674,7 +674,7 @@ operator Op(const tmp<Field<Type1>>& tf1, const UList<Type2>& f2) \
{ \
typedef typename product<Type1, Type2>::type productType; \
tmp<Field<productType>> tRes = reuseTmp<productType, Type1>::New(tf1); \
OpFunc(tRes(), tf1(), f2); \
OpFunc(tRes.ref(), tf1(), f2); \
reuseTmp<productType, Type1>::clear(tf1); \
return tRes; \
} \
......@@ -686,7 +686,7 @@ operator Op(const tmp<Field<Type1>>& tf1, const tmp<Field<Type2>>& tf2) \
typedef typename product<Type1, Type2>::type productType; \
tmp<Field<productType>> tRes = \
reuseTmpTmp<productType, Type1, Type1, Type2>::New(tf1, tf2); \
OpFunc(tRes(), tf1(), tf2()); \
OpFunc(tRes.ref(), tf1(), tf2()); \
reuseTmpTmp<productType, Type1, Type1, Type2>::clear(tf1, tf2); \
return tRes; \
} \
......@@ -701,7 +701,7 @@ void OpFunc \
{ \
typedef typename product<Type, Form>::type productType; \
TFOR_ALL_F_OP_F_OP_S \
(productType, res, =,Type, f1, Op, Form, static_cast<const Form&>(vs))\
(productType, res, =,Type, f1, Op, Form, static_cast<const Form&>(vs)) \
} \
\
template<class Type, class Form, class Cmpt, int nCmpt> \
......@@ -710,7 +710,7 @@ operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs) \
{ \
typedef typename product<Type, Form>::type productType; \
tmp<Field<productType>> tRes(new Field<productType>(f1.size())); \
OpFunc(tRes(), f1, static_cast<const Form&>(vs)); \
OpFunc(tRes.ref(), f1, static_cast<const Form&>(vs)); \
return tRes; \
} \
\
......@@ -724,7 +724,7 @@ operator Op \
{ \
typedef typename product<Type, Form>::type productType; \
tmp<Field<productType>> tRes = reuseTmp<productType, Type>::New(tf1); \
OpFunc(tRes(), tf1(), static_cast<const Form&>(vs)); \
OpFunc(tRes.ref(), tf1(), static_cast<const Form&>(vs)); \
reuseTmp<productType, Type>::clear(tf1); \
return tRes; \
} \
......@@ -739,7 +739,7 @@ void OpFunc \
{ \
typedef typename product<Form, Type>::type productType; \
TFOR_ALL_F_OP_S_OP_F \
(productType, res, =,Form,static_cast<const Form&>(vs), Op, Type, f1) \
(productType, res, =,Form,static_cast<const Form&>(vs), Op, Type, f1) \
} \
\
template<class Form, class Cmpt, int nCmpt, class Type> \
......@@ -748,7 +748,7 @@ operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1) \
{ \
typedef typename product<Form, Type>::type productType; \
tmp<Field<productType>> tRes(new Field<productType>(f1.size())); \
OpFunc(tRes(), static_cast<const Form&>(vs), f1); \
OpFunc(tRes.ref(), static_cast<const Form&>(vs), f1); \
return tRes; \
} \
\
......@@ -761,7 +761,7 @@ operator Op \
{ \
typedef typename product<Form, Type>::type productType; \
tmp<Field<productType>> tRes = reuseTmp<productType, Type>::New(tf1); \
OpFunc(tRes(), static_cast<const Form&>(vs), tf1()); \
OpFunc(tRes.ref(), static_cast<const Form&>(vs), tf1()); \
reuseTmp<productType, Type>::clear(tf1); \
return tRes; \
}
......
......@@ -40,7 +40,7 @@ TEMPLATE \
tmp<Field<ReturnType>> Func(const UList<Type>& f) \
{ \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f.size())); \
Func(tRes(), f); \
Func(tRes.ref(), f); \
return tRes; \
} \
\
......@@ -48,7 +48,7 @@ TEMPLATE \
tmp<Field<ReturnType>> Func(const tmp<Field<Type>>& tf) \
{ \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type>::New(tf); \
Func(tRes(), tf()); \
Func(tRes.ref(), tf()); \
reuseTmp<ReturnType, Type>::clear(tf); \
return tRes; \
}
......@@ -68,7 +68,7 @@ TEMPLATE \
tmp<Field<ReturnType>> operator Op(const UList<Type>& f) \
{ \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f.size())); \
OpFunc(tRes(), f); \
OpFunc(tRes.ref(), f); \
return tRes; \
} \
\
......@@ -76,7 +76,7 @@ TEMPLATE \
tmp<Field<ReturnType>> operator Op(const tmp<Field<Type>>& tf) \
{ \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type>::New(tf); \
OpFunc(tRes(), tf()); \
OpFunc(tRes.ref(), tf()); \
reuseTmp<ReturnType, Type>::clear(tf); \
return tRes; \
}
......@@ -108,7 +108,7 @@ tmp<Field<ReturnType>> Func \
) \
{ \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f1.size())); \
Func(tRes(), f1, f2); \
Func(tRes.ref(), f1, f2); \
return tRes; \
} \
\
......@@ -120,7 +120,7 @@ tmp<Field<ReturnType>> Func \
) \
{ \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type2>::New(tf2); \
Func(tRes(), f1, tf2()); \
Func(tRes.ref(), f1, tf2()); \
reuseTmp<ReturnType, Type2>::clear(tf2); \
return tRes; \
} \
......@@ -133,7 +133,7 @@ tmp<Field<ReturnType>> Func \
) \
{ \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type1>::New(tf1); \
Func(tRes(), tf1(), f2); \
Func(tRes.ref(), tf1(), f2); \
reuseTmp<ReturnType, Type1>::clear(tf1); \
return tRes; \
} \
......@@ -147,7 +147,7 @@ tmp<Field<ReturnType>> Func \
{ \
tmp<Field<ReturnType>> tRes = \
reuseTmpTmp<ReturnType, Type1, Type1, Type2>::New(tf1, tf2); \
Func(tRes(), tf1(), tf2()); \
Func(tRes.ref(), tf1(), tf2()); \
reuseTmpTmp<ReturnType, Type1, Type1, Type2>::clear(tf1, tf2); \
return tRes; \
}
......@@ -179,7 +179,7 @@ tmp<Field<ReturnType>> Func \
) \
{ \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f2.size())); \
Func(tRes(), s1, f2); \
Func(tRes.ref(), s1, f2); \
return tRes; \
} \
\
......@@ -191,7 +191,7 @@ tmp<Field<ReturnType>> Func \
) \
{ \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type2>::New(tf2); \
Func(tRes(), s1, tf2()); \
Func(tRes.ref(), s1, tf2()); \
reuseTmp<ReturnType, Type2>::clear(tf2); \
return tRes; \
}
......@@ -221,7 +221,7 @@ tmp<Field<ReturnType>> Func \
) \
{ \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f1.size())); \
Func(tRes(), f1, s2); \
Func(tRes.ref(), f1, s2); \
return tRes; \
} \
\
......@@ -233,7 +233,7 @@ tmp<Field<ReturnType>> Func \
) \
{ \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type1>::New(tf1); \
Func(tRes(), tf1(), s2); \
Func(tRes.ref(), tf1(), s2); \
reuseTmp<ReturnType, Type1>::clear(tf1); \
return tRes; \
}
......@@ -267,7 +267,7 @@ tmp<Field<ReturnType>> operator Op \
) \
{ \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f1.size())); \
OpFunc(tRes(), f1, f2); \
OpFunc(tRes.ref(), f1, f2); \
return tRes; \
} \
\
......@@ -279,7 +279,7 @@ tmp<Field<ReturnType>> operator Op \
) \
{ \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type2>::New(tf2); \
OpFunc(tRes(), f1, tf2()); \
OpFunc(tRes.ref(), f1, tf2()); \
reuseTmp<ReturnType, Type2>::clear(tf2); \
return tRes; \
} \
......@@ -292,7 +292,7 @@ tmp<Field<ReturnType>> operator Op \
) \
{ \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type1>::New(tf1); \
OpFunc(tRes(), tf1(), f2); \
OpFunc(tRes.ref(), tf1(), f2); \
reuseTmp<ReturnType, Type1>::clear(tf1); \
return tRes; \
} \
......@@ -306,7 +306,7 @@ tmp<Field<ReturnType>> operator Op \
{ \
tmp<Field<ReturnType>> tRes = \
reuseTmpTmp<ReturnType, Type1, Type1, Type2>::New(tf1, tf2); \
OpFunc(tRes(), tf1(), tf2()); \
OpFunc(tRes.ref(), tf1(), tf2()); \
reuseTmpTmp<ReturnType, Type1, Type1, Type2>::clear(tf1, tf2); \
return tRes; \
}
......@@ -335,7 +335,7 @@ tmp<Field<ReturnType>> operator Op \
) \
{ \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f2.size())); \
OpFunc(tRes(), s1, f2); \
OpFunc(tRes.ref(), s1, f2); \
return tRes; \
} \
\
......@@ -347,7 +347,7 @@ tmp<Field<ReturnType>> operator Op \
) \
{ \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type2>::New(tf2); \
OpFunc(tRes(), s1, tf2()); \
OpFunc(tRes.ref(), s1, tf2()); \
reuseTmp<ReturnType, Type2>::clear(tf2); \
return tRes; \
}
......@@ -374,7 +374,7 @@ tmp<Field<ReturnType>> operator Op \
) \
{ \
tmp<Field<ReturnType>> tRes(new Field<ReturnType>(f1.size())); \
OpFunc(tRes(), f1, s2); \
OpFunc(tRes.ref(), f1, s2); \
return tRes; \
} \
\
......@@ -386,7 +386,7 @@ tmp<Field<ReturnType>> operator Op \
) \
{ \
tmp<Field<ReturnType>> tRes = reuseTmp<ReturnType, Type1>::New(tf1); \
OpFunc(tRes(), tf1(), s2); \
OpFunc(tRes.ref(), tf1(), s2); \
reuseTmp<ReturnType, Type1>::clear(tf1); \
return tRes; \
}
......
......@@ -71,7 +71,7 @@ public:
if (initRet)
{
rtf() = tf1();
rtf.ref() = tf1();
}
return rtf;
......
......@@ -74,14 +74,14 @@ void stabilise(scalarField& res, const UList<scalar>& sf, const scalar s)
tmp<scalarField> stabilise(const UList<scalar>& sf, const scalar s)
{
tmp<scalarField> tRes(new scalarField(sf.size()));
stabilise(tRes(), sf, s);
stabilise(tRes.ref(), sf, s);
return tRes;
}
tmp<scalarField> stabilise(const tmp<scalarField>& tsf, const scalar s)
{
tmp<scalarField> tRes = reuseTmp<scalar, scalar>::New(tsf);
stabilise(tRes(), tsf(), s);
stabilise(tRes.ref(), tsf(), s);
reuseTmp<scalar, scalar>::clear(tsf);
return tRes;
}
......@@ -173,14 +173,14 @@ void func(scalarField& res, const int n, const UList<scalar>& sf) \
tmp<scalarField> func(const int n, const UList<scalar>& sf) \
{ \
tmp<scalarField> tRes(new scalarField(sf.size())); \
func(tRes(), n, sf); \
func(tRes.ref(), n, sf); \
return tRes; \
} \
\
tmp<scalarField> func(const int n, const tmp<scalarField>& tsf) \
{ \
tmp<scalarField> tRes = reuseTmp<scalar, scalar>::New(tsf); \
func(tRes(), n, tsf()); \
func(tRes.ref(), n, tsf()); \
reuseTmp<scalar, scalar>::clear(tsf); \
return tRes; \
}
......
......@@ -108,14 +108,14 @@ void inv(Field<symmTensor>& tf, const UList<symmTensor>& tf1)
tmp<symmTensorField> inv(const UList<symmTensor>& tf)
{
tmp<symmTensorField> result(new symmTensorField(tf.size()));
inv(result(), tf);
inv(result.ref(), tf);
return result;
}
tmp<symmTensorField> inv(const tmp<symmTensorField>& tf)
{
tmp<symmTensorField> tRes = reuseTmp<symmTensor, symmTensor>::New(tf);
inv(tRes(), tf());
inv(tRes.ref(), tf());
reuseTmp<symmTensor, symmTensor>::clear(tf);
return tRes;
}
......
......@@ -63,7 +63,7 @@ tmp<Field<Type>> transform
)
{
tmp<Field<Type>> tranf(new Field<Type> (tf.size()));
transform(tranf(), trf, tf);
transform(tranf.ref(), trf, tf);
return tranf;
}
......@@ -76,7 +76,7 @@ tmp<Field<Type>> transform
)
{
tmp<Field<Type>> tranf = reuseTmp<Type, Type>::New(ttf);
transform(tranf(), trf, ttf());
transform(tranf.ref(), trf, ttf());
reuseTmp<Type, Type>::clear(ttf);
return tranf;
}
......@@ -90,7 +90,7 @@ tmp<Field<Type>> transform
)
{
tmp<Field<Type>> tranf(new Field<Type> (tf.size()));
transform(tranf(), ttrf(), tf);
transform(tranf.ref(), ttrf(), tf);
ttrf.clear();
return tranf;
}
......@@ -104,7 +104,7 @@ tmp<Field<Type>> transform
)
{
tmp<Field<Type>> tranf = reuseTmp<Type, Type>::New(ttf);
transform(tranf(), ttrf(), ttf());
transform(tranf.ref(), ttrf(), ttf());
reuseTmp<Type, Type>::clear(ttf);
ttrf.clear();
return tranf;
......@@ -131,7 +131,7 @@ tmp<Field<Type>> transform
)
{
tmp<Field<Type>> tranf(new Field<Type>(tf.size()));
transform(tranf(), t, tf);
transform(tranf.ref(), t, tf);
return tranf;
}
......@@ -144,7 +144,7 @@ tmp<Field<Type>> transform
)
{
tmp<Field<Type>> tranf = reuseTmp<Type, Type>::New(ttf);
transform(tranf(), t, ttf());
transform(tranf.ref(), t, ttf());
reuseTmp<Type, Type>::clear(ttf);
return tranf;
}
......
......@@ -106,14 +106,14 @@ void inv(Field<tensor>& tf, const UList<tensor>& tf1)
tmp<tensorField> inv(const UList<tensor>& tf)
{
tmp<tensorField> result(new tensorField(tf.size()));
inv(result(), tf);
inv(result.ref(), tf);
return result;
}
tmp<tensorField> inv(const tmp<tensorField>& tf)
{
tmp<tensorField> tRes = reuseTmp<tensor, tensor>::New(tf);
inv(tRes(), tf());
inv(tRes.ref(), tf());
reuseTmp<tensor, tensor>::clear(tf);
return tRes;
}
......@@ -132,7 +132,7 @@ tmp<Field<tensor>> transformFieldMask<tensor>
)
{
tmp<tensorField> tRes(new tensorField(stf.size()));
tensorField& res = tRes();
tensorField& res = tRes.ref();
TFOR_ALL_F_OP_F(tensor, res, =, symmTensor, stf)
return tRes;
}
......
......@@ -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
......@@ -48,7 +48,7 @@ Foam::tmp<Foam::vectorField> Foam::transform
)
{
tmp<vectorField > tranf(new vectorField(tf.size()));
transform(tranf(), q, tf);
transform(tranf.ref(), q, tf);
return tranf;
}
......@@ -60,7 +60,7 @@ Foam::tmp<Foam::vectorField> Foam::transform
)
{
tmp<vectorField > tranf = reuseTmp<vector, vector>::New(ttf);
transform(tranf(), q, ttf());
transform(tranf.ref(), q, ttf());
reuseTmp<vector, vector>::clear(ttf);
return tranf;
}
......@@ -106,7 +106,7 @@ Foam::tmp<Foam::vectorField> Foam::transform
)
{
tmp<vectorField > tranf(new vectorField(tf.size()));