writeGTS.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 #include "triSurface.H"
00028
00029
00030
00031 namespace Foam
00032 {
00033
00034
00035
00036 void triSurface::writeGTS(const bool writeSorted, Ostream& os) const
00037 {
00038
00039 os << "# GTS file" << endl
00040 << "# Regions:" << endl;
00041
00042 labelList faceMap;
00043
00044 surfacePatchList myPatches(calcPatches(faceMap));
00045
00046
00047 forAll(myPatches, patchI)
00048 {
00049 os << "# " << patchI << " "
00050 << myPatches[patchI].name() << endl;
00051 }
00052 os << "#" << endl;
00053
00054
00055 const pointField& ps = points();
00056
00057 os << "# nPoints nEdges nTriangles" << endl
00058 << ps.size() << ' ' << nEdges() << ' ' << size() << endl;
00059
00060
00061
00062 forAll(ps, pointi)
00063 {
00064 os << ps[pointi].x() << ' '
00065 << ps[pointi].y() << ' '
00066 << ps[pointi].z() << endl;
00067 }
00068
00069
00070
00071 const edgeList& es = edges();
00072 const labelList& meshPts = meshPoints();
00073
00074 forAll(es, edgei)
00075 {
00076 os << meshPts[es[edgei].start()] + 1 << ' '
00077 << meshPts[es[edgei].end()] + 1 << endl;
00078 }
00079
00080
00081 const labelListList& faceEs = faceEdges();
00082
00083 if (writeSorted)
00084 {
00085 label faceIndex = 0;
00086 forAll(myPatches, patchI)
00087 {
00088 for
00089 (
00090 label patchFaceI = 0;
00091 patchFaceI < myPatches[patchI].size();
00092 patchFaceI++
00093 )
00094 {
00095 const label faceI = faceMap[faceIndex++];
00096
00097 const labelList& fEdges = faceEdges()[faceI];
00098
00099 os << fEdges[0] + 1 << ' '
00100 << fEdges[1] + 1 << ' '
00101 << fEdges[2] + 1 << ' '
00102 << (*this)[faceI].region() << endl;
00103 }
00104 }
00105 }
00106 else
00107 {
00108 forAll(faceEs, faceI)
00109 {
00110 const labelList& fEdges = faceEdges()[faceI];
00111
00112 os << fEdges[0] + 1 << ' '
00113 << fEdges[1] + 1 << ' '
00114 << fEdges[2] + 1 << ' '
00115 << (*this)[faceI].region() << endl;
00116 }
00117 }
00118 }
00119
00120
00121
00122
00123 }
00124
00125
Copyright © 2000-2009 OpenCFD Ltd