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 Class 00025 Foam::fileFormats::STLsurfaceFormatCore 00026 00027 Description 00028 Internal class used by the STLsurfaceFormat 00029 00030 SourceFiles 00031 STLsurfaceFormatCore.C 00032 STLsurfaceFormatASCII.L 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #ifndef STLsurfaceFormatCore_H 00037 #define STLsurfaceFormatCore_H 00038 00039 #include "STLtriangle.H" 00040 #include <OpenFOAM/triFace.H> 00041 #include <OpenFOAM/IFstream.H> 00042 #include <OpenFOAM/Ostream.H> 00043 00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00045 00046 namespace Foam 00047 { 00048 namespace fileFormats 00049 { 00050 00051 /*---------------------------------------------------------------------------*\ 00052 Class STLsurfaceFormatCore Declaration 00053 \*---------------------------------------------------------------------------*/ 00054 00055 class STLsurfaceFormatCore 00056 { 00057 // Private Data 00058 00059 bool sorted_; 00060 00061 //- The points supporting the facets 00062 pointField points_; 00063 00064 //- The zones associated with the faces 00065 List<label> zoneIds_; 00066 00067 //- The solid names, in the order of their first appearance 00068 List<word> names_; 00069 00070 //- The solid count, in the order of their first appearance 00071 List<label> sizes_; 00072 00073 00074 // Private Member Functions 00075 00076 //- Disallow default bitwise copy construct 00077 STLsurfaceFormatCore(const STLsurfaceFormatCore&); 00078 00079 //- Disallow default bitwise assignment 00080 void operator=(const STLsurfaceFormatCore&); 00081 00082 //- Determine the file type 00083 static int detectBINARY(const fileName&); 00084 00085 //- Read ASCII 00086 bool readASCII(istream&, const off_t); 00087 00088 //- Read BINARY 00089 bool readBINARY(istream&, const off_t); 00090 00091 00092 public: 00093 00094 // Static Data 00095 00096 //- The number of bytes in the STL binary header 00097 static const unsigned int headerSize = 80; 00098 00099 00100 // Static Member Functions 00101 00102 //- Write "STL binary file" and number of triangles to stream 00103 static void writeHeaderBINARY(ostream&, unsigned int); 00104 00105 00106 // Constructors 00107 00108 //- Read from file, filling in the information 00109 STLsurfaceFormatCore(const fileName&); 00110 00111 00112 // Destructor 00113 00114 ~STLsurfaceFormatCore(); 00115 00116 00117 // Member Functions 00118 00119 //- File read was already sorted 00120 bool sorted() const 00121 { 00122 return sorted_; 00123 } 00124 00125 //- Flush all values 00126 void clear() 00127 { 00128 sorted_ = true; 00129 points_.clear(); 00130 zoneIds_.clear(); 00131 names_.clear(); 00132 sizes_.clear(); 00133 } 00134 00135 //- Return full access to the points 00136 pointField& points() 00137 { 00138 return points_; 00139 } 00140 00141 //- Return full access to the zoneIds 00142 List<label>& zoneIds() 00143 { 00144 return zoneIds_; 00145 } 00146 00147 //- The list of solid names in the order of their first appearance 00148 List<word>& names() 00149 { 00150 return names_; 00151 } 00152 00153 //- The list of solid sizes in the order of their first appearance 00154 List<label>& sizes() 00155 { 00156 return sizes_; 00157 } 00158 }; 00159 00160 00161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00162 00163 } // End namespace fileFormats 00164 } // End namespace Foam 00165 00166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00167 00168 #endif 00169 00170 // ************************ vim: set sw=4 sts=4 et: ************************ //