1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "VTKedgeFormat.H"
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 void Foam::fileFormats::VTKedgeFormat::writeHeader
35 const pointField& pointLst
39 os << "# vtk DataFile Version 2.0" << nl
40 << "featureEdgeMesh written " << clock::dateTime().c_str() << nl
43 << "DATASET POLYDATA" << nl;
45 // Write vertex coords
46 os << "POINTS " << pointLst.size() << " float" << nl;
49 const point& pt = pointLst[ptI];
51 os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
56 void Foam::fileFormats::VTKedgeFormat::writeEdges
59 const UList<edge>& edgeLst
62 os << "LINES " << edgeLst.size() << ' ' << 3*edgeLst.size() << nl;
64 forAll(edgeLst, edgeI)
66 const edge& e = edgeLst[edgeI];
68 os << "2 " << e[0] << ' ' << e[1] << nl;
73 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
75 Foam::fileFormats::VTKedgeFormat::VTKedgeFormat()
79 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 void Foam::fileFormats::VTKedgeFormat::write
83 const fileName& filename,
87 OFstream os(filename);
92 "fileFormats::VTKedgeFormat::write"
93 "(const fileName&, const edgeMesh&)"
95 << "Cannot open file for writing " << filename
99 writeHeader(os, eMesh.points());
100 writeEdges(os, eMesh.edges());
104 // ************************************************************************* //