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 "fvPatchFieldMapper.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 fvsPatchField<Type>::fvsPatchField
43 const DimensionedField<Type, surfaceMesh>& iF
46 Field<Type>(p.size()),
53 fvsPatchField<Type>::fvsPatchField
56 const DimensionedField<Type, surfaceMesh>& iF,
67 fvsPatchField<Type>::fvsPatchField
69 const fvsPatchField<Type>& ptf,
71 const DimensionedField<Type, surfaceMesh>& iF,
72 const fvPatchFieldMapper& mapper
75 Field<Type>(ptf, mapper),
82 fvsPatchField<Type>::fvsPatchField
85 const DimensionedField<Type, surfaceMesh>& iF,
86 const dictionary& dict,
87 const bool valueRequired
90 Field<Type>(p.size()),
94 if (dict.found("value"))
96 fvsPatchField<Type>::operator=
98 Field<Type>("value", dict, p.size())
101 else if (!valueRequired)
103 fvsPatchField<Type>::operator=(pTraits<Type>::zero);
109 "fvsPatchField<Type>::fvsPatchField"
112 "const DimensionedField<Type, surfaceMesh>& iF,"
113 "const dictionary& dict,"
114 "const bool valueRequired"
117 ) << "Essential entry 'value' missing"
118 << exit(FatalIOError);
124 fvsPatchField<Type>::fvsPatchField
126 const fvsPatchField<Type>& ptf
131 internalField_(ptf.internalField_)
136 fvsPatchField<Type>::fvsPatchField
138 const fvsPatchField<Type>& ptf,
139 const DimensionedField<Type, surfaceMesh>& iF
148 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
151 const objectRegistry& fvsPatchField<Type>::db() const
153 return patch_.boundaryMesh().mesh();
158 void fvsPatchField<Type>::check(const fvsPatchField<Type>& ptf) const
160 if (&patch_ != &(ptf.patch_))
162 FatalErrorIn("PatchField<Type>::check(const fvsPatchField<Type>&)")
163 << "different patches for fvsPatchField<Type>s"
164 << abort(FatalError);
171 void fvsPatchField<Type>::autoMap
173 const fvPatchFieldMapper& m
176 Field<Type>::autoMap(m);
180 // Reverse-map the given fvsPatchField onto this fvsPatchField
182 void fvsPatchField<Type>::rmap
184 const fvsPatchField<Type>& ptf,
185 const labelList& addr
188 Field<Type>::rmap(ptf, addr);
194 void fvsPatchField<Type>::write(Ostream& os) const
196 os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
200 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
203 void fvsPatchField<Type>::operator=
205 const UList<Type>& ul
208 Field<Type>::operator=(ul);
213 void fvsPatchField<Type>::operator=
215 const fvsPatchField<Type>& ptf
219 Field<Type>::operator=(ptf);
224 void fvsPatchField<Type>::operator+=
226 const fvsPatchField<Type>& ptf
230 Field<Type>::operator+=(ptf);
235 void fvsPatchField<Type>::operator-=
237 const fvsPatchField<Type>& ptf
241 Field<Type>::operator-=(ptf);
246 void fvsPatchField<Type>::operator*=
248 const fvsPatchField<scalar>& ptf
251 if (&patch_ != &ptf.patch())
255 "PatchField<Type>::operator*=(const fvsPatchField<scalar>& ptf)"
256 ) << "incompatible patches for patch fields"
257 << abort(FatalError);
260 Field<Type>::operator*=(ptf);
265 void fvsPatchField<Type>::operator/=
267 const fvsPatchField<scalar>& ptf
270 if (&patch_ != &ptf.patch())
274 "PatchField<Type>::operator/=(const fvsPatchField<scalar>& ptf)"
275 ) << " incompatible patches for patch fields"
276 << abort(FatalError);
279 Field<Type>::operator/=(ptf);
284 void fvsPatchField<Type>::operator+=
286 const Field<Type>& tf
289 Field<Type>::operator+=(tf);
294 void fvsPatchField<Type>::operator-=
296 const Field<Type>& tf
299 Field<Type>::operator-=(tf);
304 void fvsPatchField<Type>::operator*=
306 const scalarField& tf
309 Field<Type>::operator*=(tf);
314 void fvsPatchField<Type>::operator/=
316 const scalarField& tf
319 Field<Type>::operator/=(tf);
324 void fvsPatchField<Type>::operator=
329 Field<Type>::operator=(t);
334 void fvsPatchField<Type>::operator+=
339 Field<Type>::operator+=(t);
344 void fvsPatchField<Type>::operator-=
349 Field<Type>::operator-=(t);
354 void fvsPatchField<Type>::operator*=
359 Field<Type>::operator*=(s);
364 void fvsPatchField<Type>::operator/=
369 Field<Type>::operator/=(s);
373 // Force an assignment, overriding fixedValue status
375 void fvsPatchField<Type>::operator==
377 const fvsPatchField<Type>& ptf
380 Field<Type>::operator=(ptf);
385 void fvsPatchField<Type>::operator==
387 const Field<Type>& tf
390 Field<Type>::operator=(tf);
395 void fvsPatchField<Type>::operator==
400 Field<Type>::operator=(t);
404 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
407 Ostream& operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
411 os.check("Ostream& operator<<(Ostream&, const fvsPatchField<Type>&");
417 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
419 } // End namespace Foam
421 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
423 # include "newFvsPatchField.C"
425 // ************************************************************************* //