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
OpenFOAM
fields
pointPatchFields
basic
value
valuePointPatchField.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 "
valuePointPatchField.H
"
27
#include <
OpenFOAM/pointPatchFieldMapper.H
>
28
29
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30
31
namespace
Foam
32
{
33
34
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
35
36
template
<
class
Type>
37
void
valuePointPatchField<Type>::checkFieldSize()
const
38
{
39
if
(size() != this->patch().size())
40
{
41
FatalErrorIn
42
(
43
"void valuePointPatchField<Type>::checkField() const"
44
) <<
"field does not correspond to patch. "
<<
endl
45
<<
"Field size: "
<< size() <<
" patch size: "
46
<< this->patch().size()
47
<<
abort
(
FatalError
);
48
}
49
}
50
51
52
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
53
54
template
<
class
Type>
55
valuePointPatchField<Type>::valuePointPatchField
56
(
57
const
pointPatch
&
p
,
58
const
DimensionedField<Type, pointMesh>
& iF
59
)
60
:
61
pointPatchField<Type>
(
p
, iF),
62
Field<Type>
(p.
size
())
63
{}
64
65
66
template
<
class
Type>
67
valuePointPatchField<Type>::valuePointPatchField
68
(
69
const
pointPatch
& p,
70
const
DimensionedField<Type, pointMesh>
& iF,
71
const
dictionary
& dict,
72
const
bool
valueRequired
73
)
74
:
75
pointPatchField<Type>
(
p
, iF, dict),
76
Field<Type>
(p.
size
())
77
{
78
if
(dict.
found
(
"value"
))
79
{
80
Field<Type>::operator
=
81
(
82
Field<Type>
(
"value"
, dict, p.
size
())
83
);
84
}
85
else
if
(!valueRequired)
86
{
87
Field<Type>::operator=
(
pTraits<Type>::zero
);
88
}
89
else
90
{
91
FatalIOErrorIn
92
(
93
"pointPatchField<Type>::pointPatchField"
94
"("
95
"const fvPatch& p,"
96
"const DimensionedField<Type, pointMesh>& iF,"
97
"const dictionary& dict,"
98
"const bool valueRequired"
99
")"
,
100
dict
101
) <<
"Essential entry 'value' missing"
102
<<
exit
(
FatalIOError
);
103
}
104
}
105
106
107
template
<
class
Type>
108
valuePointPatchField<Type>::valuePointPatchField
109
(
110
const
valuePointPatchField<Type>
& ptf,
111
const
pointPatch
& p,
112
const
DimensionedField<Type, pointMesh>
& iF,
113
const
pointPatchFieldMapper
& mapper
114
)
115
:
116
pointPatchField<Type>
(
p
, iF),
117
Field<Type>
(ptf, mapper)
118
{}
119
120
121
template
<
class
Type>
122
valuePointPatchField<Type>::valuePointPatchField
123
(
124
const
valuePointPatchField<Type>
& ptf,
125
const
DimensionedField<Type, pointMesh>
& iF
126
)
127
:
128
pointPatchField<Type>
(ptf, iF),
129
Field<Type>
(ptf)
130
{}
131
132
133
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
134
135
template
<
class
Type>
136
void
valuePointPatchField<Type>::autoMap
137
(
138
const
pointPatchFieldMapper
& m
139
)
140
{
141
Field<Type>::autoMap
(m);
142
}
143
144
145
template
<
class
Type>
146
void
valuePointPatchField<Type>::rmap
147
(
148
const
pointPatchField<Type>
& ptf,
149
const
labelList
& addr
150
)
151
{
152
Field<Type>::rmap
153
(
154
refCast
<
const
valuePointPatchField<Type>
>
155
(
156
ptf
157
),
158
addr
159
);
160
}
161
162
163
template
<
class
Type>
164
void
valuePointPatchField<Type>::updateCoeffs
()
165
{
166
if
(this->updated())
167
{
168
return
;
169
}
170
171
// Get internal field to insert values into
172
Field<Type>
& iF =
const_cast<
Field<Type>
&
>
(this->internalField());
173
174
setInInternalField(iF, *
this
);
175
176
pointPatchField<Type>::updateCoeffs
();
177
}
178
179
180
template
<
class
Type>
181
void
valuePointPatchField<Type>::evaluate
(
const
Pstream::commsTypes
)
182
{
183
// Get internal field to insert values into
184
Field<Type>
& iF =
const_cast<
Field<Type>
&
>
(this->internalField());
185
186
setInInternalField(iF, *
this
);
187
188
pointPatchField<Type>::evaluate
();
189
}
190
191
192
template
<
class
Type>
193
void
valuePointPatchField<Type>::write
(
Ostream
& os)
const
194
{
195
pointPatchField<Type>::write
(os);
196
this->writeEntry(
"value"
, os);
197
}
198
199
200
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
201
202
template
<
class
Type>
203
void
valuePointPatchField<Type>::operator
=
204
(
205
const
valuePointPatchField<Type>
& ptf
206
)
207
{
208
Field<Type>::operator=
(ptf);
209
}
210
211
212
template
<
class
Type>
213
void
valuePointPatchField<Type>::operator
=
214
(
215
const
pointPatchField<Type>
& ptf
216
)
217
{
218
Field<Type>::operator=
(ptf.
patchInternalField
());
219
}
220
221
222
template
<
class
Type>
223
void
valuePointPatchField<Type>::operator
=
224
(
225
const
Field<Type>
&
tf
226
)
227
{
228
Field<Type>::operator=
(
tf
);
229
}
230
231
232
template
<
class
Type>
233
void
valuePointPatchField<Type>::operator
=
234
(
235
const
Type& t
236
)
237
{
238
Field<Type>::operator=
(t);
239
}
240
241
242
// Force an assignment
243
template
<
class
Type>
244
void
valuePointPatchField<Type>::operator
==
245
(
246
const
valuePointPatchField<Type>
& ptf
247
)
248
{
249
Field<Type>::operator=
(ptf);
250
}
251
252
253
template
<
class
Type>
254
void
valuePointPatchField<Type>::operator
==
255
(
256
const
pointPatchField<Type>
& ptf
257
)
258
{
259
Field<Type>::operator=
(ptf.
patchInternalField
());
260
}
261
262
263
template
<
class
Type>
264
void
valuePointPatchField<Type>::operator
==
265
(
266
const
Field<Type>
&
tf
267
)
268
{
269
Field<Type>::operator=
(
tf
);
270
}
271
272
273
template
<
class
Type>
274
void
valuePointPatchField<Type>::operator
==
275
(
276
const
Type& t
277
)
278
{
279
Field<Type>::operator=
(t);
280
}
281
282
283
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
284
285
}
// End namespace Foam
286
287
// ************************ vim: set sw=4 sts=4 et: ************************ //