1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
33 \*---------------------------------------------------------------------------*/
41 #include "direction.H"
42 #include "VectorSpace.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of friend functions and operators
51 template<template<class> class Field, class Type>
54 template<template<class> class Field, class Type>
58 const FieldField<Field, Type>&
61 template<template<class> class Field, class Type>
65 const tmp<FieldField<Field, Type> >&
69 /*---------------------------------------------------------------------------*\
70 Class FieldField Declaration
71 \*---------------------------------------------------------------------------*/
73 template<template<class> class Field, class Type>
77 public PtrList<Field<Type> >
83 typedef typename pTraits<Type>::cmptType cmptType;
89 // Used for temporary fields which are initialised after construction
92 //- Construct given size
93 // Used for temporary fields which are initialised after construction
94 explicit FieldField(const label);
96 //- Construct using the Field sizes from the given FieldField
97 // and the given Field type.
98 // Used for temporary fields which are initialised after construction
99 FieldField(const word&, const FieldField<Field, Type>&);
101 //- Construct as copy
102 FieldField(const FieldField<Field, Type>&);
104 //- Construct as copy or re-use as specified.
105 FieldField(FieldField<Field, Type>&, bool reUse);
107 //- Construct as copy of a PtrList<Field, Type>
108 FieldField(const PtrList<Field<Type> >&);
110 //- Construct as copy of tmp<FieldField>
111 # ifdef ConstructFromTmp
112 FieldField(const tmp<FieldField<Field, Type> >&);
115 //- Construct from Istream
116 FieldField(Istream&);
119 tmp<FieldField<Field, Type> > clone() const;
121 //- Return a pointer to a new calculatedFvPatchFieldField created on
122 // freestore without setting patchField values
123 template<class Type2>
124 static tmp<FieldField<Field, Type> > NewCalculatedType
126 const FieldField<Field, Type2>& ff
128 # ifdef __INTEL_COMPILER
130 FieldField<Field, Type>* nffPtr
132 new FieldField<Field, Type>(ff.size())
137 nffPtr->set(i, Field<Type>::NewCalculatedType(ff[i]).ptr());
140 return tmp<FieldField<Field, Type> >(nffPtr);
148 //- Negate this field
151 //- Return a component field of the field
152 tmp<FieldField<Field, cmptType> > component(const direction) const;
154 //- Replace a component field of the field
155 void replace(const direction, const FieldField<Field, cmptType>&);
157 //- Replace a component field of the field
158 void replace(const direction, const cmptType&);
160 //- Return the field transpose (only defined for second rank tensors)
161 tmp<FieldField<Field, Type> > T() const;
166 void operator=(const FieldField<Field, Type>&);
167 void operator=(const tmp<FieldField<Field, Type> >&);
168 void operator=(const Type&);
170 void operator+=(const FieldField<Field, Type>&);
171 void operator+=(const tmp<FieldField<Field, Type> >&);
173 void operator-=(const FieldField<Field, Type>&);
174 void operator-=(const tmp<FieldField<Field, Type> >&);
176 void operator*=(const FieldField<Field, scalar>&);
177 void operator*=(const tmp<FieldField<Field, scalar> >&);
179 void operator/=(const FieldField<Field, scalar>&);
180 void operator/=(const tmp<FieldField<Field, scalar> >&);
182 void operator+=(const Type&);
183 void operator-=(const Type&);
185 void operator*=(const scalar&);
186 void operator/=(const scalar&);
189 // 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> >&
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 } // End namespace Foam
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 #include "FieldFieldFunctions.H"
216 # include "FieldField.C"
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 // ************************************************************************* //