|
|
|
writeTRI.CGo to the documentation of this file.00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2009 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 the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 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, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 \*---------------------------------------------------------------------------*/ 00026 00027 #include "triSurface.H" 00028 #include "IOmanip.H" 00029 00030 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00031 00032 namespace Foam 00033 { 00034 00035 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 00036 00037 void triSurface::writeTRI(const bool writeSorted, Ostream& os) const 00038 { 00039 const pointField& ps = points(); 00040 00041 // Write as cloud of triangles 00042 00043 labelList faceMap; 00044 00045 surfacePatchList myPatches(calcPatches(faceMap)); 00046 00047 if (writeSorted) 00048 { 00049 label faceIndex = 0; 00050 00051 forAll(myPatches, patchI) 00052 { 00053 for 00054 ( 00055 label patchFaceI = 0; 00056 patchFaceI < myPatches[patchI].size(); 00057 patchFaceI++ 00058 ) 00059 { 00060 const label faceI = faceMap[faceIndex++]; 00061 00062 const point& p1 = ps[operator[](faceI)[0]]; 00063 const point& p2 = ps[operator[](faceI)[1]]; 00064 const point& p3 = ps[operator[](faceI)[2]]; 00065 00066 os << p1.x() << token::SPACE 00067 << p1.y() << token::SPACE 00068 << p1.z() << token::SPACE 00069 00070 << p2.x() << token::SPACE 00071 << p2.y() << token::SPACE 00072 << p2.z() << token::SPACE 00073 00074 << p3.x() << token::SPACE 00075 << p3.y() << token::SPACE 00076 << p3.z() << token::SPACE 00077 00078 << "0x" << hex << operator[](faceI).region() << dec 00079 << endl; 00080 } 00081 } 00082 } 00083 else 00084 { 00085 forAll(*this, faceI) 00086 { 00087 const point& p1 = ps[operator[](faceI)[0]]; 00088 const point& p2 = ps[operator[](faceI)[1]]; 00089 const point& p3 = ps[operator[](faceI)[2]]; 00090 00091 os << p1.x() << token::SPACE 00092 << p1.y() << token::SPACE 00093 << p1.z() << token::SPACE 00094 00095 << p2.x() << token::SPACE 00096 << p2.y() << token::SPACE 00097 << p2.z() << token::SPACE 00098 00099 << p3.x() << token::SPACE 00100 << p3.y() << token::SPACE 00101 << p3.z() << token::SPACE 00102 00103 << "0x" << hex << operator[](faceI).region() << dec 00104 << endl; 00105 } 00106 } 00107 } 00108 00109 00110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00111 00112 } // End namespace Foam 00113 00114 // ************************************************************************* // |