All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2022 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,
110 )
111 :
112  Field<Type>(ptf),
113  patch_(ptf.patch_),
114  internalField_(iF)
115 {}
116 
117 
118 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
119 
120 template<class Type>
122 {
123  return patch_.boundaryMesh().mesh();
124 }
125 
126 
127 template<class Type>
129 {
130  if (&patch_ != &(ptf.patch_))
131  {
133  << "different patches for fvsPatchField<Type>s"
134  << abort(FatalError);
135  }
136 }
137 
138 
139 template<class Type>
141 (
142  const fvPatchFieldMapper& m
143 )
144 {
145  m(*this, *this);
146 }
147 
148 
149 template<class Type>
151 (
152  const fvsPatchField<Type>& ptf,
153  const labelList& addr
154 )
155 {
156  Field<Type>::rmap(ptf, addr);
157 }
158 
159 
160 template<class Type>
162 {
163  Field<Type>::reset(ptf);
164 }
165 
166 
167 template<class Type>
169 {
170  writeEntry(os, "type", type());
171 
172  if (overridesConstraint())
173  {
174  writeEntry(os, "patchType", patch().type());
175  }
176 
177  writeEntry(os, "value", *this);
178 }
179 
180 
181 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
182 
183 template<class Type>
184 void Foam::fvsPatchField<Type>::operator=
185 (
186  const UList<Type>& ul
187 )
188 {
190 }
191 
192 
193 template<class Type>
194 void Foam::fvsPatchField<Type>::operator=
195 (
196  const fvsPatchField<Type>& ptf
197 )
198 {
199  check(ptf);
201 }
202 
203 
204 template<class Type>
205 void Foam::fvsPatchField<Type>::operator+=
206 (
207  const fvsPatchField<Type>& ptf
208 )
209 {
210  check(ptf);
212 }
213 
214 
215 template<class Type>
216 void Foam::fvsPatchField<Type>::operator-=
217 (
218  const fvsPatchField<Type>& ptf
219 )
220 {
221  check(ptf);
223 }
224 
225 
226 template<class Type>
227 void Foam::fvsPatchField<Type>::operator*=
228 (
229  const fvsPatchField<scalar>& ptf
230 )
231 {
232  if (&patch_ != &ptf.patch())
233  {
235  << "incompatible patches for patch fields"
236  << abort(FatalError);
237  }
238 
240 }
241 
242 
243 template<class Type>
244 void Foam::fvsPatchField<Type>::operator/=
245 (
246  const fvsPatchField<scalar>& ptf
247 )
248 {
249  if (&patch_ != &ptf.patch())
250  {
252  << abort(FatalError);
253  }
254 
256 }
257 
258 
259 template<class Type>
260 void Foam::fvsPatchField<Type>::operator+=
261 (
262  const Field<Type>& tf
263 )
264 {
266 }
267 
268 
269 template<class Type>
270 void Foam::fvsPatchField<Type>::operator-=
271 (
272  const Field<Type>& tf
273 )
274 {
276 }
277 
278 
279 template<class Type>
280 void Foam::fvsPatchField<Type>::operator*=
281 (
282  const scalarField& tf
283 )
284 {
286 }
287 
288 
289 template<class Type>
290 void Foam::fvsPatchField<Type>::operator/=
291 (
292  const scalarField& tf
293 )
294 {
296 }
297 
298 
299 template<class Type>
300 void Foam::fvsPatchField<Type>::operator=
301 (
302  const Type& t
303 )
304 {
306 }
307 
308 
309 template<class Type>
310 void Foam::fvsPatchField<Type>::operator+=
311 (
312  const Type& t
313 )
314 {
316 }
317 
318 
319 template<class Type>
320 void Foam::fvsPatchField<Type>::operator-=
321 (
322  const Type& t
323 )
324 {
326 }
327 
328 
329 template<class Type>
330 void Foam::fvsPatchField<Type>::operator*=
331 (
332  const scalar s
333 )
334 {
336 }
337 
338 
339 template<class Type>
340 void Foam::fvsPatchField<Type>::operator/=
341 (
342  const scalar s
343 )
344 {
346 }
347 
348 
349 template<class Type>
350 void Foam::fvsPatchField<Type>::operator==
351 (
352  const fvsPatchField<Type>& ptf
353 )
354 {
356 }
357 
358 
359 template<class Type>
360 void Foam::fvsPatchField<Type>::operator==
361 (
362  const Field<Type>& tf
363 )
364 {
366 }
367 
368 
369 template<class Type>
370 void Foam::fvsPatchField<Type>::operator==
371 (
372  const Type& t
373 )
374 {
376 }
377 
378 
379 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
380 
381 template<class Type>
382 Foam::Ostream& Foam::operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
383 {
384  ptf.write(os);
385 
386  os.check("Ostream& operator<<(Ostream&, const fvsPatchField<Type>&");
387 
388  return os;
389 }
390 
391 
392 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
393 
394 #include "fvsPatchFieldNew.C"
395 
396 // ************************************************************************* //
virtual void reset(const fvsPatchField< Type > &)
Reset the fvsPatchField to the given fvsPatchField.
dictionary dict
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:663
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:156
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
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:157
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
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:318
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