1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #ifndef GeometricFieldReuseFunctions_H
27 #define GeometricFieldReuseFunctions_H
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 template<class> class PatchField,
43 class reuseTmpGeometricField
47 static tmp<GeometricField<TypeR, PatchField, GeoMesh> > New
49 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tdf1,
51 const dimensionSet& dimensions
54 const GeometricField<Type1, PatchField, GeoMesh>& df1 = tdf1();
56 return tmp<GeometricField<TypeR, PatchField, GeoMesh> >
58 new GeometricField<TypeR, PatchField, GeoMesh>
74 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tdf1
82 template<class TypeR, template<class> class PatchField, class GeoMesh>
83 class reuseTmpGeometricField<TypeR, TypeR, PatchField, GeoMesh>
87 static tmp<GeometricField<TypeR, PatchField, GeoMesh> > New
89 const tmp<GeometricField<TypeR, PatchField, GeoMesh> >& tdf1,
91 const dimensionSet& dimensions
94 GeometricField<TypeR, PatchField, GeoMesh>& df1 =
95 const_cast<GeometricField<TypeR, PatchField, GeoMesh>& >(tdf1());
100 df1.dimensions().reset(dimensions);
105 return tmp<GeometricField<TypeR, PatchField, GeoMesh> >
107 new GeometricField<TypeR, PatchField, GeoMesh>
124 const tmp<GeometricField<TypeR, PatchField, GeoMesh> >& tdf1
141 template<class> class PatchField,
144 class reuseTmpTmpGeometricField
148 static tmp<GeometricField<TypeR, PatchField, GeoMesh> > New
150 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tdf1,
151 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tdf2,
153 const dimensionSet& dimensions
156 const GeometricField<Type1, PatchField, GeoMesh>& df1 = tdf1();
158 return tmp<GeometricField<TypeR, PatchField, GeoMesh> >
160 new GeometricField<TypeR, PatchField, GeoMesh>
176 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tdf1,
177 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tdf2
191 template<class> class PatchField,
194 class reuseTmpTmpGeometricField
195 <TypeR, Type1, Type12, TypeR, PatchField, GeoMesh>
199 static tmp<GeometricField<TypeR, PatchField, GeoMesh> > New
201 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tdf1,
202 const tmp<GeometricField<TypeR, PatchField, GeoMesh> >& tdf2,
204 const dimensionSet& dimensions
207 const GeometricField<Type1, PatchField, GeoMesh>& df1 = tdf1();
208 GeometricField<TypeR, PatchField, GeoMesh>& df2 =
209 const_cast<GeometricField<TypeR, PatchField, GeoMesh>& >(tdf2());
214 df2.dimensions().reset(dimensions);
219 return tmp<GeometricField<TypeR, PatchField, GeoMesh> >
221 new GeometricField<TypeR, PatchField, GeoMesh>
238 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tdf1,
239 const tmp<GeometricField<TypeR, PatchField, GeoMesh> >& tdf2
255 template<class> class PatchField,
258 class reuseTmpTmpGeometricField<TypeR, TypeR, TypeR, Type2, PatchField, GeoMesh>
262 static tmp<GeometricField<TypeR, PatchField, GeoMesh> > New
264 const tmp<GeometricField<TypeR, PatchField, GeoMesh> >& tdf1,
265 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tdf2,
267 const dimensionSet& dimensions
270 GeometricField<TypeR, PatchField, GeoMesh>& df1 =
271 const_cast<GeometricField<TypeR, PatchField, GeoMesh>& >(tdf1());
276 df1.dimensions().reset(dimensions);
281 return tmp<GeometricField<TypeR, PatchField, GeoMesh> >
283 new GeometricField<TypeR, PatchField, GeoMesh>
300 const tmp<GeometricField<TypeR, PatchField, GeoMesh> >& tdf1,
301 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tdf2
313 template<class TypeR, template<class> class PatchField, class GeoMesh>
314 class reuseTmpTmpGeometricField<TypeR, TypeR, TypeR, TypeR, PatchField, GeoMesh>
318 static tmp<GeometricField<TypeR, PatchField, GeoMesh> > New
320 const tmp<GeometricField<TypeR, PatchField, GeoMesh> >& tdf1,
321 const tmp<GeometricField<TypeR, PatchField, GeoMesh> >& tdf2,
323 const dimensionSet& dimensions
326 GeometricField<TypeR, PatchField, GeoMesh>& df1 =
327 const_cast<GeometricField<TypeR, PatchField, GeoMesh>& >(tdf1());
328 GeometricField<TypeR, PatchField, GeoMesh>& df2 =
329 const_cast<GeometricField<TypeR, PatchField, GeoMesh>& >(tdf2());
334 df1.dimensions().reset(dimensions);
337 else if (tdf2.isTmp())
340 df2.dimensions().reset(dimensions);
345 return tmp<GeometricField<TypeR, PatchField, GeoMesh> >
347 new GeometricField<TypeR, PatchField, GeoMesh>
364 const tmp<GeometricField<TypeR, PatchField, GeoMesh> >& tdf1,
365 const tmp<GeometricField<TypeR, PatchField, GeoMesh> >& tdf2
373 else if (tdf2.isTmp())
382 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
384 } // End namespace Foam
386 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
390 // ************************************************************************* //