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
postProcessing
functionObjects
field
fieldValues
cellSource
cellSource.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) 2009-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::fieldValues::cellSource
26
27
Description
28
Cell source variant of field value function object. Values of user-
29
specified fields reported for collections of cells.
30
31
cellObj1 // Name also used to identify output folder
32
{
33
type cellSource;
34
functionObjectLibs ("libfieldValueFunctionObjects.so");
35
enabled true;
36
outputControl outputTime;
37
log true; // log to screen?
38
valueOutput true; // Write values at run-time output times?
39
source cellZone; // Type of cell source
40
sourceName c0;
41
operation volAverage;
42
fields
43
(
44
p
45
U
46
);
47
}
48
49
where operation is one of:
50
- none
51
- sum
52
- volAverage
53
- volIntegrate
54
- weightedAverage
55
56
SourceFiles
57
cellSource.C
58
59
\*---------------------------------------------------------------------------*/
60
61
#ifndef cellSource_H
62
#define cellSource_H
63
64
#include <
OpenFOAM/NamedEnum.H
>
65
#include <
fieldFunctionObjects/fieldValue.H
>
66
#include <
OpenFOAM/labelList.H
>
67
#include <
finiteVolume/volFieldsFwd.H
>
68
69
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70
71
namespace
Foam
72
{
73
namespace
fieldValues
74
{
75
76
/*---------------------------------------------------------------------------*\
77
Class cellSource Declaration
78
\*---------------------------------------------------------------------------*/
79
80
class
cellSource
81
:
82
public
fieldValue
83
{
84
85
public
:
86
87
// Public data types
88
89
//- Source type enumeration
90
enum
sourceType
91
{
92
stCellZone
,
93
stAll
94
};
95
96
//- Source type names
97
static
const
NamedEnum<sourceType, 2>
sourceTypeNames_
;
98
99
100
//- Operation type enumeration
101
enum
operationType
102
{
103
opNone
,
104
opSum
,
105
opVolAverage
,
106
opVolIntegrate
,
107
opWeightedAverage
,
108
opMin
,
109
opMax
110
};
111
112
//- Operation type names
113
static
const
NamedEnum<operationType, 7>
operationTypeNames_
;
114
115
116
private
:
117
118
// Private member functions
119
120
//- Set cells to evaluate based on a cell zone
121
void
setCellZoneCells();
122
123
//- Set cells to evaluate based on a patch
124
void
setPatchCells();
125
126
127
protected
:
128
129
// Protected data
130
131
//- Source type
132
sourceType
source_
;
133
134
//- Operation to apply to values
135
operationType
operation_
;
136
137
//- Global number of cells
138
label
nCells_
;
139
140
//- Local list of cell IDs
141
labelList
cellId_
;
142
143
//- Weight field name - only used for opWeightedAverage mode
144
word
weightFieldName_
;
145
146
147
// Protected member functions
148
149
//- Initialise, e.g. cell addressing
150
void
initialise
(
const
dictionary
& dict);
151
152
//- Return true if the field name is valid
153
template
<
class
Type>
154
bool
validField
(
const
word
& fieldName)
const
;
155
156
//- Insert field values into values list
157
template
<
class
Type>
158
tmp<Field<Type>
>
setFieldValues
159
(
160
const
word
& fieldName
161
)
const
;
162
163
//- Apply the 'operation' to the values
164
template
<
class
Type>
165
Type
processValues
166
(
167
const
Field<Type>
& values,
168
const
scalarField
& V,
169
const
scalarField
& weightField
170
)
const
;
171
172
//- Output file header information
173
virtual
void
writeFileHeader
();
174
175
176
public
:
177
178
//- Run-time type information
179
TypeName
(
"cellSource"
);
180
181
182
//- Construct from components
183
cellSource
184
(
185
const
word
&
name
,
186
const
objectRegistry
&
obr
,
187
const
dictionary
& dict,
188
const
bool
loadFromFiles =
false
189
);
190
191
192
//- Destructor
193
virtual
~cellSource
();
194
195
196
// Public member functions
197
198
// Access
199
200
//- Return the source type
201
inline
const
sourceType
&
source
()
const
;
202
203
//- Return the local list of cell IDs
204
inline
const
labelList
&
cellId
()
const
;
205
206
207
// Function object functions
208
209
//- Read from dictionary
210
virtual
void
read
(
const
dictionary
&);
211
212
//- Calculate and write
213
virtual
void
write
();
214
215
//- Templated helper function to output field values
216
template
<
class
Type>
217
bool
writeValues
(
const
word
& fieldName);
218
219
//- Filter a field according to cellIds
220
template
<
class
Type>
221
tmp<Field<Type>
>
filterField
(
const
Field<Type>
& field)
const
;
222
};
223
224
225
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226
227
}
// End namespace fieldValues
228
}
// End namespace Foam
229
230
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232
#include "
cellSourceI.H
"
233
234
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235
236
#ifdef NoRepository
237
#include "
cellSourceTemplates.C
"
238
#endif
239
240
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241
242
#endif
243
244
// ************************ vim: set sw=4 sts=4 et: ************************ //