fvsPatchField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class Type>
35 (
36  const fvPatch& p,
38 )
39 :
40  Field<Type>(p.size()),
41  patch_(p),
42  internalField_(iF)
43 {}
44 
45 
46 template<class Type>
48 (
49  const fvPatch& p,
51  const Field<Type>& f
52 )
53 :
54  Field<Type>(f),
55  patch_(p),
56  internalField_(iF)
57 {}
58 
59 
60 template<class Type>
62 (
63  const fvsPatchField<Type>& ptf,
64  const fvPatch& p,
66  const fvPatchFieldMapper& mapper
67 )
68 :
69  Field<Type>(mapper(ptf)),
70  patch_(p),
71  internalField_(iF)
72 {}
73 
74 
75 template<class Type>
77 (
78  const fvPatch& p,
80  const dictionary& dict
81 )
82 :
83  Field<Type>(p.size()),
84  patch_(p),
85  internalField_(iF)
86 {
87  if (dict.found("value"))
88  {
90  (
91  Field<Type>("value", dict, p.size())
92  );
93  }
94  else
95  {
97  (
98  dict
99  ) << "essential value entry not provided"
100  << exit(FatalIOError);
101  }
102 }
103 
104 
105 template<class Type>
107 (
108  const fvsPatchField<Type>& ptf
109 )
110 :
111  Field<Type>(ptf),
112  patch_(ptf.patch_),
113  internalField_(ptf.internalField_)
114 {}
115 
116 
117 template<class Type>
119 (
120  const fvsPatchField<Type>& ptf,
122 )
123 :
124  Field<Type>(ptf),
125  patch_(ptf.patch_),
126  internalField_(iF)
127 {}
128 
129 
130 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
131 
132 template<class Type>
134 {
135  return patch_.boundaryMesh().mesh();
136 }
137 
138 
139 template<class Type>
141 {
142  if (&patch_ != &(ptf.patch_))
143  {
145  << "different patches for fvsPatchField<Type>s"
146  << abort(FatalError);
147  }
148 }
149 
150 
151 template<class Type>
153 (
154  const fvPatchFieldMapper& m
155 )
156 {
157  m(*this, *this);
158 }
159 
160 
161 template<class Type>
163 (
164  const fvsPatchField<Type>& ptf,
165  const labelList& addr
166 )
167 {
168  Field<Type>::rmap(ptf, addr);
169 }
170 
171 
172 template<class Type>
174 {
175  writeEntry(os, "type", type());
176  writeEntry(os, "value", *this);
177 }
178 
179 
180 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
181 
182 template<class Type>
183 void Foam::fvsPatchField<Type>::operator=
184 (
185  const UList<Type>& ul
186 )
187 {
189 }
190 
191 
192 template<class Type>
193 void Foam::fvsPatchField<Type>::operator=
194 (
195  const fvsPatchField<Type>& ptf
196 )
197 {
198  check(ptf);
200 }
201 
202 
203 template<class Type>
204 void Foam::fvsPatchField<Type>::operator+=
205 (
206  const fvsPatchField<Type>& ptf
207 )
208 {
209  check(ptf);
211 }
212 
213 
214 template<class Type>
215 void Foam::fvsPatchField<Type>::operator-=
216 (
217  const fvsPatchField<Type>& ptf
218 )
219 {
220  check(ptf);
222 }
223 
224 
225 template<class Type>
226 void Foam::fvsPatchField<Type>::operator*=
227 (
228  const fvsPatchField<scalar>& ptf
229 )
230 {
231  if (&patch_ != &ptf.patch())
232  {
234  << "incompatible patches for patch fields"
235  << abort(FatalError);
236  }
237 
239 }
240 
241 
242 template<class Type>
243 void Foam::fvsPatchField<Type>::operator/=
244 (
245  const fvsPatchField<scalar>& ptf
246 )
247 {
248  if (&patch_ != &ptf.patch())
249  {
251  << abort(FatalError);
252  }
253 
255 }
256 
257 
258 template<class Type>
259 void Foam::fvsPatchField<Type>::operator+=
260 (
261  const Field<Type>& tf
262 )
263 {
265 }
266 
267 
268 template<class Type>
269 void Foam::fvsPatchField<Type>::operator-=
270 (
271  const Field<Type>& tf
272 )
273 {
275 }
276 
277 
278 template<class Type>
279 void Foam::fvsPatchField<Type>::operator*=
280 (
281  const scalarField& tf
282 )
283 {
285 }
286 
287 
288 template<class Type>
289 void Foam::fvsPatchField<Type>::operator/=
290 (
291  const scalarField& tf
292 )
293 {
295 }
296 
297 
298 template<class Type>
299 void Foam::fvsPatchField<Type>::operator=
300 (
301  const Type& t
302 )
303 {
305 }
306 
307 
308 template<class Type>
309 void Foam::fvsPatchField<Type>::operator+=
310 (
311  const Type& t
312 )
313 {
315 }
316 
317 
318 template<class Type>
319 void Foam::fvsPatchField<Type>::operator-=
320 (
321  const Type& t
322 )
323 {
325 }
326 
327 
328 template<class Type>
329 void Foam::fvsPatchField<Type>::operator*=
330 (
331  const scalar s
332 )
333 {
335 }
336 
337 
338 template<class Type>
339 void Foam::fvsPatchField<Type>::operator/=
340 (
341  const scalar s
342 )
343 {
345 }
346 
347 
348 template<class Type>
349 void Foam::fvsPatchField<Type>::operator==
350 (
351  const fvsPatchField<Type>& ptf
352 )
353 {
355 }
356 
357 
358 template<class Type>
359 void Foam::fvsPatchField<Type>::operator==
360 (
361  const Field<Type>& tf
362 )
363 {
365 }
366 
367 
368 template<class Type>
369 void Foam::fvsPatchField<Type>::operator==
370 (
371  const Type& t
372 )
373 {
375 }
376 
377 
378 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
379 
380 template<class Type>
381 Foam::Ostream& Foam::operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
382 {
383  ptf.write(os);
384 
385  os.check("Ostream& operator<<(Ostream&, const fvsPatchField<Type>&");
386 
387  return os;
388 }
389 
390 
391 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
392 
393 #include "fvsPatchFieldNew.C"
394 
395 // ************************************************************************* //
dictionary dict
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:438
virtual void write(Ostream &) const
Write.
const objectRegistry & db() const
Return local objectRegistry.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
const tensorField & tf
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))
Pre-declare SubField and related Field type.
Definition: Field.H:56
void check(const fvsPatchField< Type > &) const
Check fvsPatchField<Type> against given fvsPatchField<Type>
Foam::fvPatchFieldMapper.
fvsPatchField(const fvPatch &, const DimensionedField< Type, surfaceMesh > &)
Construct from patch and internal field.
Definition: fvsPatchField.C:35
errorManip< error > abort(error &err)
Definition: errorManip.H:131
virtual label size() const
Return size.
Definition: fvPatch.H:155
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual void rmap(const fvsPatchField< Type > &, const labelList &)
Reverse map the given fvsPatchField onto this fvsPatchField.
labelList f(nPoints)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
const fvPatch & patch() const
Return patch.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:331
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Registry of regIOobjects.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:65
IOerror FatalIOError