00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software: you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. 00023 00024 \*---------------------------------------------------------------------------*/ 00025 00026 #include <triSurface/triSurface.H> 00027 #include <OpenFOAM/IOmanip.H> 00028 00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00030 00031 namespace Foam 00032 { 00033 00034 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 00035 00036 void triSurface::writeTRI(const bool writeSorted, Ostream& os) const 00037 { 00038 const pointField& ps = points(); 00039 00040 // Write as cloud of triangles 00041 00042 labelList faceMap; 00043 00044 surfacePatchList myPatches(calcPatches(faceMap)); 00045 00046 if (writeSorted) 00047 { 00048 label faceIndex = 0; 00049 00050 forAll(myPatches, patchI) 00051 { 00052 for 00053 ( 00054 label patchFaceI = 0; 00055 patchFaceI < myPatches[patchI].size(); 00056 patchFaceI++ 00057 ) 00058 { 00059 const label faceI = faceMap[faceIndex++]; 00060 00061 const point& p1 = ps[operator[](faceI)[0]]; 00062 const point& p2 = ps[operator[](faceI)[1]]; 00063 const point& p3 = ps[operator[](faceI)[2]]; 00064 00065 os << p1.x() << token::SPACE 00066 << p1.y() << token::SPACE 00067 << p1.z() << token::SPACE 00068 00069 << p2.x() << token::SPACE 00070 << p2.y() << token::SPACE 00071 << p2.z() << token::SPACE 00072 00073 << p3.x() << token::SPACE 00074 << p3.y() << token::SPACE 00075 << p3.z() << token::SPACE 00076 00077 << "0x" << hex << operator[](faceI).region() << dec 00078 << endl; 00079 } 00080 } 00081 } 00082 else 00083 { 00084 forAll(*this, faceI) 00085 { 00086 const point& p1 = ps[operator[](faceI)[0]]; 00087 const point& p2 = ps[operator[](faceI)[1]]; 00088 const point& p3 = ps[operator[](faceI)[2]]; 00089 00090 os << p1.x() << token::SPACE 00091 << p1.y() << token::SPACE 00092 << p1.z() << token::SPACE 00093 00094 << p2.x() << token::SPACE 00095 << p2.y() << token::SPACE 00096 << p2.z() << token::SPACE 00097 00098 << p3.x() << token::SPACE 00099 << p3.y() << token::SPACE 00100 << p3.z() << token::SPACE 00101 00102 << "0x" << hex << operator[](faceI).region() << dec 00103 << endl; 00104 } 00105 } 00106 } 00107 00108 00109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00110 00111 } // End namespace Foam 00112 00113 // ************************ vim: set sw=4 sts=4 et: ************************ //