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-2021 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  writeEntry(os, "type", type());
164 
165  if (overridesConstraint())
166  {
167  writeEntry(os, "patchType", patch().type());
168  }
169 
170  writeEntry(os, "value", *this);
171 }
172 
173 
174 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
175 
176 template<class Type>
177 void Foam::fvsPatchField<Type>::operator=
178 (
179  const UList<Type>& ul
180 )
181 {
183 }
184 
185 
186 template<class Type>
187 void Foam::fvsPatchField<Type>::operator=
188 (
189  const fvsPatchField<Type>& ptf
190 )
191 {
192  check(ptf);
194 }
195 
196 
197 template<class Type>
198 void Foam::fvsPatchField<Type>::operator+=
199 (
200  const fvsPatchField<Type>& ptf
201 )
202 {
203  check(ptf);
205 }
206 
207 
208 template<class Type>
209 void Foam::fvsPatchField<Type>::operator-=
210 (
211  const fvsPatchField<Type>& ptf
212 )
213 {
214  check(ptf);
216 }
217 
218 
219 template<class Type>
220 void Foam::fvsPatchField<Type>::operator*=
221 (
222  const fvsPatchField<scalar>& ptf
223 )
224 {
225  if (&patch_ != &ptf.patch())
226  {
228  << "incompatible patches for patch fields"
229  << abort(FatalError);
230  }
231 
233 }
234 
235 
236 template<class Type>
237 void Foam::fvsPatchField<Type>::operator/=
238 (
239  const fvsPatchField<scalar>& ptf
240 )
241 {
242  if (&patch_ != &ptf.patch())
243  {
245  << abort(FatalError);
246  }
247 
249 }
250 
251 
252 template<class Type>
253 void Foam::fvsPatchField<Type>::operator+=
254 (
255  const Field<Type>& tf
256 )
257 {
259 }
260 
261 
262 template<class Type>
263 void Foam::fvsPatchField<Type>::operator-=
264 (
265  const Field<Type>& tf
266 )
267 {
269 }
270 
271 
272 template<class Type>
273 void Foam::fvsPatchField<Type>::operator*=
274 (
275  const scalarField& tf
276 )
277 {
279 }
280 
281 
282 template<class Type>
283 void Foam::fvsPatchField<Type>::operator/=
284 (
285  const scalarField& tf
286 )
287 {
289 }
290 
291 
292 template<class Type>
293 void Foam::fvsPatchField<Type>::operator=
294 (
295  const Type& t
296 )
297 {
299 }
300 
301 
302 template<class Type>
303 void Foam::fvsPatchField<Type>::operator+=
304 (
305  const Type& t
306 )
307 {
309 }
310 
311 
312 template<class Type>
313 void Foam::fvsPatchField<Type>::operator-=
314 (
315  const Type& t
316 )
317 {
319 }
320 
321 
322 template<class Type>
323 void Foam::fvsPatchField<Type>::operator*=
324 (
325  const scalar s
326 )
327 {
329 }
330 
331 
332 template<class Type>
333 void Foam::fvsPatchField<Type>::operator/=
334 (
335  const scalar s
336 )
337 {
339 }
340 
341 
342 template<class Type>
343 void Foam::fvsPatchField<Type>::operator==
344 (
345  const fvsPatchField<Type>& ptf
346 )
347 {
349 }
350 
351 
352 template<class Type>
353 void Foam::fvsPatchField<Type>::operator==
354 (
355  const Field<Type>& tf
356 )
357 {
359 }
360 
361 
362 template<class Type>
363 void Foam::fvsPatchField<Type>::operator==
364 (
365  const Type& t
366 )
367 {
369 }
370 
371 
372 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
373 
374 template<class Type>
375 Foam::Ostream& Foam::operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
376 {
377  ptf.write(os);
378 
379  os.check("Ostream& operator<<(Ostream&, const fvsPatchField<Type>&");
380 
381  return os;
382 }
383 
384 
385 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
386 
387 #include "fvsPatchFieldNew.C"
388 
389 // ************************************************************************* //
dictionary dict
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:643
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:323
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:62
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:156
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:335
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