Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
finiteVolume
fields
fvsPatchFields
fvsPatchField
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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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 <
OpenFOAM/IOobject.H
>
27
#include <
OpenFOAM/dictionary.H
>
28
#include <
finiteVolume/fvMesh.H
>
29
#include <
finiteVolume/fvPatchFieldMapper.H
>
30
31
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32
33
namespace
Foam
34
{
35
36
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37
38
template
<
class
Type>
39
fvsPatchField<Type>::fvsPatchField
40
(
41
const
fvPatch
&
p
,
42
const
DimensionedField<Type, surfaceMesh>
& iF
43
)
44
:
45
Field<Type>
(p.
size
()),
46
patch_(p),
47
internalField_(iF)
48
{}
49
50
51
template
<
class
Type>
52
fvsPatchField<Type>::fvsPatchField
53
(
54
const
fvPatch
& p,
55
const
DimensionedField<Type, surfaceMesh>
& iF,
56
const
Field<Type>
&
f
57
)
58
:
59
Field<Type>
(
f
),
60
patch_(p),
61
internalField_(iF)
62
{}
63
64
65
template
<
class
Type>
66
fvsPatchField<Type>::fvsPatchField
67
(
68
const
fvsPatchField<Type>
& ptf,
69
const
fvPatch
& p,
70
const
DimensionedField<Type, surfaceMesh>
& iF,
71
const
fvPatchFieldMapper
& mapper
72
)
73
:
74
Field<Type>
(ptf, mapper),
75
patch_(p),
76
internalField_(iF)
77
{}
78
79
80
template
<
class
Type>
81
fvsPatchField<Type>::fvsPatchField
82
(
83
const
fvPatch
& p,
84
const
DimensionedField<Type, surfaceMesh>
& iF,
85
const
dictionary
& dict
86
)
87
:
88
Field<Type>
(p.
size
()),
89
patch_(p),
90
internalField_(iF)
91
{
92
if
(dict.
found
(
"value"
))
93
{
94
fvsPatchField<Type>::operator
=
95
(
96
Field<Type>
(
"value"
, dict, p.
size
())
97
);
98
}
99
else
100
{
101
fvsPatchField<Type>::operator=
(
pTraits<Type>::zero
);
102
}
103
}
104
105
106
template
<
class
Type>
107
fvsPatchField<Type>::fvsPatchField
108
(
109
const
fvsPatchField<Type>
& ptf
110
)
111
:
112
Field<Type>
(ptf),
113
patch_(ptf.patch_),
114
internalField_(ptf.internalField_)
115
{}
116
117
118
template
<
class
Type>
119
fvsPatchField<Type>::fvsPatchField
120
(
121
const
fvsPatchField<Type>
& ptf,
122
const
DimensionedField<Type, surfaceMesh>
& iF
123
)
124
:
125
Field<Type>
(ptf),
126
patch_(ptf.patch_),
127
internalField_(iF)
128
{}
129
130
131
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
132
133
template
<
class
Type>
134
const
objectRegistry
&
fvsPatchField<Type>::db
()
const
135
{
136
return
patch_.boundaryMesh().mesh();
137
}
138
139
140
template
<
class
Type>
141
void
fvsPatchField<Type>::check
(
const
fvsPatchField<Type>
& ptf)
const
142
{
143
if
(&patch_ != &(ptf.patch_))
144
{
145
FatalErrorIn
(
"PatchField<Type>::check(const fvsPatchField<Type>&)"
)
146
<<
"different patches for fvsPatchField<Type>s"
147
<<
abort
(
FatalError
);
148
}
149
}
150
151
152
// Map from self
153
template
<
class
Type>
154
void
fvsPatchField<Type>::autoMap
155
(
156
const
fvPatchFieldMapper
& m
157
)
158
{
159
Field<Type>::autoMap
(m);
160
}
161
162
163
// Reverse-map the given fvsPatchField onto this fvsPatchField
164
template
<
class
Type>
165
void
fvsPatchField<Type>::rmap
166
(
167
const
fvsPatchField<Type>
& ptf,
168
const
labelList
& addr
169
)
170
{
171
Field<Type>::rmap
(ptf, addr);
172
}
173
174
175
// Write
176
template
<
class
Type>
177
void
fvsPatchField<Type>::write
(
Ostream
& os)
const
178
{
179
os.
writeKeyword
(
"type"
) <<
type
() <<
token::END_STATEMENT
<<
nl
;
180
}
181
182
183
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
184
185
template
<
class
Type>
186
void
fvsPatchField<Type>::operator
=
187
(
188
const
UList<Type>
& ul
189
)
190
{
191
Field<Type>::operator=
(ul);
192
}
193
194
195
template
<
class
Type>
196
void
fvsPatchField<Type>::operator
=
197
(
198
const
fvsPatchField<Type>
& ptf
199
)
200
{
201
check(ptf);
202
Field<Type>::operator=
(ptf);
203
}
204
205
206
template
<
class
Type>
207
void
fvsPatchField<Type>::operator
+=
208
(
209
const
fvsPatchField<Type>
& ptf
210
)
211
{
212
check(ptf);
213
Field<Type>::operator+=
(ptf);
214
}
215
216
217
template
<
class
Type>
218
void
fvsPatchField<Type>::operator
-=
219
(
220
const
fvsPatchField<Type>
& ptf
221
)
222
{
223
check(ptf);
224
Field<Type>::operator-=
(ptf);
225
}
226
227
228
template
<
class
Type>
229
void
fvsPatchField<Type>::operator
*=
230
(
231
const
fvsPatchField<scalar>
& ptf
232
)
233
{
234
if
(&patch_ != &ptf.
patch
())
235
{
236
FatalErrorIn
237
(
238
"PatchField<Type>::operator*=(const fvsPatchField<scalar>& ptf)"
239
) <<
"incompatible patches for patch fields"
240
<<
abort
(
FatalError
);
241
}
242
243
Field<Type>::operator*=
(ptf);
244
}
245
246
247
template
<
class
Type>
248
void
fvsPatchField<Type>::operator
/=
249
(
250
const
fvsPatchField<scalar>
& ptf
251
)
252
{
253
if
(&patch_ != &ptf.
patch
())
254
{
255
FatalErrorIn
256
(
257
"PatchField<Type>::operator/=(const fvsPatchField<scalar>& ptf)"
258
) <<
" incompatible patches for patch fields"
259
<<
abort
(
FatalError
);
260
}
261
262
Field<Type>::operator/=
(ptf);
263
}
264
265
266
template
<
class
Type>
267
void
fvsPatchField<Type>::operator
+=
268
(
269
const
Field<Type>
&
tf
270
)
271
{
272
Field<Type>::operator+=
(
tf
);
273
}
274
275
276
template
<
class
Type>
277
void
fvsPatchField<Type>::operator
-=
278
(
279
const
Field<Type>
&
tf
280
)
281
{
282
Field<Type>::operator-=
(
tf
);
283
}
284
285
286
template
<
class
Type>
287
void
fvsPatchField<Type>::operator
*=
288
(
289
const
scalarField
&
tf
290
)
291
{
292
Field<Type>::operator*=
(
tf
);
293
}
294
295
296
template
<
class
Type>
297
void
fvsPatchField<Type>::operator
/=
298
(
299
const
scalarField
&
tf
300
)
301
{
302
Field<Type>::operator/=
(
tf
);
303
}
304
305
306
template
<
class
Type>
307
void
fvsPatchField<Type>::operator
=
308
(
309
const
Type& t
310
)
311
{
312
Field<Type>::operator=
(t);
313
}
314
315
316
template
<
class
Type>
317
void
fvsPatchField<Type>::operator
+=
318
(
319
const
Type& t
320
)
321
{
322
Field<Type>::operator+=
(t);
323
}
324
325
326
template
<
class
Type>
327
void
fvsPatchField<Type>::operator
-=
328
(
329
const
Type& t
330
)
331
{
332
Field<Type>::operator-=
(t);
333
}
334
335
336
template
<
class
Type>
337
void
fvsPatchField<Type>::operator
*=
338
(
339
const
scalar s
340
)
341
{
342
Field<Type>::operator*=
(s);
343
}
344
345
346
template
<
class
Type>
347
void
fvsPatchField<Type>::operator
/=
348
(
349
const
scalar s
350
)
351
{
352
Field<Type>::operator/=
(s);
353
}
354
355
356
// Force an assignment, overriding fixedValue status
357
template
<
class
Type>
358
void
fvsPatchField<Type>::operator
==
359
(
360
const
fvsPatchField<Type>
& ptf
361
)
362
{
363
Field<Type>::operator=
(ptf);
364
}
365
366
367
template
<
class
Type>
368
void
fvsPatchField<Type>::operator
==
369
(
370
const
Field<Type>
&
tf
371
)
372
{
373
Field<Type>::operator=
(
tf
);
374
}
375
376
377
template
<
class
Type>
378
void
fvsPatchField<Type>::operator
==
379
(
380
const
Type& t
381
)
382
{
383
Field<Type>::operator=
(t);
384
}
385
386
387
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
388
389
template
<
class
Type>
390
Ostream
& operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
391
{
392
ptf.
write
(os);
393
394
os.check(
"Ostream& operator<<(Ostream&, const fvsPatchField<Type>&"
);
395
396
return
os;
397
}
398
399
400
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
401
402
}
// End namespace Foam
403
404
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
405
406
# include <
finiteVolume/newFvsPatchField.C
>
407
408
// ************************ vim: set sw=4 sts=4 et: ************************ //