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
DimensionedFields
DimensionedField
DimensionedField.H
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
Class
25
Foam::DimensionedField
26
27
Description
28
Field with dimensions and associated with geometry type GeoMesh which is
29
used to size the field and a reference to it is maintained.
30
31
SourceFiles
32
DimensionedFieldI.H
33
DimensionedField.C
34
DimensionedFieldIO.C
35
36
\*---------------------------------------------------------------------------*/
37
38
#ifndef DimensionedField_H
39
#define DimensionedField_H
40
41
#include <
OpenFOAM/regIOobject.H
>
42
#include <
OpenFOAM/Field.H
>
43
#include <
OpenFOAM/dimensionedType.H
>
44
45
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47
namespace
Foam
48
{
49
50
// Forward declaration of friend functions and operators
51
52
template
<
class
Type,
class
GeoMesh>
class
DimensionedField;
53
54
template
<
class
Type,
class
GeoMesh> Ostream&
operator
<<
55
(
56
Ostream&,
57
const
DimensionedField<Type, GeoMesh>&
58
);
59
60
template
<
class
Type,
class
GeoMesh> Ostream&
operator
<<
61
(
62
Ostream&,
63
const
tmp<DimensionedField<Type, GeoMesh> >&
64
);
65
66
67
/*---------------------------------------------------------------------------*\
68
Class DimensionedField Declaration
69
\*---------------------------------------------------------------------------*/
70
71
template
<
class
Type,
class
GeoMesh>
72
class
DimensionedField
73
:
74
public
regIOobject
,
75
public
Field
<Type>
76
{
77
78
public
:
79
80
// Public typedefs
81
82
typedef
typename
GeoMesh::Mesh
Mesh
;
83
typedef
typename
Field<Type>::cmptType
cmptType
;
84
85
86
private
:
87
88
// Private data
89
90
//- Reference to mesh
91
const
Mesh
& mesh_;
92
93
//- Dimension set for this field
94
dimensionSet
dimensions_;
95
96
97
public
:
98
99
//- Runtime type information
100
TypeName
(
"DimensionedField"
);
101
102
// Static Member Functions
103
104
//- Return a null DimensionedField
105
inline
static
const
DimensionedField<Type, GeoMesh>
&
null
();
106
107
108
// Constructors
109
110
//- Construct from components
111
DimensionedField
112
(
113
const
IOobject
&,
114
const
Mesh
&
mesh
,
115
const
dimensionSet
&,
116
const
Field<Type>
&
117
);
118
119
//- Construct from components
120
// Used for temporary fields which are initialised after construction
121
DimensionedField
122
(
123
const
IOobject
&,
124
const
Mesh
&
mesh
,
125
const
dimensionSet
&
126
);
127
128
//- Construct from components
129
DimensionedField
130
(
131
const
IOobject
&,
132
const
Mesh
&
mesh
,
133
const
dimensioned<Type>
&
134
);
135
136
//- Construct from Istream
137
DimensionedField
138
(
139
const
IOobject
&,
140
const
Mesh
&
mesh
,
141
const
word
& fieldDictEntry=
"value"
142
);
143
144
void
readField
145
(
146
const
dictionary
& fieldDict,
147
const
word
& fieldDictEntry=
"value"
148
);
149
150
//- Construct as copy
151
DimensionedField
152
(
153
const
DimensionedField<Type, GeoMesh>
&
154
);
155
156
//- Construct as copy or re-use as specified.
157
DimensionedField
158
(
159
DimensionedField<Type, GeoMesh>
&,
160
bool
reUse
161
);
162
163
//- Construct by transferring the DimensionedField
164
DimensionedField
165
(
166
const
Xfer
<
DimensionedField<Type, GeoMesh>
>&
167
);
168
169
//- Construct as copy of tmp<DimensionedField> deleting argument
170
# ifdef ConstructFromTmp
171
DimensionedField
172
(
173
const
tmp
<
DimensionedField<Type, GeoMesh>
>&
174
);
175
# endif
176
177
//- Construct as copy resetting IO parameters
178
DimensionedField
179
(
180
const
IOobject
&,
181
const
DimensionedField<Type, GeoMesh>
&
182
);
183
184
//- Construct as copy resetting name
185
DimensionedField
186
(
187
const
word
& newName,
188
const
DimensionedField<Type, GeoMesh>
&
189
);
190
191
//- Construct as copy resetting name and re-use as specified.
192
DimensionedField
193
(
194
const
word
& newName,
195
DimensionedField<Type, GeoMesh>
&,
196
bool
reUse
197
);
198
199
//- Construct by transferring the DimensionedField with a new name
200
DimensionedField
201
(
202
const
word
& newName,
203
const
Xfer
<
DimensionedField<Type, GeoMesh>
>&
204
);
205
206
//- Construct as copy resetting name
207
# ifdef ConstructFromTmp
208
DimensionedField
209
(
210
const
word
& newName,
211
const
tmp
<
DimensionedField<Type, GeoMesh>
>&
212
);
213
# endif
214
215
//- Clone
216
tmp<DimensionedField<Type, GeoMesh>
>
clone
()
const
;
217
218
219
//- Destructor
220
virtual
~DimensionedField
();
221
222
223
// Member Functions
224
225
//- Return mesh
226
inline
const
Mesh
&
mesh
()
const
;
227
228
//- Return dimensions
229
inline
const
dimensionSet
&
dimensions
()
const
;
230
231
//- Return non-const access to dimensions
232
inline
dimensionSet
&
dimensions
();
233
234
inline
const
Field<Type>
&
field
()
const
;
235
236
inline
Field<Type>
&
field
();
237
238
//- Return a component field of the field
239
tmp<DimensionedField<cmptType, GeoMesh>
>
component
240
(
241
const
direction
242
)
const
;
243
244
//- Replace a component field of the field
245
void
replace
246
(
247
const
direction
,
248
const
DimensionedField<cmptType, GeoMesh>
&
249
);
250
251
//- Replace a component field of the field
252
void
replace
253
(
254
const
direction
,
255
const
tmp
<
DimensionedField<cmptType, GeoMesh>
>&
256
);
257
258
//- Return the field transpose (only defined for second rank tensors)
259
tmp<DimensionedField<Type, GeoMesh>
>
T
()
const
;
260
261
//- Calculate and return arithmetic average
262
dimensioned<Type>
average
()
const
;
263
264
//- Calculate and return weighted average
265
dimensioned<Type>
weightedAverage
266
(
267
const
DimensionedField<scalar, GeoMesh>
&
268
)
const
;
269
270
//- Calculate and return weighted average
271
dimensioned<Type>
weightedAverage
272
(
273
const
tmp
<
DimensionedField<scalar, GeoMesh>
>&
274
)
const
;
275
276
277
// Write
278
279
bool
writeData
(
Ostream
&,
const
word
& fieldDictEntry)
const
;
280
281
bool
writeData
(
Ostream
&)
const
;
282
283
284
// Member Operators
285
286
void
operator=
(
const
DimensionedField<Type, GeoMesh>
&);
287
void
operator=
(
const
tmp
<
DimensionedField<Type, GeoMesh>
>&);
288
void
operator=
(
const
dimensioned<Type>
&);
289
290
void
operator+=
(
const
DimensionedField<Type, GeoMesh>
&);
291
void
operator+=
(
const
tmp
<
DimensionedField<Type, GeoMesh>
>&);
292
293
void
operator-=
(
const
DimensionedField<Type, GeoMesh>
&);
294
void
operator-=
(
const
tmp
<
DimensionedField<Type, GeoMesh>
>&);
295
296
void
operator*=
(
const
DimensionedField<scalar, GeoMesh>
&);
297
void
operator*=
(
const
tmp
<
DimensionedField<scalar, GeoMesh>
>&);
298
299
void
operator/=
(
const
DimensionedField<scalar, GeoMesh>
&);
300
void
operator/=
(
const
tmp
<
DimensionedField<scalar, GeoMesh>
>&);
301
302
void
operator+=
(
const
dimensioned<Type>
&);
303
void
operator-=
(
const
dimensioned<Type>
&);
304
305
void
operator*=
(
const
dimensioned<scalar>
&);
306
void
operator/=
(
const
dimensioned<scalar>
&);
307
308
309
// Ostream Operators
310
311
friend
Ostream
& operator<< <Type, GeoMesh>
312
(
313
Ostream
&,
314
const
DimensionedField<Type, GeoMesh>
&
315
);
316
317
friend
Ostream
& operator<< <Type, GeoMesh>
318
(
319
Ostream
&,
320
const
tmp<DimensionedField<Type, GeoMesh>
>&
321
);
322
};
323
324
325
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
326
327
}
// End namespace Foam
328
329
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
330
331
#include <
OpenFOAM/DimensionedFieldI.H
>
332
#include <
OpenFOAM/DimensionedFieldFunctions.H
>
333
334
#ifdef NoRepository
335
# include <
OpenFOAM/DimensionedField.C
>
336
#endif
337
338
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
339
340
#endif
341
342
// ************************ vim: set sw=4 sts=4 et: ************************ //