VTKsurfaceFormatCore.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 "VTKsurfaceFormatCore.H"
00028 #include "clock.H"
00029
00030
00031
00032 void Foam::fileFormats::VTKsurfaceFormatCore::writeHeader
00033 (
00034 Ostream& os,
00035 const pointField& pointLst
00036 )
00037 {
00038
00039 os << "# vtk DataFile Version 2.0" << nl
00040 << "surface written " << clock::dateTime().c_str() << nl
00041 << "ASCII" << nl
00042 << nl
00043 << "DATASET POLYDATA" << nl;
00044
00045
00046 os << "POINTS " << pointLst.size() << " float" << nl;
00047 forAll(pointLst, ptI)
00048 {
00049 const point& pt = pointLst[ptI];
00050
00051 os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
00052 }
00053 }
00054
00055
00056 void Foam::fileFormats::VTKsurfaceFormatCore::writeTail
00057 (
00058 Ostream& os,
00059 const UList<surfZone>& zoneLst
00060 )
00061 {
00062 label nFaces = 0;
00063 forAll(zoneLst, zoneI)
00064 {
00065 nFaces += zoneLst[zoneI].size();
00066 }
00067
00068
00069 os << nl
00070 << "CELL_DATA " << nFaces << nl
00071 << "FIELD attributes 1" << nl
00072 << "zone 1 " << nFaces << " float" << nl;
00073
00074
00075 forAll(zoneLst, zoneI)
00076 {
00077 forAll(zoneLst[zoneI], localFaceI)
00078 {
00079 if (localFaceI)
00080 {
00081 if (localFaceI % 20)
00082 {
00083 os << ' ';
00084 }
00085 else
00086 {
00087 os << nl;
00088 }
00089 }
00090 os << zoneI + 1;
00091 }
00092 os << nl;
00093 }
00094 }
00095
00096
00097 void Foam::fileFormats::VTKsurfaceFormatCore::writeTail
00098 (
00099 Ostream& os,
00100 const UList<label>& zoneIds
00101 )
00102 {
00103
00104 os << nl
00105 << "CELL_DATA " << zoneIds.size() << nl
00106 << "FIELD attributes 1" << nl
00107 << "zone 1 " << zoneIds.size() << " float" << nl;
00108
00109 forAll(zoneIds, faceI)
00110 {
00111 if (faceI)
00112 {
00113 if (faceI % 20)
00114 {
00115 os << ' ';
00116 }
00117 else
00118 {
00119 os << nl;
00120 }
00121 }
00122 os << zoneIds[faceI] + 1;
00123 }
00124 os << nl;
00125 }
00126
00127
00128
Copyright © 2000-2009 OpenCFD Ltd