Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 #include <OpenFOAM/argList.H>
00086 #include <OpenFOAM/timeSelector.H>
00087 #include <OpenFOAM/Time.H>
00088 #include <OpenFOAM/polyMesh.H>
00089 #include <conversion/STARCDMeshWriter.H>
00090
00091 using namespace Foam;
00092
00093
00094
00095
00096 int main(int argc, char *argv[])
00097 {
00098 argList::noParallel();
00099 timeSelector::addOptions();
00100
00101 argList::validOptions.insert("scale", "scale");
00102 argList::validOptions.insert("noBnd", "");
00103 argList::validOptions.insert("tri", "");
00104 argList::validOptions.insert("surface", "");
00105
00106 # include <OpenFOAM/setRootCase.H>
00107 # include <OpenFOAM/createTime.H>
00108
00109 instantList timeDirs = timeSelector::select0(runTime, args);
00110
00111 bool surfaceOnly = false;
00112 if (args.optionFound("surface") || args.optionFound("tri"))
00113 {
00114 surfaceOnly = true;
00115 }
00116
00117 fileName exportName = meshWriter::defaultMeshName;
00118 if (surfaceOnly)
00119 {
00120 exportName = meshWriter::defaultSurfaceName;
00121 }
00122
00123 if (args.optionFound("case"))
00124 {
00125 exportName += '-' + args.globalCaseName();
00126 }
00127
00128
00129 scalar scaleFactor = 1000;
00130 if (args.optionReadIfPresent("scale", scaleFactor))
00131 {
00132 if (scaleFactor <= 0)
00133 {
00134 scaleFactor = 1;
00135 }
00136 }
00137
00138 # include <OpenFOAM/createPolyMesh.H>
00139
00140
00141 forAll(timeDirs, timeI)
00142 {
00143 runTime.setTime(timeDirs[timeI], timeI);
00144
00145 # include "getTimeIndex.H"
00146
00147 polyMesh::readUpdateState state = mesh.readUpdate();
00148
00149 if (!timeI || state != polyMesh::UNCHANGED)
00150 {
00151 meshWriters::STARCD writer(mesh, scaleFactor);
00152
00153 if (args.optionFound("noBnd"))
00154 {
00155 writer.noBoundary();
00156 }
00157
00158 fileName meshName(exportName);
00159 if (state != polyMesh::UNCHANGED)
00160 {
00161 meshName += '_' + runTime.timeName();
00162 }
00163
00164 if (surfaceOnly)
00165 {
00166 if (args.optionFound("tri"))
00167 {
00168 writer.writeSurface(meshName, true);
00169 }
00170 else
00171 {
00172 writer.writeSurface(meshName);
00173 }
00174 }
00175 else
00176 {
00177 writer.write(meshName);
00178 }
00179 }
00180
00181 Info<< nl << endl;
00182 }
00183
00184 Info<< "End\n" << endl;
00185
00186 return 0;
00187 }
00188
00189