-{ {"Reserved", "", "", ""},
- {"MeshVersionFormatted", "", "", "i"},
- {"Reserved", "", "", ""},
- {"Dimension", "", "", "i"},
- {"Vertices", "Vertex", "i", "dri"},
- {"Edges", "Edge", "i", "iii"},
- {"Triangles", "Triangle", "i", "iiii"},
- {"Quadrilaterals", "Quadrilateral", "i", "iiiii"},
- {"Tetrahedra", "Tetrahedron", "i", "iiiii"},
- {"Prisms", "Prism", "i", "iiiiiii"},
- {"Hexahedra", "Hexahedron", "i", "iiiiiiiii"},
- {"IterationsAll", "IterationAll","","i"},
- {"TimesAll", "TimeAll","","r"},
- {"Corners", "Corner", "i", "i"},
- {"Ridges", "Ridge", "i", "i"},
- {"RequiredVertices", "RequiredVertex", "i", "i"},
- {"RequiredEdges", "RequiredEdge", "i", "i"},
- {"RequiredTriangles", "RequiredTriangle", "i", "i"},
- {"RequiredQuadrilaterals", "RequiredQuadrilateral", "i", "i"},
- {"TangentAtEdgeVertices", "TangentAtEdgeVertex", "i", "iii"},
- {"NormalAtVertices", "NormalAtVertex", "i", "ii"},
- {"NormalAtTriangleVertices", "NormalAtTriangleVertex", "i", "iii"},
- {"NormalAtQuadrilateralVertices", "NormalAtQuadrilateralVertex", "i", "iiii"},
- {"AngleOfCornerBound", "", "", "r"},
- {"TrianglesP2", "TriangleP2", "i", "iiiiiii"},
- {"EdgesP2", "EdgeP2", "i", "iiii"},
- {"SolAtPyramids", "SolAtPyramid", "i", "sr"},
- {"QuadrilateralsQ2", "QuadrilateralQ2", "i", "iiiiiiiiii"},
- {"ISolAtPyramids", "ISolAtPyramid", "i", "iiiii"},
- {"SubDomainFromGeom", "SubDomainFromGeom", "i", "iiii"},
- {"TetrahedraP2", "TetrahedronP2", "i", "iiiiiiiiiii"},
- {"Fault_NearTri", "Fault_NearTri", "i", "i"},
- {"Fault_Inter", "Fault_Inter", "i", "i"},
- {"HexahedraQ2", "HexahedronQ2", "i", "iiiiiiiiiiiiiiiiiiiiiiiiiiii"},
- {"ExtraVerticesAtEdges", "ExtraVerticesAtEdge", "i", "in"},
- {"ExtraVerticesAtTriangles", "ExtraVerticesAtTriangle", "i", "in"},
- {"ExtraVerticesAtQuadrilaterals", "ExtraVerticesAtQuadrilateral", "i", "in"},
- {"ExtraVerticesAtTetrahedra", "ExtraVerticesAtTetrahedron", "i", "in"},
- {"ExtraVerticesAtPrisms", "ExtraVerticesAtPrism", "i", "in"},
- {"ExtraVerticesAtHexahedra", "ExtraVerticesAtHexahedron", "i", "in"},
- {"VerticesOnGeometricVertices", "VertexOnGeometricVertex", "i", "iir"},
- {"VerticesOnGeometricEdges", "VertexOnGeometricEdge", "i", "iirr"},
- {"VerticesOnGeometricTriangles", "VertexOnGeometricTriangle", "i", "iirrr"},
- {"VerticesOnGeometricQuadrilaterals", "VertexOnGeometricQuadrilateral", "i", "iirrr"},
- {"EdgesOnGeometricEdges", "EdgeOnGeometricEdge", "i", "iir"},
- {"Fault_FreeEdge", "Fault_FreeEdge", "i", "i"},
- {"Polyhedra", "Polyhedron", "i", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"},
- {"Polygons", "Polygon", "", "iiiiiiiii"},
- {"Fault_Overlap", "Fault_Overlap", "i", "i"},
- {"Pyramids", "Pyramid", "i", "iiiiii"},
- {"BoundingBox", "", "", "drdr"},
- {"Body","i", "drdrdrdr"},
- {"PrivateTable", "PrivateTable", "i", "i"},
- {"Fault_BadShape", "Fault_BadShape", "i", "i"},
- {"End", "", "", ""},
- {"TrianglesOnGeometricTriangles", "TriangleOnGeometricTriangle", "i", "iir"},
- {"TrianglesOnGeometricQuadrilaterals", "TriangleOnGeometricQuadrilateral", "i", "iir"},
- {"QuadrilateralsOnGeometricTriangles", "QuadrilateralOnGeometricTriangle", "i", "iir"},
- {"QuadrilateralsOnGeometricQuadrilaterals", "QuadrilateralOnGeometricQuadrilateral", "i", "iir"},
- {"Tangents", "Tangent", "i", "dr"},
- {"Normals", "Normal", "i", "dr"},
- {"TangentAtVertices", "TangentAtVertex", "i", "ii"},
- {"SolAtVertices", "SolAtVertex", "i", "sr"},
- {"SolAtEdges", "SolAtEdge", "i", "sr"},
- {"SolAtTriangles", "SolAtTriangle", "i", "sr"},
- {"SolAtQuadrilaterals", "SolAtQuadrilateral", "i", "sr"},
- {"SolAtTetrahedra", "SolAtTetrahedron", "i", "sr"},
- {"SolAtPrisms", "SolAtPrism", "i", "sr"},
- {"SolAtHexahedra", "SolAtHexahedron", "i", "sr"},
- {"DSolAtVertices", "DSolAtVertex", "i", "sr"},
- {"ISolAtVertices", "ISolAtVertex", "i", "i"},
- {"ISolAtEdges", "ISolAtEdge", "i", "ii"},
- {"ISolAtTriangles", "ISolAtTriangle", "i", "iii"},
- {"ISolAtQuadrilaterals", "ISolAtQuadrilateral", "i", "iiii"},
- {"ISolAtTetrahedra", "ISolAtTetrahedron", "i", "iiii"},
- {"ISolAtPrisms", "ISolAtPrism", "i", "iiiiii"},
- {"ISolAtHexahedra", "ISolAtHexahedron", "i", "iiiiiiii"},
- {"Iterations", "","","i"},
- {"Time", "","","r"},
- {"Fault_SmallTri", "Fault_SmallTri","i","i"},
- {"CoarseHexahedra", "CoarseHexahedron", "i", "i"}
+{ {"Reserved", "", "", ""},
+ {"MeshVersionFormatted", "", "", "i"},
+ {"Reserved", "", "", ""},
+ {"Dimension", "", "", "i"},
+ {"Vertices", "Vertex", "i", "dri"},
+ {"Edges", "Edge", "i", "iii"},
+ {"Triangles", "Triangle", "i", "iiii"},
+ {"Quadrilaterals", "Quadrilateral", "i", "iiiii"},
+ {"Tetrahedra", "Tetrahedron", "i", "iiiii"},
+ {"Prisms", "Prism", "i", "iiiiiii"},
+ {"Hexahedra", "Hexahedron", "i", "iiiiiiiii"},
+ {"IterationsAll", "IterationAll","","i"},
+ {"TimesAll", "TimeAll","","r"},
+ {"Corners", "Corner", "i", "i"},
+ {"Ridges", "Ridge", "i", "i"},
+ {"RequiredVertices", "RequiredVertex", "i", "i"},
+ {"RequiredEdges", "RequiredEdge", "i", "i"},
+ {"RequiredTriangles", "RequiredTriangle", "i", "i"},
+ {"RequiredQuadrilaterals", "RequiredQuadrilateral", "i", "i"},
+ {"TangentAtEdgeVertices", "TangentAtEdgeVertex", "i", "iii"},
+ {"NormalAtVertices", "NormalAtVertex", "i", "ii"},
+ {"NormalAtTriangleVertices", "NormalAtTriangleVertex", "i", "iii"},
+ {"NormalAtQuadrilateralVertices", "NormalAtQuadrilateralVertex", "i", "iiii"},
+ {"AngleOfCornerBound", "", "", "r"},
+ {"TrianglesP2", "TriangleP2", "i", "iiiiiii"},
+ {"EdgesP2", "EdgeP2", "i", "iiii"},
+ {"SolAtPyramids", "SolAtPyramid", "i", "sr"},
+ {"QuadrilateralsQ2", "QuadrilateralQ2", "i", "iiiiiiiiii"},
+ {"ISolAtPyramids", "ISolAtPyramid", "i", "iiiii"},
+ {"SubDomainFromGeom", "SubDomainFromGeom", "i", "iiii"},
+ {"TetrahedraP2", "TetrahedronP2", "i", "iiiiiiiiiii"},
+ {"Fault_NearTri", "Fault_NearTri", "i", "i"},
+ {"Fault_Inter", "Fault_Inter", "i", "i"},
+ {"HexahedraQ2", "HexahedronQ2", "i", "iiiiiiiiiiiiiiiiiiiiiiiiiiii"},
+ {"ExtraVerticesAtEdges", "ExtraVerticesAtEdge", "i", "in"},
+ {"ExtraVerticesAtTriangles", "ExtraVerticesAtTriangle", "i", "in"},
+ {"ExtraVerticesAtQuadrilaterals", "ExtraVerticesAtQuadrilateral", "i", "in"},
+ {"ExtraVerticesAtTetrahedra", "ExtraVerticesAtTetrahedron", "i", "in"},
+ {"ExtraVerticesAtPrisms", "ExtraVerticesAtPrism", "i", "in"},
+ {"ExtraVerticesAtHexahedra", "ExtraVerticesAtHexahedron", "i", "in"},
+ {"VerticesOnGeometricVertices", "VertexOnGeometricVertex", "i", "iir"},
+ {"VerticesOnGeometricEdges", "VertexOnGeometricEdge", "i", "iirr"},
+ {"VerticesOnGeometricTriangles", "VertexOnGeometricTriangle", "i", "iirrr"},
+ {"VerticesOnGeometricQuadrilaterals", "VertexOnGeometricQuadrilateral", "i", "iirrr"},
+ {"EdgesOnGeometricEdges", "EdgeOnGeometricEdge", "i", "iir"},
+ {"Fault_FreeEdge", "Fault_FreeEdge", "i", "i"},
+ {"Polyhedra", "Polyhedron", "i", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"},
+ {"Polygons", "Polygon", "", "iiiiiiiii"},
+ {"Fault_Overlap", "Fault_Overlap", "i", "i"},
+ {"Pyramids", "Pyramid", "i", "iiiiii"},
+ {"BoundingBox", "", "", "drdr"},
+ {"Body","i", "drdrdrdr"},
+ {"PrivateTable", "PrivateTable", "i", "i"},
+ {"Fault_BadShape", "Fault_BadShape", "i", "i"},
+ {"End", "", "", ""},
+ {"TrianglesOnGeometricTriangles", "TriangleOnGeometricTriangle", "i", "iir"},
+ {"TrianglesOnGeometricQuadrilaterals", "TriangleOnGeometricQuadrilateral", "i", "iir"},
+ {"QuadrilateralsOnGeometricTriangles", "QuadrilateralOnGeometricTriangle", "i", "iir"},
+ {"QuadrilateralsOnGeometricQuadrilaterals", "QuadrilateralOnGeometricQuadrilateral", "i", "iir"},
+ {"Tangents", "Tangent", "i", "dr"},
+ {"Normals", "Normal", "i", "dr"},
+ {"TangentAtVertices", "TangentAtVertex", "i", "ii"},
+ {"SolAtVertices", "SolAtVertex", "i", "sr"},
+ {"SolAtEdges", "SolAtEdge", "i", "sr"},
+ {"SolAtTriangles", "SolAtTriangle", "i", "sr"},
+ {"SolAtQuadrilaterals", "SolAtQuadrilateral", "i", "sr"},
+ {"SolAtTetrahedra", "SolAtTetrahedron", "i", "sr"},
+ {"SolAtPrisms", "SolAtPrism", "i", "sr"},
+ {"SolAtHexahedra", "SolAtHexahedron", "i", "sr"},
+ {"DSolAtVertices", "DSolAtVertex", "i", "sr"},
+ {"ISolAtVertices", "ISolAtVertex", "i", "i"},
+ {"ISolAtEdges", "ISolAtEdge", "i", "ii"},
+ {"ISolAtTriangles", "ISolAtTriangle", "i", "iii"},
+ {"ISolAtQuadrilaterals", "ISolAtQuadrilateral", "i", "iiii"},
+ {"ISolAtTetrahedra", "ISolAtTetrahedron", "i", "iiii"},
+ {"ISolAtPrisms", "ISolAtPrism", "i", "iiiiii"},
+ {"ISolAtHexahedra", "ISolAtHexahedron", "i", "iiiiiiii"},
+ {"Iterations", "","","i"},
+ {"Time", "","","r"},
+ {"Fault_SmallTri", "Fault_SmallTri","i","i"},
+ {"CoarseHexahedra", "CoarseHexahedron", "i", "i"}
- strcpy(msh->FilNam, FilNam);
-
- /* Store the opening mod (read or write) and guess the filetype (binary or ascii) depending on the extension */
-
- msh->mod = mod;
- msh->buf = (unsigned char *)msh->DblBuf;
- msh->FltBuf = (float *)msh->DblBuf;
- msh->IntBuf = (int *)msh->DblBuf;
-
- k = strlen(msh->FilNam) - 6;
- if(k < 0)
- k = 0;
- ptr = msh->FilNam+k;
- if(strstr(ptr, ".meshb"))
- msh->typ |= (Bin | MshFil);
- else if(strstr(ptr, ".mesh"))
- msh->typ |= (Asc | MshFil);
- else if(strstr(ptr, ".solb"))
- msh->typ |= (Bin | SolFil);
- else if(strstr(ptr, ".sol"))
- msh->typ |= (Asc | SolFil);
- else {
- free (msh);
- return(0);
- }
-
- /* Open the file in the required mod and initialyse the mesh structure */
-
- if(msh->mod == GmfRead)
- {
-
- /*-----------------------*/
- /* OPEN FILE FOR READING */
- /*-----------------------*/
-
- va_start(VarArg, mod);
- PtrVer = va_arg(VarArg, int *);
- PtrDim = va_arg(VarArg, int *);
- va_end(VarArg);
-
- /* Create the name string and open the file */
-
- if(!(msh->hdl = fopen(msh->FilNam, "rb")))
- {
- free (msh);
- return(0);
- }
-
- /* Read the endian coding tag, the mesh version and the mesh dimension (mandatory kwd) */
-
- if(msh->typ & Bin)
- {
- fread((unsigned char *)&msh->cod, WrdSiz, 1, msh->hdl);
-
- if( (msh->cod != 1) && (msh->cod != 16777216) )
- {
- free (msh);
- return(0);
- }
-
- ScaWrd(msh, (unsigned char *)&msh->ver);
-
- if( (msh->ver < 1) || (msh->ver > 3) )
- {
- free (msh);
- return(0);
- }
-
- if( (msh->ver == 3) && (sizeof(long) == 4) )
- {
- free (msh);
- return(0);
- }
-
- ScaWrd(msh, (unsigned char *)&KwdCod);
-
- if(KwdCod != GmfDimension)
- {
- free (msh);
- return(0);
- }
-
- GetPos(msh);
- ScaWrd(msh, (unsigned char *)&msh->dim);
- }
- else
- {
- do
- {
- res = fscanf(msh->hdl, "%s", str);
- }while( (res != EOF) && strcmp(str, "MeshVersionFormatted") );
-
- if(res == EOF)
- {
- free (msh);
- return(0);
- }
-
- fscanf(msh->hdl, "%d", &msh->ver);
-
- if( (msh->ver < 1) || (msh->ver > 3) )
- {
- free (msh);
- return(0);
- }
-
- do
- {
- res = fscanf(msh->hdl, "%s", str);
- }while( (res != EOF) && strcmp(str, "Dimension") );
-
- if(res == EOF)
- {
- free (msh);
- return(0);
- }
-
- fscanf(msh->hdl, "%d", &msh->dim);
- }
-
- if( (msh->dim != 2) && (msh->dim != 3) )
- {
- free (msh);
- return(0);
- }
-
- (*PtrVer) = msh->ver;
- (*PtrDim) = msh->dim;
-
- /*------------*/
- /* KW READING */
- /*------------*/
-
- /* Read the list of kw present in the file */
-
- if(!ScaKwdTab(msh))
- {
- free (msh);
- return(0);
- }
-
- GmfMshTab[ MshIdx ] = msh;
-
- return(MshIdx);
- }
- else if(msh->mod == GmfWrite)
- {
-
- /*-----------------------*/
- /* OPEN FILE FOR WRITING */
- /*-----------------------*/
-
- msh->cod = 1;
-
- /* Check if the user provided a valid version number and dimension */
-
- va_start(VarArg, mod);
- msh->ver = va_arg(VarArg, int);
- msh->dim = va_arg(VarArg, int);
- va_end(VarArg);
-
- if( (msh->ver < 1) || (msh->ver > 3) )
- {
- free (msh);
- return(0);
- }
-
- if( (msh->ver == 3) && (sizeof(long) == 4) )
- {
- free (msh);
- return(0);
- }
-
- if( (msh->dim != 2) && (msh->dim != 3) )
- {
- free (msh);
- return(0);
- }
-
- /* Create the mesh file */
-
- if(!(msh->hdl = fopen(msh->FilNam, "wb")))
- {
- free (msh);
- return(0);
- }
-
- GmfMshTab[ MshIdx ] = msh;
-
-
- /*------------*/
- /* KW WRITING */
- /*------------*/
-
- /* Write the mesh version and dimension */
-
- if(msh->typ & Asc)
- {
- fprintf(msh->hdl, "%s %d\n\n", GmfKwdFmt[ GmfVersionFormatted ][0], msh->ver);
- fprintf(msh->hdl, "%s %d\n", GmfKwdFmt[ GmfDimension ][0], msh->dim);
- }
- else
- {
- RecWrd(msh, (unsigned char *)&msh->cod);
- RecWrd(msh, (unsigned char *)&msh->ver);
- GmfSetKwd(MshIdx, GmfDimension, 0);
- RecWrd(msh, (unsigned char *)&msh->dim);
- }
-
- return(MshIdx);
- }
- else
- {
+ strcpy(msh->FilNam, FilNam);
+
+ /* Store the opening mod (read or write) and guess the filetype (binary or ascii) depending on the extension */
+
+ msh->mod = mod;
+ msh->buf = (unsigned char *)msh->DblBuf;
+ msh->FltBuf = (float *)msh->DblBuf;
+ msh->IntBuf = (int *)msh->DblBuf;
+
+ k = strlen(msh->FilNam) - 6;
+ if(k < 0)
+ k = 0;
+ ptr = msh->FilNam+k;
+ if(strstr(ptr, ".meshb"))
+ msh->typ |= (Bin | MshFil);
+ else if(strstr(ptr, ".mesh"))
+ msh->typ |= (Asc | MshFil);
+ else if(strstr(ptr, ".solb"))
+ msh->typ |= (Bin | SolFil);
+ else if(strstr(ptr, ".sol"))
+ msh->typ |= (Asc | SolFil);
+ else {
- int i, j;
- float *FltSolTab;
- double *DblSolTab;
- va_list VarArg;
- GmfMshSct *msh = GmfMshTab[ MshIdx ];
- KwdSct *kwd = &msh->KwdTab[ KwdCod ];
-
- /* Start decoding the arguments */
-
- va_start(VarArg, KwdCod);
-
- if(kwd->typ != SolKwd)
- {
- int k, nb_repeat = 0;
-
- if(msh->ver == 1)
- {
- if(msh->typ & Asc)
- {
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- fscanf(msh->hdl, "%f", va_arg(VarArg, float *));
- else if(kwd->fmt[i] == 'n') {
- fscanf(msh->hdl, "%d", &nb_repeat);
- *(va_arg(VarArg, int *)) = nb_repeat;
- for(k=0;k<nb_repeat;k++)
- fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
- }
- else
- fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
- }
- else
- {
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- ScaWrd(msh, (unsigned char *)va_arg(VarArg, float *));
- else if(kwd->fmt[i] == 'n') {
- ScaWrd(msh, (unsigned char *)&nb_repeat);
- *(va_arg(VarArg, int *)) = nb_repeat;
- for(k=0;k<nb_repeat;k++)
- ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
- }
- else
- ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
- }
- }
- else
- {
- if(msh->typ & Asc)
- {
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- fscanf(msh->hdl, "%lf", va_arg(VarArg, double *));
- else if(kwd->fmt[i] == 'n') {
- fscanf(msh->hdl, "%d", &nb_repeat);
- *(va_arg(VarArg, int *)) = nb_repeat;
- for(k=0;k<nb_repeat;k++)
- fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
- }
- else
- fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
- }
- else
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- ScaDblWrd(msh, (unsigned char *)va_arg(VarArg, double *));
- else if(kwd->fmt[i] == 'n') {
- ScaWrd(msh, (unsigned char *)&nb_repeat);
- *(va_arg(VarArg, int *)) = nb_repeat;
- for(k=0;k<nb_repeat;k++)
- ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
- }
- else
- ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
- }
- }
- else
- {
- if(msh->ver == 1)
- {
- FltSolTab = va_arg(VarArg, float *);
-
- if(msh->typ & Asc)
- for(j=0;j<kwd->SolSiz;j++)
- fscanf(msh->hdl, "%f", &FltSolTab[j]);
- else
- ScaBlk(msh, (unsigned char *)FltSolTab, kwd->NmbWrd);
- }
- else
- {
- DblSolTab = va_arg(VarArg, double *);
-
- if(msh->typ & Asc)
- for(j=0;j<kwd->SolSiz;j++)
- fscanf(msh->hdl, "%lf", &DblSolTab[j]);
- else
- for(j=0;j<kwd->SolSiz;j++)
- ScaDblWrd(msh, (unsigned char *)&DblSolTab[j]);
- }
- }
-
- va_end(VarArg);
+ int i, j;
+ float *FltSolTab;
+ double *DblSolTab;
+ va_list VarArg;
+ GmfMshSct *msh = GmfMshTab[ MshIdx ];
+ KwdSct *kwd = &msh->KwdTab[ KwdCod ];
+
+ /* Start decoding the arguments */
+
+ va_start(VarArg, KwdCod);
+
+ if(kwd->typ != SolKwd)
+ {
+ int k, nb_repeat = 0;
+
+ if(msh->ver == 1)
+ {
+ if(msh->typ & Asc)
+ {
+ for(i=0;i<kwd->SolSiz;i++)
+ if(kwd->fmt[i] == 'r')
+ fscanf(msh->hdl, "%f", va_arg(VarArg, float *));
+ else if(kwd->fmt[i] == 'n') {
+ fscanf(msh->hdl, "%d", &nb_repeat);
+ *(va_arg(VarArg, int *)) = nb_repeat;
+ for(k=0;k<nb_repeat;k++)
+ fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
+ }
+ else
+ fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
+ }
+ else
+ {
+ for(i=0;i<kwd->SolSiz;i++)
+ if(kwd->fmt[i] == 'r')
+ ScaWrd(msh, (unsigned char *)va_arg(VarArg, float *));
+ else if(kwd->fmt[i] == 'n') {
+ ScaWrd(msh, (unsigned char *)&nb_repeat);
+ *(va_arg(VarArg, int *)) = nb_repeat;
+ for(k=0;k<nb_repeat;k++)
+ ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
+ }
+ else
+ ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
+ }
+ }
+ else
+ {
+ if(msh->typ & Asc)
+ {
+ for(i=0;i<kwd->SolSiz;i++)
+ if(kwd->fmt[i] == 'r')
+ fscanf(msh->hdl, "%lf", va_arg(VarArg, double *));
+ else if(kwd->fmt[i] == 'n') {
+ fscanf(msh->hdl, "%d", &nb_repeat);
+ *(va_arg(VarArg, int *)) = nb_repeat;
+ for(k=0;k<nb_repeat;k++)
+ fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
+ }
+ else
+ fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
+ }
+ else
+ for(i=0;i<kwd->SolSiz;i++)
+ if(kwd->fmt[i] == 'r')
+ ScaDblWrd(msh, (unsigned char *)va_arg(VarArg, double *));
+ else if(kwd->fmt[i] == 'n') {
+ ScaWrd(msh, (unsigned char *)&nb_repeat);
+ *(va_arg(VarArg, int *)) = nb_repeat;
+ for(k=0;k<nb_repeat;k++)
+ ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
+ }
+ else
+ ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
+ }
+ }
+ else
+ {
+ if(msh->ver == 1)
+ {
+ FltSolTab = va_arg(VarArg, float *);
+
+ if(msh->typ & Asc)
+ for(j=0;j<kwd->SolSiz;j++)
+ fscanf(msh->hdl, "%f", &FltSolTab[j]);
+ else
+ ScaBlk(msh, (unsigned char *)FltSolTab, kwd->NmbWrd);
+ }
+ else
+ {
+ DblSolTab = va_arg(VarArg, double *);
+
+ if(msh->typ & Asc)
+ for(j=0;j<kwd->SolSiz;j++)
+ fscanf(msh->hdl, "%lf", &DblSolTab[j]);
+ else
+ for(j=0;j<kwd->SolSiz;j++)
+ ScaDblWrd(msh, (unsigned char *)&DblSolTab[j]);
+ }
+ }
+
+ va_end(VarArg);
- int i, j, pos, *IntBuf;
- float *FltSolTab;
- double *DblSolTab, *DblBuf;
- va_list VarArg;
- GmfMshSct *msh = GmfMshTab[ MshIdx ];
- KwdSct *kwd = &msh->KwdTab[ KwdCod ];
-
- /* Start decoding the arguments */
-
- va_start(VarArg, KwdCod);
-
- if(kwd->typ != SolKwd)
- {
- int k, nb_repeat = 0;
-
- if(msh->ver == 1)
- {
- if(msh->typ & Asc)
- {
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- fprintf(msh->hdl, "%g ", (float)va_arg(VarArg, double));
- else if(kwd->fmt[i] == 'n') {
- nb_repeat = va_arg(VarArg, int);
- fprintf(msh->hdl, "%d ", nb_repeat);
- for(k=0;k<nb_repeat;k++)
- fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
- }
- else
- fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
- }
- else
- {
- int size_of_block = kwd->SolSiz;
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- msh->FltBuf[i] = va_arg(VarArg, double);
- else if(kwd->fmt[i] == 'n') {
- nb_repeat = va_arg(VarArg, int);
- msh->FltBuf[i] = nb_repeat;
- for(k=0;k<nb_repeat;k++) {
- msh->IntBuf[i+1+k] = va_arg(VarArg, int);
- size_of_block ++;
- }
- }
- else
- msh->IntBuf[i] = va_arg(VarArg, int);
-
- RecBlk(msh, msh->buf, size_of_block);
- }
- }
- else
- {
- if(msh->typ & Asc)
- {
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- fprintf(msh->hdl, "%.15lg ", va_arg(VarArg, double));
- else if(kwd->fmt[i] == 'n') {
- nb_repeat = va_arg(VarArg, int);
- fprintf(msh->hdl, "%d ", nb_repeat);
- for(k=0;k<nb_repeat;k++)
- fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
- }
- else
- fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
- }
- else
- {
- pos = 0;
-
- for(i=0;i<kwd->SolSiz;i++)
- if(kwd->fmt[i] == 'r')
- {
- DblBuf = (double *)&msh->buf[ pos ];
- *DblBuf = va_arg(VarArg, double);
- pos += 8;
- }
- else if(kwd->fmt[i] == 'n')
- {
- IntBuf = (int *)&msh->buf[ pos ];
- nb_repeat = va_arg(VarArg, int);
- *IntBuf = nb_repeat;
- pos += 4;
- for(k=0;k<nb_repeat;k++) {
- IntBuf = (int *)&msh->buf[ pos ];
- *IntBuf = va_arg(VarArg, int);
- pos += 4;
- }
- }
- else
- {
- IntBuf = (int *)&msh->buf[ pos ];
- *IntBuf = va_arg(VarArg, int);
- pos += 4;
- }
- RecBlk(msh, msh->buf, pos/4);
- }
- }
- }
- else
- {
- if(msh->ver == 1)
- {
- FltSolTab = va_arg(VarArg, float *);
-
- if(msh->typ & Asc)
- for(j=0;j<kwd->SolSiz;j++)
- fprintf(msh->hdl, "%g ", FltSolTab[j]);
- else
- RecBlk(msh, (unsigned char *)FltSolTab, kwd->NmbWrd);
- }
- else
- {
- DblSolTab = va_arg(VarArg, double *);
-
- if(msh->typ & Asc)
- for(j=0;j<kwd->SolSiz;j++)
- fprintf(msh->hdl, "%.15lg ", DblSolTab[j]);
- else
- RecBlk(msh, (unsigned char *)DblSolTab, kwd->NmbWrd);
- }
- }
-
- va_end(VarArg);
-
- if(msh->typ & Asc)
- fprintf(msh->hdl, "\n");
+ int i, j, pos, *IntBuf;
+ float *FltSolTab;
+ double *DblSolTab, *DblBuf;
+ va_list VarArg;
+ GmfMshSct *msh = GmfMshTab[ MshIdx ];
+ KwdSct *kwd = &msh->KwdTab[ KwdCod ];
+
+ /* Start decoding the arguments */
+
+ va_start(VarArg, KwdCod);
+
+ if(kwd->typ != SolKwd)
+ {
+ int k, nb_repeat = 0;
+
+ if(msh->ver == 1)
+ {
+ if(msh->typ & Asc)
+ {
+ for(i=0;i<kwd->SolSiz;i++)
+ if(kwd->fmt[i] == 'r')
+ fprintf(msh->hdl, "%g ", (float)va_arg(VarArg, double));
+ else if(kwd->fmt[i] == 'n') {
+ nb_repeat = va_arg(VarArg, int);
+ fprintf(msh->hdl, "%d ", nb_repeat);
+ for(k=0;k<nb_repeat;k++)
+ fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
+ }
+ else
+ fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
+ }
+ else
+ {
+ int size_of_block = kwd->SolSiz;
+ for(i=0;i<kwd->SolSiz;i++)
+ if(kwd->fmt[i] == 'r')
+ msh->FltBuf[i] = va_arg(VarArg, double);
+ else if(kwd->fmt[i] == 'n') {
+ nb_repeat = va_arg(VarArg, int);
+ msh->FltBuf[i] = nb_repeat;
+ for(k=0;k<nb_repeat;k++) {
+ msh->IntBuf[i+1+k] = va_arg(VarArg, int);
+ size_of_block ++;
+ }
+ }
+ else
+ msh->IntBuf[i] = va_arg(VarArg, int);
+
+ RecBlk(msh, msh->buf, size_of_block);
+ }
+ }
+ else
+ {
+ if(msh->typ & Asc)
+ {
+ for(i=0;i<kwd->SolSiz;i++)
+ if(kwd->fmt[i] == 'r')
+ fprintf(msh->hdl, "%.15lg ", va_arg(VarArg, double));
+ else if(kwd->fmt[i] == 'n') {
+ nb_repeat = va_arg(VarArg, int);
+ fprintf(msh->hdl, "%d ", nb_repeat);
+ for(k=0;k<nb_repeat;k++)
+ fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
+ }
+ else
+ fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
+ }
+ else
+ {
+ pos = 0;
+
+ for(i=0;i<kwd->SolSiz;i++)
+ if(kwd->fmt[i] == 'r')
+ {
+ DblBuf = (double *)&msh->buf[ pos ];
+ *DblBuf = va_arg(VarArg, double);
+ pos += 8;
+ }
+ else if(kwd->fmt[i] == 'n')
+ {
+ IntBuf = (int *)&msh->buf[ pos ];
+ nb_repeat = va_arg(VarArg, int);
+ *IntBuf = nb_repeat;
+ pos += 4;
+ for(k=0;k<nb_repeat;k++) {
+ IntBuf = (int *)&msh->buf[ pos ];
+ *IntBuf = va_arg(VarArg, int);
+ pos += 4;
+ }
+ }
+ else
+ {
+ IntBuf = (int *)&msh->buf[ pos ];
+ *IntBuf = va_arg(VarArg, int);
+ pos += 4;
+ }
+ RecBlk(msh, msh->buf, pos/4);
+ }
+ }
+ }
+ else
+ {
+ if(msh->ver == 1)
+ {
+ FltSolTab = va_arg(VarArg, float *);
+
+ if(msh->typ & Asc)
+ for(j=0;j<kwd->SolSiz;j++)
+ fprintf(msh->hdl, "%g ", FltSolTab[j]);
+ else
+ RecBlk(msh, (unsigned char *)FltSolTab, kwd->NmbWrd);
+ }
+ else
+ {
+ DblSolTab = va_arg(VarArg, double *);
+
+ if(msh->typ & Asc)
+ for(j=0;j<kwd->SolSiz;j++)
+ fprintf(msh->hdl, "%.15lg ", DblSolTab[j]);
+ else
+ RecBlk(msh, (unsigned char *)DblSolTab, kwd->NmbWrd);
+ }
+ }
+
+ va_end(VarArg);
+
+ if(msh->typ & Asc)
+ fprintf(msh->hdl, "\n");