1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 \*---------------------------------------------------------------------------*/
28 #include "dictionary.H"
30 #include "faPatchFieldMapper.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 faPatchField<Type>::faPatchField
43 const DimensionedField<Type, areaMesh>& iF
46 Field<Type>(p.size()),
54 faPatchField<Type>::faPatchField
57 const DimensionedField<Type, areaMesh>& iF,
69 faPatchField<Type>::faPatchField
71 const faPatchField<Type>& ptf,
73 const DimensionedField<Type, areaMesh>& iF,
74 const faPatchFieldMapper& mapper
77 Field<Type>(ptf, mapper),
85 faPatchField<Type>::faPatchField
88 const DimensionedField<Type, areaMesh>& iF,
89 const dictionary& dict
92 Field<Type>(p.size()),
97 if (dict.found("value"))
99 faPatchField<Type>::operator=
101 Field<Type>("value", dict, p.size())
106 faPatchField<Type>::operator=(pTraits<Type>::zero);
112 faPatchField<Type>::faPatchField
114 const faPatchField<Type>& ptf
119 internalField_(ptf.internalField_),
125 faPatchField<Type>::faPatchField
127 const faPatchField<Type>& ptf,
128 const DimensionedField<Type, areaMesh>& iF
138 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
141 const objectRegistry& faPatchField<Type>::db() const
143 return patch_.boundaryMesh().mesh();
148 void faPatchField<Type>::check(const faPatchField<Type>& ptf) const
150 if (&patch_ != &(ptf.patch_))
152 FatalErrorIn("PatchField<Type>::check(const faPatchField<Type>&)")
153 << "different patches for faPatchField<Type>s"
154 << abort(FatalError);
159 // Return gradient at boundary
161 tmp<Field<Type> > faPatchField<Type>::snGrad() const
163 return (*this - patchInternalField())*patch_.deltaCoeffs();
167 // Return internal field next to patch as patch field
169 tmp<Field<Type> > faPatchField<Type>::patchInternalField() const
171 return patch_.patchInternalField(internalField_);
176 void faPatchField<Type>::autoMap
178 const faPatchFieldMapper& m
181 Field<Type>::autoMap(m);
186 void faPatchField<Type>::rmap
188 const faPatchField<Type>& ptf,
189 const labelList& addr
192 Field<Type>::rmap(ptf, addr);
197 void faPatchField<Type>::evaluate(const Pstream::commsTypes)
209 void faPatchField<Type>::write(Ostream& os) const
211 os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
215 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
218 void faPatchField<Type>::operator=
220 const UList<Type>& ul
223 Field<Type>::operator=(ul);
228 void faPatchField<Type>::operator=
230 const faPatchField<Type>& ptf
234 Field<Type>::operator=(ptf);
239 void faPatchField<Type>::operator+=
241 const faPatchField<Type>& ptf
245 Field<Type>::operator+=(ptf);
250 void faPatchField<Type>::operator-=
252 const faPatchField<Type>& ptf
256 Field<Type>::operator-=(ptf);
261 void faPatchField<Type>::operator*=
263 const faPatchField<scalar>& ptf
266 if (&patch_ != &ptf.patch())
270 "PatchField<Type>::operator*=(const faPatchField<scalar>& ptf)"
271 ) << "incompatible patches for patch fields"
272 << abort(FatalError);
275 Field<Type>::operator*=(ptf);
280 void faPatchField<Type>::operator/=
282 const faPatchField<scalar>& ptf
285 if (&patch_ != &ptf.patch())
289 "PatchField<Type>::operator/=(const faPatchField<scalar>& ptf)"
290 ) << " incompatible patches for patch fields"
291 << abort(FatalError);
294 Field<Type>::operator/=(ptf);
299 void faPatchField<Type>::operator+=
301 const Field<Type>& tf
304 Field<Type>::operator+=(tf);
309 void faPatchField<Type>::operator-=
311 const Field<Type>& tf
314 Field<Type>::operator-=(tf);
319 void faPatchField<Type>::operator*=
321 const scalarField& tf
324 Field<Type>::operator*=(tf);
329 void faPatchField<Type>::operator/=
331 const scalarField& tf
334 Field<Type>::operator/=(tf);
339 void faPatchField<Type>::operator=
344 Field<Type>::operator=(t);
349 void faPatchField<Type>::operator+=
354 Field<Type>::operator+=(t);
359 void faPatchField<Type>::operator-=
364 Field<Type>::operator-=(t);
369 void faPatchField<Type>::operator*=
374 Field<Type>::operator*=(s);
379 void faPatchField<Type>::operator/=
384 Field<Type>::operator/=(s);
388 // Force an assignment, overriding fixedValue status
390 void faPatchField<Type>::operator==
392 const faPatchField<Type>& ptf
395 Field<Type>::operator=(ptf);
400 void faPatchField<Type>::operator==
402 const Field<Type>& tf
405 Field<Type>::operator=(tf);
410 void faPatchField<Type>::operator==
415 Field<Type>::operator=(t);
419 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
422 Ostream& operator<<(Ostream& os, const faPatchField<Type>& ptf)
426 os.check("Ostream& operator<<(Ostream&, const faPatchField<Type>&");
432 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
434 } // End namespace Foam
436 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
438 # include "newFaPatchField.C"
440 // ************************************************************************* //