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
34 \*---------------------------------------------------------------------------*/
42 #include "direction.H"
43 #include "VectorSpace.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of friend functions and operators
52 template<template<class> class Field, class Type>
55 template<template<class> class Field, class Type>
59 const FieldField<Field, Type>&
62 template<template<class> class Field, class Type>
66 const tmp<FieldField<Field, Type> >&
70 /*---------------------------------------------------------------------------*\
71 Class FieldField Declaration
72 \*---------------------------------------------------------------------------*/
74 template<template<class> class Field, class Type>
78 public PtrList<Field<Type> >
84 typedef typename pTraits<Type>::cmptType cmptType;
90 // Used for temporary fields which are initialised after construction
93 //- Construct given size
94 // Used for temporary fields which are initialised after construction
95 explicit FieldField(const label);
97 //- Construct using the Field sizes from the given FieldField
98 // and the given Field type.
99 // Used for temporary fields which are initialised after construction
100 FieldField(const word&, const FieldField<Field, Type>&);
102 //- Construct as copy
103 FieldField(const FieldField<Field, Type>&);
105 //- Construct as copy or re-use as specified.
106 FieldField(FieldField<Field, Type>&, bool reUse);
108 //- Construct as copy of a PtrList<Field, Type>
109 FieldField(const PtrList<Field<Type> >&);
111 //- Construct as copy of tmp<FieldField>
112 # ifdef ConstructFromTmp
113 FieldField(const tmp<FieldField<Field, Type> >&);
116 //- Construct from Istream
117 FieldField(Istream&);
120 tmp<FieldField<Field, Type> > clone() const;
122 //- Return a pointer to a new calculatedFvPatchFieldField created on
123 // freestore without setting patchField values
124 template<class Type2>
125 static tmp<FieldField<Field, Type> > NewCalculatedType
127 const FieldField<Field, Type2>& ff
129 # ifdef __INTEL_COMPILER
131 FieldField<Field, Type>* nffPtr
133 new FieldField<Field, Type>(ff.size())
138 nffPtr->set(i, Field<Type>::NewCalculatedType(ff[i]).ptr());
141 return tmp<FieldField<Field, Type> >(nffPtr);
149 //- Negate this field
152 //- Return a component field of the field
153 tmp<FieldField<Field, cmptType> > component(const direction) const;
155 //- Replace a component field of the field
156 void replace(const direction, const FieldField<Field, cmptType>&);
158 //- Replace a component field of the field
159 void replace(const direction, const cmptType&);
161 //- Return the field transpose (only defined for second rank tensors)
162 tmp<FieldField<Field, Type> > T() const;
167 void operator=(const FieldField<Field, Type>&);
168 void operator=(const tmp<FieldField<Field, Type> >&);
169 void operator=(const Type&);
171 void operator+=(const FieldField<Field, Type>&);
172 void operator+=(const tmp<FieldField<Field, Type> >&);
174 void operator-=(const FieldField<Field, Type>&);
175 void operator-=(const tmp<FieldField<Field, Type> >&);
177 void operator*=(const FieldField<Field, scalar>&);
178 void operator*=(const tmp<FieldField<Field, scalar> >&);
180 void operator/=(const FieldField<Field, scalar>&);
181 void operator/=(const tmp<FieldField<Field, scalar> >&);
183 void operator+=(const Type&);
184 void operator-=(const Type&);
186 void operator*=(const scalar&);
187 void operator/=(const scalar&);
190 // IOstream operators
192 friend Ostream& operator<< <Field, Type>
195 const FieldField<Field, Type>&
198 friend Ostream& operator<< <Field, Type>
201 const tmp<FieldField<Field, Type> >&
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 } // End namespace Foam
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 #include "FieldFieldFunctions.H"
215 # include "FieldField.C"
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 // ************************************************************************* //