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
applications
utilities
mesh
conversion
foamToStarMesh
foamToStarMesh.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
Application
25
foamToStarMesh
26
27
Description
28
Reads an OpenFOAM mesh and writes a pro-STAR (v4) bnd/cel/vrt format.
29
30
Usage
31
- foamToStarMesh [OPTION] \n
32
Reads an OpenFOAM mesh and writes a pro-STAR (v4) bnd/cel/vrt format.
33
34
@param -noBnd \n
35
Suppress writing the @c .bnd file.
36
37
@param -scale <factor>\n
38
Specify an alternative geometry scaling factor.
39
The default is @b 1000 (scale @em [m] to @em [mm]).
40
41
@param -surface \n
42
Extract the surface of the volume mesh only.
43
This can be useful, for example, for surface morphing in an external
44
package.
45
46
@param -tri \n
47
Extract a triangulated surface.
48
The @b -surface options is implicitly selected.
49
50
@param -case <dir> \n
51
Case directory.
52
53
@param -noZero \n
54
Ignore time step 0.
55
56
@param -constant \n
57
Include the constant directory.
58
59
@param -latestTime \n
60
Only apply to the latest time step.
61
62
@param -time <time>\n
63
Apply only to specified time.
64
65
@param -help \n
66
Display help message.
67
68
@param -doc \n
69
Display Doxygen API documentation page for this application.
70
71
@param -srcDoc \n
72
Display Doxygen source documentation page for this application.
73
74
Note
75
The cellTable information available in the files
76
@c constant/cellTable and @c constant/polyMesh/cellTableId
77
will be used if available. Otherwise the cellZones are used when
78
creating the cellTable information.
79
80
See Also
81
Foam::cellTable, Foam::meshWriter and Foam::meshWriters::STARCD
82
83
\*---------------------------------------------------------------------------*/
84
85
#include <
OpenFOAM/argList.H
>
86
#include <
OpenFOAM/timeSelector.H
>
87
#include <
OpenFOAM/Time.H
>
88
#include <
OpenFOAM/polyMesh.H
>
89
#include <
conversion/STARCDMeshWriter.H
>
90
91
using namespace
Foam;
92
93
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94
// Main program:
95
96
int
main
(
int
argc,
char
*argv[])
97
{
98
argList::noParallel
();
99
timeSelector::addOptions
();
100
101
argList::validOptions
.
insert
(
"scale"
,
"scale"
);
102
argList::validOptions
.
insert
(
"noBnd"
,
""
);
103
argList::validOptions
.
insert
(
"tri"
,
""
);
104
argList::validOptions
.
insert
(
"surface"
,
""
);
105
106
# include <
OpenFOAM/setRootCase.H
>
107
# include <
OpenFOAM/createTime.H
>
108
109
instantList
timeDirs
=
timeSelector::select0
(runTime,
args
);
110
111
bool
surfaceOnly =
false
;
112
if
(
args
.
optionFound
(
"surface"
) ||
args
.
optionFound
(
"tri"
))
113
{
114
surfaceOnly =
true
;
115
}
116
117
fileName
exportName =
meshWriter::defaultMeshName
;
118
if
(surfaceOnly)
119
{
120
exportName =
meshWriter::defaultSurfaceName
;
121
}
122
123
if
(
args
.
optionFound
(
"case"
))
124
{
125
exportName +=
'-'
+
args
.
globalCaseName
();
126
}
127
128
// default: rescale from [m] to [mm]
129
scalar scaleFactor = 1000;
130
if
(
args
.
optionReadIfPresent
(
"scale"
, scaleFactor))
131
{
132
if
(scaleFactor <= 0)
133
{
134
scaleFactor = 1;
135
}
136
}
137
138
# include <
OpenFOAM/createPolyMesh.H
>
139
140
141
forAll
(timeDirs, timeI)
142
{
143
runTime.setTime(timeDirs[timeI], timeI);
144
145
# include "
getTimeIndex.H
"
146
147
polyMesh::readUpdateState
state =
mesh
.
readUpdate
();
148
149
if
(!timeI || state !=
polyMesh::UNCHANGED
)
150
{
151
meshWriters::STARCD
writer
(
mesh
, scaleFactor);
152
153
if
(
args
.
optionFound
(
"noBnd"
))
154
{
155
writer
.noBoundary();
156
}
157
158
fileName
meshName
(exportName);
159
if
(state !=
polyMesh::UNCHANGED
)
160
{
161
meshName
+=
'_'
+ runTime.timeName();
162
}
163
164
if
(surfaceOnly)
165
{
166
if
(
args
.
optionFound
(
"tri"
))
167
{
168
writer
.writeSurface(
meshName
,
true
);
169
}
170
else
171
{
172
writer
.writeSurface(
meshName
);
173
}
174
}
175
else
176
{
177
writer
.
write
(
meshName
);
178
}
179
}
180
181
Info
<<
nl
<<
endl
;
182
}
183
184
Info
<<
"End\n"
<<
endl
;
185
186
return
0;
187
}
188
189
// ************************ vim: set sw=4 sts=4 et: ************************ //