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/>.
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,
86 const bool valueRequired
89 Field<Type>(p.size()),
93 if (dict.found("value"))
95 fvsPatchField<Type>::operator=
97 Field<Type>("value", dict, p.size())
100 else if (!valueRequired)
102 fvsPatchField<Type>::operator=(pTraits<Type>::zero);
108 "fvsPatchField<Type>::fvsPatchField"
111 "const DimensionedField<Type, surfaceMesh>& iF,"
112 "const dictionary& dict,"
113 "const bool valueRequired"
116 ) << "Essential entry 'value' missing"
117 << exit(FatalIOError);
123 fvsPatchField<Type>::fvsPatchField
125 const fvsPatchField<Type>& ptf
130 internalField_(ptf.internalField_)
135 fvsPatchField<Type>::fvsPatchField
137 const fvsPatchField<Type>& ptf,
138 const DimensionedField<Type, surfaceMesh>& iF
147 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
150 const objectRegistry& fvsPatchField<Type>::db() const
152 //HR 12.3.10: Lookup fields from the field DB rather than the mesh
153 return internalField_.db();
158 template<class GeometricField, class Type2>
159 const typename GeometricField::PatchFieldType& Foam::fvsPatchField<Type>::lookupPatchField
162 const GeometricField*,
166 return patch_.patchField<GeometricField, Type2>
168 internalField_.db().objectRegistry::template lookupObject<GeometricField>(name)
174 void fvsPatchField<Type>::check(const fvsPatchField<Type>& ptf) const
176 if (&patch_ != &(ptf.patch_))
178 FatalErrorIn("PatchField<Type>::check(const fvsPatchField<Type>&)")
179 << "different patches for fvsPatchField<Type>s"
180 << abort(FatalError);
186 void fvsPatchField<Type>::check(const fvPatchField<Type>& ptf) const
188 if (&patch_ != &(ptf.patch()))
190 FatalErrorIn("PatchField<Type>::check(const fvsPatchField<Type>&)")
191 << "different patches for fvsPatchField<Type>s"
192 << abort(FatalError);
199 void fvsPatchField<Type>::autoMap
201 const fvPatchFieldMapper& m
204 Field<Type>::autoMap(m);
208 // Reverse-map the given fvsPatchField onto this fvsPatchField
210 void fvsPatchField<Type>::rmap
212 const fvsPatchField<Type>& ptf,
213 const labelList& addr
216 Field<Type>::rmap(ptf, addr);
222 void fvsPatchField<Type>::write(Ostream& os) const
224 os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
228 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
231 void fvsPatchField<Type>::operator=
233 const UList<Type>& ul
236 Field<Type>::operator=(ul);
241 void fvsPatchField<Type>::operator=
243 const fvsPatchField<Type>& ptf
247 Field<Type>::operator=(ptf);
252 void fvsPatchField<Type>::operator+=
254 const fvsPatchField<Type>& ptf
258 Field<Type>::operator+=(ptf);
263 void fvsPatchField<Type>::operator-=
265 const fvsPatchField<Type>& ptf
269 Field<Type>::operator-=(ptf);
274 void fvsPatchField<Type>::operator*=
276 const fvsPatchField<scalar>& ptf
279 if (&patch_ != &ptf.patch())
283 "PatchField<Type>::operator*=(const fvsPatchField<scalar>& ptf)"
284 ) << "incompatible patches for patch fields"
285 << abort(FatalError);
288 Field<Type>::operator*=(ptf);
293 void fvsPatchField<Type>::operator/=
295 const fvsPatchField<scalar>& ptf
298 if (&patch_ != &ptf.patch())
302 "PatchField<Type>::operator/=(const fvsPatchField<scalar>& ptf)"
303 ) << " incompatible patches for patch fields"
304 << abort(FatalError);
307 Field<Type>::operator/=(ptf);
312 void fvsPatchField<Type>::operator=
314 const fvPatchField<Type>& ptf
318 Field<Type>::operator=(ptf);
323 void fvsPatchField<Type>::operator+=
325 const Field<Type>& tf
328 Field<Type>::operator+=(tf);
333 void fvsPatchField<Type>::operator-=
335 const Field<Type>& tf
338 Field<Type>::operator-=(tf);
343 void fvsPatchField<Type>::operator*=
345 const scalarField& tf
348 Field<Type>::operator*=(tf);
353 void fvsPatchField<Type>::operator/=
355 const scalarField& tf
358 Field<Type>::operator/=(tf);
363 void fvsPatchField<Type>::operator=
368 Field<Type>::operator=(t);
373 void fvsPatchField<Type>::operator+=
378 Field<Type>::operator+=(t);
383 void fvsPatchField<Type>::operator-=
388 Field<Type>::operator-=(t);
393 void fvsPatchField<Type>::operator*=
398 Field<Type>::operator*=(s);
403 void fvsPatchField<Type>::operator/=
408 Field<Type>::operator/=(s);
412 // Force an assignment, overriding fixedValue status
414 void fvsPatchField<Type>::operator==
416 const fvsPatchField<Type>& ptf
419 Field<Type>::operator=(ptf);
424 void fvsPatchField<Type>::operator==
426 const Field<Type>& tf
429 Field<Type>::operator=(tf);
434 void fvsPatchField<Type>::operator==
439 Field<Type>::operator=(t);
443 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
446 Ostream& operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
450 os.check("Ostream& operator<<(Ostream&, const fvsPatchField<Type>&");
456 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
458 } // End namespace Foam
460 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
462 # include "newFvsPatchField.C"
464 // ************************************************************************* //