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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9  Copyright (C) 2017 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "IOobject.H"
30 #include "dictionary.H"
31 #include "fvMesh.H"
32 #include "surfaceMesh.H"
33 #include "fvPatchFieldMapper.H"
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
37 template<class Type>
39 (
40  const fvPatch& p,
42 )
43 :
44  Field<Type>(p.size()),
45  patch_(p),
46  internalField_(iF)
47 {}
48 
49 
50 template<class Type>
52 (
53  const fvPatch& p,
55  const Field<Type>& f
56 )
57 :
58  Field<Type>(f),
59  patch_(p),
60  internalField_(iF)
61 {}
62 
63 
64 template<class Type>
66 (
67  const fvsPatchField<Type>& ptf,
68  const fvPatch& p,
70  const fvPatchFieldMapper& mapper
71 )
72 :
73  Field<Type>(ptf, mapper),
74  patch_(p),
75  internalField_(iF)
76 {}
77 
78 
79 template<class Type>
81 (
82  const fvPatch& p,
84  const dictionary& dict
85 )
86 :
87  Field<Type>(p.size()),
88  patch_(p),
89  internalField_(iF)
90 {
91  if (dict.found("value"))
92  {
94  (
95  Field<Type>("value", dict, p.size())
96  );
97  }
98  else
99  {
101  << "Essential entry 'value' missing on patch " << p.name() << nl
102  << exit(FatalIOError);
103  }
104 }
105 
106 
107 template<class Type>
109 :
110  Field<Type>(ptf),
111  patch_(ptf.patch_),
112  internalField_(ptf.internalField_)
113 {}
114 
115 
116 template<class Type>
118 (
119  const fvsPatchField<Type>& ptf,
121 )
122 :
123  Field<Type>(ptf),
124  patch_(ptf.patch_),
125  internalField_(iF)
126 {}
127 
128 
129 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
130 
131 template<class Type>
133 {
134  return patch_.boundaryMesh().mesh();
135 }
136 
137 
138 template<class Type>
140 {
141  if (&patch_ != &(ptf.patch_))
142  {
144  << "different patches for fvsPatchField<Type>s"
145  << abort(FatalError);
146  }
147 }
148 
149 
150 template<class Type>
152 {
153  const bool oriented = internalField_.oriented()();
154  Field<Type>::autoMap(m, oriented);
155 }
156 
157 
158 template<class Type>
160 (
161  const fvsPatchField<Type>& ptf,
162  const labelList& addr
163 )
164 {
165  Field<Type>::rmap(ptf, addr);
166 }
167 
168 
169 template<class Type>
171 {
172  os.writeEntry("type", type());
173  this->writeEntry("value", os);
174 }
175 
176 
177 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
178 
179 template<class Type>
181 (
182  const UList<Type>& ul
183 )
184 {
186 }
187 
188 
189 template<class Type>
191 (
192  const fvsPatchField<Type>& ptf
193 )
194 {
195  check(ptf);
197 }
198 
199 
200 template<class Type>
202 (
203  const fvsPatchField<Type>& ptf
204 )
205 {
206  check(ptf);
208 }
209 
210 
211 template<class Type>
213 (
214  const fvsPatchField<Type>& ptf
215 )
216 {
217  check(ptf);
219 }
220 
221 
222 template<class Type>
224 (
225  const fvsPatchField<scalar>& ptf
226 )
227 {
228  if (&patch_ != &ptf.patch())
229  {
231  << "incompatible patches for patch fields"
232  << abort(FatalError);
233  }
234 
236 }
237 
238 
239 template<class Type>
241 (
242  const fvsPatchField<scalar>& ptf
243 )
244 {
245  if (&patch_ != &ptf.patch())
246  {
248  << abort(FatalError);
249  }
250 
252 }
253 
254 
255 template<class Type>
257 (
258  const Field<Type>& tf
259 )
260 {
262 }
263 
264 
265 template<class Type>
267 (
268  const Field<Type>& tf
269 )
270 {
272 }
273 
274 
275 template<class Type>
277 (
278  const scalarField& tf
279 )
280 {
282 }
283 
284 
285 template<class Type>
287 (
288  const scalarField& tf
289 )
290 {
292 }
293 
294 
295 template<class Type>
297 (
298  const Type& t
299 )
300 {
302 }
303 
304 
305 template<class Type>
307 (
308  const Type& t
309 )
310 {
312 }
313 
314 
315 template<class Type>
317 (
318  const Type& t
319 )
320 {
322 }
323 
324 
325 template<class Type>
327 (
328  const scalar s
329 )
330 {
332 }
333 
334 
335 template<class Type>
337 (
338  const scalar s
339 )
340 {
342 }
343 
344 
345 template<class Type>
347 (
348  const fvsPatchField<Type>& ptf
349 )
350 {
352 }
353 
354 
355 template<class Type>
357 (
358  const Field<Type>& tf
359 )
360 {
362 }
363 
364 
365 template<class Type>
367 (
368  const Type& t
369 )
370 {
372 }
373 
374 
375 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
376 
377 template<class Type>
379 {
380  ptf.write(os);
381 
383 
384  return os;
385 }
386 
387 
388 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
389 
390 #include "fvsPatchFieldNew.C"
391 
392 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Field::operator-=
void operator-=(const UList< Type > &)
Definition: Field.C:688
Foam::fvsPatchField::db
const objectRegistry & db() const
Return local objectRegistry.
Definition: fvsPatchField.C:132
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
Definition: gmvOutputSpray.H:25
Foam::Field::autoMap
void autoMap(const FieldMapper &map, const bool applyFlip=true)
Map from self.
Definition: Field.C:403
Foam::fvsPatchField
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:68
Foam::Field::operator+=
void operator+=(const UList< Type > &)
Definition: Field.C:687
Foam::FatalIOError
IOerror FatalIOError
fvPatchFieldMapper.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::check
static void check(const int retVal, const char *what)
Definition: ptscotchDecomp.C:80
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
fvsPatchFieldNew.C
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::Field::rmap
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
Definition: Field.C:466
IOobject.H
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:58
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
surfaceMesh.H
os
OBJstream os(runTime.globalPath()/outputName)
Foam::fvsPatchField::fvsPatchField
fvsPatchField(const fvPatch &, const DimensionedField< Type, surfaceMesh > &)
Construct from patch and internal field.
Definition: fvsPatchField.C:39
Foam::fvsPatchField::write
virtual void write(Ostream &) const
Write.
Definition: fvsPatchField.C:170
fvMesh.H
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::Field::operator=
void operator=(const Field< Type > &)
Copy assignment.
Definition: Field.C:635
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::Field::operator/=
void operator/=(const UList< scalar > &)
Definition: Field.C:690
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::fvsPatchField::patch
const fvPatch & patch() const
Return patch.
Definition: fvsPatchField.H:281
f
labelList f(nPoints)
Foam::List< label >
Foam::fvsPatchField::rmap
virtual void rmap(const fvsPatchField< Type > &, const labelList &)
Reverse map the given fvsPatchField onto this fvsPatchField.
Definition: fvsPatchField.C:160
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::UList< Type >
dictionary.H
Foam::Field::operator*=
void operator*=(const UList< scalar > &)
Definition: Field.C:689
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:295
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:236
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:473
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::fvsPatchField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: fvsPatchField.C:151
Foam::fvsPatchField::check
void check(const fvsPatchField< Type > &) const
Check fvsPatchField<Type> against given fvsPatchField<Type>
Definition: fvsPatchField.C:139
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54