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
conversion
ensight
part
ensightPart.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::ensightPart
26
27
Description
28
Base class for ensightPartCells and ensightPartFaces
29
30
SourceFiles
31
ensightPart.C
32
ensightPartIO.C
33
ensightPartI.H
34
35
\*---------------------------------------------------------------------------*/
36
37
#ifndef ensightPart_H
38
#define ensightPart_H
39
40
#include <
conversion/ensightFile.H
>
41
#include <
conversion/ensightGeoFile.H
>
42
#include <
OpenFOAM/typeInfo.H
>
43
#include <
OpenFOAM/labelList.H
>
44
#include <
OpenFOAM/polyMesh.H
>
45
#include <
OpenFOAM/Field.H
>
46
#include <
OpenFOAM/IOPtrList.H
>
47
#include <
OpenFOAM/IOstream.H
>
48
49
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51
namespace
Foam
52
{
53
54
/*---------------------------------------------------------------------------*\
55
Class ensightPart Declaration
56
\*---------------------------------------------------------------------------*/
57
58
class
ensightPart
59
{
60
// Private data
61
62
// Static data members
63
static
List<word>
elemTypes_;
64
65
66
protected
:
67
68
// Protected data
69
70
//- part number
71
label
number_
;
72
73
//- part name (or description)
74
string
name_
;
75
76
//- simple labelList with a name
77
labelListList
elemLists_
;
78
79
//- start offset for elemLists_
80
label
offset_
;
81
82
//- number of elements in this part
83
label
size_
;
84
85
//- cell or face data
86
bool
isCellData_
;
87
88
//- material id (numeric)
89
label
matId_
;
90
91
//- mesh reference used
92
const
polyMesh
*
meshPtr_
;
93
94
95
// Protected Classes
96
97
//- track the points used by the part and map global to local indices
98
class
localPoints
99
{
100
public
:
101
//- number of points used
102
label
nPoints
;
103
104
//- map global to local indices
105
labelList
list
;
106
107
// null constructor
108
localPoints
()
109
:
110
nPoints
(0),
111
list
(0)
112
{}
113
114
// construct for mesh points
115
localPoints
(
const
polyMesh
& pMesh)
116
:
117
nPoints
(0),
118
list
(pMesh.
points
().
size
(), -1)
119
{}
120
};
121
122
123
// Protected Member Functions
124
125
//- reconstruct contents from Istream
126
void
reconstruct
(
Istream
&);
127
128
//- check for fully defined fields
129
bool
isFieldDefined
(
const
List<scalar>
&)
const
;
130
131
//- write the part header
132
void
writeHeader
(
ensightFile
&,
bool
withDescription=
false
)
const
;
133
134
//- write a scalar field for idList
135
void
writeFieldList
136
(
137
ensightFile
& os,
138
const
List<scalar>
& field,
139
const
List<label>
& idList
140
)
const
;
141
142
//- track points used
143
virtual
localPoints
calcLocalPoints
()
const
144
{
145
return
localPoints
();
146
}
147
148
//- write connectivities
149
virtual
void
writeConnectivity
150
(
151
ensightGeoFile
& os,
152
const
string
& key,
153
const
labelList
& idList,
154
const
labelList
& pointMap
155
)
const
156
{}
157
158
159
public
:
160
161
//- Runtime type information
162
TypeName
(
"ensightPart"
);
163
164
165
// Constructors
166
167
//- Construct null
168
ensightPart
();
169
170
//- Construct empty part with number and description
171
ensightPart
(label partNumber,
const
string
& partDescription);
172
173
//- Construct empty part with number and description
174
ensightPart
175
(
176
label partNumber,
177
const
string
& partDescription,
178
const
polyMesh
& pMesh
179
);
180
181
//- Construct as copy
182
ensightPart
(
const
ensightPart
&);
183
184
185
// Selectors
186
187
// Declare run-time constructor selection table
188
declareRunTimeSelectionTable
189
(
190
autoPtr
,
191
ensightPart
,
192
istream,
193
(
194
Istream
& is
195
),
196
(is)
197
);
198
199
//- Construct and return clone
200
autoPtr<ensightPart>
clone
()
const
201
{
202
return
autoPtr<ensightPart>
(
new
ensightPart
(*
this
));
203
};
204
205
//- Construct on freestore from Istream
206
static
autoPtr<ensightPart>
New
(
Istream
& is);
207
208
209
//- Destructor
210
virtual
~ensightPart
();
211
212
213
// Static members
214
215
virtual
List<word>
const
&
elementTypes
()
const
216
{
217
return
elemTypes_;
218
}
219
220
221
// Access
222
223
//- number of elements in this part
224
label
size
()
const
225
{
226
return
size_
;
227
}
228
229
//- represents cell data
230
bool
isCellData
()
const
231
{
232
return
isCellData_
;
233
}
234
235
//- represents face data
236
bool
isFaceData
()
const
237
{
238
return
!
isCellData_
;
239
}
240
241
//- part number
242
label
number
()
const
243
{
244
return
number_
;
245
}
246
247
//- part name or description
248
const
string
&
name
()
const
249
{
250
return
name_
;
251
}
252
253
//- material id
254
label
materialId
()
const
255
{
256
return
matId_
;
257
}
258
259
//- non-const access
260
void
name
(
const
string
& value)
261
{
262
name_
= value;
263
}
264
265
void
materialId
(
const
label value)
266
{
267
matId_
= value;
268
}
269
270
//- offset for element ids
271
label
offset
()
const
272
{
273
return
offset_
;
274
}
275
276
277
// Edit
278
279
//- renumber elements
280
void
renumber
(
labelList
const
&);
281
282
//- write summary information about the object
283
bool
writeSummary
(
Ostream
&)
const
;
284
285
//- write reconstruction information for the object
286
bool
writeData
(
Ostream
&)
const
;
287
288
//- write geometry
289
void
writeGeometry
(
ensightGeoFile
&)
const
;
290
291
//- write scalar field
292
void
writeScalarField
293
(
294
ensightFile
&,
295
const
List<scalar>
& field
296
)
const
;
297
298
//- write vector field components
299
void
writeVectorField
300
(
301
ensightFile
&,
302
const
List<scalar>
& field0,
303
const
List<scalar>
& field1,
304
const
List<scalar>
& field2
305
)
const
;
306
307
308
//- write generalized field components
309
template
<
class
Type>
310
void
writeField
311
(
312
ensightFile
&,
313
const
Field<Type>
&
314
)
const
;
315
316
317
// Member Operators
318
319
//- Disallow default bitwise assignment
320
void
operator=
(
const
ensightPart
&)
321
{
322
notImplemented
(
"ensightPart::operator=(const ensightPart&)"
);
323
}
324
325
326
// IOstream Operators
327
328
//- write data (reconstruction information)
329
friend
Ostream
&
operator<<
(
Ostream
&,
const
ensightPart
&);
330
331
//- write geometry
332
friend
ensightGeoFile
&
operator
<<
333
(
334
ensightGeoFile
&,
335
const
ensightPart
&
336
);
337
};
338
339
340
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
341
342
}
// End namespace Foam
343
344
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
345
346
#ifdef NoRepository
347
# include <
conversion/ensightPartI.H
>
348
#endif
349
350
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
351
352
#endif
353
354
// ************************ vim: set sw=4 sts=4 et: ************************ //