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