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