foamToStarMesh.C
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 #include "argList.H"
00064 #include "timeSelector.H"
00065 #include "Time.H"
00066 #include "polyMesh.H"
00067 #include "STARCDMeshWriter.H"
00068
00069 using namespace Foam;
00070
00071
00072
00073
00074 int main(int argc, char *argv[])
00075 {
00076 argList::noParallel();
00077 timeSelector::addOptions();
00078
00079 argList::validOptions.insert("scale", "scale");
00080 argList::validOptions.insert("noBnd", "");
00081 argList::validOptions.insert("tri", "");
00082 argList::validOptions.insert("surface", "");
00083
00084 # include "setRootCase.H"
00085 # include "createTime.H"
00086
00087 instantList timeDirs = timeSelector::select0(runTime, args);
00088
00089 bool surfaceOnly = false;
00090 if (args.optionFound("surface") || args.optionFound("tri"))
00091 {
00092 surfaceOnly = true;
00093 }
00094
00095 fileName exportName = meshWriter::defaultMeshName;
00096 if (surfaceOnly)
00097 {
00098 exportName = meshWriter::defaultSurfaceName;
00099 }
00100
00101 if (args.optionFound("case"))
00102 {
00103 exportName += '-' + args.globalCaseName();
00104 }
00105
00106
00107 scalar scaleFactor = 1000;
00108 if (args.optionReadIfPresent("scale", scaleFactor))
00109 {
00110 if (scaleFactor <= 0)
00111 {
00112 scaleFactor = 1;
00113 }
00114 }
00115
00116 # include "createPolyMesh.H"
00117
00118
00119 forAll(timeDirs, timeI)
00120 {
00121 runTime.setTime(timeDirs[timeI], timeI);
00122
00123 # include "getTimeIndex.H"
00124
00125 polyMesh::readUpdateState state = mesh.readUpdate();
00126
00127 if (!timeI || state != polyMesh::UNCHANGED)
00128 {
00129 meshWriters::STARCD writer(mesh, scaleFactor);
00130
00131 if (args.optionFound("noBnd"))
00132 {
00133 writer.noBoundary();
00134 }
00135
00136 fileName meshName(exportName);
00137 if (state != polyMesh::UNCHANGED)
00138 {
00139 meshName += '_' + runTime.timeName();
00140 }
00141
00142 if (surfaceOnly)
00143 {
00144 if (args.optionFound("tri"))
00145 {
00146 writer.writeSurface(meshName, true);
00147 }
00148 else
00149 {
00150 writer.writeSurface(meshName);
00151 }
00152 }
00153 else
00154 {
00155 writer.write(meshName);
00156 }
00157 }
00158
00159 Info<< nl << endl;
00160 }
00161
00162 Info<< "End\n" << endl;
00163
00164 return 0;
00165 }
00166
00167
Copyright © 2000-2009 OpenCFD Ltd