FreeFOAM The Cross-Platform CFD Toolkit
fvsPatchField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include <OpenFOAM/IOobject.H>
27 #include <OpenFOAM/dictionary.H>
28 #include <finiteVolume/fvMesh.H>
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
38 template<class Type>
40 (
41  const fvPatch& p,
43 )
44 :
45  Field<Type>(p.size()),
46  patch_(p),
47  internalField_(iF)
48 {}
49 
50 
51 template<class Type>
53 (
54  const fvPatch& p,
56  const Field<Type>& f
57 )
58 :
59  Field<Type>(f),
60  patch_(p),
61  internalField_(iF)
62 {}
63 
64 
65 template<class Type>
67 (
68  const fvsPatchField<Type>& ptf,
69  const fvPatch& p,
71  const fvPatchFieldMapper& mapper
72 )
73 :
74  Field<Type>(ptf, mapper),
75  patch_(p),
76  internalField_(iF)
77 {}
78 
79 
80 template<class Type>
82 (
83  const fvPatch& p,
85  const dictionary& dict
86 )
87 :
88  Field<Type>(p.size()),
89  patch_(p),
90  internalField_(iF)
91 {
92  if (dict.found("value"))
93  {
95  (
96  Field<Type>("value", dict, p.size())
97  );
98  }
99  else
100  {
102  }
103 }
104 
105 
106 template<class Type>
108 (
109  const fvsPatchField<Type>& ptf
110 )
111 :
112  Field<Type>(ptf),
113  patch_(ptf.patch_),
114  internalField_(ptf.internalField_)
115 {}
116 
117 
118 template<class Type>
120 (
121  const fvsPatchField<Type>& ptf,
123 )
124 :
125  Field<Type>(ptf),
126  patch_(ptf.patch_),
127  internalField_(iF)
128 {}
129 
130 
131 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
132 
133 template<class Type>
135 {
136  return patch_.boundaryMesh().mesh();
137 }
138 
139 
140 template<class Type>
142 {
143  if (&patch_ != &(ptf.patch_))
144  {
145  FatalErrorIn("PatchField<Type>::check(const fvsPatchField<Type>&)")
146  << "different patches for fvsPatchField<Type>s"
147  << abort(FatalError);
148  }
149 }
150 
151 
152 // Map from self
153 template<class Type>
155 (
156  const fvPatchFieldMapper& m
157 )
158 {
160 }
161 
162 
163 // Reverse-map the given fvsPatchField onto this fvsPatchField
164 template<class Type>
166 (
167  const fvsPatchField<Type>& ptf,
168  const labelList& addr
169 )
170 {
171  Field<Type>::rmap(ptf, addr);
172 }
173 
174 
175 // Write
176 template<class Type>
178 {
179  os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
180 }
181 
182 
183 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
184 
185 template<class Type>
187 (
188  const UList<Type>& ul
189 )
190 {
192 }
193 
194 
195 template<class Type>
197 (
198  const fvsPatchField<Type>& ptf
199 )
200 {
201  check(ptf);
203 }
204 
205 
206 template<class Type>
208 (
209  const fvsPatchField<Type>& ptf
210 )
211 {
212  check(ptf);
214 }
215 
216 
217 template<class Type>
219 (
220  const fvsPatchField<Type>& ptf
221 )
222 {
223  check(ptf);
225 }
226 
227 
228 template<class Type>
230 (
231  const fvsPatchField<scalar>& ptf
232 )
233 {
234  if (&patch_ != &ptf.patch())
235  {
237  (
238  "PatchField<Type>::operator*=(const fvsPatchField<scalar>& ptf)"
239  ) << "incompatible patches for patch fields"
240  << abort(FatalError);
241  }
242 
244 }
245 
246 
247 template<class Type>
249 (
250  const fvsPatchField<scalar>& ptf
251 )
252 {
253  if (&patch_ != &ptf.patch())
254  {
256  (
257  "PatchField<Type>::operator/=(const fvsPatchField<scalar>& ptf)"
258  ) << " incompatible patches for patch fields"
259  << abort(FatalError);
260  }
261 
263 }
264 
265 
266 template<class Type>
268 (
269  const Field<Type>& tf
270 )
271 {
273 }
274 
275 
276 template<class Type>
278 (
279  const Field<Type>& tf
280 )
281 {
283 }
284 
285 
286 template<class Type>
288 (
289  const scalarField& tf
290 )
291 {
293 }
294 
295 
296 template<class Type>
298 (
299  const scalarField& tf
300 )
301 {
303 }
304 
305 
306 template<class Type>
308 (
309  const Type& t
310 )
311 {
313 }
314 
315 
316 template<class Type>
318 (
319  const Type& t
320 )
321 {
323 }
324 
325 
326 template<class Type>
328 (
329  const Type& t
330 )
331 {
333 }
334 
335 
336 template<class Type>
338 (
339  const scalar s
340 )
341 {
343 }
344 
345 
346 template<class Type>
348 (
349  const scalar s
350 )
351 {
353 }
354 
355 
356 // Force an assignment, overriding fixedValue status
357 template<class Type>
359 (
360  const fvsPatchField<Type>& ptf
361 )
362 {
364 }
365 
366 
367 template<class Type>
369 (
370  const Field<Type>& tf
371 )
372 {
374 }
375 
376 
377 template<class Type>
379 (
380  const Type& t
381 )
382 {
384 }
385 
386 
387 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
388 
389 template<class Type>
390 Ostream& operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
391 {
392  ptf.write(os);
393 
394  os.check("Ostream& operator<<(Ostream&, const fvsPatchField<Type>&");
395 
396  return os;
397 }
398 
399 
400 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
401 
402 } // End namespace Foam
403 
404 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
405 
407 
408 // ************************ vim: set sw=4 sts=4 et: ************************ //