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