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::writeOFF(const bool writeSorted, Ostream& os) const
00036 {
00037
00038 os << "OFF" << endl
00039 << "# Geomview OFF file" << endl
00040 << "# Regions:" << endl;
00041
00042 labelList faceMap;
00043 surfacePatchList myPatches(calcPatches(faceMap));
00044
00045
00046 forAll(myPatches, patchI)
00047 {
00048 os << "# " << patchI << " "
00049 << myPatches[patchI].name() << endl;
00050 }
00051 os << endl << endl;
00052
00053 const pointField& ps = points();
00054
00055 os << "# nPoints nTriangles nEdges" << endl
00056 << ps.size()
00057 << ' ' << size()
00058 << ' ' << nEdges()
00059 << endl << endl;
00060
00061
00062 forAll(ps, pointi)
00063 {
00064 os << ps[pointi].x() << ' '
00065 << ps[pointi].y() << ' '
00066 << ps[pointi].z() << " #" << pointi << endl;
00067 }
00068
00069 os << endl;
00070
00071 if (writeSorted)
00072 {
00073 label faceIndex = 0;
00074
00075 forAll(myPatches, patchI)
00076 {
00077
00078
00079 for
00080 (
00081 label patchFaceI = 0;
00082 patchFaceI < myPatches[patchI].size();
00083 patchFaceI++
00084 )
00085 {
00086 const label faceI = faceMap[faceIndex++];
00087
00088 os << "3 "
00089 << operator[](faceI)[0] << ' '
00090 << operator[](faceI)[1] << ' '
00091 << operator[](faceI)[2] << ' '
00092 << operator[](faceI).region()
00093 << endl;
00094 }
00095 }
00096 }
00097 else
00098 {
00099 forAll(*this, faceI)
00100 {
00101 os << "3 "
00102 << operator[](faceI)[0] << ' '
00103 << operator[](faceI)[1] << ' '
00104 << operator[](faceI)[2] << ' '
00105 << operator[](faceI).region()
00106 << endl;
00107 }
00108 }
00109 }
00110
00111
00112
00113
00114 }
00115
00116