1 #ifndef READCCMIO_HPP
2 #define READCCMIO_HPP
3
4 #ifndef IS_BUILDING_MB
5 #error "ReadCCMIO.hpp isn't supposed to be included into an application"
6 #endif
7
8 #include <vector>
9 #include <set>
10 #include <map>
11 #include <string>
12
13 #include "moab/Forward.hpp"
14 #include "moab/Range.hpp"
15 #include "moab/ExoIIInterface.hpp"
16 #include "moab/ReaderIface.hpp"
17
18 #include "ccmio.h"
19
20 namespace moab
21 {
22
23 #undef READCCMIO_USE_TUPLE_LIST
24
25 class ReadUtilIface;
26
27 class ReadCCMIO : public ReaderIface
28 {
29
30 public:
31 typedef std::map< int, std::vector< EntityHandle > > TupleList;
32 typedef std::map< int, std::vector< int > > SenseList;
33
34
35 ReadCCMIO( Interface* impl );
36
37
38 virtual ~ReadCCMIO();
39
40 static ReaderIface* factory( Interface* );
41
42 ErrorCode load_file( const char* file_name,
43 const EntityHandle* file_set,
44 const FileOptions& opts,
45 const SubsetList* subset_list = 0,
46 const Tag* file_id_tag = 0 );
47
48 private:
49 ErrorCode read_processor( CCMIOID rootID,
50 CCMIOID problemID,
51 CCMIOID processorID,
52 CCMIOID verticesID,
53 CCMIOID topologyID,
54 CCMIOSize_t proc,
55 Range* new_ents );
56
57 ErrorCode read_cells( CCMIOSize_t proc,
58 CCMIOID processorID,
59 CCMIOID verticesID,
60 CCMIOID topologyID,
61 TupleList& vert_map,
62 Range* new_cells );
63
64 ErrorCode construct_cells( TupleList& face_map,
65 #ifndef READCCMIO_USE_TUPLE_LIST
66 SenseList& sense_map,
67 #endif
68 TupleList& vert_map,
69 std::map< int, int >& cell_topo_types,
70 std::vector< EntityHandle >& new_cells );
71
72 ErrorCode ccmio_to_moab_type( int ccm_type, EntityType& moab_type, bool& has_mid_nodes );
73
74 ErrorCode create_cell_from_faces( std::vector< EntityHandle >& facehs,
75 std::vector< int >& senses,
76 EntityType this_type,
77 bool has_mid_nodes,
78 EntityHandle& cell );
79
80 ErrorCode read_gids_and_types( CCMIOID problemID, CCMIOID topologyID, std::vector< EntityHandle >& cells );
81
82 ErrorCode read_all_faces( CCMIOID topologyID,
83 TupleList& vert_map,
84 TupleList& face_map
85 #ifndef READCCMIO_USE_TUPLE_LIST
86 ,
87 SenseList& sense_map
88 #endif
89 ,
90 Range* new_faces );
91
92 ErrorCode read_faces( CCMIOID faceID,
93 CCMIOEntity bdy_or_int,
94 TupleList& vert_map,
95 TupleList& face_map
96 #ifndef READCCMIO_USE_TUPLE_LIST
97 ,
98 SenseList& sense_map
99 #endif
100 ,
101 Range* new_faces );
102
103 ErrorCode make_faces( int* farray, TupleList& vert_map, std::vector< EntityHandle >& new_faces, int num_faces );
104
105 ErrorCode read_vertices( CCMIOSize_t proc,
106 CCMIOID processorID,
107 CCMIOID verticesID,
108 CCMIOID topologyID,
109 Range* verts,
110 TupleList& vert_map );
111
112 ErrorCode get_processors( CCMIOID stateID,
113 CCMIOID& processorID,
114 CCMIOID& verticesID,
115 CCMIOID& topologyID,
116 CCMIOID& solutionID,
117 std::vector< CCMIOSize_t >& procs,
118 bool& has_solution );
119
120 ErrorCode get_state( CCMIOID rootID, CCMIOID& problemID, CCMIOID& stateID );
121
122 ErrorCode read_tag_values( const char* file_name,
123 const char* tag_name,
124 const FileOptions& opts,
125 std::vector< int >& tag_values_out,
126 const SubsetList* subset_list = 0 );
127
128 ErrorCode load_matset_data( CCMIOID problemID );
129
130 ErrorCode load_neuset_data( CCMIOID problemID );
131
132 ErrorCode load_metadata( CCMIOID rootID,
133 CCMIOID problemID,
134 CCMIOID stateID,
135 CCMIOID processorID,
136 const EntityHandle* file_set );
137
138 ErrorCode read_topology_types( CCMIOID& topologyID, std::map< int, int >& cell_topo_types );
139
140 ErrorCode get_int_option( const char* opt_str, EntityHandle seth, Tag& tag, CCMIOID node );
141
142 ErrorCode get_dbl_option( const char* opt_str, EntityHandle seth, Tag& tag, CCMIOID node );
143
144 ErrorCode get_str_option( const char* opt_str,
145 EntityHandle seth,
146 Tag& tag,
147 CCMIOID node,
148 const char* tag_name = NULL );
149
150
151
152 Tag mMaterialSetTag;
153 Tag mDirichletSetTag;
154 Tag mNeumannSetTag;
155 Tag mHasMidNodesTag;
156 Tag mGlobalIdTag;
157 Tag mNameTag;
158 Tag mMaterialIdTag, mMaterialTypeTag;
159 Tag mRadiationTag, mPorosityIdTag, mSpinIdTag, mGroupIdTag, mColorIdxTag, mProcessorIdTag, mLightMaterialTag,
160 mFreeSurfaceMaterialTag;
161 Tag mThicknessTag, mProstarRegionNumberTag, mBoundaryTypeTag, mCreatingProgramTag;
162
163 Interface* mbImpl;
164
165 ReadUtilIface* readMeshIface;
166
167 std::map< int, EntityHandle > newMatsets, newNeusets;
168
169 bool hasSolution;
170 };
171
172 }
173
174 #endif