1 // Copyright (C) 2021 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef MESHFORMATPARSER_HXX
21 #define MESHFORMATPARSER_HXX
22 /*----------------------------------------------------------*/
26 /*----------------------------------------------------------*/
28 /* Description: handle .meshb file format I/O */
29 /* Author: Loic MARECHAL */
30 /* Creation date: feb 16 2007 */
31 /* Last modification: dec 12 2020 */
33 /*----------------------------------------------------------*/
36 /*----------------------------------------------------------*/
38 /*----------------------------------------------------------*/
41 #define GmfStrSiz 1024
42 #define GmfMaxTyp 1000
55 /*----------------------------------------------------------*/
57 /*----------------------------------------------------------*/
71 // see MeshGems/Docs/meshgems_formats_description.pdf
72 extern const char* GmfKwdFmt[ GmfMaxKwd + 1 ][4];
73 /*----------------------------------------------------------*/
75 /*----------------------------------------------------------*/
76 namespace MeshFormat {
79 int typ, SolSiz, NmbWrd, NmbLin, NmbTyp, TypTab[ GmfMaxTyp ];
81 char fmt[ GmfMaxTyp*9 ];
86 int dim, ver, mod, typ, cod, pos;
88 KwdSct KwdTab[ GmfMaxKwd + 1 ];
93 char FilNam[ GmfStrSiz ];
94 double DblBuf[1000/8];
95 unsigned char blk[ BufSiz + 1000 ];
102 // see MeshGems/Docs/meshgems_formats_description.pdf
106 GmfVersionFormatted, \
120 GmfRequiredVertices, \
122 GmfRequiredTriangles, \
123 GmfRequiredQuadrilaterals, \
124 GmfTangentAtEdgeVertices, \
125 GmfNormalAtVertices, \
126 GmfNormalAtTriangleVertices, \
127 GmfNormalAtQuadrilateralVertices, \
128 GmfAngleOfCornerBound, \
132 GmfQuadrilateralsQ2, \
134 GmfSubDomainFromGeom, \
139 GmfExtraVerticesAtEdges, \
140 GmfExtraVerticesAtTriangles, \
141 GmfExtraVerticesAtQuadrilaterals, \
142 GmfExtraVerticesAtTetrahedra, \
143 GmfExtraVerticesAtPrisms, \
144 GmfExtraVerticesAtHexahedra, \
145 GmfVerticesOnGeometricVertices, \
146 GmfVerticesOnGeometricEdges, \
147 GmfVerticesOnGeometricTriangles, \
148 GmfVerticesOnGeometricQuadrilaterals, \
149 GmfEdgesOnGeometricEdges, \
160 GmfTrianglesOnGeometricTriangles, \
161 GmfTrianglesOnGeometricQuadrilaterals, \
162 GmfQuadrilateralsOnGeometricTriangles, \
163 GmfQuadrilateralsOnGeometricQuadrilaterals, \
166 GmfTangentAtVertices, \
170 GmfSolAtQuadrilaterals, \
171 GmfSolAtTetrahedra, \
177 GmfISolAtTriangles, \
178 GmfISolAtQuadrilaterals, \
179 GmfISolAtTetrahedra, \
181 GmfISolAtHexahedra, \
185 GmfCoarseHexahedra, \
186 GmfFault_MultipleEdge
191 class MeshFormatParser {
192 /*----------------------------------------------------------*/
193 /* External procedures */
194 /*----------------------------------------------------------*/
197 int GmfOpenMesh(const char *, int, ...);
198 int GmfCloseMesh(int);
199 int GmfStatKwd(int, int, ...);
200 int GmfGotoKwd(int, int);
201 int GmfSetKwd(int, int, ...);
202 void GmfGetLin(int, int, ...);
203 void GmfSetLin(int, int, ...);
207 /*----------------------------------------------------------*/
208 /* private procedures methods */
209 /*----------------------------------------------------------*/
211 void ScaWrd(GmfMshSct *, unsigned char *);
212 void ScaDblWrd(GmfMshSct *, unsigned char *);
213 void ScaBlk(GmfMshSct *, unsigned char *, int);
214 long GetPos(GmfMshSct *);
215 void RecWrd(GmfMshSct *, unsigned char *);
216 void RecDblWrd(GmfMshSct *, unsigned char *);
217 void RecBlk(GmfMshSct *, unsigned char *, int);
218 void SetPos(GmfMshSct *, long);
219 int ScaKwdTab(GmfMshSct *);
220 void ExpFmt(GmfMshSct *, int);
221 void ScaKwdHdr(GmfMshSct *, int);
223 void GmfCpyLin(int, int, int);
227 GmfMshSct *GmfMshTab[ MaxMsh + 1 ];
236 #endif // MESHFORMATPARSER_HXX