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 FieldReuseFunctions_H
27 #define FieldReuseFunctions_H
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 template<class TypeR, class Type1>
41 static tmp<Field<TypeR> > New(const tmp<Field<Type1> >& tf1)
43 return tmp<Field<TypeR> >(new Field<TypeR>(tf1().size()));
46 static void clear(const tmp<Field<Type1> >& tf1)
54 class reuseTmp<TypeR, TypeR>
58 static tmp<Field<TypeR> > New(const tmp<Field<TypeR> >& tf1)
66 return tmp<Field<TypeR> >(new Field<TypeR>(tf1().size()));
70 static void clear(const tmp<Field<TypeR> >& tf1)
80 template<class TypeR, class Type1, class Type12, class Type2>
85 static tmp<Field<TypeR> > New
87 const tmp<Field<Type1> >& tf1,
88 const tmp<Field<Type2> >& tf2
91 return tmp<Field<TypeR> >(new Field<TypeR>(tf1().size()));
96 const tmp<Field<Type1> >& tf1,
97 const tmp<Field<Type2> >& tf2
106 template<class TypeR, class Type1, class Type12>
107 class reuseTmpTmp<TypeR, Type1, Type12, TypeR>
111 static tmp<Field<TypeR> > New
113 const tmp<Field<Type1> >& tf1,
114 const tmp<Field<TypeR> >& tf2
123 return tmp<Field<TypeR> >(new Field<TypeR>(tf1().size()));
129 const tmp<Field<Type1> >& tf1,
130 const tmp<Field<TypeR> >& tf2
142 template<class TypeR, class Type2>
143 class reuseTmpTmp<TypeR, TypeR, TypeR, Type2>
147 static tmp<Field<TypeR> > New
149 const tmp<Field<TypeR> >& tf1,
150 const tmp<Field<Type2> >& tf2
159 return tmp<Field<TypeR> >(new Field<TypeR>(tf1().size()));
165 const tmp<Field<TypeR> >& tf1,
166 const tmp<Field<Type2> >& tf2
178 template<class TypeR>
179 class reuseTmpTmp<TypeR, TypeR, TypeR, TypeR>
183 static tmp<Field<TypeR> > New
185 const tmp<Field<TypeR> >& tf1,
186 const tmp<Field<TypeR> >& tf2
193 else if (tf2.isTmp())
199 return tmp<Field<TypeR> >(new Field<TypeR>(tf1().size()));
205 const tmp<Field<TypeR> >& tf1,
206 const tmp<Field<TypeR> >& tf2
214 else if (tf2.isTmp())
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 } // End namespace Foam
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 // ************************************************************************* //