Go to the documentation of this file. 1
15
16 #ifndef WRITE_CGNS_HPP
17 #define WRITE_CGNS_HPP
18
19 #include "moab/Forward.hpp"
20 #include "moab/WriterIface.hpp"
21 #include <cstdio>
22
23
24 #include "cgnslib.h"
25 #include "moab/Range.hpp"
26
27
28 #if CGNS_VERSION < 3100
29 #define cgsize_t int
30 #else
31 #if CG_BUILD_SCOPE
32 #error enumeration scoping needs to be off
33 #endif
34 #endif
35
36 namespace moab
37 {
38
39 class WriteUtilIface;
40
41
45
46 class WriteCGNS : public WriterIface
47 {
48
49 public:
50
51 static WriterIface* factory( Interface* );
52
53
54 WriteCGNS( Interface* impl );
55
56
57 virtual ~WriteCGNS();
58
59
60 class SetStruct
61 {
62 public:
63 std::string TagName;
64 cgsize_t IdSet;
65 cgsize_t NbEdges;
66 cgsize_t NbFaces;
67 cgsize_t NbCells;
68
69
70 std::vector< cgsize_t > NbEntities;
71 ElementType_t CGNSType;
72
73 SetStruct() : IdSet( -1 ), NbEdges( 0 ), NbFaces( 0 ), NbCells( 0 ){};
74 ~SetStruct(){};
75 };
76
77
78 ErrorCode write_file( const char* file_name,
79 const bool overwrite,
80 const FileOptions& opts,
81 const EntityHandle* output_list,
82 const int num_sets,
83 const std::vector< std::string >& qa_list,
84 const Tag* tag_list = NULL,
85 int num_tags = 0,
86 int export_dimension = 3 );
87
88
89 ErrorCode get_vertex_entities( cgsize_t& VrtSize, std::vector< moab::EntityHandle >& Nodes );
90
91
92 ErrorCode get_edge_entities( cgsize_t& EdgeSize, std::vector< moab::EntityHandle >& Edges );
93
94
95 ErrorCode get_face_entities( cgsize_t& FaceSize, std::vector< moab::EntityHandle >& Faces );
96
97
98 ErrorCode get_cell_entities( cgsize_t& CellSize, std::vector< moab::EntityHandle >& Cells );
99
100
101 ErrorCode write_coord_cgns( std::vector< moab::EntityHandle >& nodes );
102
103
104 ErrorCode set_tag_values( std::vector< moab::Tag >& TagHandles,
105 std::vector< moab::EntityHandle >& Edges,
106 std::vector< moab::EntityHandle >& Faces,
107 std::vector< moab::EntityHandle >& Cells,
108 std::vector< WriteCGNS::SetStruct >& Sets );
109
110
111 ErrorCode get_set_entities( int i,
112 std::vector< moab::Tag >& TagHandles,
113 std::vector< WriteCGNS::SetStruct >& Sets );
114
115
116 ErrorCode get_cgns_type( int i, std::vector< WriteCGNS::SetStruct >& Sets );
117
118
119 ErrorCode get_conn_table( std::vector< moab::EntityHandle >& Elements,
120 std::vector< int >& Begin,
121 std::vector< int >& End,
122 std::vector< moab::Tag >& TagHandles,
123 std::vector< WriteCGNS::SetStruct >& Sets,
124 std::vector< std::vector< cgsize_t > >& ConnTable );
125
126
127 int moab_cgns_conv( const EntityHandle handle );
128
129 private:
130
131 Interface* mbImpl;
132 WriteUtilIface* mWriteIface;
133
134
135 const char* fileName;
136 int IndexFile;
137
138
139 const char* BaseName;
140 int IndexBase;
141
142
143 const char* ZoneName;
144 int IndexZone;
145
146
147 int IndexSection;
148
149
150 int IndexCoord[3];
151
152
153 int celldim;
154 int physdim;
155 cgsize_t isize[3];
156
157
158 std::vector< moab::EntityHandle > Nodes;
159 std::vector< moab::EntityHandle > Edges;
160 std::vector< moab::EntityHandle > Faces;
161 std::vector< moab::EntityHandle > Cells;
162
163
164 cgsize_t VrtSize;
165 cgsize_t EdgeSize;
166 cgsize_t FaceSize;
167 cgsize_t CellSize;
168 };
169
170 }
171
172 #endif