fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / finiteArea / fields / faPatchFields / faPatchField / faPatchField.C
blob1d56979c5b97f1f6e8f4964a964ca291f5807ea1
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 \*---------------------------------------------------------------------------*/
27 #include "IOobject.H"
28 #include "dictionary.H"
29 #include "faMesh.H"
30 #include "faPatchFieldMapper.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace Foam
37 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
39 template<class Type>
40 faPatchField<Type>::faPatchField
42     const faPatch& p,
43     const DimensionedField<Type, areaMesh>& iF
46     Field<Type>(p.size()),
47     patch_(p),
48     internalField_(iF),
49     updated_(false)
53 template<class Type>
54 faPatchField<Type>::faPatchField
56     const faPatch& p,
57     const DimensionedField<Type, areaMesh>& iF,
58     const Field<Type>& f
61     Field<Type>(f),
62     patch_(p),
63     internalField_(iF),
64     updated_(false)
68 template<class Type>
69 faPatchField<Type>::faPatchField
71     const faPatchField<Type>& ptf,
72     const faPatch& p,
73     const DimensionedField<Type, areaMesh>& iF,
74     const faPatchFieldMapper& mapper
77     Field<Type>(ptf, mapper),
78     patch_(p),
79     internalField_(iF),
80     updated_(false)
84 template<class Type>
85 faPatchField<Type>::faPatchField
87     const faPatch& p,
88     const DimensionedField<Type, areaMesh>& iF,
89     const dictionary& dict
92     Field<Type>(p.size()),
93     patch_(p),
94     internalField_(iF),
95     updated_(false)
97     if (dict.found("value"))
98     {
99         faPatchField<Type>::operator=
100         (
101             Field<Type>("value", dict, p.size())
102         );
103     }
104     else
105     {
106         faPatchField<Type>::operator=(pTraits<Type>::zero);
107     }
111 template<class Type>
112 faPatchField<Type>::faPatchField
114     const faPatchField<Type>& ptf
117     Field<Type>(ptf),
118     patch_(ptf.patch_),
119     internalField_(ptf.internalField_),
120     updated_(false)
124 template<class Type>
125 faPatchField<Type>::faPatchField
127     const faPatchField<Type>& ptf,
128     const DimensionedField<Type, areaMesh>& iF
131     Field<Type>(ptf),
132     patch_(ptf.patch_),
133     internalField_(iF),
134     updated_(false)
138 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
140 template<class Type>
141 const objectRegistry& faPatchField<Type>::db() const
143     return patch_.boundaryMesh().mesh();
147 template<class Type>
148 void faPatchField<Type>::check(const faPatchField<Type>& ptf) const
150     if (&patch_ != &(ptf.patch_))
151     {
152         FatalErrorIn("PatchField<Type>::check(const faPatchField<Type>&)")
153             << "different patches for faPatchField<Type>s"
154             << abort(FatalError);
155     }
159 // Return gradient at boundary
160 template<class Type>
161 tmp<Field<Type> > faPatchField<Type>::snGrad() const
163     return (*this - patchInternalField())*patch_.deltaCoeffs();
167 // Return internal field next to patch as patch field
168 template<class Type>
169 tmp<Field<Type> > faPatchField<Type>::patchInternalField() const
171     return patch_.patchInternalField(internalField_);
175 template<class Type>
176 void faPatchField<Type>::autoMap
178     const faPatchFieldMapper& m
181     Field<Type>::autoMap(m);
185 template<class Type>
186 void faPatchField<Type>::rmap
188     const faPatchField<Type>& ptf,
189     const labelList& addr
192     Field<Type>::rmap(ptf, addr);
196 template<class Type>
197 void faPatchField<Type>::evaluate(const Pstream::commsTypes)
199     if (!updated_)
200     {
201         updateCoeffs();
202     }
203     
204     updated_ = false;
208 template<class Type>
209 void faPatchField<Type>::write(Ostream& os) const
211     os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
215 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
217 template<class Type>
218 void faPatchField<Type>::operator=
220     const UList<Type>& ul
223     Field<Type>::operator=(ul);
227 template<class Type>
228 void faPatchField<Type>::operator=
230     const faPatchField<Type>& ptf
233     check(ptf);
234     Field<Type>::operator=(ptf);
238 template<class Type>
239 void faPatchField<Type>::operator+=
241     const faPatchField<Type>& ptf
244     check(ptf);
245     Field<Type>::operator+=(ptf);
249 template<class Type>
250 void faPatchField<Type>::operator-=
252     const faPatchField<Type>& ptf
255     check(ptf);
256     Field<Type>::operator-=(ptf);
260 template<class Type>
261 void faPatchField<Type>::operator*=
263     const faPatchField<scalar>& ptf
266     if (&patch_ != &ptf.patch())
267     {
268         FatalErrorIn
269         (
270             "PatchField<Type>::operator*=(const faPatchField<scalar>& ptf)"
271         )   << "incompatible patches for patch fields"
272             << abort(FatalError);
273     }
275     Field<Type>::operator*=(ptf);
279 template<class Type>
280 void faPatchField<Type>::operator/=
282     const faPatchField<scalar>& ptf
285     if (&patch_ != &ptf.patch())
286     {
287         FatalErrorIn
288         (
289             "PatchField<Type>::operator/=(const faPatchField<scalar>& ptf)"
290         )   << "    incompatible patches for patch fields"
291             << abort(FatalError);
292     }
294     Field<Type>::operator/=(ptf);
298 template<class Type>
299 void faPatchField<Type>::operator+=
301     const Field<Type>& tf
304     Field<Type>::operator+=(tf);
308 template<class Type>
309 void faPatchField<Type>::operator-=
311     const Field<Type>& tf
314     Field<Type>::operator-=(tf);
318 template<class Type>
319 void faPatchField<Type>::operator*=
321     const scalarField& tf
324     Field<Type>::operator*=(tf);
328 template<class Type>
329 void faPatchField<Type>::operator/=
331     const scalarField& tf
334     Field<Type>::operator/=(tf);
338 template<class Type>
339 void faPatchField<Type>::operator=
341     const Type& t
344     Field<Type>::operator=(t);
348 template<class Type>
349 void faPatchField<Type>::operator+=
351     const Type& t
354     Field<Type>::operator+=(t);
358 template<class Type>
359 void faPatchField<Type>::operator-=
361     const Type& t
364     Field<Type>::operator-=(t);
368 template<class Type>
369 void faPatchField<Type>::operator*=
371     const scalar s
374     Field<Type>::operator*=(s);
378 template<class Type>
379 void faPatchField<Type>::operator/=
381     const scalar s
384     Field<Type>::operator/=(s);
388 // Force an assignment, overriding fixedValue status
389 template<class Type>
390 void faPatchField<Type>::operator==
392     const faPatchField<Type>& ptf
395     Field<Type>::operator=(ptf);
399 template<class Type>
400 void faPatchField<Type>::operator==
402     const Field<Type>& tf
405     Field<Type>::operator=(tf);
409 template<class Type>
410 void faPatchField<Type>::operator==
412     const Type& t
415     Field<Type>::operator=(t);
419 // * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
421 template<class Type>
422 Ostream& operator<<(Ostream& os, const faPatchField<Type>& ptf)
424     ptf.write(os);
426     os.check("Ostream& operator<<(Ostream&, const faPatchField<Type>&");
428     return os;
432 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
434 } // End namespace Foam
436 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
438 #   include "newFaPatchField.C"
440 // ************************************************************************* //