1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 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
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 \*---------------------------------------------------------------------------*/
27 #include "dictionary.H"
29 #include "fvPatchFieldMapper.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 fvsPatchField<Type>::fvsPatchField
42 const DimensionedField<Type, surfaceMesh>& iF
45 Field<Type>(p.size()),
52 fvsPatchField<Type>::fvsPatchField
55 const DimensionedField<Type, surfaceMesh>& iF,
66 fvsPatchField<Type>::fvsPatchField
68 const fvsPatchField<Type>& ptf,
70 const DimensionedField<Type, surfaceMesh>& iF,
71 const fvPatchFieldMapper& mapper
74 Field<Type>(ptf, mapper),
81 fvsPatchField<Type>::fvsPatchField
84 const DimensionedField<Type, surfaceMesh>& iF,
85 const dictionary& dict
88 Field<Type>(p.size()),
92 if (dict.found("value"))
94 fvsPatchField<Type>::operator=
96 Field<Type>("value", dict, p.size())
101 fvsPatchField<Type>::operator=(pTraits<Type>::zero);
107 fvsPatchField<Type>::fvsPatchField
109 const fvsPatchField<Type>& ptf
114 internalField_(ptf.internalField_)
119 fvsPatchField<Type>::fvsPatchField
121 const fvsPatchField<Type>& ptf,
122 const DimensionedField<Type, surfaceMesh>& iF
131 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
134 const objectRegistry& fvsPatchField<Type>::db() const
136 return patch_.boundaryMesh().mesh();
141 void fvsPatchField<Type>::check(const fvsPatchField<Type>& ptf) const
143 if (&patch_ != &(ptf.patch_))
145 FatalErrorIn("PatchField<Type>::check(const fvsPatchField<Type>&)")
146 << "different patches for fvsPatchField<Type>s"
147 << abort(FatalError);
154 void fvsPatchField<Type>::autoMap
156 const fvPatchFieldMapper& m
159 Field<Type>::autoMap(m);
163 // Reverse-map the given fvsPatchField onto this fvsPatchField
165 void fvsPatchField<Type>::rmap
167 const fvsPatchField<Type>& ptf,
168 const labelList& addr
171 Field<Type>::rmap(ptf, addr);
177 void fvsPatchField<Type>::write(Ostream& os) const
179 os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
183 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
186 void fvsPatchField<Type>::operator=
188 const UList<Type>& ul
191 Field<Type>::operator=(ul);
196 void fvsPatchField<Type>::operator=
198 const fvsPatchField<Type>& ptf
202 Field<Type>::operator=(ptf);
207 void fvsPatchField<Type>::operator+=
209 const fvsPatchField<Type>& ptf
213 Field<Type>::operator+=(ptf);
218 void fvsPatchField<Type>::operator-=
220 const fvsPatchField<Type>& ptf
224 Field<Type>::operator-=(ptf);
229 void fvsPatchField<Type>::operator*=
231 const fvsPatchField<scalar>& ptf
234 if (&patch_ != &ptf.patch())
238 "PatchField<Type>::operator*=(const fvsPatchField<scalar>& ptf)"
239 ) << "incompatible patches for patch fields"
240 << abort(FatalError);
243 Field<Type>::operator*=(ptf);
248 void fvsPatchField<Type>::operator/=
250 const fvsPatchField<scalar>& ptf
253 if (&patch_ != &ptf.patch())
257 "PatchField<Type>::operator/=(const fvsPatchField<scalar>& ptf)"
258 ) << " incompatible patches for patch fields"
259 << abort(FatalError);
262 Field<Type>::operator/=(ptf);
267 void fvsPatchField<Type>::operator+=
269 const Field<Type>& tf
272 Field<Type>::operator+=(tf);
277 void fvsPatchField<Type>::operator-=
279 const Field<Type>& tf
282 Field<Type>::operator-=(tf);
287 void fvsPatchField<Type>::operator*=
289 const scalarField& tf
292 Field<Type>::operator*=(tf);
297 void fvsPatchField<Type>::operator/=
299 const scalarField& tf
302 Field<Type>::operator/=(tf);
307 void fvsPatchField<Type>::operator=
312 Field<Type>::operator=(t);
317 void fvsPatchField<Type>::operator+=
322 Field<Type>::operator+=(t);
327 void fvsPatchField<Type>::operator-=
332 Field<Type>::operator-=(t);
337 void fvsPatchField<Type>::operator*=
342 Field<Type>::operator*=(s);
347 void fvsPatchField<Type>::operator/=
352 Field<Type>::operator/=(s);
356 // Force an assignment, overriding fixedValue status
358 void fvsPatchField<Type>::operator==
360 const fvsPatchField<Type>& ptf
363 Field<Type>::operator=(ptf);
368 void fvsPatchField<Type>::operator==
370 const Field<Type>& tf
373 Field<Type>::operator=(tf);
378 void fvsPatchField<Type>::operator==
383 Field<Type>::operator=(t);
387 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
390 Ostream& operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
394 os.check("Ostream& operator<<(Ostream&, const fvsPatchField<Type>&");
400 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
402 } // End namespace Foam
404 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
406 # include "fvsPatchFieldNew.C"
408 // ************************************************************************* //