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