00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GMSH_FORMAT_READER_HPP
00021 #define GMSH_FORMAT_READER_HPP
00022
00023 #include <MeshReader.hpp>
00024 #include <string>
00025
00026 #include <TinyVector.hpp>
00027
00028 #include <set>
00029 #include <map>
00030 #include <string>
00031 #include <vector>
00032
00040 class GmshFormatReader
00041 : public MeshReader
00042 {
00043 private:
00044 struct VertexError {};
00045
00050 std::vector<int> __verticesNumbers;
00051
00056 std::vector<int> __verticesCorrepondance;
00057
00061 std::vector<short> __elementType;
00062
00066 std::vector<int> __references;
00067
00071 std::vector<std::vector<int> > __elementVertices;
00072
00077 std::vector<int> __numberOfPrimitiveNodes;
00078
00083 TinyVector<15, bool> __supportedPrimitives;
00084
00089 std::map<int, std::string> __primitivesNames;
00090
00091 bool __binary;
00092 bool __convertEndian;
00098 void __proceedData();
00099
00104 void __readGmshFormat1();
00105
00110 void __readGmshFormat2();
00111
00116 enum KeywordType {
00117
00118 NOD,
00119 ENDNOD,
00120 ELM,
00121 ENDELM,
00122
00123
00124 MESHFORMAT,
00125 ENDMESHFORMAT,
00126 NODES,
00127 ENDNODES,
00128 ELEMENTS,
00129 ENDELEMENTS,
00130
00131 Unknown,
00132 EndOfFile
00133 };
00134
00139 typedef std::map<std::string, int> KeywordList;
00140
00141 KeywordList __keywordList;
00147 typedef std::pair<std::string, int> Keyword;
00148
00153 void __skipComments();
00154
00160 GmshFormatReader::Keyword __nextKeyword();
00161
00166 void __getVertices();
00167
00172 void __readVertices();
00173
00178 void __readElements1();
00179
00184 void __readElements2();
00185
00191 GmshFormatReader(const GmshFormatReader& M);
00192
00199 void __writeReferences(const std::set<size_t>& references,
00200 std::string objectName);
00201 public:
00202
00208 GmshFormatReader(const std::string& s);
00209
00214 ~GmshFormatReader()
00215 {
00216 ;
00217 }
00218 };
00219
00220 #endif // GMSH_FORMAT_READER_HPP