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,
41  const DimensionedField<Type, surfaceMesh>& iF
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,
54  const DimensionedField<Type, surfaceMesh>& iF,
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,
69  const DimensionedField<Type, surfaceMesh>& iF,
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,
83  const DimensionedField<Type, surfaceMesh>& iF,
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>
108 Foam::fvsPatchField<Type>::fvsPatchField(const fvsPatchField<Type>& ptf)
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,
120  const DimensionedField<Type, surfaceMesh>& iF
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>
151 void Foam::fvsPatchField<Type>::autoMap(const fvPatchFieldMapper& m)
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>
378 Foam::Ostream& Foam::operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
379 {
380  ptf.write(os);
381 
382  os.check(FUNCTION_NAME);
383 
384  return os;
385 }
386 
387 
388 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
389 
390 #include "fvsPatchFieldNew.C"
391 
392 // ************************************************************************* //
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:46
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Field::operator-=
void operator-=(const UList< Type > &)
Foam::fvsPatchField::db
const objectRegistry & db() const
Definition: fvsPatchField.C:125
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)
Definition: Field.C:396
Foam::fvsPatchField< Type >::operator
friend Ostream & operator(Ostream &, const fvsPatchField< Type > &)
Foam::fvsPatchField< Type >
Foam::Field::operator+=
void operator+=(const UList< Type > &)
Foam::FatalIOError
IOerror FatalIOError
fvPatchFieldMapper.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:56
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Definition: boundaryPatch.C:76
Foam::check
static void check(const int retVal, const char *what)
Definition: ptscotchDecomp.C:73
Foam::Field
Generic templated field type.
Definition: Field.H:59
fvsPatchFieldNew.C
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::Field::rmap
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
Definition: Field.C:459
IOobject.H
Foam::IOstream::check
virtual bool check(const char *operation) const
Definition: IOstream.C:51
Foam::FatalError
error FatalError
surfaceMesh.H
os
OBJstream os(runTime.globalPath()/outputName)
Foam::fvsPatchField::fvsPatchField
fvsPatchField(const fvPatch &, const DimensionedField< Type, surfaceMesh > &)
Foam::fvsPatchField::write
virtual void write(Ostream &) const
Definition: fvsPatchField.C:163
Foam::Ostream::write
virtual bool write(const token &tok)=0
fvMesh.H
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:139
Foam::Field::operator=
void operator=(const Field< Type > &)
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
Foam::Field::operator/=
void operator/=(const UList< scalar > &)
FatalErrorInFunction
#define FatalErrorInFunction
Definition: error.H:465
Foam::nl
constexpr char nl
Definition: Ostream.H:424
Foam::fvsPatchField::patch
const fvPatch & patch() const
Definition: fvsPatchField.H:277
f
labelList f(nPoints)
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:58
Foam::fvsPatchField::rmap
virtual void rmap(const fvsPatchField< Type > &, const labelList &)
Definition: fvsPatchField.C:153
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Definition: POSIX.C:717
Foam::UList< Type >
dictionary.H
Foam::Field::operator*=
void operator*=(const UList< scalar > &)
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:302
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Definition: Ostream.H:232
Foam::roots::type
type
Definition: Roots.H:52
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Definition: error.H:494
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:41
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:52
Foam::fvsPatchField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Definition: fvsPatchField.C:144
Foam::fvsPatchField::check
void check(const fvsPatchField< Type > &) const
Definition: fvsPatchField.C:132