From: eap Date: Fri, 28 Dec 2012 16:30:38 +0000 (+0000) Subject: untabify X-Git-Tag: pluginMGCleaner~192 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=752ad5bd147fda68033627bfb00e761f897503c1;p=modules%2Fsmesh.git untabify --- diff --git a/src/DriverGMF/libmesh5.c b/src/DriverGMF/libmesh5.c index b16c39c93..e0892c77e 100644 --- a/src/DriverGMF/libmesh5.c +++ b/src/DriverGMF/libmesh5.c @@ -1,21 +1,21 @@ /*----------------------------------------------------------*/ -/* */ -/* LIBMESH V 5.46 */ -/* */ +/* */ +/* LIBMESH V 5.46 */ +/* */ /*----------------------------------------------------------*/ -/* */ -/* Description: handle .meshb file format I/O */ -/* Author: Loic MARECHAL */ -/* Creation date: feb 16 2007 */ -/* Last modification: apr 03 2012 */ -/* */ +/* */ +/* Description: handle .meshb file format I/O */ +/* Author: Loic MARECHAL */ +/* Creation date: feb 16 2007 */ +/* Last modification: apr 03 2012 */ +/* */ /*----------------------------------------------------------*/ /*----------------------------------------------------------*/ -/* Includes */ +/* Includes */ /*----------------------------------------------------------*/ #include @@ -29,7 +29,7 @@ /*----------------------------------------------------------*/ -/* Defines */ +/* Defines */ /*----------------------------------------------------------*/ #define Asc 1 @@ -45,124 +45,124 @@ /*----------------------------------------------------------*/ -/* Structures */ +/* Structures */ /*----------------------------------------------------------*/ typedef struct { - int typ, SolSiz, NmbWrd, NmbLin, NmbTyp, TypTab[ GmfMaxTyp ]; - long pos; - char fmt[ GmfMaxTyp*9 ]; + int typ, SolSiz, NmbWrd, NmbLin, NmbTyp, TypTab[ GmfMaxTyp ]; + long pos; + char fmt[ GmfMaxTyp*9 ]; }KwdSct; typedef struct { - int dim, ver, mod, typ, cod, pos; - long NexKwdPos, siz; - KwdSct KwdTab[ GmfMaxKwd + 1 ]; - FILE *hdl; - int *IntBuf; - float *FltBuf; - unsigned char *buf; - char FilNam[ GmfStrSiz ]; - double DblBuf[1000/8]; - unsigned char blk[ BufSiz + 1000 ]; + int dim, ver, mod, typ, cod, pos; + long NexKwdPos, siz; + KwdSct KwdTab[ GmfMaxKwd + 1 ]; + FILE *hdl; + int *IntBuf; + float *FltBuf; + unsigned char *buf; + char FilNam[ GmfStrSiz ]; + double DblBuf[1000/8]; + unsigned char blk[ BufSiz + 1000 ]; }GmfMshSct; /*----------------------------------------------------------*/ -/* Global variables */ +/* Global variables */ /*----------------------------------------------------------*/ static int GmfIniFlg=0; static GmfMshSct *GmfMshTab[ MaxMsh + 1 ]; static const char *GmfKwdFmt[ GmfMaxKwd + 1 ][4] = -{ {"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"} }; /*----------------------------------------------------------*/ -/* Prototypes of local procedures */ +/* Prototypes of local procedures */ /*----------------------------------------------------------*/ static void ScaWrd(GmfMshSct *, unsigned char *); @@ -179,299 +179,299 @@ static void ScaKwdHdr(GmfMshSct *, int); /*----------------------------------------------------------*/ -/* Open a mesh file in read or write mod */ +/* Open a mesh file in read or write mod */ /*----------------------------------------------------------*/ int GmfOpenMesh(const char *FilNam, int mod, ...) { - int i, KwdCod, res, *PtrVer, *PtrDim, MshIdx=0; - char str[ GmfStrSiz ]; - va_list VarArg; - GmfMshSct *msh; - char *ptr; - int k; - - if(!GmfIniFlg) - { - for(i=0;i<=MaxMsh;i++) - GmfMshTab[i] = NULL; - - GmfIniFlg = 1; - } - - /*---------------------*/ - /* MESH STRUCTURE INIT */ - /*---------------------*/ - - for(i=1;i<=MaxMsh;i++) - if(!GmfMshTab[i]) - { - MshIdx = i; - break; - } - - if( !MshIdx || !(msh = calloc(1, sizeof(GmfMshSct))) ) - return(0); - - /* Copy the FilNam into the structure */ - - if(strlen(FilNam) + 7 >= GmfStrSiz) + int i, KwdCod, res, *PtrVer, *PtrDim, MshIdx=0; + char str[ GmfStrSiz ]; + va_list VarArg; + GmfMshSct *msh; + char *ptr; + int k; + + if(!GmfIniFlg) + { + for(i=0;i<=MaxMsh;i++) + GmfMshTab[i] = NULL; + + GmfIniFlg = 1; + } + + /*---------------------*/ + /* MESH STRUCTURE INIT */ + /*---------------------*/ + + for(i=1;i<=MaxMsh;i++) + if(!GmfMshTab[i]) + { + MshIdx = i; + break; + } + + if( !MshIdx || !(msh = calloc(1, sizeof(GmfMshSct))) ) + return(0); + + /* Copy the FilNam into the structure */ + + if(strlen(FilNam) + 7 >= GmfStrSiz) { free (msh); - return(0); + return(0); } - 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 { free (msh); - return(0); + 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 + { + free (msh); + return(0); } } /*----------------------------------------------------------*/ -/* Close a meshfile in the right way */ +/* Close a meshfile in the right way */ /*----------------------------------------------------------*/ int GmfCloseMesh(int MshIdx) { - int res = 1; - GmfMshSct *msh; + int res = 1; + GmfMshSct *msh; - if( (MshIdx < 1) || (MshIdx > MaxMsh) ) - return(0); + if( (MshIdx < 1) || (MshIdx > MaxMsh) ) + return(0); - msh = GmfMshTab[ MshIdx ]; - RecBlk(msh, msh->buf, 0); + msh = GmfMshTab[ MshIdx ]; + RecBlk(msh, msh->buf, 0); - /* In write down the "End" kw in write mode */ + /* In write down the "End" kw in write mode */ - if(msh->mod == GmfWrite){ - if(msh->typ & Asc) - fprintf(msh->hdl, "\n%s\n", GmfKwdFmt[ GmfEnd ][0]); - else - GmfSetKwd(MshIdx, GmfEnd, 0); - } - /* Close the file and free the mesh structure */ + if(msh->mod == GmfWrite){ + if(msh->typ & Asc) + fprintf(msh->hdl, "\n%s\n", GmfKwdFmt[ GmfEnd ][0]); + else + GmfSetKwd(MshIdx, GmfEnd, 0); + } + /* Close the file and free the mesh structure */ - if(fclose(msh->hdl)) - res = 0; + if(fclose(msh->hdl)) + res = 0; - free(msh); - GmfMshTab[ MshIdx ] = NULL; + free(msh); + GmfMshTab[ MshIdx ] = NULL; - return(res); + return(res); } @@ -481,866 +481,866 @@ int GmfCloseMesh(int MshIdx) int GmfStatKwd(int MshIdx, int KwdCod, ...) { - int i, *PtrNmbTyp, *PtrSolSiz, *TypTab; - GmfMshSct *msh; - KwdSct *kwd; - va_list VarArg; + int i, *PtrNmbTyp, *PtrSolSiz, *TypTab; + GmfMshSct *msh; + KwdSct *kwd; + va_list VarArg; - if( (MshIdx < 1) || (MshIdx > MaxMsh) ) - return(0); + if( (MshIdx < 1) || (MshIdx > MaxMsh) ) + return(0); - msh = GmfMshTab[ MshIdx ]; + msh = GmfMshTab[ MshIdx ]; - if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) ) - return(0); + if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) ) + return(0); - kwd = &msh->KwdTab[ KwdCod ]; + kwd = &msh->KwdTab[ KwdCod ]; - if(!kwd->NmbLin) - return(0); + if(!kwd->NmbLin) + return(0); - /* Read further arguments if this kw is a sol */ + /* Read further arguments if this kw is a sol */ - if(kwd->typ == SolKwd) - { - va_start(VarArg, KwdCod); + if(kwd->typ == SolKwd) + { + va_start(VarArg, KwdCod); - PtrNmbTyp = va_arg(VarArg, int *); - *PtrNmbTyp = kwd->NmbTyp; + PtrNmbTyp = va_arg(VarArg, int *); + *PtrNmbTyp = kwd->NmbTyp; - PtrSolSiz = va_arg(VarArg, int *); - *PtrSolSiz = kwd->SolSiz; + PtrSolSiz = va_arg(VarArg, int *); + *PtrSolSiz = kwd->SolSiz; - TypTab = va_arg(VarArg, int *); + TypTab = va_arg(VarArg, int *); - for(i=0;iNmbTyp;i++) - TypTab[i] = kwd->TypTab[i]; + for(i=0;iNmbTyp;i++) + TypTab[i] = kwd->TypTab[i]; - va_end(VarArg); - } + va_end(VarArg); + } - return(kwd->NmbLin); + return(kwd->NmbLin); } /*----------------------------------------------------------*/ -/* Set the current file position to a given kwd */ +/* Set the current file position to a given kwd */ /*----------------------------------------------------------*/ int GmfGotoKwd(int MshIdx, int KwdCod) { - GmfMshSct *msh; - KwdSct *kwd; + GmfMshSct *msh; + KwdSct *kwd; - if( (MshIdx < 1) || (MshIdx > MaxMsh) ) - return(0); + if( (MshIdx < 1) || (MshIdx > MaxMsh) ) + return(0); - msh = GmfMshTab[ MshIdx ]; + msh = GmfMshTab[ MshIdx ]; - if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) ) - return(0); + if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) ) + return(0); - kwd = &msh->KwdTab[ KwdCod ]; + kwd = &msh->KwdTab[ KwdCod ]; - if(!kwd->NmbLin) - return(0); + if(!kwd->NmbLin) + return(0); - return(fseek(msh->hdl, kwd->pos, SEEK_SET)); + return(fseek(msh->hdl, kwd->pos, SEEK_SET)); } /*----------------------------------------------------------*/ -/* Write the kwd and set the number of lines */ +/* Write the kwd and set the number of lines */ /*----------------------------------------------------------*/ int GmfSetKwd(int MshIdx, int KwdCod, ...) { - int i, NmbLin=0, *TypTab; - long CurPos; - va_list VarArg; - GmfMshSct *msh; - KwdSct *kwd; + int i, NmbLin=0, *TypTab; + long CurPos; + va_list VarArg; + GmfMshSct *msh; + KwdSct *kwd; - if( (MshIdx < 1) || (MshIdx > MaxMsh) ) - return(0); + if( (MshIdx < 1) || (MshIdx > MaxMsh) ) + return(0); - msh = GmfMshTab[ MshIdx ]; - RecBlk(msh, msh->buf, 0); + msh = GmfMshTab[ MshIdx ]; + RecBlk(msh, msh->buf, 0); - if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) ) - return(0); + if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) ) + return(0); - kwd = &msh->KwdTab[ KwdCod ]; + kwd = &msh->KwdTab[ KwdCod ]; - /* Read further arguments if this kw has a header */ + /* Read further arguments if this kw has a header */ - if(strlen(GmfKwdFmt[ KwdCod ][2])) - { - va_start(VarArg, KwdCod); - NmbLin = va_arg(VarArg, int); + if(strlen(GmfKwdFmt[ KwdCod ][2])) + { + va_start(VarArg, KwdCod); + NmbLin = va_arg(VarArg, int); - if(!strcmp(GmfKwdFmt[ KwdCod ][3], "sr")) - { - kwd->NmbTyp = va_arg(VarArg, int); - TypTab = va_arg(VarArg, int *); + if(!strcmp(GmfKwdFmt[ KwdCod ][3], "sr")) + { + kwd->NmbTyp = va_arg(VarArg, int); + TypTab = va_arg(VarArg, int *); - for(i=0;iNmbTyp;i++) - kwd->TypTab[i] = TypTab[i]; - } + for(i=0;iNmbTyp;i++) + kwd->TypTab[i] = TypTab[i]; + } - va_end(VarArg); - } + va_end(VarArg); + } - /* Setup the kwd info */ + /* Setup the kwd info */ - ExpFmt(msh, KwdCod); + ExpFmt(msh, KwdCod); - if(!kwd->typ) - return(0); - else if(kwd->typ == InfKwd) - kwd->NmbLin = 1; - else - kwd->NmbLin = NmbLin; + if(!kwd->typ) + return(0); + else if(kwd->typ == InfKwd) + kwd->NmbLin = 1; + else + kwd->NmbLin = NmbLin; - /* Store the next kwd position in binary file */ + /* Store the next kwd position in binary file */ - if( (msh->typ & Bin) && msh->NexKwdPos ) - { - CurPos = ftell(msh->hdl); - fseek(msh->hdl, msh->NexKwdPos, SEEK_SET); - SetPos(msh, CurPos); - fseek(msh->hdl, CurPos, SEEK_SET); - } + if( (msh->typ & Bin) && msh->NexKwdPos ) + { + CurPos = ftell(msh->hdl); + fseek(msh->hdl, msh->NexKwdPos, SEEK_SET); + SetPos(msh, CurPos); + fseek(msh->hdl, CurPos, SEEK_SET); + } - /* Write the header */ + /* Write the header */ - if(msh->typ & Asc) - { - fprintf(msh->hdl, "\n%s\n", GmfKwdFmt[ KwdCod ][0]); + if(msh->typ & Asc) + { + fprintf(msh->hdl, "\n%s\n", GmfKwdFmt[ KwdCod ][0]); - if(kwd->typ != InfKwd) - fprintf(msh->hdl, "%d\n", kwd->NmbLin); + if(kwd->typ != InfKwd) + fprintf(msh->hdl, "%d\n", kwd->NmbLin); - /* In case of solution field, write the extended header */ + /* In case of solution field, write the extended header */ - if(kwd->typ == SolKwd) - { - fprintf(msh->hdl, "%d ", kwd->NmbTyp); + if(kwd->typ == SolKwd) + { + fprintf(msh->hdl, "%d ", kwd->NmbTyp); - for(i=0;iNmbTyp;i++) - fprintf(msh->hdl, "%d ", kwd->TypTab[i]); + for(i=0;iNmbTyp;i++) + fprintf(msh->hdl, "%d ", kwd->TypTab[i]); - fprintf(msh->hdl, "\n\n"); - } - } - else - { - RecWrd(msh, (unsigned char *)&KwdCod); - msh->NexKwdPos = ftell(msh->hdl); - SetPos(msh, 0); + fprintf(msh->hdl, "\n\n"); + } + } + else + { + RecWrd(msh, (unsigned char *)&KwdCod); + msh->NexKwdPos = ftell(msh->hdl); + SetPos(msh, 0); - if(kwd->typ != InfKwd) - RecWrd(msh, (unsigned char *)&kwd->NmbLin); + if(kwd->typ != InfKwd) + RecWrd(msh, (unsigned char *)&kwd->NmbLin); - /* In case of solution field, write the extended header at once */ + /* In case of solution field, write the extended header at once */ - if(kwd->typ == SolKwd) - { - RecWrd(msh, (unsigned char *)&kwd->NmbTyp); + if(kwd->typ == SolKwd) + { + RecWrd(msh, (unsigned char *)&kwd->NmbTyp); - for(i=0;iNmbTyp;i++) - RecWrd(msh, (unsigned char *)&kwd->TypTab[i]); - } - } + for(i=0;iNmbTyp;i++) + RecWrd(msh, (unsigned char *)&kwd->TypTab[i]); + } + } - /* Reset write buffer position */ - msh->pos = 0; + /* Reset write buffer position */ + msh->pos = 0; - /* Estimate the total file size and check whether it crosses the 2GB threshold */ + /* Estimate the total file size and check whether it crosses the 2GB threshold */ - msh->siz += kwd->NmbLin * kwd->NmbWrd * WrdSiz; + msh->siz += kwd->NmbLin * kwd->NmbWrd * WrdSiz; - if(msh->siz > 2E9) - return(0); - else - return(kwd->NmbLin); + if(msh->siz > 2E9) + return(0); + else + return(kwd->NmbLin); } /*----------------------------------------------------------*/ -/* Read a full line from the current kwd */ +/* Read a full line from the current kwd */ /*----------------------------------------------------------*/ void GmfGetLin(int MshIdx, int KwdCod, ...) { - 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;iSolSiz;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;khdl, "%d", va_arg(VarArg, int *)); - } - else - fscanf(msh->hdl, "%d", va_arg(VarArg, int *)); - } - else - { - for(i=0;iSolSiz;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;ktyp & Asc) - { - for(i=0;iSolSiz;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;khdl, "%d", va_arg(VarArg, int *)); - } - else - fscanf(msh->hdl, "%d", va_arg(VarArg, int *)); - } - else - for(i=0;iSolSiz;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;kver == 1) - { - FltSolTab = va_arg(VarArg, float *); - - if(msh->typ & Asc) - for(j=0;jSolSiz;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;jSolSiz;j++) - fscanf(msh->hdl, "%lf", &DblSolTab[j]); - else - for(j=0;jSolSiz;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;iSolSiz;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;khdl, "%d", va_arg(VarArg, int *)); + } + else + fscanf(msh->hdl, "%d", va_arg(VarArg, int *)); + } + else + { + for(i=0;iSolSiz;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;ktyp & Asc) + { + for(i=0;iSolSiz;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;khdl, "%d", va_arg(VarArg, int *)); + } + else + fscanf(msh->hdl, "%d", va_arg(VarArg, int *)); + } + else + for(i=0;iSolSiz;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;kver == 1) + { + FltSolTab = va_arg(VarArg, float *); + + if(msh->typ & Asc) + for(j=0;jSolSiz;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;jSolSiz;j++) + fscanf(msh->hdl, "%lf", &DblSolTab[j]); + else + for(j=0;jSolSiz;j++) + ScaDblWrd(msh, (unsigned char *)&DblSolTab[j]); + } + } + + va_end(VarArg); } /*----------------------------------------------------------*/ -/* Write a full line from the current kwd */ +/* Write a full line from the current kwd */ /*----------------------------------------------------------*/ void GmfSetLin(int MshIdx, int KwdCod, ...) { - 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;iSolSiz;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;khdl, "%d ", va_arg(VarArg, int)); - } - else - fprintf(msh->hdl, "%d ", va_arg(VarArg, int)); - } - else - { - int size_of_block = kwd->SolSiz; - for(i=0;iSolSiz;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;kIntBuf[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;iSolSiz;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;khdl, "%d ", va_arg(VarArg, int)); - } - else - fprintf(msh->hdl, "%d ", va_arg(VarArg, int)); - } - else - { - pos = 0; - - for(i=0;iSolSiz;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;kbuf[ 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;jSolSiz;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;jSolSiz;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;iSolSiz;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;khdl, "%d ", va_arg(VarArg, int)); + } + else + fprintf(msh->hdl, "%d ", va_arg(VarArg, int)); + } + else + { + int size_of_block = kwd->SolSiz; + for(i=0;iSolSiz;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;kIntBuf[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;iSolSiz;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;khdl, "%d ", va_arg(VarArg, int)); + } + else + fprintf(msh->hdl, "%d ", va_arg(VarArg, int)); + } + else + { + pos = 0; + + for(i=0;iSolSiz;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;kbuf[ 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;jSolSiz;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;jSolSiz;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"); } /*----------------------------------------------------------*/ -/* Private procedure for transmesh : copy a whole line */ +/* Private procedure for transmesh : copy a whole line */ /*----------------------------------------------------------*/ void GmfCpyLin(int InpIdx, int OutIdx, int KwdCod) { - double d; - float f; - int i, a; - GmfMshSct *InpMsh = GmfMshTab[ InpIdx ], *OutMsh = GmfMshTab[ OutIdx ]; - KwdSct *kwd = &InpMsh->KwdTab[ KwdCod ]; - - for(i=0;iSolSiz;i++) - { - if(kwd->fmt[i] == 'r') - { - if(InpMsh->ver == 1) - { - if(InpMsh->typ & Asc) - fscanf(InpMsh->hdl, "%f", &f); - else - ScaWrd(InpMsh, (unsigned char *)&f); - - d = f; - } - else - { - if(InpMsh->typ & Asc) - fscanf(InpMsh->hdl, "%lf", &d); - else - ScaDblWrd(InpMsh, (unsigned char *)&d); - - f = (float)d; - } - - if(OutMsh->ver == 1) - if(OutMsh->typ & Asc) - fprintf(OutMsh->hdl, "%g ", f); - else - RecWrd(OutMsh, (unsigned char *)&f); - else - if(OutMsh->typ & Asc) - fprintf(OutMsh->hdl, "%.15g ", d); - else - RecDblWrd(OutMsh, (unsigned char *)&d); - } - else if(kwd->fmt[i] == 'n') - { - int k, nb_repeat = 0; - - if(InpMsh->typ & Asc) - fscanf(InpMsh->hdl, "%d", &a); - else - ScaWrd(InpMsh, (unsigned char *)&a); - - nb_repeat = a; - - if(OutMsh->typ & Asc) - fprintf(OutMsh->hdl, "%d ", a); - else - RecWrd(OutMsh, (unsigned char *)&a); - - for(k=0;ktyp & Asc) - fscanf(InpMsh->hdl, "%d", &a); - else - ScaWrd(InpMsh, (unsigned char *)&a); - - if(OutMsh->typ & Asc) - fprintf(OutMsh->hdl, "%d ", a); - else - RecWrd(OutMsh, (unsigned char *)&a); - } - } - else - { - if(InpMsh->typ & Asc) - fscanf(InpMsh->hdl, "%d", &a); - else - ScaWrd(InpMsh, (unsigned char *)&a); - - if(OutMsh->typ & Asc) - fprintf(OutMsh->hdl, "%d ", a); - else - RecWrd(OutMsh, (unsigned char *)&a); - } - } - - if(OutMsh->typ & Asc) - fprintf(OutMsh->hdl, "\n"); + double d; + float f; + int i, a; + GmfMshSct *InpMsh = GmfMshTab[ InpIdx ], *OutMsh = GmfMshTab[ OutIdx ]; + KwdSct *kwd = &InpMsh->KwdTab[ KwdCod ]; + + for(i=0;iSolSiz;i++) + { + if(kwd->fmt[i] == 'r') + { + if(InpMsh->ver == 1) + { + if(InpMsh->typ & Asc) + fscanf(InpMsh->hdl, "%f", &f); + else + ScaWrd(InpMsh, (unsigned char *)&f); + + d = f; + } + else + { + if(InpMsh->typ & Asc) + fscanf(InpMsh->hdl, "%lf", &d); + else + ScaDblWrd(InpMsh, (unsigned char *)&d); + + f = (float)d; + } + + if(OutMsh->ver == 1) + if(OutMsh->typ & Asc) + fprintf(OutMsh->hdl, "%g ", f); + else + RecWrd(OutMsh, (unsigned char *)&f); + else + if(OutMsh->typ & Asc) + fprintf(OutMsh->hdl, "%.15g ", d); + else + RecDblWrd(OutMsh, (unsigned char *)&d); + } + else if(kwd->fmt[i] == 'n') + { + int k, nb_repeat = 0; + + if(InpMsh->typ & Asc) + fscanf(InpMsh->hdl, "%d", &a); + else + ScaWrd(InpMsh, (unsigned char *)&a); + + nb_repeat = a; + + if(OutMsh->typ & Asc) + fprintf(OutMsh->hdl, "%d ", a); + else + RecWrd(OutMsh, (unsigned char *)&a); + + for(k=0;ktyp & Asc) + fscanf(InpMsh->hdl, "%d", &a); + else + ScaWrd(InpMsh, (unsigned char *)&a); + + if(OutMsh->typ & Asc) + fprintf(OutMsh->hdl, "%d ", a); + else + RecWrd(OutMsh, (unsigned char *)&a); + } + } + else + { + if(InpMsh->typ & Asc) + fscanf(InpMsh->hdl, "%d", &a); + else + ScaWrd(InpMsh, (unsigned char *)&a); + + if(OutMsh->typ & Asc) + fprintf(OutMsh->hdl, "%d ", a); + else + RecWrd(OutMsh, (unsigned char *)&a); + } + } + + if(OutMsh->typ & Asc) + fprintf(OutMsh->hdl, "\n"); } /*----------------------------------------------------------*/ -/* Find every kw present in a meshfile */ +/* Find every kw present in a meshfile */ /*----------------------------------------------------------*/ static int ScaKwdTab(GmfMshSct *msh) { - int KwdCod; - long NexPos, CurPos, EndPos; - char str[ GmfStrSiz ]; - - if(msh->typ & Asc) - { - /* Scan each string in the file until the end */ - - while(fscanf(msh->hdl, "%s", str) != EOF) - { - /* Fast test in order to reject quickly the numeric values */ - - if(isalpha(str[0])) - { - /* Search which kwd code this string is associated with, - then get its header and save the curent position in file (just before the data) */ - - for(KwdCod=1; KwdCod<= GmfMaxKwd; KwdCod++) - if(!strcmp(str, GmfKwdFmt[ KwdCod ][0])) - { - ScaKwdHdr(msh, KwdCod); - break; - } - } - else if(str[0] == '#') - while(fgetc(msh->hdl) != '\n'); - } - } - else - { - /* Get file size */ - - CurPos = ftell(msh->hdl); - fseek(msh->hdl, 0, SEEK_END); - EndPos = ftell(msh->hdl); - fseek(msh->hdl, CurPos, SEEK_SET); - - /* Jump through kwd positions in the file */ - - do - { - /* Get the kwd code and the next kwd position */ - - ScaWrd(msh, (unsigned char *)&KwdCod); - NexPos = GetPos(msh); - - if(NexPos > EndPos) - return(0); - - /* Check if this kwd belongs to this mesh version */ - - if( (KwdCod >= 1) && (KwdCod <= GmfMaxKwd) ) - ScaKwdHdr(msh, KwdCod); - - /* Go to the next kwd */ - - if(NexPos) - fseek(msh->hdl, NexPos, SEEK_SET); - }while(NexPos && (KwdCod != GmfEnd)); - } - - return(1); + int KwdCod; + long NexPos, CurPos, EndPos; + char str[ GmfStrSiz ]; + + if(msh->typ & Asc) + { + /* Scan each string in the file until the end */ + + while(fscanf(msh->hdl, "%s", str) != EOF) + { + /* Fast test in order to reject quickly the numeric values */ + + if(isalpha(str[0])) + { + /* Search which kwd code this string is associated with, + then get its header and save the curent position in file (just before the data) */ + + for(KwdCod=1; KwdCod<= GmfMaxKwd; KwdCod++) + if(!strcmp(str, GmfKwdFmt[ KwdCod ][0])) + { + ScaKwdHdr(msh, KwdCod); + break; + } + } + else if(str[0] == '#') + while(fgetc(msh->hdl) != '\n'); + } + } + else + { + /* Get file size */ + + CurPos = ftell(msh->hdl); + fseek(msh->hdl, 0, SEEK_END); + EndPos = ftell(msh->hdl); + fseek(msh->hdl, CurPos, SEEK_SET); + + /* Jump through kwd positions in the file */ + + do + { + /* Get the kwd code and the next kwd position */ + + ScaWrd(msh, (unsigned char *)&KwdCod); + NexPos = GetPos(msh); + + if(NexPos > EndPos) + return(0); + + /* Check if this kwd belongs to this mesh version */ + + if( (KwdCod >= 1) && (KwdCod <= GmfMaxKwd) ) + ScaKwdHdr(msh, KwdCod); + + /* Go to the next kwd */ + + if(NexPos) + fseek(msh->hdl, NexPos, SEEK_SET); + }while(NexPos && (KwdCod != GmfEnd)); + } + + return(1); } /*----------------------------------------------------------*/ -/* Read and setup the keyword's header */ +/* Read and setup the keyword's header */ /*----------------------------------------------------------*/ static void ScaKwdHdr(GmfMshSct *msh, int KwdCod) { - int i; - KwdSct *kwd = &msh->KwdTab[ KwdCod ]; - - if(!strcmp("i", GmfKwdFmt[ KwdCod ][2])) - { - if(msh->typ & Asc) - fscanf(msh->hdl, "%d", &kwd->NmbLin); - else - ScaWrd(msh, (unsigned char *)&kwd->NmbLin); - } - else - kwd->NmbLin = 1; - - if(!strcmp("sr", GmfKwdFmt[ KwdCod ][3])) - { - if(msh->typ & Asc) - { - fscanf(msh->hdl, "%d", &kwd->NmbTyp); - - for(i=0;iNmbTyp;i++) - fscanf(msh->hdl, "%d", &kwd->TypTab[i]); - } - else - { - ScaWrd(msh, (unsigned char *)&kwd->NmbTyp); - - for(i=0;iNmbTyp;i++) - ScaWrd(msh, (unsigned char *)&kwd->TypTab[i]); - } - } - - ExpFmt(msh, KwdCod); - kwd->pos = ftell(msh->hdl); + int i; + KwdSct *kwd = &msh->KwdTab[ KwdCod ]; + + if(!strcmp("i", GmfKwdFmt[ KwdCod ][2])) + { + if(msh->typ & Asc) + fscanf(msh->hdl, "%d", &kwd->NmbLin); + else + ScaWrd(msh, (unsigned char *)&kwd->NmbLin); + } + else + kwd->NmbLin = 1; + + if(!strcmp("sr", GmfKwdFmt[ KwdCod ][3])) + { + if(msh->typ & Asc) + { + fscanf(msh->hdl, "%d", &kwd->NmbTyp); + + for(i=0;iNmbTyp;i++) + fscanf(msh->hdl, "%d", &kwd->TypTab[i]); + } + else + { + ScaWrd(msh, (unsigned char *)&kwd->NmbTyp); + + for(i=0;iNmbTyp;i++) + ScaWrd(msh, (unsigned char *)&kwd->TypTab[i]); + } + } + + ExpFmt(msh, KwdCod); + kwd->pos = ftell(msh->hdl); } /*----------------------------------------------------------*/ -/* Expand the compacted format and compute the line size */ +/* Expand the compacted format and compute the line size */ /*----------------------------------------------------------*/ static void ExpFmt(GmfMshSct *msh, int KwdCod) { - int i, j, TmpSiz=0; - char chr; - const char *InpFmt = GmfKwdFmt[ KwdCod ][3]; - KwdSct *kwd = &msh->KwdTab[ KwdCod ]; - - /* Set the kwd's type */ - - if(!strlen(GmfKwdFmt[ KwdCod ][2])) - kwd->typ = InfKwd; - else if(!strcmp(InpFmt, "sr")) - kwd->typ = SolKwd; - else - kwd->typ = RegKwd; - - /* Get the solution-field's size */ - - if(kwd->typ == SolKwd) - for(i=0;iNmbTyp;i++) - switch(kwd->TypTab[i]) - { - case GmfSca : TmpSiz += 1; break; - case GmfVec : TmpSiz += msh->dim; break; - case GmfSymMat : TmpSiz += (msh->dim * (msh->dim+1)) / 2; break; - case GmfMat : TmpSiz += msh->dim * msh->dim; break; - } - - /* Scan each character from the format string */ - - i = kwd->SolSiz = kwd->NmbWrd = 0; - - while(i < strlen(InpFmt)) - { - chr = InpFmt[ i++ ]; - - if(chr == 'd') - { - chr = InpFmt[i++]; - - for(j=0;jdim;j++) - kwd->fmt[ kwd->SolSiz++ ] = chr; - } - else if(chr == 's') - { - chr = InpFmt[i++]; - - for(j=0;jfmt[ kwd->SolSiz++ ] = chr; - } - else - kwd->fmt[ kwd->SolSiz++ ] = chr; - } - - for(i=0;iSolSiz;i++) - if(kwd->fmt[i] == 'i') - kwd->NmbWrd++; - else if(msh->ver >= 2) - kwd->NmbWrd += 2; - else - kwd->NmbWrd++; + int i, j, TmpSiz=0; + char chr; + const char *InpFmt = GmfKwdFmt[ KwdCod ][3]; + KwdSct *kwd = &msh->KwdTab[ KwdCod ]; + + /* Set the kwd's type */ + + if(!strlen(GmfKwdFmt[ KwdCod ][2])) + kwd->typ = InfKwd; + else if(!strcmp(InpFmt, "sr")) + kwd->typ = SolKwd; + else + kwd->typ = RegKwd; + + /* Get the solution-field's size */ + + if(kwd->typ == SolKwd) + for(i=0;iNmbTyp;i++) + switch(kwd->TypTab[i]) + { + case GmfSca : TmpSiz += 1; break; + case GmfVec : TmpSiz += msh->dim; break; + case GmfSymMat : TmpSiz += (msh->dim * (msh->dim+1)) / 2; break; + case GmfMat : TmpSiz += msh->dim * msh->dim; break; + } + + /* Scan each character from the format string */ + + i = kwd->SolSiz = kwd->NmbWrd = 0; + + while(i < strlen(InpFmt)) + { + chr = InpFmt[ i++ ]; + + if(chr == 'd') + { + chr = InpFmt[i++]; + + for(j=0;jdim;j++) + kwd->fmt[ kwd->SolSiz++ ] = chr; + } + else if(chr == 's') + { + chr = InpFmt[i++]; + + for(j=0;jfmt[ kwd->SolSiz++ ] = chr; + } + else + kwd->fmt[ kwd->SolSiz++ ] = chr; + } + + for(i=0;iSolSiz;i++) + if(kwd->fmt[i] == 'i') + kwd->NmbWrd++; + else if(msh->ver >= 2) + kwd->NmbWrd += 2; + else + kwd->NmbWrd++; } /*----------------------------------------------------------*/ -/* Read a four bytes word from a mesh file */ +/* Read a four bytes word from a mesh file */ /*----------------------------------------------------------*/ static void ScaWrd(GmfMshSct *msh, unsigned char *wrd) { - unsigned char swp; + unsigned char swp; - fread(wrd, WrdSiz, 1, msh->hdl); + fread(wrd, WrdSiz, 1, msh->hdl); - if(msh->cod == 1) - return; + if(msh->cod == 1) + return; - swp = wrd[3]; - wrd[3] = wrd[0]; - wrd[0] = swp; + swp = wrd[3]; + wrd[3] = wrd[0]; + wrd[0] = swp; - swp = wrd[2]; - wrd[2] = wrd[1]; - wrd[1] = swp; + swp = wrd[2]; + wrd[2] = wrd[1]; + wrd[1] = swp; } /*----------------------------------------------------------*/ -/* Read an eight bytes word from a mesh file */ +/* Read an eight bytes word from a mesh file */ /*----------------------------------------------------------*/ static void ScaDblWrd(GmfMshSct *msh, unsigned char *wrd) { - int i; - unsigned char swp; + int i; + unsigned char swp; - fread(wrd, WrdSiz, 2, msh->hdl); + fread(wrd, WrdSiz, 2, msh->hdl); - if(msh->cod == 1) - return; + if(msh->cod == 1) + return; - for(i=0;i<4;i++) - { - swp = wrd[7-i]; - wrd[7-i] = wrd[i]; - wrd[i] = swp; - } + for(i=0;i<4;i++) + { + swp = wrd[7-i]; + wrd[7-i] = wrd[i]; + wrd[i] = swp; + } } /*----------------------------------------------------------*/ -/* Read ablock of four bytes word from a mesh file */ +/* Read ablock of four bytes word from a mesh file */ /*----------------------------------------------------------*/ static void ScaBlk(GmfMshSct *msh, unsigned char *blk, int siz) { - int i, j; - unsigned char swp, *wrd; + int i, j; + unsigned char swp, *wrd; - fread(blk, WrdSiz, siz, msh->hdl); + fread(blk, WrdSiz, siz, msh->hdl); - if(msh->cod == 1) - return; + if(msh->cod == 1) + return; - for(i=0;iver >= 3) - ScaDblWrd(msh, (unsigned char*)&pos); - else - { - ScaWrd(msh, (unsigned char*)&IntVal); - pos = IntVal; - } - - return(pos); + int IntVal; + long pos; + + if(msh->ver >= 3) + ScaDblWrd(msh, (unsigned char*)&pos); + else + { + ScaWrd(msh, (unsigned char*)&IntVal); + pos = IntVal; + } + + return(pos); } /*----------------------------------------------------------*/ -/* Write a four bytes word to a mesh file */ +/* Write a four bytes word to a mesh file */ /*----------------------------------------------------------*/ static void RecWrd(GmfMshSct *msh, unsigned char *wrd) { - fwrite(wrd, WrdSiz, 1, msh->hdl); + fwrite(wrd, WrdSiz, 1, msh->hdl); } /*----------------------------------------------------------*/ -/* Write an eight bytes word to a mesh file */ +/* Write an eight bytes word to a mesh file */ /*----------------------------------------------------------*/ static void RecDblWrd(GmfMshSct *msh, unsigned char *wrd) { - fwrite(wrd, WrdSiz, 2, msh->hdl); + fwrite(wrd, WrdSiz, 2, msh->hdl); } /*----------------------------------------------------------*/ -/* Write a block of four bytes word to a mesh file */ +/* Write a block of four bytes word to a mesh file */ /*----------------------------------------------------------*/ static void RecBlk(GmfMshSct *msh, unsigned char *blk, int siz) { - /* Copy this line-block into the main mesh buffer */ + /* Copy this line-block into the main mesh buffer */ - if(siz) - { - memcpy(&msh->blk[ msh->pos ], blk, siz * WrdSiz); - msh->pos += siz * WrdSiz; - } + if(siz) + { + memcpy(&msh->blk[ msh->pos ], blk, siz * WrdSiz); + msh->pos += siz * WrdSiz; + } - /* When the buffer is full or this procedure is called with a 0 size, flush the cache on disk */ + /* When the buffer is full or this procedure is called with a 0 size, flush the cache on disk */ - if( (msh->pos > BufSiz) || (!siz && msh->pos) ) - { - fwrite(msh->blk, 1, msh->pos, msh->hdl); - msh->pos = 0; - } + if( (msh->pos > BufSiz) || (!siz && msh->pos) ) + { + fwrite(msh->blk, 1, msh->pos, msh->hdl); + msh->pos = 0; + } } /*----------------------------------------------------------*/ -/* Write a 4 or 8 bytes position in a mesh file */ +/* Write a 4 or 8 bytes position in a mesh file */ /*----------------------------------------------------------*/ static void SetPos(GmfMshSct *msh, long pos) { - int IntVal; - - if(msh->ver >= 3) - RecDblWrd(msh, (unsigned char*)&pos); - else - { - IntVal = pos; - RecWrd(msh, (unsigned char*)&IntVal); - } + int IntVal; + + if(msh->ver >= 3) + RecDblWrd(msh, (unsigned char*)&pos); + else + { + IntVal = pos; + RecWrd(msh, (unsigned char*)&IntVal); + } } diff --git a/src/DriverGMF/libmesh5.h b/src/DriverGMF/libmesh5.h index 66579574d..066853f52 100644 --- a/src/DriverGMF/libmesh5.h +++ b/src/DriverGMF/libmesh5.h @@ -1,21 +1,21 @@ /*----------------------------------------------------------*/ -/* */ -/* LIBMESH V 5.46 */ -/* */ +/* */ +/* LIBMESH V 5.46 */ +/* */ /*----------------------------------------------------------*/ -/* */ -/* Description: handle .meshb file format I/O */ -/* Author: Loic MARECHAL */ -/* Creation date: feb 16 2007 */ -/* Last modification: dec 09 2011 */ -/* */ +/* */ +/* Description: handle .meshb file format I/O */ +/* Author: Loic MARECHAL */ +/* Creation date: feb 16 2007 */ +/* Last modification: dec 09 2011 */ +/* */ /*----------------------------------------------------------*/ /*----------------------------------------------------------*/ -/* Defines */ +/* Defines */ /*----------------------------------------------------------*/ #include "SMESH_DriverGMF.hxx" @@ -35,92 +35,92 @@ enum GmfKwdCod { - GmfReserved1, \ - GmfVersionFormatted, \ - GmfReserved2, \ - GmfDimension, \ - GmfVertices, \ - GmfEdges, \ - GmfTriangles, \ - GmfQuadrilaterals, \ - GmfTetrahedra, \ - GmfPrisms, \ - GmfHexahedra, \ - GmfIterationsAll, \ - GmfTimesAll, \ - GmfCorners, \ - GmfRidges, \ - GmfRequiredVertices, \ - GmfRequiredEdges, \ - GmfRequiredTriangles, \ - GmfRequiredQuadrilaterals, \ - GmfTangentAtEdgeVertices, \ - GmfNormalAtVertices, \ - GmfNormalAtTriangleVertices, \ - GmfNormalAtQuadrilateralVertices, \ - GmfAngleOfCornerBound, \ - GmfTrianglesP2, \ - GmfEdgesP2, \ - GmfSolAtPyramids, \ - GmfQuadrilateralsQ2, \ - GmfISolAtPyramids, \ - GmfSubDomainFromGeom, \ - GmfTetrahedraP2, \ - GmfFault_NearTri, \ - GmfFault_Inter, \ - GmfHexahedraQ2, \ - GmfExtraVerticesAtEdges, \ - GmfExtraVerticesAtTriangles, \ - GmfExtraVerticesAtQuadrilaterals, \ - GmfExtraVerticesAtTetrahedra, \ - GmfExtraVerticesAtPrisms, \ - GmfExtraVerticesAtHexahedra, \ - GmfVerticesOnGeometricVertices, \ - GmfVerticesOnGeometricEdges, \ - GmfVerticesOnGeometricTriangles, \ - GmfVerticesOnGeometricQuadrilaterals, \ - GmfEdgesOnGeometricEdges, \ - GmfFault_FreeEdge, \ - GmfPolyhedra, \ - GmfPolygons, \ - GmfFault_Overlap, \ - GmfPyramids, \ - GmfBoundingBox, \ - GmfBody, \ - GmfPrivateTable, \ - GmfFault_BadShape, \ - GmfEnd, \ - GmfTrianglesOnGeometricTriangles, \ - GmfTrianglesOnGeometricQuadrilaterals, \ - GmfQuadrilateralsOnGeometricTriangles, \ - GmfQuadrilateralsOnGeometricQuadrilaterals, \ - GmfTangents, \ - GmfNormals, \ - GmfTangentAtVertices, \ - GmfSolAtVertices, \ - GmfSolAtEdges, \ - GmfSolAtTriangles, \ - GmfSolAtQuadrilaterals, \ - GmfSolAtTetrahedra, \ - GmfSolAtPrisms, \ - GmfSolAtHexahedra, \ - GmfDSolAtVertices, \ - GmfISolAtVertices, \ - GmfISolAtEdges, \ - GmfISolAtTriangles, \ - GmfISolAtQuadrilaterals, \ - GmfISolAtTetrahedra, \ - GmfISolAtPrisms, \ - GmfISolAtHexahedra, \ - GmfIterations, \ - GmfTime, \ - GmfFault_SmallTri, \ - GmfCoarseHexahedra + GmfReserved1, \ + GmfVersionFormatted, \ + GmfReserved2, \ + GmfDimension, \ + GmfVertices, \ + GmfEdges, \ + GmfTriangles, \ + GmfQuadrilaterals, \ + GmfTetrahedra, \ + GmfPrisms, \ + GmfHexahedra, \ + GmfIterationsAll, \ + GmfTimesAll, \ + GmfCorners, \ + GmfRidges, \ + GmfRequiredVertices, \ + GmfRequiredEdges, \ + GmfRequiredTriangles, \ + GmfRequiredQuadrilaterals, \ + GmfTangentAtEdgeVertices, \ + GmfNormalAtVertices, \ + GmfNormalAtTriangleVertices, \ + GmfNormalAtQuadrilateralVertices, \ + GmfAngleOfCornerBound, \ + GmfTrianglesP2, \ + GmfEdgesP2, \ + GmfSolAtPyramids, \ + GmfQuadrilateralsQ2, \ + GmfISolAtPyramids, \ + GmfSubDomainFromGeom, \ + GmfTetrahedraP2, \ + GmfFault_NearTri, \ + GmfFault_Inter, \ + GmfHexahedraQ2, \ + GmfExtraVerticesAtEdges, \ + GmfExtraVerticesAtTriangles, \ + GmfExtraVerticesAtQuadrilaterals, \ + GmfExtraVerticesAtTetrahedra, \ + GmfExtraVerticesAtPrisms, \ + GmfExtraVerticesAtHexahedra, \ + GmfVerticesOnGeometricVertices, \ + GmfVerticesOnGeometricEdges, \ + GmfVerticesOnGeometricTriangles, \ + GmfVerticesOnGeometricQuadrilaterals, \ + GmfEdgesOnGeometricEdges, \ + GmfFault_FreeEdge, \ + GmfPolyhedra, \ + GmfPolygons, \ + GmfFault_Overlap, \ + GmfPyramids, \ + GmfBoundingBox, \ + GmfBody, \ + GmfPrivateTable, \ + GmfFault_BadShape, \ + GmfEnd, \ + GmfTrianglesOnGeometricTriangles, \ + GmfTrianglesOnGeometricQuadrilaterals, \ + GmfQuadrilateralsOnGeometricTriangles, \ + GmfQuadrilateralsOnGeometricQuadrilaterals, \ + GmfTangents, \ + GmfNormals, \ + GmfTangentAtVertices, \ + GmfSolAtVertices, \ + GmfSolAtEdges, \ + GmfSolAtTriangles, \ + GmfSolAtQuadrilaterals, \ + GmfSolAtTetrahedra, \ + GmfSolAtPrisms, \ + GmfSolAtHexahedra, \ + GmfDSolAtVertices, \ + GmfISolAtVertices, \ + GmfISolAtEdges, \ + GmfISolAtTriangles, \ + GmfISolAtQuadrilaterals, \ + GmfISolAtTetrahedra, \ + GmfISolAtPrisms, \ + GmfISolAtHexahedra, \ + GmfIterations, \ + GmfTime, \ + GmfFault_SmallTri, \ + GmfCoarseHexahedra }; /*----------------------------------------------------------*/ -/* External procedures */ +/* External procedures */ /*----------------------------------------------------------*/ MESHDriverGMF_EXPORT extern int GmfOpenMesh(const char *, int, ...); @@ -133,7 +133,7 @@ MESHDriverGMF_EXPORT extern void GmfSetLin(int, int, ...); /*----------------------------------------------------------*/ -/* Fortran 77 API */ +/* Fortran 77 API */ /*----------------------------------------------------------*/ #if defined(F77_NO_UNDER_SCORE) @@ -144,7 +144,7 @@ MESHDriverGMF_EXPORT extern void GmfSetLin(int, int, ...); /*----------------------------------------------------------*/ -/* Transmesh private API */ +/* Transmesh private API */ /*----------------------------------------------------------*/ #ifdef TRANSMESH diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 4a64b0de0..f1bb13d16 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -645,8 +645,8 @@ void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled ) } void SMESH_ActorDef::SetPointsFontProperties( SMESH::LabelFont theFamily, int theSize, - bool theBold, bool theItalic, bool theShadow, - vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) + bool theBold, bool theItalic, bool theShadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) { if(myNodeActor) { myNodeActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b ); @@ -656,8 +656,8 @@ void SMESH_ActorDef::SetPointsFontProperties( SMESH::LabelFont theFamily, int th } void SMESH_ActorDef::SetCellsFontProperties( SMESH::LabelFont theFamily, int theSize, - bool theBold, bool theItalic, bool theShadow, - vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) + bool theBold, bool theItalic, bool theShadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) { if(my3DActor) { my3DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b ); diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index 2952818a7..bbd7ac965 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -164,11 +164,11 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor virtual void UpdateDistribution() = 0; virtual void SetPointsFontProperties( SMESH::LabelFont family, int size, - bool bold, bool italic, bool shadow, - vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) = 0; + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) = 0; virtual void SetCellsFontProperties( SMESH::LabelFont family, int size, - bool bold, bool italic, bool shadow, - vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) = 0; + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) = 0; #ifndef DISABLE_PLOT2DVIEWER virtual SPlot2d_Histogram* GetPlot2Histogram() = 0; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index 2238faa5e..47dc703a0 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -181,11 +181,11 @@ class SMESH_ActorDef : public SMESH_Actor virtual bool GetPointsLabeled(); virtual void SetPointsFontProperties( SMESH::LabelFont family, int size, - bool bold, bool italic, bool shadow, - vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); virtual void SetCellsFontProperties( SMESH::LabelFont family, int size, - bool bold, bool italic, bool shadow, - vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); virtual void SetCellsLabeled(bool theIsCellsLabeled); virtual bool GetCellsLabeled(); diff --git a/src/OBJECT/SMESH_ActorUtils.cxx b/src/OBJECT/SMESH_ActorUtils.cxx index bb9fd64b1..c756156e0 100644 --- a/src/OBJECT/SMESH_ActorUtils.cxx +++ b/src/OBJECT/SMESH_ActorUtils.cxx @@ -144,10 +144,10 @@ namespace SMESH void GetColor( const QString& theSect, - const QString& theName, - QColor& color, - int& delta, - QString def) + const QString& theName, + QColor& color, + int& delta, + QString def) { SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr(); @@ -160,15 +160,15 @@ namespace SMESH std::map GetEntitiesFromObject(SMESH_VisualObj *theObject) { std::map entities; entities.insert(std::pair(SMDSAbs_0DElement, - theObject ? theObject->GetNbEntities(SMDSAbs_0DElement) : 0)); + theObject ? theObject->GetNbEntities(SMDSAbs_0DElement) : 0)); entities.insert(std::pair(SMDSAbs_Ball, - theObject ? theObject->GetNbEntities(SMDSAbs_Ball) : 0)); + theObject ? theObject->GetNbEntities(SMDSAbs_Ball) : 0)); entities.insert(std::pair(SMDSAbs_Edge, - theObject ? theObject->GetNbEntities(SMDSAbs_Edge) : 0)); + theObject ? theObject->GetNbEntities(SMDSAbs_Edge) : 0)); entities.insert(std::pair(SMDSAbs_Face, - theObject ? theObject->GetNbEntities(SMDSAbs_Face) : 0)); + theObject ? theObject->GetNbEntities(SMDSAbs_Face) : 0)); entities.insert(std::pair(SMDSAbs_Volume, - theObject ? theObject->GetNbEntities(SMDSAbs_Volume) : 0)); + theObject ? theObject->GetNbEntities(SMDSAbs_Volume) : 0)); return entities; } diff --git a/src/OBJECT/SMESH_ActorUtils.h b/src/OBJECT/SMESH_ActorUtils.h index 5aafbbbf5..ce189fbe8 100644 --- a/src/OBJECT/SMESH_ActorUtils.h +++ b/src/OBJECT/SMESH_ActorUtils.h @@ -78,10 +78,10 @@ SMESHOBJECT_EXPORT SMESHOBJECT_EXPORT void GetColor( const QString& theSect, - const QString& theName, - QColor& color, - int& delta, - QString def); + const QString& theName, + QColor& color, + int& delta, + QString def); SMESHOBJECT_EXPORT std::map diff --git a/src/OBJECT/SMESH_CellLabelActor.cxx b/src/OBJECT/SMESH_CellLabelActor.cxx index 0726cd65f..297c37da9 100644 --- a/src/OBJECT/SMESH_CellLabelActor.cxx +++ b/src/OBJECT/SMESH_CellLabelActor.cxx @@ -119,8 +119,8 @@ SMESH_CellLabelActor::~SMESH_CellLabelActor() { void SMESH_CellLabelActor::SetFontProperties( SMESH::LabelFont family, int size, - bool bold, bool italic, bool shadow, - vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) { switch ( family ) { case SMESH::FntArial: diff --git a/src/OBJECT/SMESH_CellLabelActor.h b/src/OBJECT/SMESH_CellLabelActor.h index eff545d7c..f9a6a239d 100644 --- a/src/OBJECT/SMESH_CellLabelActor.h +++ b/src/OBJECT/SMESH_CellLabelActor.h @@ -61,8 +61,8 @@ public: virtual void RemoveFromRender(vtkRenderer* theRenderer); virtual void SetFontProperties( SMESH::LabelFont family, int size, - bool bold, bool italic, bool shadow, - vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); void UpdateLabels(); diff --git a/src/OBJECT/SMESH_NodeLabelActor.cxx b/src/OBJECT/SMESH_NodeLabelActor.cxx index 2e172d4ab..b3a8d3d0f 100644 --- a/src/OBJECT/SMESH_NodeLabelActor.cxx +++ b/src/OBJECT/SMESH_NodeLabelActor.cxx @@ -111,8 +111,8 @@ SMESH_NodeLabelActor::~SMESH_NodeLabelActor() { } void SMESH_NodeLabelActor::SetFontProperties( SMESH::LabelFont family, int size, - bool bold, bool italic, bool shadow, - vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) { switch ( family ) { case SMESH::FntArial: diff --git a/src/OBJECT/SMESH_NodeLabelActor.h b/src/OBJECT/SMESH_NodeLabelActor.h index df09248d3..03de78f3a 100644 --- a/src/OBJECT/SMESH_NodeLabelActor.h +++ b/src/OBJECT/SMESH_NodeLabelActor.h @@ -58,8 +58,8 @@ public: virtual void RemoveFromRender(vtkRenderer* theRenderer); virtual void SetFontProperties( SMESH::LabelFont family, int size, - bool bold, bool italic, bool shadow, - vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); + bool bold, bool italic, bool shadow, + vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); void UpdateLabels(); diff --git a/src/OBJECT/SMESH_PreviewActorsCollection.cxx b/src/OBJECT/SMESH_PreviewActorsCollection.cxx index 9fecefb18..9d6d1c80f 100644 --- a/src/OBJECT/SMESH_PreviewActorsCollection.cxx +++ b/src/OBJECT/SMESH_PreviewActorsCollection.cxx @@ -65,8 +65,8 @@ SMESH_PreviewActorsCollection::~SMESH_PreviewActorsCollection() } bool SMESH_PreviewActorsCollection::Init( const TopoDS_Shape& theShape, - TopAbs_ShapeEnum theType, - const QString& theEntry ) + TopAbs_ShapeEnum theType, + const QString& theEntry ) { SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr(); diff --git a/src/OBJECT/SMESH_SVTKActor.cxx b/src/OBJECT/SMESH_SVTKActor.cxx index b86c81d54..0158f7f91 100644 --- a/src/OBJECT/SMESH_SVTKActor.cxx +++ b/src/OBJECT/SMESH_SVTKActor.cxx @@ -129,9 +129,9 @@ SMESH_SVTKActor if (aCell->GetCellType() != VTK_POLYHEDRON) #endif if(aCell->GetCellType() == VTK_VERTEX ) { - my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); + my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); } else if(aCell->GetCellType() == VTK_POLY_VERTEX ) { - myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); + myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); } else { myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); } diff --git a/src/SMESH/memoire.h b/src/SMESH/memoire.h index 258eda28b..531752fbe 100644 --- a/src/SMESH/memoire.h +++ b/src/SMESH/memoire.h @@ -28,7 +28,7 @@ void memostat(const char* f, int l); void memostat(const char* f, int l) { #ifdef WIN32 - //rnv: TODO: find alternative of the malloc_stats() on windows platform + //rnv: TODO: find alternative of the malloc_stats() on windows platform #else /* struct mallinfo mem = mallinfo(); */ /* std::cerr << f << ":"<< l << " " << mem.arena << " " << mem.ordblks << " " << mem.hblks << " " << mem.hblkhd << " " << mem.uordblks << " " << mem.fordblks << " " << mem.keepcost << std::endl; */ diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx index 1131a04e1..98761c133 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx @@ -559,9 +559,9 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", "?" ); myWidgets[i2DQuadrangles][iQuadratic]->setProperty( "text", "?" ); myWidgets[i2DPolygons][iTotal] ->setProperty( "text", "?" ); - myWidgets[iNb][iTotal] ->setProperty( "text", "?" ); - myWidgets[iNb][iLinear] ->setProperty( "text", "?" ); - myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[iNb][iTotal] ->setProperty( "text", "?" ); + myWidgets[iNb][iLinear] ->setProperty( "text", "?" ); + myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" ); } else if ( nb3DLinear + nb3DQuadratic > 0 ) { @@ -581,9 +581,9 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", "?" ); myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", "?" ); myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", "?" ); - myWidgets[iNb][iTotal] ->setProperty( "text", "?" ); - myWidgets[iNb][iLinear] ->setProperty( "text", "?" ); - myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[iNb][iTotal] ->setProperty( "text", "?" ); + myWidgets[iNb][iLinear] ->setProperty( "text", "?" ); + myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" ); } } else @@ -621,9 +621,9 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", "?" ); myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", "?" ); myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", "?" ); - myWidgets[iNb][iTotal] ->setProperty( "text", "?" ); - myWidgets[iNb][iLinear] ->setProperty( "text", "?" ); - myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" ); + myWidgets[iNb][iTotal] ->setProperty( "text", "?" ); + myWidgets[iNb][iLinear] ->setProperty( "text", "?" ); + myWidgets[iNb][iQuadratic] ->setProperty( "text", "?" ); } } } @@ -1105,100 +1105,100 @@ void SMESHGUI_SimpleElemInfo::information( const QList& ids ) myInfo->append( QString( "%1" ).arg( SMESHGUI_ElemInfo::tr( "FREE_NODE" ) ).arg( id ) ); } // node position - SMESH::SMESH_Mesh_ptr aMeshPtr = actor()->GetObject()->GetMeshServer(); - if ( !CORBA::is_nil( aMeshPtr ) ) { - SMESH::NodePosition_var pos = aMeshPtr->GetNodePosition( id ); - int shapeID = pos->shapeID; - if ( shapeID > 0 ) { - QString shapeType; - double u, v; - switch ( pos->shapeType ) { - case GEOM::EDGE: - shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); - if ( pos->params.length() == 1 ) - u = pos->params[0]; - break; - case GEOM::FACE: - shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); - if ( pos->params.length() == 2 ) { - u = pos->params[0]; - v = pos->params[1]; - } - break; - case GEOM::VERTEX: - shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); - break; - default: - shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); - break; - } - // separator - myInfo->append( "" ); - myInfo->append( QString( "%1:" ).arg( SMESHGUI_ElemInfo::tr( "POSITION" ) ) ); - myInfo->append( QString( "- %1: #%2" ).arg( shapeType ).arg( shapeID ) ); - if ( pos->shapeType == GEOM::EDGE || pos->shapeType == GEOM::FACE ) { - myInfo->append( QString( "- %1: #%2" ).arg( SMESHGUI_ElemInfo::tr( "U_POSITION" ) ). - arg( QString::number( u, precision > 0 ? 'f' : 'g', qAbs( precision )) ) ); - if ( pos->shapeType == GEOM::FACE ) { - myInfo->append( QString( "- %1: #%2" ).arg( SMESHGUI_ElemInfo::tr( "V_POSITION" ) ). - arg( QString::number( v, precision > 0 ? 'f' : 'g', qAbs( precision )) ) ); - } - } - } - } - // groups node belongs to - SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); - if ( !CORBA::is_nil( aMesh ) ) { - SMESH::ListOfGroups_var groups = aMesh->GetGroups(); - myInfo->append( "" ); // separator - bool top_created = false; - for ( int i = 0; i < groups->length(); i++ ) { - SMESH::SMESH_GroupBase_var aGrp = groups[i]; - if ( CORBA::is_nil( aGrp ) ) continue; - QString aName = aGrp->GetName(); - if ( aGrp->GetType() == SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) { - if ( !top_created ) { - myInfo->append( QString( "%1:" ).arg( SMESHGUI_AddInfo::tr( "GROUPS" ) ) ); - top_created = true; - } - myInfo->append( QString( "+ %1:" ).arg( aName.trimmed() ) ); - if ( grp_details ) { - SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); - SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp ); - SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp ); - - // type : group on geometry, standalone group, group on filter - if ( !CORBA::is_nil( aStdGroup ) ) { - myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). - arg( SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) ) ); - } - else if ( !CORBA::is_nil( aGeomGroup ) ) { - myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). - arg( SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) ) ); - GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape(); - _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj ); - if ( sobj ) { - myInfo->append( QString( " - %1: %2: %3" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). - arg( SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) ).arg( sobj->GetName().c_str() ) ); - } - } - else if ( !CORBA::is_nil( aFltGroup ) ) { - myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). - arg( SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) ) ); - } - - // size - myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "SIZE" ) ). - arg( QString::number( aGrp->Size() ) ) ); - - // color - SALOMEDS::Color color = aGrp->GetColor(); - myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "COLOR" ) ). - arg( QColor( color.R*255., color.G*255., color.B*255. ).name() ) ); - } - } - } - } + SMESH::SMESH_Mesh_ptr aMeshPtr = actor()->GetObject()->GetMeshServer(); + if ( !CORBA::is_nil( aMeshPtr ) ) { + SMESH::NodePosition_var pos = aMeshPtr->GetNodePosition( id ); + int shapeID = pos->shapeID; + if ( shapeID > 0 ) { + QString shapeType; + double u, v; + switch ( pos->shapeType ) { + case GEOM::EDGE: + shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); + if ( pos->params.length() == 1 ) + u = pos->params[0]; + break; + case GEOM::FACE: + shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); + if ( pos->params.length() == 2 ) { + u = pos->params[0]; + v = pos->params[1]; + } + break; + case GEOM::VERTEX: + shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); + break; + default: + shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); + break; + } + // separator + myInfo->append( "" ); + myInfo->append( QString( "%1:" ).arg( SMESHGUI_ElemInfo::tr( "POSITION" ) ) ); + myInfo->append( QString( "- %1: #%2" ).arg( shapeType ).arg( shapeID ) ); + if ( pos->shapeType == GEOM::EDGE || pos->shapeType == GEOM::FACE ) { + myInfo->append( QString( "- %1: #%2" ).arg( SMESHGUI_ElemInfo::tr( "U_POSITION" ) ). + arg( QString::number( u, precision > 0 ? 'f' : 'g', qAbs( precision )) ) ); + if ( pos->shapeType == GEOM::FACE ) { + myInfo->append( QString( "- %1: #%2" ).arg( SMESHGUI_ElemInfo::tr( "V_POSITION" ) ). + arg( QString::number( v, precision > 0 ? 'f' : 'g', qAbs( precision )) ) ); + } + } + } + } + // groups node belongs to + SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); + if ( !CORBA::is_nil( aMesh ) ) { + SMESH::ListOfGroups_var groups = aMesh->GetGroups(); + myInfo->append( "" ); // separator + bool top_created = false; + for ( int i = 0; i < groups->length(); i++ ) { + SMESH::SMESH_GroupBase_var aGrp = groups[i]; + if ( CORBA::is_nil( aGrp ) ) continue; + QString aName = aGrp->GetName(); + if ( aGrp->GetType() == SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) { + if ( !top_created ) { + myInfo->append( QString( "%1:" ).arg( SMESHGUI_AddInfo::tr( "GROUPS" ) ) ); + top_created = true; + } + myInfo->append( QString( "+ %1:" ).arg( aName.trimmed() ) ); + if ( grp_details ) { + SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); + SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp ); + SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp ); + + // type : group on geometry, standalone group, group on filter + if ( !CORBA::is_nil( aStdGroup ) ) { + myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). + arg( SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) ) ); + } + else if ( !CORBA::is_nil( aGeomGroup ) ) { + myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). + arg( SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) ) ); + GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape(); + _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj ); + if ( sobj ) { + myInfo->append( QString( " - %1: %2: %3" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). + arg( SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) ).arg( sobj->GetName().c_str() ) ); + } + } + else if ( !CORBA::is_nil( aFltGroup ) ) { + myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). + arg( SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) ) ); + } + + // size + myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "SIZE" ) ). + arg( QString::number( aGrp->Size() ) ) ); + + // color + SALOMEDS::Color color = aGrp->GetColor(); + myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "COLOR" ) ). + arg( QColor( color.R*255., color.G*255., color.B*255. ).name() ) ); + } + } + } + } } else { // @@ -1372,79 +1372,79 @@ void SMESHGUI_SimpleElemInfo::information( const QList& ids ) afunctor->SetMesh( actor()->GetObject()->GetMesh() ); myInfo->append( QString( "- %1: %2" ).arg( tr( "MAX_ELEMENT_LENGTH_3D" ) ).arg( afunctor->GetValue( id ) ) ); } - // element position - if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) { - SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); - if ( !CORBA::is_nil( aMesh ) ) { - SMESH::ElementPosition pos = aMesh->GetElementPosition( id ); - int shapeID = pos.shapeID; - if ( shapeID > 0 ) { - myInfo->append( "" ); // separator - QString shapeType; - switch ( pos.shapeType ) { - case GEOM::EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); break; - case GEOM::FACE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); break; - case GEOM::VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break; - case GEOM::SOLID: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); break; - case GEOM::SHELL: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHELL" ); break; - default: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHAPE" ); break; - } - myInfo->append( QString( "%1: %2 #%3" ).arg( SMESHGUI_ElemInfo::tr( "POSITION" ) ).arg( shapeType ).arg( shapeID ) ); - } - } - } - // groups element belongs to - SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); - if ( !CORBA::is_nil( aMesh ) ) { - SMESH::ListOfGroups_var groups = aMesh->GetGroups(); - myInfo->append( "" ); // separator - bool top_created = false; - for ( int i = 0; i < groups->length(); i++ ) { - SMESH::SMESH_GroupBase_var aGrp = groups[i]; - if ( CORBA::is_nil( aGrp ) ) continue; - QString aName = aGrp->GetName(); - if ( aGrp->GetType() != SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) { - if ( !top_created ) { - myInfo->append( QString( "%1:" ).arg( SMESHGUI_AddInfo::tr( "GROUPS" ) ) ); - top_created = true; - } - myInfo->append( QString( "+ %1:" ).arg( aName.trimmed() ) ); - if ( grp_details ) { - SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); - SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp ); - SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp ); - - // type : group on geometry, standalone group, group on filter - if ( !CORBA::is_nil( aStdGroup ) ) { - myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). - arg( SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) ) ); - } - else if ( !CORBA::is_nil( aGeomGroup ) ) { - myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). - arg( SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) ) ); - GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape(); - _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj ); - if ( sobj ) { - myInfo->append( QString( " - %1: %2: %3" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). - arg( SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) ).arg( sobj->GetName().c_str() ) ); - } - } - else if ( !CORBA::is_nil( aFltGroup ) ) { - myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). - arg( SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) ) ); - } - - myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "SIZE" ) ). - arg( QString::number( aGrp->Size() ) ) ); - - // color - SALOMEDS::Color color = aGrp->GetColor(); - myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "COLOR" ) ). - arg( QColor( color.R*255., color.G*255., color.B*255. ).name() ) ); - } - } - } - } + // element position + if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) { + SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); + if ( !CORBA::is_nil( aMesh ) ) { + SMESH::ElementPosition pos = aMesh->GetElementPosition( id ); + int shapeID = pos.shapeID; + if ( shapeID > 0 ) { + myInfo->append( "" ); // separator + QString shapeType; + switch ( pos.shapeType ) { + case GEOM::EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); break; + case GEOM::FACE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); break; + case GEOM::VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break; + case GEOM::SOLID: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); break; + case GEOM::SHELL: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHELL" ); break; + default: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHAPE" ); break; + } + myInfo->append( QString( "%1: %2 #%3" ).arg( SMESHGUI_ElemInfo::tr( "POSITION" ) ).arg( shapeType ).arg( shapeID ) ); + } + } + } + // groups element belongs to + SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); + if ( !CORBA::is_nil( aMesh ) ) { + SMESH::ListOfGroups_var groups = aMesh->GetGroups(); + myInfo->append( "" ); // separator + bool top_created = false; + for ( int i = 0; i < groups->length(); i++ ) { + SMESH::SMESH_GroupBase_var aGrp = groups[i]; + if ( CORBA::is_nil( aGrp ) ) continue; + QString aName = aGrp->GetName(); + if ( aGrp->GetType() != SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) { + if ( !top_created ) { + myInfo->append( QString( "%1:" ).arg( SMESHGUI_AddInfo::tr( "GROUPS" ) ) ); + top_created = true; + } + myInfo->append( QString( "+ %1:" ).arg( aName.trimmed() ) ); + if ( grp_details ) { + SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); + SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp ); + SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp ); + + // type : group on geometry, standalone group, group on filter + if ( !CORBA::is_nil( aStdGroup ) ) { + myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). + arg( SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) ) ); + } + else if ( !CORBA::is_nil( aGeomGroup ) ) { + myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). + arg( SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) ) ); + GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape(); + _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj ); + if ( sobj ) { + myInfo->append( QString( " - %1: %2: %3" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). + arg( SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) ).arg( sobj->GetName().c_str() ) ); + } + } + else if ( !CORBA::is_nil( aFltGroup ) ) { + myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ). + arg( SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) ) ); + } + + myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "SIZE" ) ). + arg( QString::number( aGrp->Size() ) ) ); + + // color + SALOMEDS::Color color = aGrp->GetColor(); + myInfo->append( QString( " - %1: %2" ).arg( SMESHGUI_AddInfo::tr( "COLOR" ) ). + arg( QColor( color.R*255., color.G*255., color.B*255. ).name() ) ); + } + } + } + } } // separator if ( ids.count() > 1 ) { @@ -1584,131 +1584,131 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) QTreeWidgetItem* i = createItem( conItem ); i->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" ) ); i->setText( 1, con ); - i->setData( 1, TypeRole, NodeConnectivity ); + i->setData( 1, TypeRole, NodeConnectivity ); } con = formatConnectivity( connectivity, SMDSAbs_Edge ); if ( !con.isEmpty() ) { QTreeWidgetItem* i = createItem( conItem ); i->setText( 0, SMESHGUI_ElemInfo::tr( "EDGES" ) ); i->setText( 1, con ); - i->setData( 1, TypeRole, NodeConnectivity ); + i->setData( 1, TypeRole, NodeConnectivity ); } con = formatConnectivity( connectivity, SMDSAbs_Face ); if ( !con.isEmpty() ) { QTreeWidgetItem* i = createItem( conItem ); i->setText( 0, SMESHGUI_ElemInfo::tr( "FACES" ) ); i->setText( 1, con ); - i->setData( 1, TypeRole, NodeConnectivity ); + i->setData( 1, TypeRole, NodeConnectivity ); } con = formatConnectivity( connectivity, SMDSAbs_Volume ); if ( !con.isEmpty() ) { QTreeWidgetItem* i = createItem( conItem ); i->setText( 0, SMESHGUI_ElemInfo::tr( "VOLUMES" ) ); i->setText( 1, con ); - i->setData( 1, TypeRole, NodeConnectivity ); + i->setData( 1, TypeRole, NodeConnectivity ); } } else { conItem->setText( 1, SMESHGUI_ElemInfo::tr( "FREE_NODE" ) ); } // node position - SMESH::SMESH_Mesh_ptr aMeshPtr = actor()->GetObject()->GetMeshServer(); - if ( !CORBA::is_nil( aMeshPtr ) ) { - SMESH::NodePosition_var pos = aMeshPtr->GetNodePosition( id ); - int shapeID = pos->shapeID; - if ( shapeID > 0 ) { - QString shapeType; - double u, v; - switch ( pos->shapeType ) { - case GEOM::EDGE: - shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); - if ( pos->params.length() == 1 ) - u = pos->params[0]; - break; - case GEOM::FACE: - shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); - if ( pos->params.length() == 2 ) { - u = pos->params[0]; - v = pos->params[1]; - } - break; - case GEOM::VERTEX: - shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); - break; - default: - shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); - break; - } - QTreeWidgetItem* posItem = createItem( nodeItem, Bold ); - posItem->setText( 0, SMESHGUI_ElemInfo::tr("POSITION") ); - posItem->setText( 1, (shapeType + " #%1").arg( shapeID )); - if ( pos->shapeType == GEOM::EDGE || pos->shapeType == GEOM::FACE ) { - QTreeWidgetItem* uItem = createItem( posItem ); - uItem->setText( 0, SMESHGUI_ElemInfo::tr("U_POSITION") ); - uItem->setText( 1, QString::number( u, precision > 0 ? 'f' : 'g', qAbs( precision ))); - if ( pos->shapeType == GEOM::FACE ) { - QTreeWidgetItem* vItem = createItem( posItem ); - vItem->setText( 0, SMESHGUI_ElemInfo::tr("V_POSITION") ); - vItem->setText( 1, QString::number( v, precision > 0 ? 'f' : 'g', qAbs( precision ))); - } - } - } - } - // groups node belongs to - SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); - if ( !CORBA::is_nil( aMesh ) ) { - SMESH::ListOfGroups_var groups = aMesh->GetGroups(); - QTreeWidgetItem* groupsItem = 0; - for ( int i = 0; i < groups->length(); i++ ) { - SMESH::SMESH_GroupBase_var aGrp = groups[i]; - if ( CORBA::is_nil( aGrp ) ) continue; - QString aName = aGrp->GetName(); - if ( aGrp->GetType() == SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) { - if ( !groupsItem ) { - groupsItem = createItem( nodeItem, Bold ); - groupsItem->setText( 0, SMESHGUI_AddInfo::tr( "GROUPS" ) ); - } - QTreeWidgetItem* it = createItem( groupsItem, Bold ); - it->setText( 0, aName.trimmed() ); - if ( grp_details ) { - SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); - SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp ); - SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp ); - - // type : group on geometry, standalone group, group on filter - QTreeWidgetItem* typeItem = createItem( it ); - typeItem->setText( 0, SMESHGUI_AddInfo::tr( "TYPE" ) ); - if ( !CORBA::is_nil( aStdGroup ) ) { - typeItem->setText( 1, SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) ); - } - else if ( !CORBA::is_nil( aGeomGroup ) ) { - typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) ); - GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape(); - _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj ); - if ( sobj ) { - QTreeWidgetItem* gobjItem = createItem( typeItem ); - gobjItem->setText( 0, SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) ); - gobjItem->setText( 1, sobj->GetName().c_str() ); - } - } - else if ( !CORBA::is_nil( aFltGroup ) ) { - typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) ); - } - - // size - QTreeWidgetItem* sizeItem = createItem( it ); - sizeItem->setText( 0, SMESHGUI_AddInfo::tr( "SIZE" ) ); - sizeItem->setText( 1, QString::number( aGrp->Size() ) ); - - // color - SALOMEDS::Color color = aGrp->GetColor(); - QTreeWidgetItem* colorItem = createItem( it ); - colorItem->setText( 0, SMESHGUI_AddInfo::tr( "COLOR" ) ); - colorItem->setBackground( 1, QBrush( QColor( color.R*255., color.G*255., color.B*255.) ) ); - } - } - } - } + SMESH::SMESH_Mesh_ptr aMeshPtr = actor()->GetObject()->GetMeshServer(); + if ( !CORBA::is_nil( aMeshPtr ) ) { + SMESH::NodePosition_var pos = aMeshPtr->GetNodePosition( id ); + int shapeID = pos->shapeID; + if ( shapeID > 0 ) { + QString shapeType; + double u, v; + switch ( pos->shapeType ) { + case GEOM::EDGE: + shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); + if ( pos->params.length() == 1 ) + u = pos->params[0]; + break; + case GEOM::FACE: + shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); + if ( pos->params.length() == 2 ) { + u = pos->params[0]; + v = pos->params[1]; + } + break; + case GEOM::VERTEX: + shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); + break; + default: + shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); + break; + } + QTreeWidgetItem* posItem = createItem( nodeItem, Bold ); + posItem->setText( 0, SMESHGUI_ElemInfo::tr("POSITION") ); + posItem->setText( 1, (shapeType + " #%1").arg( shapeID )); + if ( pos->shapeType == GEOM::EDGE || pos->shapeType == GEOM::FACE ) { + QTreeWidgetItem* uItem = createItem( posItem ); + uItem->setText( 0, SMESHGUI_ElemInfo::tr("U_POSITION") ); + uItem->setText( 1, QString::number( u, precision > 0 ? 'f' : 'g', qAbs( precision ))); + if ( pos->shapeType == GEOM::FACE ) { + QTreeWidgetItem* vItem = createItem( posItem ); + vItem->setText( 0, SMESHGUI_ElemInfo::tr("V_POSITION") ); + vItem->setText( 1, QString::number( v, precision > 0 ? 'f' : 'g', qAbs( precision ))); + } + } + } + } + // groups node belongs to + SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); + if ( !CORBA::is_nil( aMesh ) ) { + SMESH::ListOfGroups_var groups = aMesh->GetGroups(); + QTreeWidgetItem* groupsItem = 0; + for ( int i = 0; i < groups->length(); i++ ) { + SMESH::SMESH_GroupBase_var aGrp = groups[i]; + if ( CORBA::is_nil( aGrp ) ) continue; + QString aName = aGrp->GetName(); + if ( aGrp->GetType() == SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) { + if ( !groupsItem ) { + groupsItem = createItem( nodeItem, Bold ); + groupsItem->setText( 0, SMESHGUI_AddInfo::tr( "GROUPS" ) ); + } + QTreeWidgetItem* it = createItem( groupsItem, Bold ); + it->setText( 0, aName.trimmed() ); + if ( grp_details ) { + SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); + SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp ); + SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp ); + + // type : group on geometry, standalone group, group on filter + QTreeWidgetItem* typeItem = createItem( it ); + typeItem->setText( 0, SMESHGUI_AddInfo::tr( "TYPE" ) ); + if ( !CORBA::is_nil( aStdGroup ) ) { + typeItem->setText( 1, SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) ); + } + else if ( !CORBA::is_nil( aGeomGroup ) ) { + typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) ); + GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape(); + _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj ); + if ( sobj ) { + QTreeWidgetItem* gobjItem = createItem( typeItem ); + gobjItem->setText( 0, SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) ); + gobjItem->setText( 1, sobj->GetName().c_str() ); + } + } + else if ( !CORBA::is_nil( aFltGroup ) ) { + typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) ); + } + + // size + QTreeWidgetItem* sizeItem = createItem( it ); + sizeItem->setText( 0, SMESHGUI_AddInfo::tr( "SIZE" ) ); + sizeItem->setText( 1, QString::number( aGrp->Size() ) ); + + // color + SALOMEDS::Color color = aGrp->GetColor(); + QTreeWidgetItem* colorItem = createItem( it ); + colorItem->setText( 0, SMESHGUI_AddInfo::tr( "COLOR" ) ); + colorItem->setBackground( 1, QBrush( QColor( color.R*255., color.G*255., color.B*255.) ) ); + } + } + } + } } else { // @@ -1813,8 +1813,8 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) QTreeWidgetItem* nodeItem = createItem( conItem, Bold ); nodeItem->setText( 0, QString( "%1 %2 / %3" ).arg( SMESHGUI_ElemInfo::tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ) ); nodeItem->setText( 1, QString( "#%1" ).arg( node->GetID() ) ); - nodeItem->setData( 1, TypeRole, ElemConnectivity ); - nodeItem->setData( 1, IdRole, node->GetID() ); + nodeItem->setData( 1, TypeRole, ElemConnectivity ); + nodeItem->setData( 1, IdRole, node->GetID() ); nodeItem->setExpanded( false ); // node coordinates QTreeWidgetItem* coordItem = createItem( nodeItem ); @@ -1844,28 +1844,28 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) QTreeWidgetItem* i = createItem( nconItem ); i->setText( 0, SMESHGUI_ElemInfo::tr( "EDGES" ) ); i->setText( 1, con ); - i->setData( 1, TypeRole, NodeConnectivity ); + i->setData( 1, TypeRole, NodeConnectivity ); } con = formatConnectivity( connectivity, SMDSAbs_Ball ); if ( !con.isEmpty() ) { QTreeWidgetItem* i = createItem( nconItem ); i->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" ) ); i->setText( 1, con ); - i->setData( 1, TypeRole, NodeConnectivity ); + i->setData( 1, TypeRole, NodeConnectivity ); } con = formatConnectivity( connectivity, SMDSAbs_Face ); if ( !con.isEmpty() ) { QTreeWidgetItem* i = createItem( nconItem ); i->setText( 0, SMESHGUI_ElemInfo::tr( "FACES" ) ); i->setText( 1, con ); - i->setData( 1, TypeRole, NodeConnectivity ); + i->setData( 1, TypeRole, NodeConnectivity ); } con = formatConnectivity( connectivity, SMDSAbs_Volume ); if ( !con.isEmpty() ) { QTreeWidgetItem* i = createItem( nconItem ); i->setText( 0, SMESHGUI_ElemInfo::tr( "VOLUMES" ) ); i->setText( 1, con ); - i->setData( 1, TypeRole, NodeConnectivity ); + i->setData( 1, TypeRole, NodeConnectivity ); } } } @@ -1950,83 +1950,83 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) diam3Item->setText( 0, tr( "MAX_ELEMENT_LENGTH_3D" ) ); diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); } - // element position - if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) { - SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); - if ( !CORBA::is_nil( aMesh ) ) { - SMESH::ElementPosition pos = aMesh->GetElementPosition( id ); - int shapeID = pos.shapeID; - if ( shapeID > 0 ) { - QTreeWidgetItem* shItem = createItem( elemItem, Bold ); - QString shapeType; - switch ( pos.shapeType ) { - case GEOM::EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); break; - case GEOM::FACE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); break; - case GEOM::VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break; - case GEOM::SOLID: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); break; - case GEOM::SHELL: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHELL" ); break; - default: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHAPE" ); break; - } - shItem->setText( 0, SMESHGUI_ElemInfo::tr( "POSITION" ) ); - shItem->setText( 1, QString( "%1 #%2" ).arg( shapeType ).arg( shapeID ) ); - } - } - } - // groups element belongs to - SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); - if ( !CORBA::is_nil( aMesh ) ) { - SMESH::ListOfGroups_var groups = aMesh->GetGroups(); - QTreeWidgetItem* groupsItem = 0; - for ( int i = 0; i < groups->length(); i++ ) { - SMESH::SMESH_GroupBase_var aGrp = groups[i]; - if ( CORBA::is_nil( aGrp ) ) continue; - QString aName = aGrp->GetName(); - if ( aGrp->GetType() != SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) { - if ( !groupsItem ) { - groupsItem = createItem( elemItem, Bold ); - groupsItem->setText( 0, SMESHGUI_AddInfo::tr( "GROUPS" ) ); - } - QTreeWidgetItem* it = createItem( groupsItem, Bold ); - it->setText( 0, aName.trimmed() ); - if ( grp_details ) { - SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); - SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp ); - SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp ); - - // type : group on geometry, standalone group, group on filter - QTreeWidgetItem* typeItem = createItem( it ); - typeItem->setText( 0, SMESHGUI_AddInfo::tr( "TYPE" ) ); - if ( !CORBA::is_nil( aStdGroup ) ) { - typeItem->setText( 1, SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) ); - } - else if ( !CORBA::is_nil( aGeomGroup ) ) { - typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) ); - GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape(); - _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj ); - if ( sobj ) { - QTreeWidgetItem* gobjItem = createItem( typeItem ); - gobjItem->setText( 0, SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) ); - gobjItem->setText( 1, sobj->GetName().c_str() ); - } - } - else if ( !CORBA::is_nil( aFltGroup ) ) { - typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) ); - } - - // size - QTreeWidgetItem* sizeItem = createItem( it ); - sizeItem->setText( 0, SMESHGUI_AddInfo::tr( "SIZE" ) ); - sizeItem->setText( 1, QString::number( aGrp->Size() ) ); - - // color - SALOMEDS::Color color = aGrp->GetColor(); - QTreeWidgetItem* colorItem = createItem( it ); - colorItem->setText( 0, SMESHGUI_AddInfo::tr( "COLOR" ) ); - colorItem->setBackground( 1, QBrush( QColor( color.R*255., color.G*255., color.B*255.) ) ); - } - } - } - } + // element position + if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) { + SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); + if ( !CORBA::is_nil( aMesh ) ) { + SMESH::ElementPosition pos = aMesh->GetElementPosition( id ); + int shapeID = pos.shapeID; + if ( shapeID > 0 ) { + QTreeWidgetItem* shItem = createItem( elemItem, Bold ); + QString shapeType; + switch ( pos.shapeType ) { + case GEOM::EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); break; + case GEOM::FACE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); break; + case GEOM::VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break; + case GEOM::SOLID: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); break; + case GEOM::SHELL: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHELL" ); break; + default: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHAPE" ); break; + } + shItem->setText( 0, SMESHGUI_ElemInfo::tr( "POSITION" ) ); + shItem->setText( 1, QString( "%1 #%2" ).arg( shapeType ).arg( shapeID ) ); + } + } + } + // groups element belongs to + SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); + if ( !CORBA::is_nil( aMesh ) ) { + SMESH::ListOfGroups_var groups = aMesh->GetGroups(); + QTreeWidgetItem* groupsItem = 0; + for ( int i = 0; i < groups->length(); i++ ) { + SMESH::SMESH_GroupBase_var aGrp = groups[i]; + if ( CORBA::is_nil( aGrp ) ) continue; + QString aName = aGrp->GetName(); + if ( aGrp->GetType() != SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) { + if ( !groupsItem ) { + groupsItem = createItem( elemItem, Bold ); + groupsItem->setText( 0, SMESHGUI_AddInfo::tr( "GROUPS" ) ); + } + QTreeWidgetItem* it = createItem( groupsItem, Bold ); + it->setText( 0, aName.trimmed() ); + if ( grp_details ) { + SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); + SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp ); + SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp ); + + // type : group on geometry, standalone group, group on filter + QTreeWidgetItem* typeItem = createItem( it ); + typeItem->setText( 0, SMESHGUI_AddInfo::tr( "TYPE" ) ); + if ( !CORBA::is_nil( aStdGroup ) ) { + typeItem->setText( 1, SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) ); + } + else if ( !CORBA::is_nil( aGeomGroup ) ) { + typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) ); + GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape(); + _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj ); + if ( sobj ) { + QTreeWidgetItem* gobjItem = createItem( typeItem ); + gobjItem->setText( 0, SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) ); + gobjItem->setText( 1, sobj->GetName().c_str() ); + } + } + else if ( !CORBA::is_nil( aFltGroup ) ) { + typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) ); + } + + // size + QTreeWidgetItem* sizeItem = createItem( it ); + sizeItem->setText( 0, SMESHGUI_AddInfo::tr( "SIZE" ) ); + sizeItem->setText( 1, QString::number( aGrp->Size() ) ); + + // color + SALOMEDS::Color color = aGrp->GetColor(); + QTreeWidgetItem* colorItem = createItem( it ); + colorItem->setText( 0, SMESHGUI_AddInfo::tr( "COLOR" ) ); + colorItem->setBackground( 1, QBrush( QColor( color.R*255., color.G*255., color.B*255.) ) ); + } + } + } + } } } } @@ -2582,7 +2582,7 @@ void SMESHGUI_AddInfo::saveInfo( QTextStream &out ) if ( !( ( *it )->text(0) ).isEmpty() ) { out << QString( SPACING_INFO * itemDepth( *it ), ' ' ) << ( *it )->text(0); if ( ( *it )->text(0) == tr( "COLOR" ) ) { - out << ": " << ( ( ( *it )->background(1) ).color() ).name(); + out << ": " << ( ( ( *it )->background(1) ).color() ).name(); } else if ( !( ( *it )->text(1) ).isEmpty() ) out << ": " << ( *it )->text(1); out << "\n"; @@ -2959,7 +2959,7 @@ void SMESHGUI_MeshInfoDlg::dump() QFile aFile( aFileName ); if ( !aFile.open( QIODevice::WriteOnly | QIODevice::Text ) ) - return; + return; QTextStream out( &aFile ); diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index 48ce5afc7..dcc093c07 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -982,23 +982,23 @@ namespace SMESH foreach ( SUIT_ViewManager* vm, vmList ) { QVector views = vm->getViews(); foreach ( SUIT_ViewWindow* vw, views ) { - // update VTK viewer properties - if ( SVTK_ViewWindow* aVtkView = GetVtkViewWindow( vw ) ) { - // update actors - vtkRenderer* aRenderer = aVtkView->getRenderer(); - VTK::ActorCollectionCopy aCopy( aRenderer->GetActors() ); - vtkActorCollection* aCollection = aCopy.GetActors(); - aCollection->InitTraversal(); - while ( vtkActor* anAct = aCollection->GetNextActor() ) { - if ( SMESH_NodeLabelActor* anActor = dynamic_cast< SMESH_NodeLabelActor* >( anAct ) ) { - anActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] ); - } - else if ( SMESH_CellLabelActor* anActor = dynamic_cast< SMESH_CellLabelActor* >( anAct ) ) { - anActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] ); - } - } - aVtkView->Repaint( false ); - } + // update VTK viewer properties + if ( SVTK_ViewWindow* aVtkView = GetVtkViewWindow( vw ) ) { + // update actors + vtkRenderer* aRenderer = aVtkView->getRenderer(); + VTK::ActorCollectionCopy aCopy( aRenderer->GetActors() ); + vtkActorCollection* aCollection = aCopy.GetActors(); + aCollection->InitTraversal(); + while ( vtkActor* anAct = aCollection->GetNextActor() ) { + if ( SMESH_NodeLabelActor* anActor = dynamic_cast< SMESH_NodeLabelActor* >( anAct ) ) { + anActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] ); + } + else if ( SMESH_CellLabelActor* anActor = dynamic_cast< SMESH_CellLabelActor* >( anAct ) ) { + anActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] ); + } + } + aVtkView->Repaint( false ); + } } } } diff --git a/src/Tools/MeshCut/MeshCut_Maillage.cxx b/src/Tools/MeshCut/MeshCut_Maillage.cxx index 0ae4437e0..08284c21a 100644 --- a/src/Tools/MeshCut/MeshCut_Maillage.cxx +++ b/src/Tools/MeshCut/MeshCut_Maillage.cxx @@ -1121,8 +1121,8 @@ void Maillage::outputMED(std::string fichierMED) // Création de la famille if (MEDfamilyCr(fid, maa, nomfam, numfam, 0, MED_NO_GROUP) < 0) ERREUR("Error MEDfamilyCr"); - delete gro; - } + delete gro; + } } @@ -1437,7 +1437,7 @@ void Maillage::outputMED(std::string fichierMED) if (MEDfamilyCr(fid, maa, nomfam, numfam, 1, gro) < 0) ERREUR("Error MEDfamilyCr"); - delete gro; + delete gro; } } diff --git a/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx b/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx index 612906070..76c71870e 100644 --- a/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx +++ b/src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx @@ -294,9 +294,9 @@ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobParameterList & m break; default: _lastErrorMessage = - std::string("The type of the file ")+ - std::string(currentMesh.file_name)+ - std::string(" is not recognized"); + std::string("The type of the file ")+ + std::string(currentMesh.file_name)+ + std::string(" is not recognized"); LOG(_lastErrorMessage); return JOBID_UNDEFINED; } diff --git a/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx b/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx index f53d7aa34..40e2a96ce 100644 --- a/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx +++ b/src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx @@ -42,9 +42,9 @@ public: ~MeshJobManager_i(); bool configure (const char *configId, - const MESHJOB::ConfigParameter & configParameter); + const MESHJOB::ConfigParameter & configParameter); CORBA::Long initialize (const MESHJOB::MeshJobParameterList & meshJobParameterList, - const char *configId); + const char *configId); bool start (CORBA::Long jobId); char* getState (CORBA::Long jobId); MESHJOB::MeshJobResults * finalize(CORBA::Long jobId); diff --git a/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx b/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx index 26a7416cd..6aa4c71ce 100644 --- a/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx +++ b/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx @@ -33,8 +33,8 @@ class SPADDERPluginTester_i: { public: SPADDERPluginTester_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, const char *interfaceName); + PortableServer::ObjectId * contId, + const char *instanceName, const char *interfaceName); virtual ~SPADDERPluginTester_i(); void demo(CORBA::Double a,CORBA::Double b,CORBA::Double& c);