STYLE: modernize code for GeometricFieldFunctions (#1160)

- use forwarding tmp factory methods, auto types
This commit is contained in:
Mark Olesen
2019-01-10 17:06:04 +01:00
parent b002a232d6
commit 7e48f2c6b3
4 changed files with 234 additions and 294 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -1021,25 +1021,22 @@ template<class Type, template<class> class PatchField, class GeoMesh>
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>> Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
Foam::GeometricField<Type, PatchField, GeoMesh>::T() const Foam::GeometricField<Type, PatchField, GeoMesh>::T() const
{ {
tmp<GeometricField<Type, PatchField, GeoMesh>> result auto tresult = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
( (
new GeometricField<Type, PatchField, GeoMesh> IOobject
( (
IOobject this->name() + ".T()",
( this->instance(),
this->name() + ".T()", this->db()
this->instance(), ),
this->db() this->mesh(),
), this->dimensions()
this->mesh(),
this->dimensions()
)
); );
Foam::T(result.ref().primitiveFieldRef(), primitiveField()); Foam::T(tresult.ref().primitiveFieldRef(), primitiveField());
Foam::T(result.ref().boundaryFieldRef(), boundaryField()); Foam::T(tresult.ref().boundaryFieldRef(), boundaryField());
return result; return tresult;
} }
@ -1058,25 +1055,22 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::component
const direction d const direction d
) const ) const
{ {
tmp<GeometricField<cmptType, PatchField, GeoMesh>> Component auto tresult = tmp<GeometricField<cmptType, PatchField, GeoMesh>>::New
( (
new GeometricField<cmptType, PatchField, GeoMesh> IOobject
( (
IOobject this->name() + ".component(" + Foam::name(d) + ')',
( this->instance(),
this->name() + ".component(" + Foam::name(d) + ')', this->db()
this->instance(), ),
this->db() this->mesh(),
), this->dimensions()
this->mesh(),
this->dimensions()
)
); );
Foam::component(Component.ref().primitiveFieldRef(), primitiveField(), d); Foam::component(tresult.ref().primitiveFieldRef(), primitiveField(), d);
Foam::component(Component.ref().boundaryFieldRef(), boundaryField(), d); Foam::component(tresult.ref().boundaryFieldRef(), boundaryField(), d);
return Component; return tresult;
} }

View File

@ -103,9 +103,8 @@ pow
{ {
typedef typename powProduct<Type, r>::type powProductType; typedef typename powProduct<Type, r>::type powProductType;
tmp<GeometricField<powProductType, PatchField, GeoMesh>> tPow auto tres =
( tmp<GeometricField<powProductType, PatchField, GeoMesh>>::New
new GeometricField<powProductType, PatchField, GeoMesh>
( (
IOobject IOobject
( (
@ -117,12 +116,11 @@ pow
), ),
gf.mesh(), gf.mesh(),
pow(gf.dimensions(), r) pow(gf.dimensions(), r)
) );
);
pow<Type, r, PatchField, GeoMesh>(tPow.ref(), gf); pow<Type, r, PatchField, GeoMesh>(tres.ref(), gf);
return tPow; return tres;
} }
@ -144,9 +142,8 @@ pow
const GeometricField<Type, PatchField, GeoMesh>& gf = tgf(); const GeometricField<Type, PatchField, GeoMesh>& gf = tgf();
tmp<GeometricField<powProductType, PatchField, GeoMesh>> tPow auto tres =
( tmp<GeometricField<powProductType, PatchField, GeoMesh>>::New
new GeometricField<powProductType, PatchField, GeoMesh>
( (
IOobject IOobject
( (
@ -158,14 +155,12 @@ pow
), ),
gf.mesh(), gf.mesh(),
pow(gf.dimensions(), r) pow(gf.dimensions(), r)
) );
);
pow<Type, r, PatchField, GeoMesh>(tPow.ref(), gf); pow<Type, r, PatchField, GeoMesh>(tres.ref(), gf);
tgf.clear(); tgf.clear();
return tres;
return tPow;
} }
@ -197,9 +192,8 @@ sqr(const GeometricField<Type, PatchField, GeoMesh>& gf)
{ {
typedef typename outerProduct<Type, Type>::type outerProductType; typedef typename outerProduct<Type, Type>::type outerProductType;
tmp<GeometricField<outerProductType, PatchField, GeoMesh>> tSqr auto tres =
( tmp<GeometricField<outerProductType, PatchField, GeoMesh>>::New
new GeometricField<outerProductType, PatchField, GeoMesh>
( (
IOobject IOobject
( (
@ -211,12 +205,11 @@ sqr(const GeometricField<Type, PatchField, GeoMesh>& gf)
), ),
gf.mesh(), gf.mesh(),
sqr(gf.dimensions()) sqr(gf.dimensions())
) );
);
sqr(tSqr.ref(), gf); sqr(tres.ref(), gf);
return tSqr; return tres;
} }
@ -236,9 +229,8 @@ sqr(const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf)
const GeometricField<Type, PatchField, GeoMesh>& gf = tgf(); const GeometricField<Type, PatchField, GeoMesh>& gf = tgf();
tmp<GeometricField<outerProductType, PatchField, GeoMesh>> tSqr auto tres =
( tmp<GeometricField<outerProductType, PatchField, GeoMesh>>::New
new GeometricField<outerProductType, PatchField, GeoMesh>
( (
IOobject IOobject
( (
@ -250,14 +242,13 @@ sqr(const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf)
), ),
gf.mesh(), gf.mesh(),
sqr(gf.dimensions()) sqr(gf.dimensions())
) );
);
sqr(tSqr.ref(), gf); sqr(tres.ref(), gf);
tgf.clear(); tgf.clear();
return tSqr; return tres;
} }
@ -280,9 +271,8 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> magSqr
const GeometricField<Type, PatchField, GeoMesh>& gf const GeometricField<Type, PatchField, GeoMesh>& gf
) )
{ {
tmp<GeometricField<scalar, PatchField, GeoMesh>> tMagSqr auto tres =
( tmp<GeometricField<scalar, PatchField, GeoMesh>>::New
new GeometricField<scalar, PatchField, GeoMesh>
( (
IOobject IOobject
( (
@ -294,12 +284,11 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> magSqr
), ),
gf.mesh(), gf.mesh(),
sqr(gf.dimensions()) sqr(gf.dimensions())
) );
);
magSqr(tMagSqr.ref(), gf); magSqr(tres.ref(), gf);
return tMagSqr; return tres;
} }
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
@ -310,9 +299,8 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> magSqr
{ {
const GeometricField<Type, PatchField, GeoMesh>& gf = tgf(); const GeometricField<Type, PatchField, GeoMesh>& gf = tgf();
tmp<GeometricField<scalar, PatchField, GeoMesh>> tMagSqr auto tres =
( tmp<GeometricField<scalar, PatchField, GeoMesh>>::New
new GeometricField<scalar, PatchField, GeoMesh>
( (
IOobject IOobject
( (
@ -324,14 +312,13 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> magSqr
), ),
gf.mesh(), gf.mesh(),
sqr(gf.dimensions()) sqr(gf.dimensions())
) );
);
magSqr(tMagSqr.ref(), gf); magSqr(tres.ref(), gf);
tgf.clear(); tgf.clear();
return tMagSqr; return tres;
} }
@ -354,9 +341,8 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> mag
const GeometricField<Type, PatchField, GeoMesh>& gf const GeometricField<Type, PatchField, GeoMesh>& gf
) )
{ {
tmp<GeometricField<scalar, PatchField, GeoMesh>> tMag auto tres =
( tmp<GeometricField<scalar, PatchField, GeoMesh>>::New
new GeometricField<scalar, PatchField, GeoMesh>
( (
IOobject IOobject
( (
@ -368,12 +354,11 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> mag
), ),
gf.mesh(), gf.mesh(),
gf.dimensions() gf.dimensions()
) );
);
mag(tMag.ref(), gf); mag(tres.ref(), gf);
return tMag; return tres;
} }
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
@ -384,9 +369,8 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> mag
{ {
const GeometricField<Type, PatchField, GeoMesh>& gf = tgf(); const GeometricField<Type, PatchField, GeoMesh>& gf = tgf();
tmp<GeometricField<scalar, PatchField, GeoMesh>> tMag auto tres =
( tmp<GeometricField<scalar, PatchField, GeoMesh>>::New
new GeometricField<scalar, PatchField, GeoMesh>
( (
IOobject IOobject
( (
@ -398,14 +382,13 @@ tmp<GeometricField<scalar, PatchField, GeoMesh>> mag
), ),
gf.mesh(), gf.mesh(),
gf.dimensions() gf.dimensions()
) );
);
mag(tMag.ref(), gf); mag(tres.ref(), gf);
tgf.clear(); tgf.clear();
return tMag; return tres;
} }
@ -441,9 +424,8 @@ cmptAv(const GeometricField<Type, PatchField, GeoMesh>& gf)
typedef typename GeometricField<Type, PatchField, GeoMesh>::cmptType typedef typename GeometricField<Type, PatchField, GeoMesh>::cmptType
cmptType; cmptType;
tmp<GeometricField<cmptType, PatchField, GeoMesh>> CmptAv auto tres =
( tmp<GeometricField<cmptType, PatchField, GeoMesh>>::New
new GeometricField<scalar, PatchField, GeoMesh>
( (
IOobject IOobject
( (
@ -455,12 +437,11 @@ cmptAv(const GeometricField<Type, PatchField, GeoMesh>& gf)
), ),
gf.mesh(), gf.mesh(),
gf.dimensions() gf.dimensions()
) );
);
cmptAv(CmptAv.ref(), gf); cmptAv(tres.ref(), gf);
return CmptAv; return tres;
} }
@ -481,9 +462,8 @@ cmptAv(const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf)
const GeometricField<Type, PatchField, GeoMesh>& gf = tgf(); const GeometricField<Type, PatchField, GeoMesh>& gf = tgf();
tmp<GeometricField<cmptType, PatchField, GeoMesh>> CmptAv auto tres =
( tmp<GeometricField<cmptType, PatchField, GeoMesh>>::New
new GeometricField<scalar, PatchField, GeoMesh>
( (
IOobject IOobject
( (
@ -495,14 +475,13 @@ cmptAv(const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf)
), ),
gf.mesh(), gf.mesh(),
gf.dimensions() gf.dimensions()
) );
);
cmptAv(CmptAv.ref(), gf); cmptAv(tres.ref(), gf);
tgf.clear(); tgf.clear();
return CmptAv; return tres;
} }
@ -649,9 +628,9 @@ operator op \
) \ ) \
{ \ { \
typedef typename product<Type1, Type2>::type productType; \ typedef typename product<Type1, Type2>::type productType; \
tmp<GeometricField<productType, PatchField, GeoMesh>> tRes \ \
( \ auto tres = \
new GeometricField<productType, PatchField, GeoMesh> \ tmp<GeometricField<productType, PatchField, GeoMesh>>::New \
( \ ( \
IOobject \ IOobject \
( \ ( \
@ -663,14 +642,14 @@ operator op \
), \ ), \
gf1.mesh(), \ gf1.mesh(), \
gf1.dimensions() op gf2.dimensions() \ gf1.dimensions() op gf2.dimensions() \
) \ ); \
); \
\ \
Foam::opFunc(tRes.ref(), gf1, gf2); \ Foam::opFunc(tres.ref(), gf1, gf2); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
template \ template \
<class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
tmp \ tmp \
@ -687,7 +666,7 @@ operator op \
\ \
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \ const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
\ \
tmp<GeometricField<productType, PatchField, GeoMesh>> tRes = \ auto tres = \
reuseTmpGeometricField<productType, Type2, PatchField, GeoMesh>::New \ reuseTmpGeometricField<productType, Type2, PatchField, GeoMesh>::New \
( \ ( \
tgf2, \ tgf2, \
@ -695,11 +674,11 @@ operator op \
gf1.dimensions() op gf2.dimensions() \ gf1.dimensions() op gf2.dimensions() \
); \ ); \
\ \
Foam::opFunc(tRes.ref(), gf1, gf2); \ Foam::opFunc(tres.ref(), gf1, gf2); \
\ \
tgf2.clear(); \ tgf2.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
template \ template \
@ -718,7 +697,7 @@ operator op \
\ \
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \ const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
\ \
tmp<GeometricField<productType, PatchField, GeoMesh>> tRes = \ auto tres = \
reuseTmpGeometricField<productType, Type1, PatchField, GeoMesh>::New \ reuseTmpGeometricField<productType, Type1, PatchField, GeoMesh>::New \
( \ ( \
tgf1, \ tgf1, \
@ -726,11 +705,11 @@ operator op \
gf1.dimensions() op gf2.dimensions() \ gf1.dimensions() op gf2.dimensions() \
); \ ); \
\ \
Foam::opFunc(tRes.ref(), gf1, gf2); \ Foam::opFunc(tres.ref(), gf1, gf2); \
\ \
tgf1.clear(); \ tgf1.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
template \ template \
@ -750,7 +729,7 @@ operator op \
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \ const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \ const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
\ \
tmp<GeometricField<productType, PatchField, GeoMesh>> tRes = \ auto tres = \
reuseTmpTmpGeometricField \ reuseTmpTmpGeometricField \
<productType, Type1, Type1, Type2, PatchField, GeoMesh>::New \ <productType, Type1, Type1, Type2, PatchField, GeoMesh>::New \
( \ ( \
@ -760,12 +739,12 @@ operator op \
gf1.dimensions() op gf2.dimensions() \ gf1.dimensions() op gf2.dimensions() \
); \ ); \
\ \
Foam::opFunc(tRes.ref(), gf1, gf2); \ Foam::opFunc(tres.ref(), gf1, gf2); \
\ \
tgf1.clear(); \ tgf1.clear(); \
tgf2.clear(); \ tgf2.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
template \ template \
@ -794,9 +773,8 @@ operator op \
{ \ { \
typedef typename product<Type, Form>::type productType; \ typedef typename product<Type, Form>::type productType; \
\ \
tmp<GeometricField<productType, PatchField, GeoMesh>> tRes \ auto tres = \
( \ tmp<GeometricField<productType, PatchField, GeoMesh>>::New \
new GeometricField<productType, PatchField, GeoMesh> \
( \ ( \
IOobject \ IOobject \
( \ ( \
@ -808,12 +786,11 @@ operator op \
), \ ), \
gf1.mesh(), \ gf1.mesh(), \
gf1.dimensions() op dvs.dimensions() \ gf1.dimensions() op dvs.dimensions() \
) \ ); \
); \
\ \
Foam::opFunc(tRes.ref(), gf1, dvs); \ Foam::opFunc(tres.ref(), gf1, dvs); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
template \ template \
@ -848,7 +825,7 @@ operator op \
\ \
const GeometricField<Type, PatchField, GeoMesh>& gf1 = tgf1(); \ const GeometricField<Type, PatchField, GeoMesh>& gf1 = tgf1(); \
\ \
tmp<GeometricField<productType, PatchField, GeoMesh>> tRes = \ auto tres = \
reuseTmpGeometricField<productType, Type, PatchField, GeoMesh>::New \ reuseTmpGeometricField<productType, Type, PatchField, GeoMesh>::New \
( \ ( \
tgf1, \ tgf1, \
@ -856,11 +833,11 @@ operator op \
gf1.dimensions() op dvs.dimensions() \ gf1.dimensions() op dvs.dimensions() \
); \ ); \
\ \
Foam::opFunc(tRes.ref(), gf1, dvs); \ Foam::opFunc(tres.ref(), gf1, dvs); \
\ \
tgf1.clear(); \ tgf1.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
template \ template \
@ -907,9 +884,9 @@ operator op \
) \ ) \
{ \ { \
typedef typename product<Form, Type>::type productType; \ typedef typename product<Form, Type>::type productType; \
tmp<GeometricField<productType, PatchField, GeoMesh>> tRes \ \
( \ auto tres = \
new GeometricField<productType, PatchField, GeoMesh> \ tmp<GeometricField<productType, PatchField, GeoMesh>>::New \
( \ ( \
IOobject \ IOobject \
( \ ( \
@ -921,12 +898,11 @@ operator op \
), \ ), \
gf1.mesh(), \ gf1.mesh(), \
dvs.dimensions() op gf1.dimensions() \ dvs.dimensions() op gf1.dimensions() \
) \ ); \
); \
\ \
Foam::opFunc(tRes.ref(), dvs, gf1); \ Foam::opFunc(tres.ref(), dvs, gf1); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
template \ template \
@ -960,7 +936,7 @@ operator op \
\ \
const GeometricField<Type, PatchField, GeoMesh>& gf1 = tgf1(); \ const GeometricField<Type, PatchField, GeoMesh>& gf1 = tgf1(); \
\ \
tmp<GeometricField<productType, PatchField, GeoMesh>> tRes = \ auto tres = \
reuseTmpGeometricField<productType, Type, PatchField, GeoMesh>::New \ reuseTmpGeometricField<productType, Type, PatchField, GeoMesh>::New \
( \ ( \
tgf1, \ tgf1, \
@ -968,11 +944,11 @@ operator op \
dvs.dimensions() op gf1.dimensions() \ dvs.dimensions() op gf1.dimensions() \
); \ ); \
\ \
Foam::opFunc(tRes.ref(), dvs, gf1); \ Foam::opFunc(tres.ref(), dvs, gf1); \
\ \
tgf1.clear(); \ tgf1.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
template \ template \

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2019 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -46,15 +46,15 @@ void Func \
res.oriented() = gf1.oriented(); \ res.oriented() = gf1.oriented(); \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
( \ ( \
const GeometricField<Type1, PatchField, GeoMesh>& gf1 \ const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
) \ ) \
{ \ { \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>>::New \
new GeometricField<ReturnType, PatchField, GeoMesh> \
( \ ( \
IOobject \ IOobject \
( \ ( \
@ -66,14 +66,14 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
), \ ), \
gf1.mesh(), \ gf1.mesh(), \
Dfunc(gf1.dimensions()) \ Dfunc(gf1.dimensions()) \
) \ ); \
); \
\ \
Foam::Func(tRes.ref(), gf1); \ Foam::Func(tres.ref(), gf1); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
( \ ( \
@ -82,21 +82,19 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
{ \ { \
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \ const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
\ \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \ reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
( \ ( \
tgf1, \ tgf1, \
#Func "(" + gf1.name() + ')', \ #Func "(" + gf1.name() + ')', \
Dfunc(gf1.dimensions()) \ Dfunc(gf1.dimensions()) \
) \ ); \
); \
\ \
Foam::Func(tRes.ref(), gf1); \ Foam::Func(tres.ref(), gf1); \
\ \
tgf1.clear(); \ tgf1.clear(); \
\ \
return tRes; \ return tres; \
} }
@ -122,9 +120,8 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
const GeometricField<Type1, PatchField, GeoMesh>& gf1 \ const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
) \ ) \
{ \ { \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>>::New \
new GeometricField<ReturnType, PatchField, GeoMesh> \
( \ ( \
IOobject \ IOobject \
( \ ( \
@ -136,14 +133,14 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
), \ ), \
gf1.mesh(), \ gf1.mesh(), \
Dfunc(gf1.dimensions()) \ Dfunc(gf1.dimensions()) \
) \ ); \
); \
\ \
Foam::OpFunc(tRes.ref(), gf1); \ Foam::OpFunc(tres.ref(), gf1); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
( \ ( \
@ -152,21 +149,19 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
{ \ { \
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \ const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
\ \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \ reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
( \ ( \
tgf1, \ tgf1, \
#Op + gf1.name(), \ #Op + gf1.name(), \
Dfunc(gf1.dimensions()) \ Dfunc(gf1.dimensions()) \
) \ ); \
); \
\ \
Foam::OpFunc(tRes.ref(), gf1); \ Foam::OpFunc(tres.ref(), gf1); \
\ \
tgf1.clear(); \ tgf1.clear(); \
\ \
return tRes; \ return tres; \
} }
@ -197,6 +192,7 @@ void Func \
res.oriented() = Func(gf1.oriented(), gf2.oriented()); \ res.oriented() = Func(gf1.oriented(), gf2.oriented()); \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
( \ ( \
@ -204,9 +200,8 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \ const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
) \ ) \
{ \ { \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>>::New \
new GeometricField<ReturnType, PatchField, GeoMesh> \
( \ ( \
IOobject \ IOobject \
( \ ( \
@ -218,14 +213,14 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
), \ ), \
gf1.mesh(), \ gf1.mesh(), \
Func(gf1.dimensions(), gf2.dimensions()) \ Func(gf1.dimensions(), gf2.dimensions()) \
) \ ); \
); \
\ \
Foam::Func(tRes.ref(), gf1, gf2); \ Foam::Func(tres.ref(), gf1, gf2); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
( \ ( \
@ -235,23 +230,22 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
{ \ { \
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \ const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
\ \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \
reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \ reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
( \ ( \
tgf2, \ tgf2, \
#Func "(" + gf1.name() + ',' + gf2.name() + ')', \ #Func "(" + gf1.name() + ',' + gf2.name() + ')', \
Func(gf1.dimensions(), gf2.dimensions()) \ Func(gf1.dimensions(), gf2.dimensions()) \
) \ ); \
); \
\ \
Foam::Func(tRes.ref(), gf1, gf2); \ Foam::Func(tres.ref(), gf1, gf2); \
\ \
tgf2.clear(); \ tgf2.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
( \ ( \
@ -261,23 +255,22 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
{ \ { \
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \ const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
\ \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \ reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
( \ ( \
tgf1, \ tgf1, \
#Func "(" + gf1.name() + ',' + gf2.name() + ')', \ #Func "(" + gf1.name() + ',' + gf2.name() + ')', \
Func(gf1.dimensions(), gf2.dimensions()) \ Func(gf1.dimensions(), gf2.dimensions()) \
) \ ); \
); \
\ \
Foam::Func(tRes.ref(), gf1, gf2); \ Foam::Func(tres.ref(), gf1, gf2); \
\ \
tgf1.clear(); \ tgf1.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
( \ ( \
@ -288,8 +281,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \ const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \ const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
\ \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \
reuseTmpTmpGeometricField \ reuseTmpTmpGeometricField \
<ReturnType, Type1, Type1, Type2, PatchField, GeoMesh> \ <ReturnType, Type1, Type1, Type2, PatchField, GeoMesh> \
::New \ ::New \
@ -298,17 +290,17 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
tgf2, \ tgf2, \
#Func "(" + gf1.name() + ',' + gf2.name() + ')', \ #Func "(" + gf1.name() + ',' + gf2.name() + ')', \
Func(gf1.dimensions(), gf2.dimensions()) \ Func(gf1.dimensions(), gf2.dimensions()) \
) \ ); \
); \
\ \
Foam::Func(tRes.ref(), gf1, gf2); \ Foam::Func(tres.ref(), gf1, gf2); \
\ \
tgf1.clear(); \ tgf1.clear(); \
tgf2.clear(); \ tgf2.clear(); \
\ \
return tRes; \ return tres; \
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \ #define BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
@ -326,6 +318,7 @@ void Func \
res.oriented() = gf2.oriented(); \ res.oriented() = gf2.oriented(); \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
( \ ( \
@ -333,9 +326,8 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \ const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
) \ ) \
{ \ { \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>>::New \
new GeometricField<ReturnType, PatchField, GeoMesh> \
( \ ( \
IOobject \ IOobject \
( \ ( \
@ -347,14 +339,14 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
), \ ), \
gf2.mesh(), \ gf2.mesh(), \
Func(dt1.dimensions(), gf2.dimensions()) \ Func(dt1.dimensions(), gf2.dimensions()) \
) \ ); \
); \
\ \
Foam::Func(tRes.ref(), dt1, gf2); \ Foam::Func(tres.ref(), dt1, gf2); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
( \ ( \
@ -375,23 +367,22 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
{ \ { \
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \ const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
\ \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \
reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \ reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
( \ ( \
tgf2, \ tgf2, \
#Func "(" + dt1.name() + gf2.name() + ',' + ')', \ #Func "(" + dt1.name() + gf2.name() + ',' + ')', \
Func(dt1.dimensions(), gf2.dimensions()) \ Func(dt1.dimensions(), gf2.dimensions()) \
) \ ); \
); \
\ \
Foam::Func(tRes.ref(), dt1, gf2); \ Foam::Func(tres.ref(), dt1, gf2); \
\ \
tgf2.clear(); \ tgf2.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
( \ ( \
@ -418,6 +409,7 @@ void Func \
res.oriented() = gf1.oriented(); \ res.oriented() = gf1.oriented(); \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
( \ ( \
@ -425,9 +417,8 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
const dimensioned<Type2>& dt2 \ const dimensioned<Type2>& dt2 \
) \ ) \
{ \ { \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>>::New \
new GeometricField<ReturnType, PatchField, GeoMesh> \
( \ ( \
IOobject \ IOobject \
( \ ( \
@ -439,14 +430,14 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
), \ ), \
gf1.mesh(), \ gf1.mesh(), \
Func(gf1.dimensions(), dt2.dimensions()) \ Func(gf1.dimensions(), dt2.dimensions()) \
) \ ); \
); \
\ \
Foam::Func(tRes.ref(), gf1, dt2); \ Foam::Func(tres.ref(), gf1, dt2); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
( \ ( \
@ -467,23 +458,22 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
{ \ { \
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \ const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
\ \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \ reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
( \ ( \
tgf1, \ tgf1, \
#Func "(" + gf1.name() + ',' + dt2.name() + ')', \ #Func "(" + gf1.name() + ',' + dt2.name() + ')', \
Func(gf1.dimensions(), dt2.dimensions()) \ Func(gf1.dimensions(), dt2.dimensions()) \
) \ ); \
); \
\ \
Foam::Func(tRes.ref(), gf1, dt2); \ Foam::Func(tres.ref(), gf1, dt2); \
\ \
tgf1.clear(); \ tgf1.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
( \ ( \
@ -519,6 +509,7 @@ void OpFunc \
res.oriented() = gf1.oriented() Op gf2.oriented(); \ res.oriented() = gf1.oriented() Op gf2.oriented(); \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
( \ ( \
@ -526,9 +517,8 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \ const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
) \ ) \
{ \ { \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>>::New \
new GeometricField<ReturnType, PatchField, GeoMesh> \
( \ ( \
IOobject \ IOobject \
( \ ( \
@ -540,14 +530,14 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
), \ ), \
gf1.mesh(), \ gf1.mesh(), \
gf1.dimensions() Op gf2.dimensions() \ gf1.dimensions() Op gf2.dimensions() \
) \ ); \
); \
\ \
Foam::OpFunc(tRes.ref(), gf1, gf2); \ Foam::OpFunc(tres.ref(), gf1, gf2); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
( \ ( \
@ -557,23 +547,22 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
{ \ { \
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \ const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
\ \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \
reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \ reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
( \ ( \
tgf2, \ tgf2, \
'(' + gf1.name() + OpName + gf2.name() + ')', \ '(' + gf1.name() + OpName + gf2.name() + ')', \
gf1.dimensions() Op gf2.dimensions() \ gf1.dimensions() Op gf2.dimensions() \
) \ ); \
); \
\ \
Foam::OpFunc(tRes.ref(), gf1, gf2); \ Foam::OpFunc(tres.ref(), gf1, gf2); \
\ \
tgf2.clear(); \ tgf2.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
( \ ( \
@ -583,23 +572,22 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
{ \ { \
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \ const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
\ \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \ reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
( \ ( \
tgf1, \ tgf1, \
'(' + gf1.name() + OpName + gf2.name() + ')', \ '(' + gf1.name() + OpName + gf2.name() + ')', \
gf1.dimensions() Op gf2.dimensions() \ gf1.dimensions() Op gf2.dimensions() \
) \ ); \
); \
\ \
Foam::OpFunc(tRes.ref(), gf1, gf2); \ Foam::OpFunc(tres.ref(), gf1, gf2); \
\ \
tgf1.clear(); \ tgf1.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
( \ ( \
@ -610,8 +598,7 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \ const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \ const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
\ \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \
reuseTmpTmpGeometricField \ reuseTmpTmpGeometricField \
<ReturnType, Type1, Type1, Type2, PatchField, GeoMesh>::New \ <ReturnType, Type1, Type1, Type2, PatchField, GeoMesh>::New \
( \ ( \
@ -619,15 +606,14 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
tgf2, \ tgf2, \
'(' + gf1.name() + OpName + gf2.name() + ')', \ '(' + gf1.name() + OpName + gf2.name() + ')', \
gf1.dimensions() Op gf2.dimensions() \ gf1.dimensions() Op gf2.dimensions() \
) \ ); \
); \
\ \
Foam::OpFunc(tRes.ref(), gf1, gf2); \ Foam::OpFunc(tres.ref(), gf1, gf2); \
\ \
tgf1.clear(); \ tgf1.clear(); \
tgf2.clear(); \ tgf2.clear(); \
\ \
return tRes; \ return tres; \
} }
@ -656,9 +642,8 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \ const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
) \ ) \
{ \ { \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>>::New \
new GeometricField<ReturnType, PatchField, GeoMesh> \
( \ ( \
IOobject \ IOobject \
( \ ( \
@ -670,14 +655,14 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
), \ ), \
gf2.mesh(), \ gf2.mesh(), \
dt1.dimensions() Op gf2.dimensions() \ dt1.dimensions() Op gf2.dimensions() \
) \ ); \
); \
\ \
Foam::OpFunc(tRes.ref(), dt1, gf2); \ Foam::OpFunc(tres.ref(), dt1, gf2); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
( \ ( \
@ -698,23 +683,22 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
{ \ { \
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \ const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
\ \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \
reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \ reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
( \ ( \
tgf2, \ tgf2, \
'(' + dt1.name() + OpName + gf2.name() + ')', \ '(' + dt1.name() + OpName + gf2.name() + ')', \
dt1.dimensions() Op gf2.dimensions() \ dt1.dimensions() Op gf2.dimensions() \
) \ ) ; \
); \
\ \
Foam::OpFunc(tRes.ref(), dt1, gf2); \ Foam::OpFunc(tres.ref(), dt1, gf2); \
\ \
tgf2.clear(); \ tgf2.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
( \ ( \
@ -741,6 +725,7 @@ void OpFunc \
res.oriented() = gf1.oriented(); \ res.oriented() = gf1.oriented(); \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
( \ ( \
@ -748,9 +733,8 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
const dimensioned<Type2>& dt2 \ const dimensioned<Type2>& dt2 \
) \ ) \
{ \ { \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>>::New \
new GeometricField<ReturnType, PatchField, GeoMesh> \
( \ ( \
IOobject \ IOobject \
( \ ( \
@ -762,14 +746,14 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
), \ ), \
gf1.mesh(), \ gf1.mesh(), \
gf1.dimensions() Op dt2.dimensions() \ gf1.dimensions() Op dt2.dimensions() \
) \ ); \
); \
\ \
Foam::OpFunc(tRes.ref(), gf1, dt2); \ Foam::OpFunc(tres.ref(), gf1, dt2); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
( \ ( \
@ -790,23 +774,22 @@ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
{ \ { \
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \ const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
\ \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \ auto tres = \
( \
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \ reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
( \ ( \
tgf1, \ tgf1, \
'(' + gf1.name() + OpName + dt2.name() + ')', \ '(' + gf1.name() + OpName + dt2.name() + ')', \
gf1.dimensions() Op dt2.dimensions() \ gf1.dimensions() Op dt2.dimensions() \
) \ ); \
); \
\ \
Foam::OpFunc(tRes.ref(), gf1, dt2); \ Foam::OpFunc(tres.ref(), gf1, dt2); \
\ \
tgf1.clear(); \ tgf1.clear(); \
\ \
return tRes; \ return tres; \
} \ } \
\ \
\
TEMPLATE \ TEMPLATE \
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \ tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
( \ ( \

View File

@ -23,7 +23,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class GeoField> template<class GeoField>
@ -37,22 +36,19 @@ Foam::tmp<GeoField> Foam::uniformInterpolate
const GeoField& field0 = *(*fields.begin()); const GeoField& field0 = *(*fields.begin());
// Interpolate // Interpolate
tmp<GeoField> tfld auto tfld = tmp<GeoField>::New
( (
new GeoField IOobject
( (
IOobject "uniformInterpolate(" + field0.name() + ')',
( field0.time().timeName(),
"uniformInterpolate(" + field0.name() + ')', field0.db(),
field0.time().timeName(), IOobject::NO_READ,
field0.db(), IOobject::AUTO_WRITE
IOobject::NO_READ, ),
IOobject::AUTO_WRITE weights[0]*(*fields[indices[0]])
),
weights[0]*(*fields[indices[0]])
)
); );
GeoField& fld = tfld(); auto& fld = tfld();
for (label i = 1; i < indices.size(); ++i) for (label i = 1; i < indices.size(); ++i)
{ {
@ -91,25 +87,16 @@ Foam::tmp<GeoField> Foam::uniformInterpolate
// Interpolate // Interpolate
tmp<GeoField> tfld(new GeoField(fieldIO, weights[0]*field0)); auto tfld = tmp<GeoField>::New(fieldIO, weights[0]*field0);
GeoField& fld = tfld.ref(); GeoField& fld = tfld.ref();
for (label i = 1; i < times.size(); ++i) for (label i = 1; i < times.size(); ++i)
{ {
const objectRegistry& timeIFields = fieldsCache.lookupObject const objectRegistry& timeIFields =
< fieldsCache.lookupObject<const objectRegistry>(times[i]);
const objectRegistry
> const GeoField& fieldi =
( timeIFields.lookupObject<const GeoField>(fieldName);
times[i]
);
const GeoField& fieldi = timeIFields.lookupObject
<
const GeoField
>
(
fieldName
);
fld += weights[i]*fieldi; fld += weights[i]*fieldi;
} }