Go to the documentation of this file. 1
15
16
17
18
19
20
21
22
23
24
25
26
27 #ifndef READNASTRAN_HPP
28 #define READNASTRAN_HPP
29
30 #ifndef IS_BUILDING_MB
31 #error "ReadNASTRAN.hpp isn't supposed to be included into an application"
32 #endif
33
34 #include <iostream>
35 #include <fstream>
36 #include <sstream>
37 #include <vector>
38
39 #include "moab/Interface.hpp"
40 #include "moab/ReaderIface.hpp"
41 #include "FileTokenizer.hpp"
42 #include "moab/RangeMap.hpp"
43
44 namespace moab
45 {
46
47 class ReadUtilIface;
48
49 class ReadNASTRAN : public ReaderIface
50 {
51
52 public:
53
54 static ReaderIface* factory( Interface* );
55
56 ErrorCode load_file( const char* file_name,
57 const EntityHandle* file_set,
58 const FileOptions& opts,
59 const SubsetList* subset_list = 0,
60 const Tag* file_id_tag = 0 );
61
62 ReadNASTRAN( Interface* impl = NULL );
63
64
65 virtual ~ReadNASTRAN();
66
67 ErrorCode read_tag_values( const char* file_name,
68 const char* tag_name,
69 const FileOptions& opts,
70 std::vector< int >& tag_values_out,
71 const SubsetList* subset_list = 0 );
72
73 protected:
74 private:
75
76 ReadUtilIface* readMeshIface;
77
78
79 Interface* MBI;
80
81 RangeMap< int, EntityHandle > nodeIdMap, elemIdMap;
82
83 enum line_format
84 {
85 SMALL_FIELD,
86 LARGE_FIELD,
87 FREE_FIELD
88 };
89
90 ErrorCode determine_line_format( const std::string& line, line_format& format );
91
92 ErrorCode tokenize_line( const std::string& line, const line_format format, std::vector< std::string >& tokens );
93
94 ErrorCode determine_entity_type( const std::string& token, EntityType& type );
95
96 ErrorCode get_real( const std::string&, double& real );
97
98 ErrorCode read_node( const std::vector< std::string >& tokens,
99 const bool debug,
100 double* coord_arrays[3],
101 int& node_id );
102
103 ErrorCode read_element( const std::vector< std::string >& tokens,
104 std::vector< Range >& materials,
105 const EntityType element_type,
106 const bool debug );
107
108 ErrorCode create_materials( const std::vector< Range >& materials );
109
110 ErrorCode assign_ids( const Tag* file_id_tag );
111 };
112
113 }
114
115 #endif