1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "triSurface.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
37 void triSurface::writeTRI(const bool writeSorted, Ostream& os) const
39 const pointField& ps = points();
41 // Write as cloud of triangles
45 surfacePatchList myPatches(calcPatches(faceMap));
51 forAll(myPatches, patchI)
56 patchFaceI < myPatches[patchI].size();
60 const label faceI = faceMap[faceIndex++];
62 const point& p1 = ps[operator[](faceI)[0]];
63 const point& p2 = ps[operator[](faceI)[1]];
64 const point& p3 = ps[operator[](faceI)[2]];
66 os << p1.x() << token::SPACE
67 << p1.y() << token::SPACE
68 << p1.z() << token::SPACE
70 << p2.x() << token::SPACE
71 << p2.y() << token::SPACE
72 << p2.z() << token::SPACE
74 << p3.x() << token::SPACE
75 << p3.y() << token::SPACE
76 << p3.z() << token::SPACE
78 << "0x" << hex << operator[](faceI).region() << dec
87 const point& p1 = ps[operator[](faceI)[0]];
88 const point& p2 = ps[operator[](faceI)[1]];
89 const point& p3 = ps[operator[](faceI)[2]];
91 os << p1.x() << token::SPACE
92 << p1.y() << token::SPACE
93 << p1.z() << token::SPACE
95 << p2.x() << token::SPACE
96 << p2.y() << token::SPACE
97 << p2.z() << token::SPACE
99 << p3.x() << token::SPACE
100 << p3.y() << token::SPACE
101 << p3.z() << token::SPACE
103 << "0x" << hex << operator[](faceI).region() << dec
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 } // End namespace Foam
114 // ************************************************************************* //