00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 #ifndef _STLASCIIREADER_H_ 00012 #define _STLASCIIREADER_H_ 00013 00014 #include <iostream> 00015 #include <string> 00016 using namespace std; 00017 00018 #include "MayDay.H" 00019 00020 #include "STLReader.H" 00021 #include "STLMesh.H" 00022 //#include "STLExplorer.H" // for comparators 00023 00024 #include "NamespaceHeader.H" 00025 00026 /* 00027 * Reads ascii STL files and generates a mesh 00028 * see http://www.cplusplus.com/doc/tutorial/files/ 00029 */ 00030 00031 class STLAsciiReader: public STLReader 00032 { 00033 public: 00034 /// Constructor - read from standard input 00035 STLAsciiReader(); 00036 00037 /// Constructor - read from file name 00038 STLAsciiReader(const string& a_filename); 00039 00040 /// Destructor 00041 ~STLAsciiReader(); 00042 00043 /// Return header information 00044 string* GetHeader() const; 00045 00046 /// Return number of elements 00047 void GetNtri(int& a_ntri) const; 00048 00049 /// Return whether number of elements from header matches file 00050 void GetNtriMatch(bool& a_ntriMatch) const; 00051 00052 /// Return pointer to the mesh 00053 RefCountedPtr<STLMesh> GetMesh() const; 00054 00055 protected: 00056 void ReadData(istream& a_file, 00057 const int offset); 00058 00059 string* m_header; // header info 00060 int m_ntri; // number of triangles read in 00061 bool m_ntriMatch; // true if m_ntri equals the number of triangles declared in the header 00062 00063 // actual data - shared by all copies 00064 RefCountedPtr<STLMesh> m_stlmesh; // pointer to the mesh 00065 00066 private: 00067 void operator=(const STLAsciiReader& a_inputReader) 00068 { 00069 MayDay::Abort("STLAsciiReader doesn't allow assignment"); 00070 } 00071 }; 00072 00073 #include "NamespaceFooter.H" 00074 #endif