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) 2011 OpenFOAM Foundation
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 "IOobject.H"
27 #include "dictionary.H"
28 #include "fvMesh.H"
29 #include "fvPatchFieldMapper.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  "fvsPatchField<Type>::fvsPatchField\n"
104  "(\n"
105  " const fvPatch& p,\n"
106  " const DimensionedField<Type, surfaceMesh>& iF,\n"
107  " const dictionary& dict\n"
108  ")\n",
109  dict
110  ) << "essential value entry not provided"
111  << exit(FatalIOError);
112  }
113 }
114 
115 
116 template<class Type>
118 (
119  const fvsPatchField<Type>& ptf
120 )
121 :
122  Field<Type>(ptf),
123  patch_(ptf.patch_),
124  internalField_(ptf.internalField_)
125 {}
126 
127 
128 template<class Type>
130 (
131  const fvsPatchField<Type>& ptf,
133 )
134 :
135  Field<Type>(ptf),
136  patch_(ptf.patch_),
137  internalField_(iF)
138 {}
139 
140 
141 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
142 
143 template<class Type>
145 {
146  return patch_.boundaryMesh().mesh();
147 }
148 
149 
150 template<class Type>
152 {
153  if (&patch_ != &(ptf.patch_))
154  {
155  FatalErrorIn("PatchField<Type>::check(const fvsPatchField<Type>&)")
156  << "different patches for fvsPatchField<Type>s"
157  << abort(FatalError);
158  }
159 }
160 
161 
162 // Map from self
163 template<class Type>
165 (
166  const fvPatchFieldMapper& m
167 )
168 {
170 }
171 
172 
173 // Reverse-map the given fvsPatchField onto this fvsPatchField
174 template<class Type>
176 (
177  const fvsPatchField<Type>& ptf,
178  const labelList& addr
179 )
180 {
181  Field<Type>::rmap(ptf, addr);
182 }
183 
184 
185 // Write
186 template<class Type>
188 {
189  os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
190  this->writeEntry("value", os);
191 }
192 
193 
194 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
195 
196 template<class Type>
198 (
199  const UList<Type>& ul
200 )
201 {
203 }
204 
205 
206 template<class Type>
207 void fvsPatchField<Type>::operator=
208 (
209  const fvsPatchField<Type>& ptf
210 )
211 {
212  check(ptf);
214 }
215 
216 
217 template<class Type>
218 void fvsPatchField<Type>::operator+=
219 (
220  const fvsPatchField<Type>& ptf
221 )
222 {
223  check(ptf);
225 }
226 
227 
228 template<class Type>
229 void fvsPatchField<Type>::operator-=
230 (
231  const fvsPatchField<Type>& ptf
232 )
233 {
234  check(ptf);
236 }
237 
238 
239 template<class Type>
240 void fvsPatchField<Type>::operator*=
241 (
242  const fvsPatchField<scalar>& ptf
243 )
244 {
245  if (&patch_ != &ptf.patch())
246  {
248  (
249  "PatchField<Type>::operator*=(const fvsPatchField<scalar>& ptf)"
250  ) << "incompatible patches for patch fields"
251  << abort(FatalError);
252  }
253 
255 }
256 
257 
258 template<class Type>
259 void fvsPatchField<Type>::operator/=
260 (
261  const fvsPatchField<scalar>& ptf
262 )
263 {
264  if (&patch_ != &ptf.patch())
265  {
267  (
268  "PatchField<Type>::operator/=(const fvsPatchField<scalar>& ptf)"
269  ) << " incompatible patches for patch fields"
270  << abort(FatalError);
271  }
272 
274 }
275 
276 
277 template<class Type>
278 void fvsPatchField<Type>::operator+=
279 (
280  const Field<Type>& tf
281 )
282 {
284 }
285 
286 
287 template<class Type>
288 void fvsPatchField<Type>::operator-=
289 (
290  const Field<Type>& tf
291 )
292 {
294 }
295 
296 
297 template<class Type>
298 void fvsPatchField<Type>::operator*=
299 (
300  const scalarField& tf
301 )
302 {
304 }
305 
306 
307 template<class Type>
308 void fvsPatchField<Type>::operator/=
309 (
310  const scalarField& tf
311 )
312 {
314 }
315 
316 
317 template<class Type>
318 void fvsPatchField<Type>::operator=
319 (
320  const Type& t
321 )
322 {
324 }
325 
326 
327 template<class Type>
328 void fvsPatchField<Type>::operator+=
329 (
330  const Type& t
331 )
332 {
334 }
335 
336 
337 template<class Type>
338 void fvsPatchField<Type>::operator-=
339 (
340  const Type& t
341 )
342 {
344 }
345 
346 
347 template<class Type>
348 void fvsPatchField<Type>::operator*=
349 (
350  const scalar s
351 )
352 {
354 }
355 
356 
357 template<class Type>
358 void fvsPatchField<Type>::operator/=
359 (
360  const scalar s
361 )
362 {
364 }
365 
366 
367 // Force an assignment, overriding fixedValue status
368 template<class Type>
369 void fvsPatchField<Type>::operator==
370 (
371  const fvsPatchField<Type>& ptf
372 )
373 {
375 }
376 
377 
378 template<class Type>
379 void fvsPatchField<Type>::operator==
380 (
381  const Field<Type>& tf
382 )
383 {
385 }
386 
387 
388 template<class Type>
389 void fvsPatchField<Type>::operator==
390 (
391  const Type& t
392 )
393 {
395 }
396 
397 
398 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
399 
400 template<class Type>
401 Ostream& operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
402 {
403  ptf.write(os);
404 
405  os.check("Ostream& operator<<(Ostream&, const fvsPatchField<Type>&");
406 
407  return os;
408 }
409 
410 
411 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
412 
413 } // End namespace Foam
414 
415 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
416 
417 # include "fvsPatchFieldNew.C"
418 
419 // ************************************************************************* //
void check(const fvsPatchField< Type > &) const
Check fvsPatchField<Type> against given fvsPatchField<Type>
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:306
void operator+=(const UList< Type > &)
Definition: Field.C:752
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject( name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE ))
labelList f(nPoints)
const fvPatch & patch() const
Return patch.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::fvPatchFieldMapper.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
dictionary dict
static const char nl
Definition: Ostream.H:260
void operator*=(const UList< scalar > &)
Definition: Field.C:754
IOerror FatalIOError
void autoMap(const FieldMapper &map)
Map from self.
Definition: Field.C:479
void operator=(const Field< Type > &)
Definition: Field.C:672
virtual void write(Ostream &) const
Write.
const objectRegistry & db() const
Return local objectRegistry.
fvsPatchField(const fvPatch &, const DimensionedField< Type, surfaceMesh > &)
Construct from patch and internal field.
Definition: fvsPatchField.C:40
Pre-declare SubField and related Field type.
Definition: Field.H:57
errorManip< error > abort(error &err)
Definition: errorManip.H:131
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:589
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:59
void operator-=(const UList< Type > &)
Definition: Field.C:753
const tensorField & tf
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
virtual void rmap(const fvsPatchField< Type > &, const labelList &)
Reverse map the given fvsPatchField onto this fvsPatchField.
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
Definition: Field.C:505
error FatalError
Registry of regIOobjects.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
void operator/=(const UList< scalar > &)
Definition: Field.C:755
virtual label size() const
Return size.
Definition: fvPatch.H:161
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:325
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:65