1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #ifndef FieldReuseFunctions_H
28 #define FieldReuseFunctions_H
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 template<class TypeR, class Type1>
42 static tmp<Field<TypeR> > New(const tmp<Field<Type1> >& tf1)
44 return tmp<Field<TypeR> >(new Field<TypeR>(tf1().size()));
47 static void clear(const tmp<Field<Type1> >& tf1)
55 class reuseTmp<TypeR, TypeR>
59 static tmp<Field<TypeR> > New(const tmp<Field<TypeR> >& tf1)
67 return tmp<Field<TypeR> >(new Field<TypeR>(tf1().size()));
71 static void clear(const tmp<Field<TypeR> >& tf1)
81 template<class TypeR, class Type1, class Type12, class Type2>
86 static tmp<Field<TypeR> > New
88 const tmp<Field<Type1> >& tf1,
89 const tmp<Field<Type2> >& tf2
92 return tmp<Field<TypeR> >(new Field<TypeR>(tf1().size()));
97 const tmp<Field<Type1> >& tf1,
98 const tmp<Field<Type2> >& tf2
107 template<class TypeR, class Type1, class Type12>
108 class reuseTmpTmp<TypeR, Type1, Type12, TypeR>
112 static tmp<Field<TypeR> > New
114 const tmp<Field<Type1> >& tf1,
115 const tmp<Field<TypeR> >& tf2
124 return tmp<Field<TypeR> >(new Field<TypeR>(tf1().size()));
130 const tmp<Field<Type1> >& tf1,
131 const tmp<Field<TypeR> >& tf2
143 template<class TypeR, class Type2>
144 class reuseTmpTmp<TypeR, TypeR, TypeR, Type2>
148 static tmp<Field<TypeR> > New
150 const tmp<Field<TypeR> >& tf1,
151 const tmp<Field<Type2> >& tf2
160 return tmp<Field<TypeR> >(new Field<TypeR>(tf1().size()));
166 const tmp<Field<TypeR> >& tf1,
167 const tmp<Field<Type2> >& tf2
179 template<class TypeR>
180 class reuseTmpTmp<TypeR, TypeR, TypeR, TypeR>
184 static tmp<Field<TypeR> > New
186 const tmp<Field<TypeR> >& tf1,
187 const tmp<Field<TypeR> >& tf2
194 else if (tf2.isTmp())
200 return tmp<Field<TypeR> >(new Field<TypeR>(tf1().size()));
206 const tmp<Field<TypeR> >& tf1,
207 const tmp<Field<TypeR> >& tf2
215 else if (tf2.isTmp())
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 } // End namespace Foam
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 // ************************************************************************* //