diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index 63905e6942ded8797d34667ac990a5a2367d88de..049a075b33536b7bb3ca294b103bb651a3255ed1 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -274,7 +274,7 @@ int MergeFile(const std::string &fileName, bool warnIfMissing) } char header[256]; - if(!fgets(header, sizeof(header), fp)) return 0; + if(!fgets(header, sizeof(header), fp)){ fclose(fp); return 0; } fclose(fp); Msg::StatusBar(true, "Reading '%s'...", fileName.c_str()); @@ -499,7 +499,7 @@ int MergePostProcessingFile(const std::string &fileName, bool showLastStep, return 0; } char header[256]; - if(!fgets(header, sizeof(header), fp)) return 0; + if(!fgets(header, sizeof(header), fp)){ fclose(fp); return 0; } bool haveMesh = false; if(!strncmp(header, "$MeshFormat", 11)){ while(!feof(fp) && fgets(header, sizeof(header), fp)){ diff --git a/Fltk/projectionEditor.cpp b/Fltk/projectionEditor.cpp index 6a36897f19de95eec16afb18eae37197456a898c..bf09f357786927aa5ee60a9e18205dd1bc8e2812 100644 --- a/Fltk/projectionEditor.cpp +++ b/Fltk/projectionEditor.cpp @@ -467,12 +467,14 @@ static void load_projection_cb(Fl_Widget *w, void *data) int num; if(!fscanf(fp, "%d", &num)){ Msg::Error("Bad projection file format"); + fclose(fp); return; } for(int proj = 0; proj < num; proj++){ char name[256], tag[256]; if(!fscanf(fp, "%s", tag) || !fscanf(fp, "%s", name)){ Msg::Error("Bad projection file format"); + fclose(fp); return; } fourierProjectionFace *face = createProjectionFaceFromName(name); diff --git a/Geo/GModelIO_ACIS.cpp b/Geo/GModelIO_ACIS.cpp index 6deca8fbdfeb7b3053f44d65882edcc546265956..d5c339ec88c0411c4d1c91bceebaed335adcfa31 100644 --- a/Geo/GModelIO_ACIS.cpp +++ b/Geo/GModelIO_ACIS.cpp @@ -38,9 +38,9 @@ class GMSH_MESH_MANAGER : public MESH_MANAGER { GModel *_gm; GFace *_current; public: - GMSH_MESH_MANAGER(GModel *gm) + GMSH_MESH_MANAGER(GModel *gm) : _gm(gm) - { + { } virtual ~GMSH_MESH_MANAGER() { @@ -48,7 +48,7 @@ class GMSH_MESH_MANAGER : public MESH_MANAGER { virtual void begin_mesh_output(ENTITY *entity, ENTITY *app_ref, ENTITY *format) { FACE *acisFace = dynamic_cast<FACE*>(entity); - if (!acisFace)return; + if (!acisFace) return; _current = getACISFaceByNativePtr (_gm,acisFace); } virtual void announce_counts(int npoly, int nnode, int nref) @@ -61,16 +61,16 @@ class GMSH_MESH_MANAGER : public MESH_MANAGER { return 1; } virtual void announce_indexed_polynode(int ipoly, int i, void *pnode); - virtual void *announce_indexed_node(int inode, const SPApar_pos &pos, + virtual void *announce_indexed_node(int inode, const SPApar_pos &pos, const SPAposition &X, const SPAunit_vector &N) { - SPoint2 p(pos.u,pos.v); - _current->stl_vertices[inode] = p; + SPoint2 p(pos.u,pos.v); + _current->stl_vertices[inode] = p; // printf("node %d pos %g %g\n",inode,p.x(),p.y()); return (void*)inode; // bad idea, but... } - virtual void announce_indexed_polynode(ENTITY *E, int ipoly, int i, - void *id, const double &edge_tpar, + virtual void announce_indexed_polynode(ENTITY *E, int ipoly, int i, + void *id, const double &edge_tpar, const SPApar_pos &uv, const SPAposition &iX, const SPAunit_vector &N) { @@ -79,7 +79,7 @@ class GMSH_MESH_MANAGER : public MESH_MANAGER { { return 0; } - virtual void start_indexed_polygon(int polygonIndex,int _polygonNodeCount, + virtual void start_indexed_polygon(int polygonIndex,int _polygonNodeCount, int ishare = -2) { } @@ -105,7 +105,7 @@ public: GMSH_MESH_MANAGER *_mm; ACIS_Internals(GModel *gm); ~ACIS_Internals(); - void loadSAT(std::string fileName, GModel*); + void loadSAT(std::string fileName, GModel*); void addVertices(GModel *gm, ENTITY_LIST &l); void addEdges(GModel *gm, ENTITY_LIST &l); void addFaces(GModel *gm, ENTITY_LIST &l); @@ -123,7 +123,7 @@ ACIS_Internals::ACIS_Internals(GModel *gm) } option_header* seam_option = NULL; - + seam_option = find_option("periodic_no_seam"); if (seam_option != NULL) seam_option->push(FALSE); @@ -155,7 +155,7 @@ ACIS_Internals::~ACIS_Internals() outcome prout = api_stop_modeller(); if (!prout.ok()){ Msg::Error("Unable to stop ACIS"); - } + } delete _mm; } @@ -183,7 +183,7 @@ void ACIS_Internals::addEdges (GModel *gm, ENTITY_LIST &l) GEdge *v = getACISEdgeByNativePtr(gm, av); if (!v){ GVertex *v1 = getACISVertexByNativePtr(gm, av->start()); - GVertex *v2 = getACISVertexByNativePtr(gm, av->end()); + GVertex *v2 = getACISVertexByNativePtr(gm, av->end()); gm->add(new ACISEdge(gm, av, gm->getMaxElementaryNumber(1) + 1, v1, v2)); } } @@ -210,14 +210,15 @@ void ACIS_Internals::loadSAT(std::string fileName, GModel *gm) FILE *f = fopen (fileName.c_str(), "r"); if (!f){ return; - } - outcome prout = api_restore_entity_list(f,1,entities); + } + outcome prout = api_restore_entity_list(f,1,entities); if (!prout.ok()){ Msg::Error("Unable to load ACIS FILE %d",fileName.c_str()); + fclose(f); return; - } + } Msg::Info("ACIS FILE %d Loaded",fileName.c_str()); - + ENTITY *e; entities.init(); while((e = entities.next())){ diff --git a/Geo/GModelIO_DIFF.cpp b/Geo/GModelIO_DIFF.cpp index cde45f6842accbf2f83d7dd97370598be67e7f47..2ad72e9d0f24bfea52db9addc65a553b35f307d0 100644 --- a/Geo/GModelIO_DIFF.cpp +++ b/Geo/GModelIO_DIFF.cpp @@ -57,39 +57,41 @@ int GModel::readDIFF(const std::string &name) } int dim; - if(sscanf(str, "%*s %*s %*s %*s %*s %d", &dim) != 1) return 0; + if(sscanf(str, "%*s %*s %*s %*s %*s %d", &dim) != 1){ fclose(fp); return 0; } Msg::Info("dimension %d", dim); int numElements; - if(!fgets(str, sizeof(str), fp) || feof(fp)) return 0; + if(!fgets(str, sizeof(str), fp) || feof(fp)){ fclose(fp); return 0; } while(strstr(str, "Number of elements =") == NULL){ if(!fgets(str, sizeof(str), fp) || feof(fp)) break; } - if(sscanf(str, "%*s %*s %*s %*s %d", &numElements) != 1) return 0; + if(sscanf(str, "%*s %*s %*s %*s %d", &numElements) != 1){ fclose(fp); return 0; } Msg::Info("%d elements", numElements); int numVertices; - if(!fgets(str, sizeof(str), fp) || feof(fp)) return 0; + if(!fgets(str, sizeof(str), fp) || feof(fp)){ fclose(fp); return 0; } while(strstr(str, "Number of nodes =") == NULL){ if(!fgets(str, sizeof(str), fp) || feof(fp)) break; } - if(sscanf(str, "%*s %*s %*s %*s %d", &numVertices) != 1) return 0; + if(sscanf(str, "%*s %*s %*s %*s %d", &numVertices) != 1){ fclose(fp); return 0; } Msg::Info("%d vertices", numVertices); int numVerticesPerElement; - if(!fgets(str, sizeof(str), fp)||feof(fp)) return 0; + if(!fgets(str, sizeof(str), fp) || feof(fp)){ fclose(fp); return 0; } while(strstr(str, "Max number of nodes in an element:")==NULL){ if(!fgets(str, sizeof(str), fp) || feof(fp)) break; } - if(sscanf(str, "%*s %*s %*s %*s %*s %*s %*s %d", &numVerticesPerElement) != 1) + if(sscanf(str, "%*s %*s %*s %*s %*s %*s %*s %d", &numVerticesPerElement) != 1){ + fclose(fp); return 0; + } Msg::Info("numVerticesPerElement %d", numVerticesPerElement); bool several_subdomains; - if(!fgets(str, sizeof(str), fp) || feof(fp)) return 0; + if(!fgets(str, sizeof(str), fp) || feof(fp)){ fclose(fp); return 0; } if(!strncmp(&str[2], "Only one material", 17) || !strncmp(&str[2], "Only one subdomain", 18)){ if(!strncmp(&str[37], "dpTRUE", 6) || !strncmp(&str[37], "true", 4) || @@ -104,13 +106,13 @@ int GModel::readDIFF(const std::string &name) int nbi; std::vector<int> bi; - if(!fgets(str, sizeof(str), fp) || feof(fp)) return 0; + if(!fgets(str, sizeof(str), fp) || feof(fp)){ fclose(fp); return 0; } while(strstr(str, "Boundary indicators:") == NULL && strstr(str, "boundary indicators:") == NULL){ if(!fgets(str, sizeof(str), fp) || feof(fp)) break; } - if(sscanf(str, "%d %*s %*s", &nbi) != 1) return 0; + if(sscanf(str, "%d %*s %*s", &nbi) != 1){ fclose(fp); return 0; } Msg::Info("nbi %d", nbi); if(nbi != 0) bi.resize(nbi); @@ -122,7 +124,7 @@ int GModel::readDIFF(const std::string &name) } else format_read_bi += " %d"; - if(sscanf(str, format_read_bi.c_str(), &bi[i]) != 1) return 0; + if(sscanf(str, format_read_bi.c_str(), &bi[i]) != 1){ fclose(fp); return 0; } Msg::Info("bi[%d]=%d", i, bi[i]); } @@ -138,11 +140,11 @@ int GModel::readDIFF(const std::string &name) Msg::ResetProgressMeter(); for(int i = 0; i < numVertices; i++){ - if(!fgets(str, sizeof(str), fp)) return 0; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return 0; } double xyz[3]; int tmp; if(sscanf(str, "%d ( %lf , %lf , %lf ) [%d]", &num, - &xyz[0], &xyz[1], &xyz[2], &tmp) != 5) return 0; + &xyz[0], &xyz[1], &xyz[2], &tmp) != 5){ fclose(fp); return 0; } elementary[i].resize(tmp + 1); elementary[i][0] = tmp; minVertex = std::min(minVertex, num); @@ -179,8 +181,10 @@ int GModel::readDIFF(const std::string &name) } else format_read_bi += " %d"; - if(sscanf(str, format_read_bi.c_str(), &(elementary[i][j + 1])) != 1) + if(sscanf(str, format_read_bi.c_str(), &(elementary[i][j + 1])) != 1){ + fclose(fp); return 0; + } Msg::Info("elementary[%d][%d]=%d", i + 1, j + 1, elementary[i][j + 1]); } } @@ -198,10 +202,10 @@ int GModel::readDIFF(const std::string &name) Msg::ResetProgressMeter(); std::vector<int> mapping; for(int i = 1; i <= numElements; i++){ - if(!fgets(str, sizeof(str), fp)) return 0; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return 0; } int num = 0, type, physical = 0, partition = 0; int indices[60]; - if(sscanf(str, "%*d %s %d", eleTypec, &material[i-1]) != 2) return 0; + if(sscanf(str, "%*d %s %d", eleTypec, &material[i-1]) != 2){ fclose(fp); return 0; } eleType = std::string(eleTypec); int k2; // local number for the element int NoVertices; // number of vertices per element @@ -268,6 +272,7 @@ int GModel::readDIFF(const std::string &name) type = MSH_HEX_27; } else{ + fclose(fp); return 0; } std::string format_read_vertices = "%*d %*s %*d"; @@ -279,26 +284,33 @@ int GModel::readDIFF(const std::string &name) else format_read_vertices += " %d"; k2 = mapping[k]; - if(sscanf(str, format_read_vertices.c_str(), &ElementsNodes[i-1][k2]) != 1) + if(sscanf(str, format_read_vertices.c_str(), &ElementsNodes[i-1][k2]) != 1){ + fclose(fp); return 0; + } } mapping.clear(); for(int j = 0; j < NoVertices; j++) indices[j] = ElementsNodes[i - 1][j]; std::vector<MVertex*> vertices; if(vertexVector.size()){ - if(!getVertices(numVerticesPerElement, indices, vertexVector, vertices)) + if(!getVertices(numVerticesPerElement, indices, vertexVector, vertices)){ + fclose(fp); return 0; + } } else{ - if(!getVertices(numVerticesPerElement, indices, vertexMap, vertices)) + if(!getVertices(numVerticesPerElement, indices, vertexMap, vertices)){ + fclose(fp); return 0; + } } MElementFactory f; MElement *e = f.create(type, vertices, num, partition); if(!e){ Msg::Error("Unknown type of element %d", type); + fclose(fp); return 0; } int reg = elementary[i-1][1]; @@ -311,7 +323,7 @@ int GModel::readDIFF(const std::string &name) case TYPE_HEX : elements[5][reg].push_back(e); break; case TYPE_PRI : elements[6][reg].push_back(e); break; case TYPE_PYR : elements[7][reg].push_back(e); break; - default : Msg::Error("Wrong type of element"); return 0; + default : Msg::Error("Wrong type of element"); fclose(fp); return 0; } int dim = e->getDim(); if(physical && (!physicals[dim].count(reg) || diff --git a/Geo/GModelIO_GEOM.cpp b/Geo/GModelIO_GEOM.cpp index 509880cc6e3a20ad4a5b31e026fe39f22e89355f..813ddc44aeb0827b2fb8da49efa076b5df3d3c33 100644 --- a/Geo/GModelIO_GEOM.cpp +++ b/Geo/GModelIO_GEOM.cpp @@ -31,11 +31,14 @@ int GModel::readGEOM(const std::string &name) } int numNodes, numElements, dummy; - if(fscanf(fp, "%d %d %d", &numNodes, &numElements, &dummy) != 3) + if(fscanf(fp, "%d %d %d", &numNodes, &numElements, &dummy) != 3){ + fclose(fp); return 0; + } if(!numNodes || !numElements){ Msg::Warning("No vertices or elements found"); + fclose(fp); return 0; } diff --git a/Geo/GModelIO_MESH.cpp b/Geo/GModelIO_MESH.cpp index fb513ada0eaf9f5818e4a06c161a925f3f6e0b3f..49bc0fba00be526078bb21e5f868f19fcbf826a8 100644 --- a/Geo/GModelIO_MESH.cpp +++ b/Geo/GModelIO_MESH.cpp @@ -36,13 +36,14 @@ int GModel::readMESH(const std::string &name) } char buffer[256]; - if(!fgets(buffer, sizeof(buffer), fp)) return 0; + if(!fgets(buffer, sizeof(buffer), fp)){ fclose(fp); return 0; } char str[256]; int format; sscanf(buffer, "%s %d", str, &format); if(format == 3){ Msg::Error("Medit mesh import only available for ASCII files"); + fclose(fp); return 0; } @@ -82,7 +83,7 @@ int GModel::readMESH(const std::string &name) sscanf(buffer, "%d %d %d", &n[0], &n[1], &cl); for(int j = 0; j < 2; j++) n[j]--; std::vector<MVertex*> vertices; - if(!getVertices(2, n, vertexVector, vertices)) return 0; + if(!getVertices(2, n, vertexVector, vertices)){ fclose(fp); return 0; } elements[0][cl].push_back(new MLine(vertices)); } } @@ -97,7 +98,7 @@ int GModel::readMESH(const std::string &name) sscanf(buffer, "%d %d %d %d", &n[0], &n[1], &n[2], &cl); for(int j = 0; j < 3; j++) n[j]--; std::vector<MVertex*> vertices; - if(!getVertices(3, n, vertexVector, vertices)) return 0; + if(!getVertices(3, n, vertexVector, vertices)){ fclose(fp); return 0; } elements[0][cl].push_back(new MLine3(vertices)); } } @@ -112,7 +113,7 @@ int GModel::readMESH(const std::string &name) sscanf(buffer, "%d %d %d %d", &n[0], &n[1], &n[2], &cl); for(int j = 0; j < 3; j++) n[j]--; std::vector<MVertex*> vertices; - if(!getVertices(3, n, vertexVector, vertices)) return 0; + if(!getVertices(3, n, vertexVector, vertices)){ fclose(fp); return 0; } elements[1][cl].push_back(new MTriangle(vertices)); } } @@ -124,10 +125,11 @@ int GModel::readMESH(const std::string &name) for(int i = 0; i < nbe; i++) { if(!fgets(buffer, sizeof(buffer), fp)) break; int n[6], cl; - sscanf(buffer, "%d %d %d %d %d %d %d", &n[0], &n[1], &n[2], &n[3], &n[4], &n[5],&cl); + sscanf(buffer, "%d %d %d %d %d %d %d", + &n[0], &n[1], &n[2], &n[3], &n[4], &n[5], &cl); for(int j = 0; j < 6; j++) n[j]--; std::vector<MVertex*> vertices; - if(!getVertices(6, n, vertexVector, vertices)) return 0; + if(!getVertices(6, n, vertexVector, vertices)){ fclose(fp); return 0; } elements[1][cl].push_back(new MTriangle6(vertices)); } } @@ -142,7 +144,7 @@ int GModel::readMESH(const std::string &name) sscanf(buffer, "%d %d %d %d %d", &n[0], &n[1], &n[2], &n[3], &cl); for(int j = 0; j < 4; j++) n[j]--; std::vector<MVertex*> vertices; - if(!getVertices(4, n, vertexVector, vertices)) return 0; + if(!getVertices(4, n, vertexVector, vertices)){ fclose(fp); return 0; } elements[2][cl].push_back(new MQuadrangle(vertices)); } } @@ -157,7 +159,7 @@ int GModel::readMESH(const std::string &name) sscanf(buffer, "%d %d %d %d %d", &n[0], &n[1], &n[2], &n[3], &cl); for(int j = 0; j < 4; j++) n[j]--; std::vector<MVertex*> vertices; - if(!getVertices(4, n, vertexVector, vertices)) return 0; + if(!getVertices(4, n, vertexVector, vertices)){ fclose(fp); return 0; } elements[3][cl].push_back(new MTetrahedron(vertices)); } } @@ -169,10 +171,11 @@ int GModel::readMESH(const std::string &name) for(int i = 0; i < nbe; i++) { if(!fgets(buffer, sizeof(buffer), fp)) break; int n[10], cl; - sscanf(buffer, "%d %d %d %d %d %d %d %d %d %d %d", &n[0], &n[1], &n[2], &n[3],&n[4], &n[5], &n[6], &n[7], &n[9], &n[8], &cl); + sscanf(buffer, "%d %d %d %d %d %d %d %d %d %d %d", &n[0], &n[1], &n[2], + &n[3],&n[4], &n[5], &n[6], &n[7], &n[9], &n[8], &cl); for(int j = 0; j < 10; j++) n[j]--; std::vector<MVertex*> vertices; - if(!getVertices(10, n, vertexVector, vertices)) return 0; + if(!getVertices(10, n, vertexVector, vertices)){ fclose(fp); return 0; } elements[3][cl].push_back(new MTetrahedron10(vertices)); } } @@ -188,7 +191,7 @@ int GModel::readMESH(const std::string &name) &n[4], &n[5], &n[6], &n[7], &cl); for(int j = 0; j < 8; j++) n[j]--; std::vector<MVertex*> vertices; - if(!getVertices(8, n, vertexVector, vertices)) return 0; + if(!getVertices(8, n, vertexVector, vertices)){ fclose(fp); return 0; } elements[4][cl].push_back(new MHexahedron(vertices)); } } diff --git a/Geo/GModelIO_MSH.cpp b/Geo/GModelIO_MSH.cpp index 4858d2d2dd85a82cb96c7af445441089731de670..369186b338ed29900da373702cf29051612c0585 100644 --- a/Geo/GModelIO_MSH.cpp +++ b/Geo/GModelIO_MSH.cpp @@ -113,9 +113,12 @@ int GModel::readMSH(const std::string &name) // $MeshFormat section if(!strncmp(&str[1], "MeshFormat", 10)) { - if(!fgets(str, sizeof(str), fp)) return 0; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return 0; } int format, size; - if(sscanf(str, "%lf %d %d", &version, &format, &size) != 3) return 0; + if(sscanf(str, "%lf %d %d", &version, &format, &size) != 3){ + fclose(fp); + return 0; + } if(version < 3.){ fclose(fp); return _readMSH2(name); @@ -124,7 +127,7 @@ int GModel::readMSH(const std::string &name) binary = true; Msg::Info("Mesh is in binary format"); int one; - if(fread(&one, sizeof(int), 1, fp) != 1) return 0; + if(fread(&one, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(one != 1){ swap = true; Msg::Info("Swapping bytes from binary file"); @@ -140,14 +143,14 @@ int GModel::readMSH(const std::string &name) // $PhysicalNames section else if(!strncmp(&str[1], "PhysicalNames", 13)) { - if(!fgets(str, sizeof(str), fp)) return 0; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return 0; } int numNames; - if(sscanf(str, "%d", &numNames) != 1) return 0; + if(sscanf(str, "%d", &numNames) != 1){ fclose(fp); return 0; } for(int i = 0; i < numNames; i++) { int dim, num; - if(fscanf(fp, "%d", &dim) != 1) return 0; - if(fscanf(fp, "%d", &num) != 1) return 0; - if(!fgets(str, sizeof(str), fp)) return 0; + if(fscanf(fp, "%d", &dim) != 1){ fclose(fp); return 0; } + if(fscanf(fp, "%d", &num) != 1){ fclose(fp); return 0; } + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return 0; } std::string name = ExtractDoubleQuotedString(str, 256); if(name.size()) setPhysicalName(name, dim, num); } @@ -155,16 +158,19 @@ int GModel::readMSH(const std::string &name) // $Entities section else if(!strncmp(&str[1], "Entities", 8)) { - if(!fgets(str, sizeof(str), fp)) return 0; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return 0; } int numEntities; - if(sscanf(str, "%d", &numEntities) != 1) return 0; + if(sscanf(str, "%d", &numEntities) != 1){ fclose(fp); return 0; } for(int i = 0; i < numEntities; i++) { int num, dim, numPhysicals; - if(fscanf(fp, "%d %d %d", &num, &dim, &numPhysicals) != 3) return 0; + if(fscanf(fp, "%d %d %d", &num, &dim, &numPhysicals) != 3){ + fclose(fp); + return 0; + } if(numPhysicals > 0){ std::vector<int> physicals(numPhysicals); for(int j = 0; j < numPhysicals; j++){ - if(fscanf(fp, "%d", &physicals[j]) != 1) return 0; + if(fscanf(fp, "%d", &physicals[j]) != 1){ fclose(fp); return 0; } } entities[dim][num] = physicals; } @@ -173,9 +179,9 @@ int GModel::readMSH(const std::string &name) // $Nodes section else if(!strncmp(&str[1], "Nodes", 5)) { - if(!fgets(str, sizeof(str), fp)) return 0; + if(!fgets(str, sizeof(str), fp)){ return 0; fclose(fp); } int numVertices; - if(sscanf(str, "%d", &numVertices) != 1) return 0; + if(sscanf(str, "%d", &numVertices) != 1){ fclose(fp); return 0; } Msg::Info("%d vertices", numVertices); Msg::ResetProgressMeter(); _vertexMapCache.clear(); @@ -189,14 +195,15 @@ int GModel::readMSH(const std::string &name) if(!binary){ if(fscanf(fp, "%d %lf %lf %lf %d", &num, &xyz[0], &xyz[1], &xyz[2], &entity) != 5) + fclose(fp); return 0; } else{ - if(fread(&num, sizeof(int), 1, fp) != 1) return 0; + if(fread(&num, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)&num, sizeof(int), 1); - if(fread(xyz, sizeof(double), 3, fp) != 3) return 0; + if(fread(xyz, sizeof(double), 3, fp) != 3){ fclose(fp); return 0; } if(swap) SwapBytes((char*)xyz, sizeof(double), 3); - if(fread(&entity, sizeof(int), 1, fp) != 1) return 0; + if(fread(&entity, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)&entity, sizeof(int), 1); } if(!entity){ @@ -204,10 +211,10 @@ int GModel::readMSH(const std::string &name) } else{ if(!binary){ - if(fscanf(fp, "%d", &entity) != 1) return 0; + if(fscanf(fp, "%d", &entity) != 1){ fclose(fp); return 0; } } else{ - if(fread(&dim, sizeof(int), 1, fp) != 1) return 0; + if(fread(&dim, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)&dim, sizeof(int), 1); } switch(dim){ @@ -223,10 +230,10 @@ int GModel::readMSH(const std::string &name) GEdge *ge = getEdgeByTag(entity); double u; if(!binary){ - if(fscanf(fp, "%lf", &u) != 1) return 0; + if(fscanf(fp, "%lf", &u) != 1){ fclose(fp); return 0; } } else{ - if(fread(&u, sizeof(double), 1, fp) != 1) return 0; + if(fread(&u, sizeof(double), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)&u, sizeof(double), 1); } vertex = new MEdgeVertex(xyz[0], xyz[1], xyz[2], ge, u, -1.0, num); @@ -237,10 +244,10 @@ int GModel::readMSH(const std::string &name) GFace *gf = getFaceByTag(entity); double uv[2]; if(!binary){ - if(fscanf(fp, "%lf %lf", &uv[0], &uv[1]) != 2) return 0; + if(fscanf(fp, "%lf %lf", &uv[0], &uv[1]) != 2){ fclose(fp); return 0; } } else{ - if(fread(uv, sizeof(double), 2, fp) != 2) return 0; + if(fread(uv, sizeof(double), 2, fp) != 2){ fclose(fp); return 0; } if(swap) SwapBytes((char*)uv, sizeof(double), 2); } vertex = new MFaceVertex(xyz[0], xyz[1], xyz[2], gf, uv[0], uv[1], num); @@ -251,10 +258,13 @@ int GModel::readMSH(const std::string &name) GRegion *gr = getRegionByTag(entity); double uvw[3]; if(!binary){ - if(fscanf(fp, "%lf %lf %lf", &uvw[0], &uvw[1], &uvw[2]) != 2) return 0; + if(fscanf(fp, "%lf %lf %lf", &uvw[0], &uvw[1], &uvw[2]) != 2){ + fclose(fp); + return 0; + } } else{ - if(fread(uvw, sizeof(double), 3, fp) != 3) return 0; + if(fread(uvw, sizeof(double), 3, fp) != 3){ fclose(fp); return 0; } if(swap) SwapBytes((char*)uvw, sizeof(double), 3); } vertex = new MVertex(xyz[0], xyz[1], xyz[2], gr, num); @@ -262,6 +272,7 @@ int GModel::readMSH(const std::string &name) break; default: Msg::Error("Wrong entity dimension for vertex %d", num); + fclose(fp); return 0; } } @@ -293,25 +304,28 @@ int GModel::readMSH(const std::string &name) // $Elements section else if(!strncmp(&str[1], "Elements", 8)) { - if(!fgets(str, sizeof(str), fp)) return 0; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return 0; } int numElements; - if(sscanf(str, "%d", &numElements) != 1) return 0; + if(sscanf(str, "%d", &numElements) != 1){ fclose(fp); return 0; } Msg::Info("%d elements", numElements); Msg::ResetProgressMeter(); _elementMapCache.clear(); for(int i = 0; i < numElements; i++) { int num, type, entity, numData; if(!binary){ - if(fscanf(fp, "%d %d %d %d", &num, &type, &entity, &numData) != 4) return 0; + if(fscanf(fp, "%d %d %d %d", &num, &type, &entity, &numData) != 4){ + fclose(fp); + return 0; + } } else{ - if(fread(&num, sizeof(int), 1, fp) != 1) return 0; + if(fread(&num, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)&num, sizeof(int), 1); - if(fread(&type, sizeof(int), 1, fp) != 1) return 0; + if(fread(&type, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)&type, sizeof(int), 1); - if(fread(&entity, sizeof(int), 1, fp) != 1) return 0; + if(fread(&entity, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)&entity, sizeof(int), 1); - if(fread(&numData, sizeof(int), 1, fp) != 1) return 0; + if(fread(&numData, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)&numData, sizeof(int), 1); } std::vector<int> data; @@ -319,17 +333,20 @@ int GModel::readMSH(const std::string &name) data.resize(numData); if(!binary){ for(int j = 0; j < numData; j++){ - if(fscanf(fp, "%d", &data[j]) != 1) return 0; + if(fscanf(fp, "%d", &data[j]) != 1){ fclose(fp); return 0; } } } else{ - if((int) fread(&data[0], sizeof(int), numData, fp) != numData) return 0; + if((int) fread(&data[0], sizeof(int), numData, fp) != numData){ + fclose(fp); + return 0; + } if(swap) SwapBytes((char*)&data[0], sizeof(int), numData); } } MElementFactory f; MElement *element = f.create(num, type, data, this); - if(!element) return 0; + if(!element){ fclose(fp); return 0; } switch(element->getType()){ case TYPE_PNT: elements[0][entity].push_back(element); break; case TYPE_LIN: elements[1][entity].push_back(element); break; diff --git a/Geo/GModelIO_MSH2.cpp b/Geo/GModelIO_MSH2.cpp index 3a7813cb6799bc9379b2b2b0c9e8d1071d62dd10..d3e1485d4bf2114c865e35f9100b21c26214df99 100644 --- a/Geo/GModelIO_MSH2.cpp +++ b/Geo/GModelIO_MSH2.cpp @@ -207,14 +207,17 @@ int GModel::_readMSH2(const std::string &name) if(!strncmp(&str[1], "MeshFormat", 10)) { - if(!fgets(str, sizeof(str), fp)) return 0; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return 0; } int format, size; - if(sscanf(str, "%lf %d %d", &version, &format, &size) != 3) return 0; + if(sscanf(str, "%lf %d %d", &version, &format, &size) != 3){ + fclose(fp); + return 0; + } if(format){ binary = true; Msg::Info("Mesh is in binary format"); int one; - if(fread(&one, sizeof(int), 1, fp) != 1) return 0; + if(fread(&one, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(one != 1){ swap = true; Msg::Info("Swapping bytes from binary file"); @@ -224,16 +227,16 @@ int GModel::_readMSH2(const std::string &name) } else if(!strncmp(&str[1], "PhysicalNames", 13)) { - if(!fgets(str, sizeof(str), fp)) return 0; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return 0; } int numNames; - if(sscanf(str, "%d", &numNames) != 1) return 0; + if(sscanf(str, "%d", &numNames) != 1){ fclose(fp); return 0; } for(int i = 0; i < numNames; i++) { int dim = -1, num; if(version > 2.0){ - if(fscanf(fp, "%d", &dim) != 1) return 0; + if(fscanf(fp, "%d", &dim) != 1){ fclose(fp); return 0; } } - if(fscanf(fp, "%d", &num) != 1) return 0; - if(!fgets(str, sizeof(str), fp)) return 0; + if(fscanf(fp, "%d", &num) != 1){ fclose(fp); return 0; } + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return 0; } std::string name = ExtractDoubleQuotedString(str, 256); if(name.size()) setPhysicalName(name, dim, num); } @@ -243,9 +246,9 @@ int GModel::_readMSH2(const std::string &name) !strncmp(&str[1], "ParametricNodes", 15)) { const bool parametric = !strncmp(&str[1], "ParametricNodes", 15); - if(!fgets(str, sizeof(str), fp)) return 0; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return 0; } int numVertices = -1; - if(sscanf(str, "%d", &numVertices) != 1) return 0; + if(sscanf(str, "%d", &numVertices) != 1){ fclose(fp); return 0; } Msg::Info("%d vertices", numVertices); Msg::ResetProgressMeter(); vertexVector.clear(); @@ -258,13 +261,15 @@ int GModel::_readMSH2(const std::string &name) MVertex *newVertex = 0; if (!parametric){ if(!binary){ - if (fscanf(fp, "%d %lf %lf %lf", &num, &xyz[0], &xyz[1], &xyz[2]) != 4) + if (fscanf(fp, "%d %lf %lf %lf", &num, &xyz[0], &xyz[1], &xyz[2]) != 4){ + fclose(fp); return 0; + } } else{ - if(fread(&num, sizeof(int), 1, fp) != 1) return 0; + if(fread(&num, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)&num, sizeof(int), 1); - if(fread(xyz, sizeof(double), 3, fp) != 3) return 0; + if(fread(xyz, sizeof(double), 3, fp) != 3){ fclose(fp); return 0; } if(swap) SwapBytes((char*)xyz, sizeof(double), 3); } newVertex = new MVertex(xyz[0], xyz[1], xyz[2], 0, num); @@ -273,17 +278,19 @@ int GModel::_readMSH2(const std::string &name) int iClasDim, iClasTag; if(!binary){ if (fscanf(fp, "%d %lf %lf %lf %d %d", &num, &xyz[0], &xyz[1], &xyz[2], - &iClasDim, &iClasTag) != 6) + &iClasDim, &iClasTag) != 6){ + fclose(fp); return 0; + } } else{ - if(fread(&num, sizeof(int), 1, fp) != 1) return 0; + if(fread(&num, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)&num, sizeof(int), 1); - if(fread(xyz, sizeof(double), 3, fp) != 3) return 0; + if(fread(xyz, sizeof(double), 3, fp) != 3){ fclose(fp); return 0; } if(swap) SwapBytes((char*)xyz, sizeof(double), 3); - if(fread(&iClasDim, sizeof(int), 1, fp) != 1) return 0; + if(fread(&iClasDim, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)&iClasDim, sizeof(int), 1); - if(fread(&iClasTag, sizeof(int), 1, fp) != 1) return 0; + if(fread(&iClasTag, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)&iClasTag, sizeof(int), 1); } if (iClasDim == 0){ @@ -294,10 +301,10 @@ int GModel::_readMSH2(const std::string &name) else if (iClasDim == 1){ GEdge *ge = getEdgeByTag(iClasTag); if(!binary){ - if (fscanf(fp, "%lf", &uv[0]) != 1) return 0; + if (fscanf(fp, "%lf", &uv[0]) != 1){ fclose(fp); return 0; } } else{ - if(fread(uv, sizeof(double), 1, fp) != 1) return 0; + if(fread(uv, sizeof(double), 1, fp) != 1){ fclose(fp); return 0; } if(swap) SwapBytes((char*)uv, sizeof(double), 1); } newVertex = new MEdgeVertex(xyz[0], xyz[1], xyz[2], ge, uv[0], -1.0, num); @@ -305,10 +312,10 @@ int GModel::_readMSH2(const std::string &name) else if (iClasDim == 2){ GFace *gf = getFaceByTag(iClasTag); if(!binary){ - if (fscanf(fp, "%lf %lf", &uv[0], &uv[1]) != 2) return 0; + if (fscanf(fp, "%lf %lf", &uv[0], &uv[1]) != 2){ fclose(fp); return 0; } } else{ - if(fread(uv, sizeof(double), 2, fp) != 2) return 0; + if(fread(uv, sizeof(double), 2, fp) != 2){ fclose(fp); return 0; } if(swap) SwapBytes((char*)uv, sizeof(double), 2); } newVertex = new MFaceVertex(xyz[0], xyz[1], xyz[2], gf, uv[0], uv[1], num); @@ -346,7 +353,7 @@ int GModel::_readMSH2(const std::string &name) } else if(!strncmp(&str[1], "ELM", 3) || !strncmp(&str[1], "Elements", 8)) { - if(!fgets(str, sizeof(str), fp)) return 0; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return 0; } int numElements; std::map<int, MElement*> elems; @@ -366,17 +373,19 @@ int GModel::_readMSH2(const std::string &name) std::vector<short> ghosts; if(version <= 1.0){ if(fscanf(fp, "%d %d %d %d %d", &num, &type, &physical, &elementary, - &numVertices) != 5) + &numVertices) != 5){ + fclose(fp); return 0; - if(numVertices != MElement::getInfoMSH(type)) return 0; + } + if(numVertices != MElement::getInfoMSH(type)){ fclose(fp); return 0; } } else{ int numTags; - if(fscanf(fp, "%d %d %d", &num, &type, &numTags) != 3) return 0; + if(fscanf(fp, "%d %d %d", &num, &type, &numTags) != 3){ fclose(fp); return 0; } int numPartitions = 0; for(int j = 0; j < numTags; j++){ int tag; - if(fscanf(fp, "%d", &tag) != 1) return 0; + if(fscanf(fp, "%d", &tag) != 1){ fclose(fp); return 0; } if(j == 0) physical = tag; else if(j == 1) elementary = tag; else if(version < 2.2 && j == 2) partition = tag; @@ -387,26 +396,32 @@ int GModel::_readMSH2(const std::string &name) parent = tag; else if(j == 3 + numPartitions && (numTags == 5 + numPartitions)) { dom1 = tag; j++; - if(fscanf(fp, "%d", &dom2) != 1) return 0; + if(fscanf(fp, "%d", &dom2) != 1){ fclose(fp); return 0; } } } if(!(numVertices = MElement::getInfoMSH(type))) { - if(type != MSH_POLYG_ && type != MSH_POLYH_ && type != MSH_POLYG_B) + if(type != MSH_POLYG_ && type != MSH_POLYH_ && type != MSH_POLYG_B){ + fclose(fp); return 0; - if(fscanf(fp, "%d", &numVertices) != 1) return 0; + } + if(fscanf(fp, "%d", &numVertices) != 1){ fclose(fp); return 0; } } } int *indices = new int[numVertices]; for(int j = 0; j < numVertices; j++) - if(fscanf(fp, "%d", &indices[j]) != 1) return 0; + if(fscanf(fp, "%d", &indices[j]) != 1){ fclose(fp); return 0; } std::vector<MVertex*> vertices; if(vertexVector.size()){ - if(!getVertices(numVertices, indices, vertexVector, vertices, minVertex)) + if(!getVertices(numVertices, indices, vertexVector, vertices, minVertex)){ + fclose(fp); return 0; + } } else{ - if(!getVertices(numVertices, indices, vertexMap, vertices)) + if(!getVertices(numVertices, indices, vertexMap, vertices)){ + fclose(fp); return 0; + } } MElement *p = NULL; bool own = false; @@ -493,7 +508,7 @@ int GModel::_readMSH2(const std::string &name) int numElementsPartial = 0; while(numElementsPartial < numElements){ int header[3]; - if(fread(header, sizeof(int), 3, fp) != 3) return 0; + if(fread(header, sizeof(int), 3, fp) != 3){ fclose(fp); return 0; } if(swap) SwapBytes((char*)header, sizeof(int), 3); int type = header[0]; int numElms = header[1]; @@ -502,7 +517,7 @@ int GModel::_readMSH2(const std::string &name) unsigned int n = 1 + numTags + numVertices; int *data = new int[n]; for(int i = 0; i < numElms; i++) { - if(fread(data, sizeof(int), n, fp) != n) return 0; + if(fread(data, sizeof(int), n, fp) != n){ fclose(fp); return 0; } if(swap) SwapBytes((char*)data, sizeof(int), n); int num = data[0]; int physical = (numTags > 0) ? data[1] : 0; @@ -517,12 +532,16 @@ int GModel::_readMSH2(const std::string &name) int *indices = &data[numTags + 1]; std::vector<MVertex*> vertices; if(vertexVector.size()){ - if(!getVertices(numVertices, indices, vertexVector, vertices, minVertex)) + if(!getVertices(numVertices, indices, vertexVector, vertices, minVertex)){ + fclose(fp); return 0; + } } else{ - if(!getVertices(numVertices, indices, vertexMap, vertices)) + if(!getVertices(numVertices, indices, vertexMap, vertices)){ + fclose(fp); return 0; + } } MElement *p = NULL; bool own = false; @@ -605,7 +624,8 @@ int GModel::_readMSH2(const std::string &name) case TYPE_POLYH : elements[9][reg].push_back(e); break; default : Msg::Error("Wrong type of element"); - return false; + fclose(fp); + return 0; } } } diff --git a/Geo/GModelIO_P3D.cpp b/Geo/GModelIO_P3D.cpp index e25fed23633a32ed3edc372c69022381626f1917..eaa2947ea3da2012675b783c8071f767354d55dd 100644 --- a/Geo/GModelIO_P3D.cpp +++ b/Geo/GModelIO_P3D.cpp @@ -18,11 +18,11 @@ int GModel::readP3D(const std::string &name) } int numBlocks = 0; - if(fscanf(fp, "%d", &numBlocks) != 1 || numBlocks <= 0) return 0; + if(fscanf(fp, "%d", &numBlocks) != 1 || numBlocks <= 0){ fclose(fp); return 0; } std::vector<int> Ni(numBlocks), Nj(numBlocks), Nk(numBlocks); for(int n = 0; n < numBlocks; n++) - if(fscanf(fp, "%d %d %d", &Ni[n], &Nj[n], &Nk[n]) != 3) return 0; + if(fscanf(fp, "%d %d %d", &Ni[n], &Nj[n], &Nk[n]) != 3){ fclose(fp); return 0; } for(int n = 0; n < numBlocks; n++){ if(Nk[n] == 1){ @@ -35,7 +35,7 @@ int GModel::readP3D(const std::string &name) for(int j = 0; j < Nj[n]; j++){ for(int i = 0; i < Ni[n]; i++){ double d; - if(fscanf(fp, "%lf", &d) != 1) return 0; + if(fscanf(fp, "%lf", &d) != 1){ fclose(fp); return 0; } if(coord == 0){ MVertex *v = new MVertex(d, 0., 0., gf); gf->transfinite_vertices[i][j] = v; @@ -73,7 +73,7 @@ int GModel::readP3D(const std::string &name) for(int j = 0; j < Nj[n]; j++){ for(int i = 0; i < Ni[n]; i++){ double d; - if(fscanf(fp, "%lf", &d) != 1) return 0; + if(fscanf(fp, "%lf", &d) != 1){ fclose(fp); return 0; } if(coord == 0){ MVertex *v = new MVertex(d, 0., 0., gr); gr->transfinite_vertices[i][j][k] = v; diff --git a/Geo/GModelIO_PLY.cpp b/Geo/GModelIO_PLY.cpp index 8702f549c42f3bcdcfcd5b9c452205f24af3dadc..b172b0fd5aa08d0bc1fa1268bb10c504f00372d8 100644 --- a/Geo/GModelIO_PLY.cpp +++ b/Geo/GModelIO_PLY.cpp @@ -83,6 +83,7 @@ int GModel::readPLY(const std::string &name) } if(!strcmp(str, "format") && strcmp(str2, "ascii")){ Msg::Error("Only reading of ascii PLY files implemented"); + fclose(fp); return 0; } if(!strcmp(str, "property") && strcmp(str2, "list")){ @@ -103,7 +104,7 @@ int GModel::readPLY(const std::string &name) for(int i = 0; i < nbv; i++) { double x,y,z; char line[10000], *pEnd, *pEnd2, *pEnd3; - if(!fgets(line, sizeof(line), fp)) return 0; + if(!fgets(line, sizeof(line), fp)){ fclose(fp); return 0; } x = strtod(line, &pEnd); y = strtod(pEnd, &pEnd2); z = strtod(pEnd2, &pEnd3); @@ -123,7 +124,7 @@ int GModel::readPLY(const std::string &name) int n[3], nbe; sscanf(buffer, "%d %d %d %d", &nbe, &n[0], &n[1], &n[2]); std::vector<MVertex*> vertices; - if(!getVertices(3, n, vertexVector, vertices)) return 0; + if(!getVertices(3, n, vertexVector, vertices)){ fclose(fp); return 0; } elements[0][elementary].push_back(new MTriangle(vertices)); } @@ -158,7 +159,7 @@ int GModel::readPLY(const std::string &name) n[0] = e->getVertex(0)->getNum()-1; n[1] = e->getVertex(1)->getNum()-1; n[2] = e->getVertex(2)->getNum()-1; - if(!getProperties(3, n, properties[iV], props)) return 0; + if(!getProperties(3, n, properties[iV], props)){ fclose(fp); return 0; } for(int nod = 0; nod < numNodes; nod++) out->push_back(props[nod]); } } @@ -222,7 +223,7 @@ int GModel::readPLY2(const std::string &name) sscanf(buffer, "%d", &n[2]); } std::vector<MVertex*> vertices; - if(!getVertices(3, n, vertexVector, vertices)) return 0; + if(!getVertices(3, n, vertexVector, vertices)){ fclose(fp); return 0; } elements[0][elementary].push_back(new MTriangle(vertices)); } } diff --git a/Geo/GModelIO_POS.cpp b/Geo/GModelIO_POS.cpp index ff69ea80a1d72d873d37b0dec681a53676726180..e58e1ff2fac5d2498b323911e3304b938aea59f9 100644 --- a/Geo/GModelIO_POS.cpp +++ b/Geo/GModelIO_POS.cpp @@ -65,7 +65,7 @@ int GModel::writePOS(const std::string &name, bool printElementary, names += "\"Disto\""; } - if(names.empty()) return 0; + if(names.empty()){ fclose(fp); return 0; } if(noPhysicalGroups()) saveAll = true; diff --git a/Geo/GModelIO_STL.cpp b/Geo/GModelIO_STL.cpp index 44b3fe740288015fc9e2a7f0c38e9333aa99a4c2..4a7fb22430ce736362bfe954036de859d29ca6c7 100644 --- a/Geo/GModelIO_STL.cpp +++ b/Geo/GModelIO_STL.cpp @@ -26,7 +26,7 @@ int GModel::readSTL(const std::string &name, double tolerance) // "solid", or binary data header char buffer[256]; - if(!fgets(buffer, sizeof(buffer), fp)) return 0; + if(!fgets(buffer, sizeof(buffer), fp)){ fclose(fp); return 0; } bool binary = strncmp(buffer, "solid", 5); @@ -117,11 +117,13 @@ int GModel::readSTL(const std::string &name, double tolerance) for(unsigned int i = 0; i < points.size(); i++){ if(points[i].empty()){ Msg::Error("No facets found in STL file for solid %d", i); + fclose(fp); return 0; } if(points[i].size() % 3){ Msg::Error("Wrong number of points (%d) in STL file for solid %d", points[i].size(), i); + fclose(fp); return 0; } Msg::Info("%d facets in solid %d", points[i].size() / 3, i); diff --git a/Geo/GModelIO_UNV.cpp b/Geo/GModelIO_UNV.cpp index 0de32550cfdfd0abbdbc46125af5de199bb89811..4b062a4a9b8c1c01cb4d9e0e40c6f937bfa25672 100644 --- a/Geo/GModelIO_UNV.cpp +++ b/Geo/GModelIO_UNV.cpp @@ -76,10 +76,11 @@ int GModel::readUNV(const std::string &name) std::vector<MVertex*> vertices(numNodes); for(int i = 0; i < numNodes; i++){ int n; - if(!fscanf(fp, "%d", &n)) return 0; + if(!fscanf(fp, "%d", &n)){ fclose(fp); return 0; } vertices[i] = getMeshVertexByTag(n); if(!vertices[i]){ Msg::Error("Wrong vertex index %d", n); + fclose(fp); return 0; } } diff --git a/Geo/GModelIO_VTK.cpp b/Geo/GModelIO_VTK.cpp index 2d1b9f1324e60d6c49065968e4ce7d55c3c55723..d4f1c096aa63b9242d6250aaa8c32f144c25119a 100644 --- a/Geo/GModelIO_VTK.cpp +++ b/Geo/GModelIO_VTK.cpp @@ -107,15 +107,15 @@ int GModel::readVTK(const std::string &name, bool bigEndian) char buffer[256], buffer2[256]; std::map<int, std::map<int, std::string> > physicals[4]; - if(!fgets(buffer, sizeof(buffer), fp)) return 0; // version line - if(!fgets(buffer, sizeof(buffer), fp)) return 0; // title + if(!fgets(buffer, sizeof(buffer), fp)){ fclose(fp); return 0; } // version line + if(!fgets(buffer, sizeof(buffer), fp)){ fclose(fp); return 0; } // title if(fscanf(fp, "%s", buffer) != 1) // ASCII or BINARY Msg::Error("Failed reading buffer"); bool binary = false; if(!strcmp(buffer, "BINARY")) binary = true; - if(fscanf(fp, "%s %s", buffer, buffer2) != 2) return 0; + if(fscanf(fp, "%s %s", buffer, buffer2) != 2){ fclose(fp); return 0; } bool unstructured = false; if(!strcmp(buffer, "DATASET") && !strcmp(buffer2, "UNSTRUCTURED_GRID")) @@ -124,6 +124,7 @@ int GModel::readVTK(const std::string &name, bool bigEndian) if((strcmp(buffer, "DATASET") && strcmp(buffer2, "UNSTRUCTURED_GRID")) || (strcmp(buffer, "DATASET") && strcmp(buffer2, "POLYDATA"))){ Msg::Error("VTK reader can only read unstructured or polydata datasets"); + fclose(fp); return 0; } @@ -132,6 +133,7 @@ int GModel::readVTK(const std::string &name, bool bigEndian) if(fscanf(fp, "%s %d %s\n", buffer, &numVertices, buffer2) != 3) return 0; if(strcmp(buffer, "POINTS") || !numVertices){ Msg::Warning("No points in dataset"); + fclose(fp); return 0; } int datasize; @@ -141,6 +143,7 @@ int GModel::readVTK(const std::string &name, bool bigEndian) datasize = sizeof(float); else{ Msg::Warning("VTK reader only accepts float or double datasets"); + fclose(fp); return 0; } Msg::Info("Reading %d points", numVertices); @@ -150,24 +153,30 @@ int GModel::readVTK(const std::string &name, bool bigEndian) if(binary){ if(datasize == sizeof(float)){ float f[3]; - if(fread(f, sizeof(float), 3, fp) != 3) return 0; + if(fread(f, sizeof(float), 3, fp) != 3){ fclose(fp); return 0; } if(!bigEndian) SwapBytes((char*)f, sizeof(float), 3); for(int j = 0; j < 3; j++) xyz[j] = f[j]; } else{ - if(fread(xyz, sizeof(double), 3, fp) != 3) return 0; + if(fread(xyz, sizeof(double), 3, fp) != 3){ fclose(fp); return 0; } if(!bigEndian) SwapBytes((char*)xyz, sizeof(double), 3); } } else{ - if(fscanf(fp, "%lf %lf %lf", &xyz[0], &xyz[1], &xyz[2]) != 3) return 0; + if(fscanf(fp, "%lf %lf %lf", &xyz[0], &xyz[1], &xyz[2]) != 3){ + fclose(fp); + return 0; + } } vertices[i] = new MVertex(xyz[0], xyz[1], xyz[2]); } // read mesh elements int numElements, totalNumInt; - if(fscanf(fp, "%s %d %d\n", buffer, &numElements, &totalNumInt) != 3) return 0; + if(fscanf(fp, "%s %d %d\n", buffer, &numElements, &totalNumInt) != 3){ + fclose(fp); + return 0; + } bool haveCells = true; bool haveLines = false; @@ -182,6 +191,7 @@ int GModel::readVTK(const std::string &name, bool bigEndian) } else{ Msg::Warning("No cells or polygons in dataset"); + fclose(fp); return 0; } @@ -192,15 +202,15 @@ int GModel::readVTK(const std::string &name, bool bigEndian) for(unsigned int i = 0; i < cells.size(); i++){ int numVerts, n[100]; if(binary){ - if(fread(&numVerts, sizeof(int), 1, fp) != 1) return 0; + if(fread(&numVerts, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(!bigEndian) SwapBytes((char*)&numVerts, sizeof(int), 1); - if((int)fread(n, sizeof(int), numVerts, fp) != numVerts) return 0; + if((int)fread(n, sizeof(int), numVerts, fp) != numVerts){ fclose(fp); return 0; } if(!bigEndian) SwapBytes((char*)n, sizeof(int), numVerts); } else{ - if(fscanf(fp, "%d", &numVerts) != 1) return 0; + if(fscanf(fp, "%d", &numVerts) != 1){ fclose(fp); return 0; } for(int j = 0; j < numVerts; j++){ - if(fscanf(fp, "%d", &n[j]) != 1) return 0; + if(fscanf(fp, "%d", &n[j]) != 1){ fclose(fp); return 0; } } } for(int j = 0; j < numVerts; j++){ @@ -212,19 +222,20 @@ int GModel::readVTK(const std::string &name, bool bigEndian) } if (unstructured){ - if(fscanf(fp, "%s %d\n", buffer, &numElements) != 2 ) return 0; + if(fscanf(fp, "%s %d\n", buffer, &numElements) != 2 ){ fclose(fp); return 0; } if(strcmp(buffer, "CELL_TYPES") || numElements != (int)cells.size()){ Msg::Error("No or invalid number of cells types"); + fclose(fp); return 0; } for(unsigned int i = 0; i < cells.size(); i++){ int type; if(binary){ - if(fread(&type, sizeof(int), 1, fp) != 1) return 0; + if(fread(&type, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(!bigEndian) SwapBytes((char*)&type, sizeof(int), 1); } else{ - if(fscanf(fp, "%d", &type) != 1) return 0; + if(fscanf(fp, "%d", &type) != 1){ fclose(fp); return 0; } } switch(type){ case 1: elements[0][1].push_back(new MPoint(cells[i])); break; @@ -263,7 +274,7 @@ int GModel::readVTK(const std::string &name, bool bigEndian) int iLine = 1; for (int k= 0; k < numElements; k++){ physicals[1][iLine][1] = "centerline"; - if(!fgets(line, sizeof(line), fp)) return 0; + if(!fgets(line, sizeof(line), fp)){ fclose(fp); return 0; } v0 = (int)strtol(line, &pEnd, 10); //ignore first line v0 = (int)strtol(pEnd, &pEnd2, 10); p=pEnd2; diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp index 0529281a0ce9675453147f8e6a52d45518a6ab2b..a615b2a7248ba6726aab6197e44fc9de567001be 100644 --- a/Geo/Geo.cpp +++ b/Geo/Geo.cpp @@ -2508,11 +2508,13 @@ int Extrude_ProtudeSurface(int type, int is, for(i = 0; i < List_Nbr(chapeau->Generatrices); i++) { List_Read(ps->Generatrices, i, &c2); List_Read(chapeau->Generatrices, i, &c); - if(c->Num < 0) - if(!(c = FindCurve(-c->Num))) { - Msg::Error("Unknown curve %d", -c->Num); + if(c->Num < 0){ + int nn = -c->Num; + if(!(c = FindCurve(nn))) { + Msg::Error("Unknown curve %d", nn); return ps->Num; } + } c->Extrude = new ExtrudeParams(COPIED_ENTITY); c->Extrude->fill(type, T0, T1, T2, A0, A1, A2, X0, X1, X2, alpha); // don't take the abs(): the sign of c2->Num is important (used diff --git a/Geo/MSubElement.cpp b/Geo/MSubElement.cpp index 5c26f71ada6c83a8feb2a55fe8a2c1d693d2071a..1652cf8a80aa06f09b977b14952a96228c475b70 100644 --- a/Geo/MSubElement.cpp +++ b/Geo/MSubElement.cpp @@ -235,7 +235,7 @@ void MSubTriangle::getGradShapeFunctions(double u, double v, double w, double s[ return _orig->getGradShapeFunctions(u, v, w, s, order); int nsf = getNumShapeFunctions(); - double gradsuvw[nsf][3]; + double gradsuvw[1256][3]; _orig->getGradShapeFunctions(u, v, w, gradsuvw, order); // work in the parametric space of the parent element @@ -473,7 +473,7 @@ void MSubLine::getGradShapeFunctions(double u, double v, double w, double s[][3] return _orig->getGradShapeFunctions(u, v, w, s, order); int nsf = _orig->getNumShapeFunctions(); - double gradsuvw[nsf][3]; + double gradsuvw[1256][3]; _orig->getGradShapeFunctions(u, v, w, gradsuvw, order); double jac[3][3]; diff --git a/Graphics/gl2gif.cpp b/Graphics/gl2gif.cpp index 4242c4cd956bc9416005061940c6c68b5b132a80..b3b724106f3c23b139d4a24d56e49e2be4326d60 100644 --- a/Graphics/gl2gif.cpp +++ b/Graphics/gl2gif.cpp @@ -3,11 +3,11 @@ // See the LICENSE.txt file for license information. Please report all // bugs and problems to the public mailing list <gmsh@geuz.org>. -/* +/* * Warning: This code is really a dirty hack. It SHOULD be cleaned * (and most of all, all the static variables should be removed). * - * It is based on + * It is based on * * - libppm3.c - ppm utility library part 3 * - ppmquant.c - quantize the colors in a pixmap down to a specified number @@ -21,7 +21,7 @@ * documentation. This software is provided "as is" without express or * implied warranty. * - * and + * and * * - ppmtogif.c - read a portable pixmap and produce a GIF file * @@ -552,6 +552,7 @@ static colorhist_vector mediancut(colorhist_vector chv, int colors, /* * All done. */ + free(bv); return colormap; } @@ -819,7 +820,7 @@ static void output(code_int code) /* - * compress + * compress * * Algorithm: use open addressing double hashing (no chaining) on the * prefix code / next character combination. We do a variant of Knuth's diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index 93087bd9cd21654fc7e75a25a9f67770bab3125b..cf18547702e5f814f81f22344a8890bda8927ca0 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -415,7 +415,10 @@ static void PrintMesh2dStatistics(GModel *m) fprintf(statreport, "2D stats\tname\t\t#faces\t\t#fail\t\t" "#t\t\tQavg\t\tQbest\t\tQworst\t\t#Q>90\t\t#Q>90/#t\t" "#e\t\ttau\t\t#Egood\t\t#Egood/#e\tCPU\n"); - if(m->empty()) return; + if(m->empty()){ + fclose(statreport); + return; + } } for(GModel::fiter it = m->firstFace() ; it != m->lastFace(); ++it){ diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp index 91ed501fe14235093c4c9bc4843a194f90c8c034..b13b22125f84c0c067a66bb157ef5e6d7fef3bd1 100644 --- a/Mesh/meshGFace.cpp +++ b/Mesh/meshGFace.cpp @@ -1027,19 +1027,19 @@ bool meshGenerator(GFace *gf, int RECUR_ITER, remeshUnrecoveredEdges(recoverMapInv, edgesNotRecovered, facesToRemesh); else{ std::set<EdgeToRecover>::iterator itr = edgesNotRecovered.begin(); - int *_error = new int[3 * edgesNotRecovered.size()]; + //int *_error = new int[3 * edgesNotRecovered.size()]; int I = 0; for(; itr != edgesNotRecovered.end(); ++itr){ int p1 = itr->p1; int p2 = itr->p2; int tag = itr->ge->tag(); - printf("%d %d %d\n",p1,p2,tag); - _error[3 * I + 0] = p1; - _error[3 * I + 1] = p2; - _error[3 * I + 2] = tag; + Msg::Error("Edge not recovered: %d %d %d", p1, p2, tag); + //_error[3 * I + 0] = p1; + //_error[3 * I + 1] = p2; + //_error[3 * I + 2] = tag; I++; } - throw _error; + //throw _error; } // delete the mesh diff --git a/Mesh/meshGFaceOptimize.cpp b/Mesh/meshGFaceOptimize.cpp index b4a929d09091832abdc7b730fcb2fcb247d4e957..6b03bb95c70a686d8f6883c2a6dbceab84afc976 100644 --- a/Mesh/meshGFaceOptimize.cpp +++ b/Mesh/meshGFaceOptimize.cpp @@ -935,6 +935,7 @@ void createRegularMesh (GFace *gf, (p34.x() && p34.y() == -1.0) || (p41.x() && p41.y() == -1.0)) { Msg::Error("Wrong param -1"); + fclose(f3); return; } diff --git a/Numeric/pointsGenerators.cpp b/Numeric/pointsGenerators.cpp index 2c36b2adf081f07a9ba4a68db2f145be0c8ac46d..6c3db2a1a7be8300fbde5c54a65230da324fdd82 100644 --- a/Numeric/pointsGenerators.cpp +++ b/Numeric/pointsGenerators.cpp @@ -607,10 +607,10 @@ fullMatrix<double> gmshGeneratePointsPrism(int order, bool serendip) fullMatrix<double> gmshGeneratePointsPyramid(int order, bool serendip) { int nbPoints = (order+1)*((order+1)+1)*(2*(order+1)+1)/6; - + // Remove volume points if incomplete basis if (serendip && order > 2) nbPoints -= (order-2)*((order-2)+1)*(2*(order-2)+1)/6; - + fullMatrix<double> points(nbPoints, 3); static const int edges[8][2] = { @@ -630,13 +630,13 @@ fullMatrix<double> gmshGeneratePointsPyramid(int order, bool serendip) {2, 3, 4, -1}, {0, 3, 2, 1} }; - + if (order == 0) { points(0,0) = 0.0; points(0,1) = 0.0; points(0,2) = 0.0; return points; - } + } // Principal vertices of the pyramid points(0,0) = -1.0; points(0,1) = -1.0; points(0,2) = 0.0; @@ -653,7 +653,7 @@ fullMatrix<double> gmshGeneratePointsPyramid(int order, bool serendip) double vec[3]; vec[0] = points(edges[e][1],0) - points(edges[e][0],0); vec[1] = points(edges[e][1],1) - points(edges[e][0],1); - vec[2] = points(edges[e][1],2) - points(edges[e][0],2); + vec[2] = points(edges[e][1],2) - points(edges[e][0],2); for (int i = 0; i < order - 1; i++) { points(p,0) = points(edges[e][0],0) + vec[0]/order * (i+1); points(p,1) = points(edges[e][0],1) + vec[1]/order * (i+1); @@ -727,7 +727,7 @@ fullMatrix<double> gmshGeneratePointsPyramid(int order, bool serendip) for(int k = 3*order; k < fp.size1(); k++) { fullVector<double> pnt(4); pnt(0) = fp(k,0); - pnt(1) = fp(k,1); + pnt(1) = fp(k,1); pnt(2) = 0.0; pnt(3) = 1.0; @@ -758,7 +758,7 @@ fullMatrix<double> gmshGeneratePointsPyramid(int order, bool serendip) } // Volume - if (!serendip and order > 2) { + if (!serendip && order > 2) { fullMatrix<double> volume_points = gmshGeneratePointsPyramid(order - 3, false); // scale to order-3/order fullMatrix<double> T(3,3); diff --git a/Plugin/Crack.cpp b/Plugin/Crack.cpp index ed4f2a200174fc9dd99c3a08557fb6ea8268f9c2..f24fcfc8aa1ef6e5267b4ff71947e83456517f44 100644 --- a/Plugin/Crack.cpp +++ b/Plugin/Crack.cpp @@ -122,7 +122,7 @@ PView *GMSH_CrackPlugin::execute(PView *view) bnd.erase(ed); } } - for(std::set<EdgeData>::iterator it = bnd.begin(); it != bnd.end(); it++) + for(std::set<EdgeData, Less_EdgeData>::iterator it = bnd.begin(); it != bnd.end(); it++) bndVertices.insert(it->data.begin(), it->data.end()); } for(std::set<MVertex*>::iterator it = bndVertices.begin(); diff --git a/Plugin/MakeSimplex.cpp b/Plugin/MakeSimplex.cpp index 5e31716e5effb95df3c2c0e1aa4e7174e3c9672d..c1c55154468323bccfd632cb111b4edadda3a135 100644 --- a/Plugin/MakeSimplex.cpp +++ b/Plugin/MakeSimplex.cpp @@ -37,22 +37,21 @@ StringXNumber *GMSH_MakeSimplexPlugin::getOption(int iopt) } static void decomposeList(PViewDataList *data, int nbNod, int nbComp, - std::vector<double> &listIn, int *nbIn, + std::vector<double> &listIn, int *nbIn, std::vector<double> &listOut, int *nbOut) { + if(!(*nbIn)) return; + double xNew[4], yNew[4], zNew[4]; double *valNew = new double[data->getNumTimeSteps() * nbComp * nbNod]; MakeSimplex dec(nbNod, nbComp, data->getNumTimeSteps()); - if(!(*nbIn)) - return; - int nb = listIn.size() / (*nbIn); for(unsigned int i = 0; i < listIn.size(); i += nb){ double *x = &listIn[i]; double *y = &listIn[i + nbNod]; double *z = &listIn[i + 2 * nbNod]; - double *val = &listIn[i + 3 * nbNod]; + double *val = &listIn[i + 3 * nbNod]; for(int j = 0; j < dec.numSimplices(); j++){ dec.decompose(j, x, y, z, val, xNew, yNew, zNew, valNew); for(int k = 0; k < dec.numSimplexNodes(); k++) @@ -87,18 +86,18 @@ PView *GMSH_MakeSimplexPlugin::execute(PView *v) decomposeList(data1, 4, 1, data1->SQ, &data1->NbSQ, data1->ST, &data1->NbST); decomposeList(data1, 4, 3, data1->VQ, &data1->NbVQ, data1->VT, &data1->NbVT); decomposeList(data1, 4, 9, data1->TQ, &data1->NbTQ, data1->TT, &data1->NbTT); - - // hexas + + // hexas decomposeList(data1, 8, 1, data1->SH, &data1->NbSH, data1->SS, &data1->NbSS); decomposeList(data1, 8, 3, data1->VH, &data1->NbVH, data1->VS, &data1->NbVS); decomposeList(data1, 8, 9, data1->TH, &data1->NbTH, data1->TS, &data1->NbTS); - - // prisms + + // prisms decomposeList(data1, 6, 1, data1->SI, &data1->NbSI, data1->SS, &data1->NbSS); decomposeList(data1, 6, 3, data1->VI, &data1->NbVI, data1->VS, &data1->NbVS); decomposeList(data1, 6, 9, data1->TI, &data1->NbTI, data1->TS, &data1->NbTS); - - // pyramids + + // pyramids decomposeList(data1, 5, 1, data1->SY, &data1->NbSY, data1->SS, &data1->NbSS); decomposeList(data1, 5, 3, data1->VY, &data1->NbVY, data1->VS, &data1->NbVS); decomposeList(data1, 5, 9, data1->TY, &data1->NbTY, data1->TS, &data1->NbTS); @@ -109,12 +108,12 @@ PView *GMSH_MakeSimplexPlugin::execute(PView *v) return v1; } -// Utility class +// Utility class MakeSimplex::MakeSimplex(int numNodes, int numComponents, int numTimeSteps) - : _numNodes(numNodes), _numComponents(numComponents), _numTimeSteps(numTimeSteps) + : _numNodes(numNodes), _numComponents(numComponents), _numTimeSteps(numTimeSteps) { - ; + ; } int MakeSimplex::numSimplices() @@ -150,12 +149,12 @@ void MakeSimplex::reorder(int map[4], int n, for(int ts = 0; ts < _numTimeSteps; ts++) for(int i = 0; i < n; i++) { for(int j = 0; j < _numComponents; j++) - valn[ts*n*_numComponents + i*_numComponents + j] = + valn[ts*n*_numComponents + i*_numComponents + j] = val[ts*_numNodes*_numComponents + map2[i]*_numComponents + j]; } } -void MakeSimplex::decompose(int num, +void MakeSimplex::decompose(int num, double *x, double *y, double *z, double *val, double *xn, double *yn, double *zn, double *valn) { @@ -168,7 +167,7 @@ void MakeSimplex::decompose(int num, Msg::Error("Invalid decomposition"); num = 0; } - + switch(_numNodes) { case 4: reorder(quadTri[num], 3, x, y, z, val, xn, yn, zn, valn); break ; case 8: reorder(hexaTet[num], 4, x, y, z, val, xn, yn, zn, valn); break ; diff --git a/Post/PViewDataGModelIO.cpp b/Post/PViewDataGModelIO.cpp index 537f72695ff8affd125a03778db1705a7f32034d..d177ce0c7b6dde99684a0a9415a5c43870855925 100644 --- a/Post/PViewDataGModelIO.cpp +++ b/Post/PViewDataGModelIO.cpp @@ -217,6 +217,7 @@ bool PViewDataGModel::writeMSH(const std::string &fileName, double version, bool MVertex *v = _steps[step]->getModel()->getMeshVertexByTag(i); if(!v){ Msg::Error("Unknown vertex %d in data", i); + fclose(fp); return false; } int num = v->getIndex(); @@ -252,6 +253,7 @@ bool PViewDataGModel::writeMSH(const std::string &fileName, double version, bool MElement *e = model->getMeshElementByTag(i); if(!e){ Msg::Error("Unknown element %d in data", i); + fclose(fp); return false; } int mult = _steps[step]->getMult(i); @@ -717,8 +719,8 @@ bool PViewDataGModel::writeMED(const std::string &fileName) // save the mesh if(!model->writeMED(fileName, true)) return false; - char *meshName = (char*)model->getName().c_str(); - char *fieldName = (char*)getName().c_str(); + std::string meshName(model->getName()); + std::string fieldName(getName()); med_idt fid = MEDouvrir((char*)fileName.c_str(), MED_LECTURE_AJOUT); if(fid < 0){ @@ -757,10 +759,11 @@ bool PViewDataGModel::writeMED(const std::string &fileName) int numComp = _steps[0]->getNumComponents(); #if (MED_MAJOR_NUM == 3) - if(MEDfieldCr(fid, fieldName, MED_FLOAT64, (med_int)numComp, "unknown", "unknown", - "unknown", meshName) < 0){ + if(MEDfieldCr(fid, (char*)fieldName.c_str(), MED_FLOAT64, (med_int)numComp, + "unknown", "unknown", "unknown", (char*)meshName.c_str()) < 0){ #else - if(MEDchampCr(fid, fieldName, MED_FLOAT64, (char*)"unknown", (char*)"unknown", + if(MEDchampCr(fid, (char*)fieldName.c_str(), MED_FLOAT64, + (char*)"unknown", (char*)"unknown", (med_int)numComp) < 0){ #endif Msg::Error("Could not create MED field"); @@ -769,11 +772,12 @@ bool PViewDataGModel::writeMED(const std::string &fileName) #if (MED_MAJOR_NUM == 3) med_bool changeOfCoord, geoTransform; - med_int numNodes = MEDmeshnEntity(fid, meshName, MED_NO_DT, MED_NO_IT, MED_NODE, + med_int numNodes = MEDmeshnEntity(fid, (char*)meshName.c_str(), + MED_NO_DT, MED_NO_IT, MED_NODE, MED_NO_GEOTYPE, MED_COORDINATE, MED_NO_CMODE, &changeOfCoord, &geoTransform); #else - med_int numNodes = MEDnEntMaa(fid, meshName, MED_COOR, MED_NOEUD, + med_int numNodes = MEDnEntMaa(fid, (char*)meshName.c_str(), MED_COOR, MED_NOEUD, MED_NONE, (med_connectivite)0); #endif if(numNodes <= 0){ @@ -794,13 +798,15 @@ bool PViewDataGModel::writeMED(const std::string &fileName) for(int k = 0; k < numComp; k++) val[i * numComp + k] = _steps[step]->getData(indices[i])[k]; #if (MED_MAJOR_NUM == 3) - if(MEDfieldValueWithProfileWr(fid, fieldName, (med_int)(step + 1), MED_NO_IT, + if(MEDfieldValueWithProfileWr(fid, (char*)fieldName.c_str(), (med_int)(step + 1), + MED_NO_IT, time, MED_NODE, MED_NO_GEOTYPE, MED_COMPACT_STMODE, profileName, "", MED_FULL_INTERLACE, MED_ALL_CONSTITUENT, numNodes, (unsigned char*)&val[0]) < 0){ #else - if(MEDchampEcr(fid, meshName, fieldName, (unsigned char*)&val[0], + if(MEDchampEcr(fid, (char*)meshName.c_str(), (char*)fieldName.c_str(), + (unsigned char*)&val[0], MED_FULL_INTERLACE, numNodes, (char*)MED_NOGAUSS, MED_ALL, profileName, MED_COMPACT, MED_NOEUD, MED_NONE, (med_int)step, (char*)"unknown", time, MED_NONOR) < 0){ diff --git a/Post/PViewDataIO.cpp b/Post/PViewDataIO.cpp index 7916b3b2094a42ac36a1d1ea162eea7376fd1cb4..02d9da6a7e6a07a8e93ca58047b204dd14d86f11 100644 --- a/Post/PViewDataIO.cpp +++ b/Post/PViewDataIO.cpp @@ -21,6 +21,7 @@ bool PViewData::writeSTL(const std::string &fileName) if(!getNumTriangles() && !getNumQuadrangles()){ Msg::Error("No surface elements to save"); + fclose(fp); return false; } diff --git a/Post/PViewIO.cpp b/Post/PViewIO.cpp index edbe196a4dd1dc12360da4a0f770a5ac3f6f65ed..36520e3d951cc0530f94a729b16a3d05834ded8c 100644 --- a/Post/PViewIO.cpp +++ b/Post/PViewIO.cpp @@ -92,6 +92,7 @@ bool PView::readMSH(const std::string &fileName, int fileIndex) GModel *model = GModel::current(); if(model->empty()){ Msg::Error("Model is empty: please load a mesh before loading the dataset"); + fclose(fp); return false; } @@ -111,14 +112,17 @@ bool PView::readMSH(const std::string &fileName, int fileIndex) if(!strncmp(&str[1], "MeshFormat", 10)) { double version; - if(!fgets(str, sizeof(str), fp)) return false; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return false; } int format, size; - if(sscanf(str, "%lf %d %d", &version, &format, &size) != 3) return false; + if(sscanf(str, "%lf %d %d", &version, &format, &size) != 3){ + fclose(fp); + return false; + } if(format){ binary = true; Msg::Info("View data is in binary format"); int one; - if(fread(&one, sizeof(int), 1, fp) != 1) return 0; + if(fread(&one, sizeof(int), 1, fp) != 1){ fclose(fp); return 0; } if(one != 1){ swap = true; Msg::Info("Swapping bytes from binary file"); @@ -127,23 +131,23 @@ bool PView::readMSH(const std::string &fileName, int fileIndex) } else if(!strncmp(&str[1], "InterpolationScheme", 19)){ std::string name; - if(!fgets(str, sizeof(str), fp)) return false; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return false; } name = ExtractDoubleQuotedString(str, sizeof(str)); Msg::Info("Reading interpolation scheme '%s'", name.c_str()); PViewData::removeInterpolationScheme(name); int numTypes; - if(fscanf(fp, "%d", &numTypes) != 1) return false; + if(fscanf(fp, "%d", &numTypes) != 1){ fclose(fp); return false; } for(int i = 0; i < numTypes; i++){ int type, numMatrices; - if(fscanf(fp, "%d %d", &type, &numMatrices) != 2) return false; + if(fscanf(fp, "%d %d", &type, &numMatrices) != 2){ fclose(fp); return false; } for(int j = 0; j < numMatrices; j++){ int m, n; - if(fscanf(fp, "%d %d", &m, &n) != 2) return false; + if(fscanf(fp, "%d %d", &m, &n) != 2){ fclose(fp); return false; } fullMatrix<double> mat(m, n); for(int k = 0; k < m; k++){ for(int l = 0; l < n; l++){ double d; - if(fscanf(fp, "%lf", &d) != 1) return false; + if(fscanf(fp, "%lf", &d) != 1){ fclose(fp); return false; } mat.set(k, l, d); } } @@ -166,10 +170,10 @@ bool PView::readMSH(const std::string &fileName, int fileIndex) int numTags; // string tags std::string viewName, interpolationScheme; - if(!fgets(str, sizeof(str), fp)) return false; - if(sscanf(str, "%d", &numTags) != 1) return false; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return false; } + if(sscanf(str, "%d", &numTags) != 1){ fclose(fp); return false; } for(int i = 0; i < numTags; i++){ - if(!fgets(str, sizeof(str), fp)) return false; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return false; } if(i == 0) viewName = ExtractDoubleQuotedString(str, sizeof(str)); else if(i == 1) @@ -177,31 +181,31 @@ bool PView::readMSH(const std::string &fileName, int fileIndex) } // double tags double time = 0.; - if(!fgets(str, sizeof(str), fp)) return false; - if(sscanf(str, "%d", &numTags) != 1) return false; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return false; } + if(sscanf(str, "%d", &numTags) != 1){ fclose(fp); return false; } for(int i = 0; i < numTags; i++){ - if(!fgets(str, sizeof(str), fp)) return false; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return false; } if(i == 0){ - if(sscanf(str, "%lf", &time) != 1) return false; + if(sscanf(str, "%lf", &time) != 1){ fclose(fp); return false; } } } // integer tags int timeStep = 0, numComp = 0, numEnt = 0, partition = 0; - if(!fgets(str, sizeof(str), fp)) return false; - if(sscanf(str, "%d", &numTags) != 1) return false; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return false; } + if(sscanf(str, "%d", &numTags) != 1){ fclose(fp); return false; } for(int i = 0; i < numTags; i++){ - if(!fgets(str, sizeof(str), fp)) return false; + if(!fgets(str, sizeof(str), fp)){ fclose(fp); return false; } if(i == 0){ - if(sscanf(str, "%d", &timeStep) != 1) return false; + if(sscanf(str, "%d", &timeStep) != 1){ fclose(fp); return false; } } else if(i == 1){ - if(sscanf(str, "%d", &numComp) != 1) return false; + if(sscanf(str, "%d", &numComp) != 1){ fclose(fp); return false; } } else if(i == 2){ - if(sscanf(str, "%d", &numEnt) != 1) return false; + if(sscanf(str, "%d", &numEnt) != 1){ fclose(fp); return false; } } else if(i == 3){ - if(sscanf(str, "%d", &partition) != 1) return false; + if(sscanf(str, "%d", &partition) != 1){ fclose(fp); return false; } } } // either get existing viewData, or create new one @@ -214,6 +218,7 @@ bool PView::readMSH(const std::string &fileName, int fileIndex) time, partition, numComp, numEnt, interpolationScheme)){ Msg::Error("Could not read data in msh file"); if(create) delete d; + fclose(fp); return false; } else{ diff --git a/Post/PViewVertexArrays.cpp b/Post/PViewVertexArrays.cpp index 8ca41643374ff41e4cd0b784a238a910ce68e9f7..a9f9cecfd759d7643075ec3781afed77e51c3253 100644 --- a/Post/PViewVertexArrays.cpp +++ b/Post/PViewVertexArrays.cpp @@ -1266,8 +1266,8 @@ static void addElementsInArrays(PView *p, bool preprocessNormalsOnly) addVectorElement(p, ent, i, 1, TYPE_PNT, xyz2, val2, preprocessNormalsOnly); else if(numComp == 9 && opt->drawTensors) addTensorElement(p, ent, i, 1, TYPE_PNT, xyz2, val2, preprocessNormalsOnly); - delete [] xyz2[0]; - delete [] val2[0]; + delete [] x2; + delete [] v2; } } else if(numComp == 1 && opt->drawScalars) diff --git a/contrib/kbipack/gmp_matrix.cpp b/contrib/kbipack/gmp_matrix.cpp index aae01ec1e75e148b09ac5b174de2128960a7c864..af511c9b38ed22018a225fafecac018e356ede9c 100644 --- a/contrib/kbipack/gmp_matrix.cpp +++ b/contrib/kbipack/gmp_matrix.cpp @@ -1,6 +1,6 @@ -/* - Source file for integer-oriented matrix, relying on the arbitrary - precision integers from the GNU gmp package. +/* + Source file for integer-oriented matrix, relying on the arbitrary + precision integers from the GNU gmp package. Copyright (C) 28.10.2003 Saku Suuriniemi TUT/CEM @@ -8,7 +8,7 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -29,8 +29,8 @@ #include<stdlib.h> #include"gmp_matrix.h" -gmp_matrix * -create_gmp_matrix(size_t r, size_t c, +gmp_matrix * +create_gmp_matrix(size_t r, size_t c, mpz_t * e) { gmp_matrix * new_matrix; @@ -61,8 +61,8 @@ create_gmp_matrix(size_t r, size_t c, return new_matrix; } -gmp_matrix * -create_gmp_matrix_int(size_t r, size_t c, +gmp_matrix * +create_gmp_matrix_int(size_t r, size_t c, const long int * e) { gmp_matrix * new_matrix; @@ -94,7 +94,7 @@ create_gmp_matrix_int(size_t r, size_t c, } -gmp_matrix * +gmp_matrix * create_gmp_matrix_identity(size_t dim) { gmp_matrix * new_matrix; @@ -130,9 +130,9 @@ create_gmp_matrix_identity(size_t dim) } -gmp_matrix * +gmp_matrix * create_gmp_matrix_zero(size_t rows, size_t cols) -{ +{ gmp_matrix * new_matrix; size_t ind; @@ -159,9 +159,9 @@ create_gmp_matrix_zero(size_t rows, size_t cols) return new_matrix; } -gmp_matrix * -copy_gmp_matrix(const gmp_matrix * matrix, - const size_t start_row, const size_t start_col, +gmp_matrix * +copy_gmp_matrix(const gmp_matrix * matrix, + const size_t start_row, const size_t start_col, const size_t end_row, const size_t end_col) { gmp_matrix * new_matrix; @@ -181,8 +181,12 @@ copy_gmp_matrix(const gmp_matrix * matrix, r = end_row-start_row+1; c = end_col-start_col+1; - if(r < 1 || c < 1) return NULL; - + if(r < 1 || c < 1) + { + free(new_matrix); + return NULL; + } + new_matrix -> storage = (mpz_t *) calloc(r*c, sizeof(mpz_t)); if(new_matrix -> storage == NULL) { @@ -208,11 +212,11 @@ copy_gmp_matrix(const gmp_matrix * matrix, } } } - + return new_matrix; } -int +int destroy_gmp_matrix(gmp_matrix * m) { size_t ind, nmb_storage;; @@ -300,7 +304,7 @@ gmp_matrix_set_elem(mpz_t elem, size_t row, size_t col, return EXIT_SUCCESS; } -int +int gmp_matrix_swap_rows(size_t row1, size_t row2, gmp_matrix * m) { if(m == NULL) @@ -314,7 +318,7 @@ gmp_matrix_swap_rows(size_t row1, size_t row2, gmp_matrix * m) /* printf("Swapping rows %i %i\n", row1, row2); */ gmp_blas_swap(m -> cols, - &(m -> storage[row1-1]), m -> rows, + &(m -> storage[row1-1]), m -> rows, &(m -> storage[row2-1]), m -> rows); return EXIT_SUCCESS; @@ -333,8 +337,8 @@ gmp_matrix_swap_cols(size_t col1, size_t col2, gmp_matrix * m) } /* printf("Swapping cols %i %i\n", col1, col2); */ - gmp_blas_swap(m -> rows, - &(m -> storage[(m->rows)*(col1-1)]), 1, + gmp_blas_swap(m -> rows, + &(m -> storage[(m->rows)*(col1-1)]), 1, &(m -> storage[(m->rows)*(col2-1)]), 1); return EXIT_SUCCESS; @@ -356,9 +360,9 @@ gmp_matrix_negate_row(size_t row, gmp_matrix * m) mpz_init(minus_one); mpz_set_si(minus_one, -1); - gmp_blas_scal(m -> cols, minus_one, (&m -> storage[row-1]), m -> rows); + gmp_blas_scal(m -> cols, minus_one, (&m -> storage[row-1]), m -> rows); mpz_clear(minus_one); - return EXIT_SUCCESS; + return EXIT_SUCCESS; } int @@ -375,8 +379,8 @@ gmp_matrix_negate_col(size_t col, gmp_matrix * m) } mpz_init(minus_one); mpz_set_si(minus_one, -1); - gmp_blas_scal(m -> rows, minus_one, - &(m -> storage[(m->rows)*(col-1)]), 1); + gmp_blas_scal(m -> rows, minus_one, + &(m -> storage[(m->rows)*(col-1)]), 1); mpz_clear(minus_one); return EXIT_SUCCESS; } @@ -395,9 +399,9 @@ gmp_matrix_add_row(mpz_t a, size_t row1, size_t row2, return EXIT_FAILURE; } - gmp_blas_axpy(m->cols, a, - (mpz_t *) &(m->storage[row1-1]), m->rows, - &(m->storage[row2-1]), m->rows); + gmp_blas_axpy(m->cols, a, + (mpz_t *) &(m->storage[row1-1]), m->rows, + &(m->storage[row2-1]), m->rows); return EXIT_SUCCESS; } @@ -415,9 +419,9 @@ gmp_matrix_add_col(mpz_t a, size_t col1, size_t col2, return EXIT_FAILURE; } - gmp_blas_axpy(m->rows, a, - (mpz_t *) &(m -> storage[(m->rows)*(col1-1)]), 1, - &(m -> storage[(m->rows)*(col2-1)]), 1); + gmp_blas_axpy(m->rows, a, + (mpz_t *) &(m -> storage[(m->rows)*(col1-1)]), 1, + &(m -> storage[(m->rows)*(col2-1)]), 1); return EXIT_SUCCESS; } @@ -438,9 +442,9 @@ gmp_matrix_row_rot(mpz_t a, mpz_t b, size_t row1, return EXIT_FAILURE; } - gmp_blas_rot(m->cols, - a, b, &(m->storage[row1-1]), m->rows, - c, d, &(m->storage[row2-1]), m->rows); + gmp_blas_rot(m->cols, + a, b, &(m->storage[row1-1]), m->rows, + c, d, &(m->storage[row2-1]), m->rows); return EXIT_SUCCESS; } @@ -465,15 +469,15 @@ gmp_matrix_col_rot(mpz_t a, mpz_t b, size_t col1, /* mpz_get_si(d), */ /* col1, col2); */ - gmp_blas_rot(m->rows, - a, b, &(m -> storage[(m->rows)*(col1-1)]), 1, - c, d, &(m -> storage[(m->rows)*(col2-1)]), 1); + gmp_blas_rot(m->rows, + a, b, &(m -> storage[(m->rows)*(col1-1)]), 1, + c, d, &(m -> storage[(m->rows)*(col2-1)]), 1); return EXIT_SUCCESS; } size_t -gmp_matrix_col_inz (size_t r1, size_t r2, size_t c, +gmp_matrix_col_inz (size_t r1, size_t r2, size_t c, gmp_matrix * m) { size_t result; @@ -482,15 +486,15 @@ gmp_matrix_col_inz (size_t r1, size_t r2, size_t c, { return 0; } - if((r1 < 1) || (r1 > m->rows) || + if((r1 < 1) || (r1 > m->rows) || (r2 < 1) || (r2 > m->rows) || (r2 < r1) || (c < 1) || (c > m->cols)) { return 0; } - result = gmp_blas_inz(r2-r1+1, - (mpz_t *) &(m->storage[(c-1)*(m->rows)+r1-1]), + result = gmp_blas_inz(r2-r1+1, + (mpz_t *) &(m->storage[(c-1)*(m->rows)+r1-1]), 1); if(result > r2-r1+1) @@ -502,7 +506,7 @@ gmp_matrix_col_inz (size_t r1, size_t r2, size_t c, } size_t -gmp_matrix_row_inz (size_t r, size_t c1, size_t c2, +gmp_matrix_row_inz (size_t r, size_t c1, size_t c2, gmp_matrix * m) { size_t result; @@ -511,15 +515,15 @@ gmp_matrix_row_inz (size_t r, size_t c1, size_t c2, { return 0; } - if((r < 1) || (r > m->rows) || + if((r < 1) || (r > m->rows) || (c1 < 1) || (c1 > m->cols) || (c2 < c1) || (c2 < 1) || (c2 > m->cols)) { return 0; } - result = gmp_blas_inz(c2-c1+1, - (mpz_t *) &(m->storage[(c1-1)*(m->rows)+r-1]), + result = gmp_blas_inz(c2-c1+1, + (mpz_t *) &(m->storage[(c1-1)*(m->rows)+r-1]), m->rows); if(result > c2-c1+1) @@ -541,7 +545,7 @@ gmp_matrix_is_diagonal(const gmp_matrix * M) { return 0; } - + rows = M->rows; cols = M->cols; @@ -549,7 +553,7 @@ gmp_matrix_is_diagonal(const gmp_matrix * M) { for(i = 1; i <= rows; i ++) { - if((mpz_cmp_si(M->storage[(i-1)+(j-1)*rows], 0) != 0) && + if((mpz_cmp_si(M->storage[(i-1)+(j-1)*rows], 0) != 0) && (i != j)) { return 0; @@ -572,7 +576,7 @@ gmp_matrix_transp(gmp_matrix * M) { return EXIT_FAILURE; } - + rows = M->rows; cols = M->cols; @@ -585,15 +589,15 @@ gmp_matrix_transp(gmp_matrix * M) if(rows == 1){ for(i = 1; i <= cols; i++) { - mpz_init_set(new_storage[i-1], + mpz_init_set(new_storage[i-1], M-> storage[i-1]); mpz_clear(M-> storage[i-1]); } - } + } else if(cols == 1){ for(i = 1; i <= rows; i++) { - mpz_init_set(new_storage[i-1], + mpz_init_set(new_storage[i-1], M-> storage[i-1]); mpz_clear(M-> storage[i-1]); } @@ -603,13 +607,13 @@ gmp_matrix_transp(gmp_matrix * M) { for(j = 1; j <= cols; j++) { - mpz_init_set(new_storage[(j-1)+(i-1)*cols], + mpz_init_set(new_storage[(j-1)+(i-1)*cols], M-> storage[(i-1)+(j-1)*rows]); mpz_clear(M-> storage[(i-1)+(j-1)*rows]); } } } - + free(M->storage); M -> storage = new_storage; @@ -631,7 +635,7 @@ gmp_matrix_right_mult(gmp_matrix * A, const gmp_matrix * B) { return EXIT_FAILURE; } - + rows_A = A->rows; cols_A = A->cols; rows_B = B->rows; @@ -687,7 +691,7 @@ gmp_matrix_left_mult(const gmp_matrix * A, gmp_matrix * B) { return EXIT_FAILURE; } - + rows_A = A->rows; cols_A = A->cols; rows_B = B->rows; diff --git a/contrib/kbipack/gmp_normal_form.cpp b/contrib/kbipack/gmp_normal_form.cpp index 42785337e7e54cf85e1bc82b1dc0ea52b14ed925..fcaa55956e1cda75ca8375fd451664ff86d5da12 100644 --- a/contrib/kbipack/gmp_normal_form.cpp +++ b/contrib/kbipack/gmp_normal_form.cpp @@ -1,22 +1,22 @@ -/* - Implementation for integer computation of Hermite and Smith normal - forms of matrices of modest size. +/* + Implementation for integer computation of Hermite and Smith normal + forms of matrices of modest size. - Implementation: Dense matrix with GMP-library's mpz_t elements to - hold huge integers. + Implementation: Dense matrix with GMP-library's mpz_t elements to + hold huge integers. Algorithm: Kannan - Bachem algorithm with improvement by - Chou and Collins. Expects a large number of unit invariant - factors and takes advantage of them as they appear. + Chou and Collins. Expects a large number of unit invariant + factors and takes advantage of them as they appear. - References: - [1] Ravindran Kannan, Achim Bachem: - "Polynomial algorithms for computing the Smith and Hermite normal - forms of an integer matrix", + References: + [1] Ravindran Kannan, Achim Bachem: + "Polynomial algorithms for computing the Smith and Hermite normal + forms of an integer matrix", SIAM J. Comput., vol. 8, no. 5, pp. 499-507, 1979. - [2] Tsu-Wu J.Chou, George E. Collins: - "Algorithms for the solution of systems of linear Diophantine - equations", + [2] Tsu-Wu J.Chou, George E. Collins: + "Algorithms for the solution of systems of linear Diophantine + equations", SIAM J. Comput., vol. 11, no. 4, pp. 687-708, 1982. [3] GMP homepage http://www.swox.com/gmp/ [4] GNU gmp page http://www.gnu.org/software/gmp/ @@ -27,7 +27,7 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -52,7 +52,7 @@ /* The unaltered matrix and identity left and right factors */ static gmp_normal_form * -create_gmp_trivial_normal_form(gmp_matrix * A, +create_gmp_trivial_normal_form(gmp_matrix * A, inverted_flag left_inverted, inverted_flag right_inverted) { @@ -77,6 +77,7 @@ create_gmp_trivial_normal_form(gmp_matrix * A, if((rows == 0) || (cols == 0)) { destroy_gmp_matrix(A); + free(new_nf); return NULL; } @@ -105,7 +106,7 @@ create_gmp_trivial_normal_form(gmp_matrix * A, } static int -gmp_Hermite_eliminate_step(gmp_matrix * L, gmp_matrix * U, +gmp_Hermite_eliminate_step(gmp_matrix * L, gmp_matrix * U, size_t col, inverted_flag right_inverted) { size_t ind, row_limit; @@ -121,8 +122,8 @@ gmp_Hermite_eliminate_step(gmp_matrix * L, gmp_matrix * U, mpz_init(cff2); mpz_init(gc_div); - row_limit = (L->rows >= col) ? - col-1 : + row_limit = (L->rows >= col) ? + col-1 : L->rows; for(ind = 1; ind <= row_limit; ind++) @@ -134,7 +135,7 @@ gmp_Hermite_eliminate_step(gmp_matrix * L, gmp_matrix * U, { gmp_matrix_get_elem(pivot, ind, ind, L); - /* Extended Euclid's: + /* Extended Euclid's: bez1*pivot+bez2*elem = gc_div */ gmp_blas_rotg(gc_div, bez1, bez2, pivot, elem); @@ -183,7 +184,7 @@ gmp_Hermite_eliminate_step(gmp_matrix * L, gmp_matrix * U, static int -gmp_Hermite_reduce_step(gmp_matrix * L, gmp_matrix * U, +gmp_Hermite_reduce_step(gmp_matrix * L, gmp_matrix * U, size_t col, inverted_flag right_inverted) { @@ -227,10 +228,10 @@ gmp_Hermite_reduce_step(gmp_matrix * L, gmp_matrix * U, mpz_neg (cff, elem); mpz_cdiv_q (cff, cff, pivot); - /* printf("col %i j %i\n", i, j); - printf("elem %i k %i pivot %i\n", - mpz_get_si(elem), - mpz_get_si(cff), + /* printf("col %i j %i\n", i, j); + printf("elem %i k %i pivot %i\n", + mpz_get_si(elem), + mpz_get_si(cff), mpz_get_si(pivot));*/ @@ -300,7 +301,7 @@ gmp_normal_form_make_Hermite(gmp_normal_form * nf) /* Eliminate a column */ if (schur > 1) { - gmp_Hermite_eliminate_step(canonical, right, + gmp_Hermite_eliminate_step(canonical, right, schur, nf->right_inverted); } @@ -308,7 +309,7 @@ gmp_normal_form_make_Hermite(gmp_normal_form * nf) pivot_ind = gmp_matrix_col_inz(schur, rows, schur, canonical); - /* If no nonzeros was found, the column is all zero, hence + /* If no nonzeros was found, the column is all zero, hence settled with. Permute it to the end and decrement cols. */ if(pivot_ind == 0) { @@ -325,19 +326,19 @@ gmp_normal_form_make_Hermite(gmp_normal_form * nf) cols--; - /* When the whole column was zeroed, the diagonal + /* When the whole column was zeroed, the diagonal elements may have got reduced. Reduce the sub- diagonals as well*/ if(schur > 1) { - gmp_Hermite_reduce_step (canonical, right, schur-1, + gmp_Hermite_reduce_step (canonical, right, schur-1, nf -> right_inverted); } } - /* A nonzero pivot was found. Permute it to the diagonal position, - make it positive, and reduce the off-diagonals. + /* A nonzero pivot was found. Permute it to the diagonal position, + make it positive, and reduce the off-diagonals. The schur complement now starts from the next diagonal. */ else { @@ -358,15 +359,15 @@ gmp_normal_form_make_Hermite(gmp_normal_form * nf) if(mpz_cmp_si(pivot, 0) < 0) { - gmp_matrix_negate_col(schur, canonical); + gmp_matrix_negate_col(schur, canonical); if(nf->right_inverted == INVERTED) { - gmp_matrix_negate_col(schur, right); + gmp_matrix_negate_col(schur, right); } else { - gmp_matrix_negate_row(schur, right); + gmp_matrix_negate_row(schur, right); } } @@ -377,7 +378,7 @@ gmp_normal_form_make_Hermite(gmp_normal_form * nf) } } - /* The Schur complement is now empty. There may still be uneliminated + /* The Schur complement is now empty. There may still be uneliminated columns left (in case of a wide matrix) */ colind = schur; @@ -395,8 +396,8 @@ gmp_normal_form_make_Hermite(gmp_normal_form * nf) -gmp_normal_form * -create_gmp_Hermite_normal_form(gmp_matrix * A, +gmp_normal_form * +create_gmp_Hermite_normal_form(gmp_matrix * A, inverted_flag left_inverted, inverted_flag right_inverted) { @@ -407,7 +408,7 @@ create_gmp_Hermite_normal_form(gmp_matrix * A, return NULL; } - new_nf = + new_nf = create_gmp_trivial_normal_form(A, left_inverted, right_inverted); if(new_nf == NULL) @@ -448,7 +449,7 @@ create_gmp_Smith_normal_form(gmp_matrix * A, return NULL; } - new_nf = + new_nf = create_gmp_trivial_normal_form(A, left_inverted, right_inverted); if(new_nf == NULL) @@ -490,68 +491,68 @@ create_gmp_Smith_normal_form(gmp_matrix * A, /* Find ready columns */ /**********************/ - /* If a diagonal entry is zero, so is the corresponding - column. The zero diagonals always reside in the end. + /* If a diagonal entry is zero, so is the corresponding + column. The zero diagonals always reside in the end. Seek until zero diagonal encountered, but stay within the matrix! */ ind = 1; - while ( (ind < first_ready_col) && - (mpz_cmp_si(canonical -> storage[(ind-1)+(ind-1)*rows], 0) != 0) - ) + while ( (ind < first_ready_col) && + (mpz_cmp_si(canonical -> storage[(ind-1)+(ind-1)*rows], 0) != 0) + ) { ind ++; } first_ready_col = ind; - /* Note: The number of ready cols is settled after the first HNF, + /* Note: The number of ready cols is settled after the first HNF, but the check is cheap. */ /**********************************************/ /* Permute unit diagonals such that they lead */ /**********************************************/ - /* If the recently computed HNF has ones on the diagonal, their - corresponding rows are all zero (except the diagonal). + /* If the recently computed HNF has ones on the diagonal, their + corresponding rows are all zero (except the diagonal). They are then settled, because the next LHNF kills the elements on their columns. */ ind = last_ready_row+1; - + /* Stay within the nonzero cols of the matrix */ while (ind < first_ready_col) { /* Unit diagonal encountered */ - if(mpz_cmp_si ( canonical->storage[(ind-1) + (ind-1)*rows], + if(mpz_cmp_si ( canonical->storage[(ind-1) + (ind-1)*rows], 1) == 0) { - /* If not in the beginning, permute to extend the leading minor + /* If not in the beginning, permute to extend the leading minor with unit diagonals */ if(ind != last_ready_row+1) { - gmp_matrix_swap_rows(last_ready_row+1, ind, + gmp_matrix_swap_rows(last_ready_row+1, ind, new_nf -> canonical); - + if(left_inverted == INVERTED) { - gmp_matrix_swap_rows(last_ready_row+1, ind, + gmp_matrix_swap_rows(last_ready_row+1, ind, new_nf -> left); } else { - gmp_matrix_swap_cols(last_ready_row+1, ind, + gmp_matrix_swap_cols(last_ready_row+1, ind, new_nf -> left); } - - gmp_matrix_swap_cols(last_ready_row+1, ind, + + gmp_matrix_swap_cols(last_ready_row+1, ind, new_nf -> canonical); - + if(right_inverted == INVERTED) { - gmp_matrix_swap_cols(last_ready_row+1, ind, + gmp_matrix_swap_cols(last_ready_row+1, ind, new_nf -> right); } else { - gmp_matrix_swap_rows(last_ready_row+1, ind, + gmp_matrix_swap_rows(last_ready_row+1, ind, new_nf -> right); } } @@ -559,7 +560,7 @@ create_gmp_Smith_normal_form(gmp_matrix * A, } ind++; } - + #ifdef DEBUG printf("Leading units\n"); gmp_matrix_printf (new_nf -> left); @@ -654,12 +655,12 @@ create_gmp_Smith_normal_form(gmp_matrix * A, /* Check if more of the leading normal form is ready */ /*****************************************************/ - /* The matrix is in LHNF, i.e. it is upper triangular. - If the row trailing the top left diagonal element is - zero, the diagonal element may be an invariant factor + /* The matrix is in LHNF, i.e. it is upper triangular. + If the row trailing the top left diagonal element is + zero, the diagonal element may be an invariant factor on its final position, and the stage may be ready. - The stage may not still be ready: The leading diagonal element + The stage may not still be ready: The leading diagonal element of D may not divide the rest of the Schur complement. */ subd_ind = 0; @@ -668,39 +669,39 @@ create_gmp_Smith_normal_form(gmp_matrix * A, /* Explanation of loop conditions: 1.) No relative primes found from Schur complement 2.) Stay within the Schur complement - 3.) If a nonzero is found from the trailing row, the stage is + 3.) If a nonzero is found from the trailing row, the stage is definitely not ready */ - while (row_undivisible == 0 && - last_ready_row + 1 < first_ready_col && - subd_ind == 0) + while (row_undivisible == 0 && + last_ready_row + 1 < first_ready_col && + subd_ind == 0) { - subd_ind = + subd_ind = gmp_matrix_row_inz(last_ready_row+1, - last_ready_row+2, cols, + last_ready_row+2, cols, canonical); /* printf("subd_ind %i\n", subd_ind); printf("last_ready_row %i\n", last_ready_row); */ - + /* No nonzeros found, the stage may be ready */ if (subd_ind == 0) { - mpz_set (pivot, + mpz_set (pivot, canonical->storage[(last_ready_row)+ (last_ready_row)*rows]); - /* Check whether the pivot divides all elements in the Schur + /* Check whether the pivot divides all elements in the Schur complement */ row_undivisible = 0; for(j = last_ready_row+2; j < first_ready_col; j++) { for(i = last_ready_row+2; i <= j; i++) { - mpz_tdiv_r (remainder, + mpz_tdiv_r (remainder, canonical->storage[(i-1)+ - (j-1)*rows], + (j-1)*rows], pivot); - + if(mpz_cmp_si(remainder, 0) !=0) { row_undivisible = i; @@ -711,13 +712,13 @@ create_gmp_Smith_normal_form(gmp_matrix * A, /* printf("Row undivisible %i\n", row_undivisible); */ - /* If a relative prime was found from the Schur complement, + /* If a relative prime was found from the Schur complement, add that row to the first row of the Schur complement */ if(row_undivisible != 0) { mpz_set_si (remainder, 1); - gmp_matrix_add_row(remainder, - row_undivisible, last_ready_row+1, + gmp_matrix_add_row(remainder, + row_undivisible, last_ready_row+1, canonical); /* [ 1 0] [1 0] = [1 0] @@ -725,14 +726,14 @@ create_gmp_Smith_normal_form(gmp_matrix * A, if(left_inverted == INVERTED) { - gmp_matrix_add_row(remainder, - row_undivisible, last_ready_row+1, + gmp_matrix_add_row(remainder, + row_undivisible, last_ready_row+1, new_nf->left); } else { mpz_neg (remainder, remainder); - gmp_matrix_add_col(remainder, + gmp_matrix_add_col(remainder, last_ready_row+1, row_undivisible, new_nf->left); } @@ -743,9 +744,9 @@ create_gmp_Smith_normal_form(gmp_matrix * A, last_ready_row++; } } - } + } } /* The main loop ends here */ - + mpz_clear(pivot); mpz_clear(remainder); return new_nf; @@ -773,7 +774,7 @@ int destroy_gmp_normal_form(gmp_normal_form * nf) if(destroy_gmp_matrix(nf -> right) == EXIT_FAILURE) { - status = EXIT_FAILURE; + status = EXIT_FAILURE; } free(nf); diff --git a/contrib/mmg3d/build/sources/outqua.c b/contrib/mmg3d/build/sources/outqua.c index d7a83d3655d2a58fd350fae026f4b28ab25467fa..c1c35b27f46fd03e55413a5879d9ad043d1afba7 100644 --- a/contrib/mmg3d/build/sources/outqua.c +++ b/contrib/mmg3d/build/sources/outqua.c @@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0 Co-auteurs : Cecile Dobrzynski et Pascal Frey. Propriétaires :IPB - UPMC -INRIA. -Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, +Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, diffusé sous les termes et conditions de la licence publique générale de GNU -Version 3 ou toute version ultérieure. +Version 3 ou toute version ultérieure. Ce fichier est une partie de MMG3D. MMG3D est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier suivant les termes de la licence publique générale de GNU Version 3 ou toute version ultérieure. -MMG3D est distribué dans l'espoir qu'il sera utile, mais SANS -AUCUNE GARANTIE ; sans même garantie de valeur marchande. +MMG3D est distribué dans l'espoir qu'il sera utile, mais SANS +AUCUNE GARANTIE ; sans même garantie de valeur marchande. Voir la licence publique générale de GNU pour plus de détails. -MMG3D est diffusé en espérant qu’il sera utile, -mais SANS AUCUNE GARANTIE, ni explicite ni implicite, -y compris les garanties de commercialisation ou -d’adaptation dans un but spécifique. +MMG3D est diffusé en espérant qu’il sera utile, +mais SANS AUCUNE GARANTIE, ni explicite ni implicite, +y compris les garanties de commercialisation ou +d’adaptation dans un but spécifique. Reportez-vous à la licence publique générale de GNU pour plus de détails. -Vous devez avoir reçu une copie de la licence publique générale de GNU -en même temps que ce document. +Vous devez avoir reçu une copie de la licence publique générale de GNU +en même temps que ce document. Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>. /**************************************************************************** Initial software: MMG3D Version 4.0 Co-authors: Cecile Dobrzynski et Pascal Frey. Owners: IPB - UPMC -INRIA. -Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, -spread under the terms and conditions of the license GNU General Public License +Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, +spread under the terms and conditions of the license GNU General Public License as published Version 3, or (at your option) any later version. This file is part of MMG3D @@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with MMG3D. If not, see <http://www.gnu.org/licenses/>. +along with MMG3D. If not, see <http://www.gnu.org/licenses/>. ****************************************************************************/ #include "mesh.h" @@ -51,11 +51,11 @@ int MMG_outqua(pMesh mesh,pSol sol) { double coef,rap4,rapl,rapmin,rapmax,rapavg,dcal; int his10[11],his01[33],rapnum,iout; int k,i,j,imax,iel,ir,nn,nex,ielreal,tmp; - + iout = 0; - + if(mesh->info.imprim < 0) MMG_priworst(mesh,sol); - + rapmin = 1.e20; rapmax = -1.e20; rapavg = 0.0; @@ -75,16 +75,16 @@ int MMG_outqua(pMesh mesh,pSol sol) { nex++; continue; } - nn++; - dcal = MMG_caltet(mesh,sol,k);//(sol->offset==6) ? MMG_caltet_ani(mesh,sol,k) : MMG_caltet_iso(mesh,sol,k); - rap4 = coef * dcal; + nn++; + dcal = MMG_caltet(mesh,sol,k);//(sol->offset==6) ? MMG_caltet_ani(mesh,sol,k) : MMG_caltet_iso(mesh,sol,k); + rap4 = coef * dcal; if(dcal == CALLIM) { //printf("Wrong elt %d : %d %d %d %d (qual %e %e)\n",k,pt->v[0],pt->v[1],pt->v[2],pt->v[3],rap4,MMG_voltet(mesh,k)); tmp = pt->v[2]; pt->v[2] = pt->v[3]; pt->v[3] = tmp; - dcal = MMG_caltet(mesh,sol,k);//(sol->offset==6) ? MMG_caltet_ani(mesh,sol,k) : MMG_caltet_iso(mesh,sol,k); - rap4 = coef * dcal; + dcal = MMG_caltet(mesh,sol,k);//(sol->offset==6) ? MMG_caltet_ani(mesh,sol,k) : MMG_caltet_iso(mesh,sol,k); + rap4 = coef * dcal; if(dcal == CALLIM) { printf("Wrong elt %d : %d %d %d %d (qual %e (%e) %13.12f)\n",k,pt->v[0],pt->v[1],pt->v[2],pt->v[3],rap4,rap4/coef,MMG_voltet(mesh,k)); printf("vextex 0 : %e %e %e\n",mesh->point[pt->v[0]].c[0],mesh->point[pt->v[0]].c[1],mesh->point[pt->v[0]].c[2]); @@ -92,7 +92,7 @@ int MMG_outqua(pMesh mesh,pSol sol) { printf("vextex 2 : %e %e %e\n",mesh->point[pt->v[2]].c[0],mesh->point[pt->v[2]].c[1],mesh->point[pt->v[2]].c[2]); printf("vextex 3 : %e %e %e\n",mesh->point[pt->v[3]].c[0],mesh->point[pt->v[3]].c[1],mesh->point[pt->v[3]].c[2]); //MMG_saveMesh(mesh,"titi.mesh"); - //exit(0); + //exit(0); iout += 1; } if(abs(mesh->info.imprim) > 5) printf("reorient tet %d\n",k); @@ -101,11 +101,11 @@ int MMG_outqua(pMesh mesh,pSol sol) { //rap4 = M_MIN(rap4,1.0e9); ir = (int)rap4; if ( rap4 > rapmax ) { - rapmax = rap4; + rapmax = rap4; iel = k; ielreal = k - nex; } - rapavg += rap4; + rapavg += rap4; rapnum++; if ( rap4 > 1.0 && rap4 < 17e10 ) { @@ -118,12 +118,12 @@ int MMG_outqua(pMesh mesh,pSol sol) { rapl = M_MIN(log10(rap4),32.0); his01[(int)rapl] += 1; his01[0] += 1; - } + } } } /* print histo */ - //EMI if(mesh->info.imprim < 0) { + //EMI if(mesh->info.imprim < 0) { fprintf(stdout,"\n -- MESH QUALITY %d \n",rapnum); if ( (rapavg > 0) && (rapavg / rapnum < 100.0) ) fprintf(stdout," AVERAGE QUALITY %12.4f\n",rapavg / rapnum); @@ -143,18 +143,18 @@ int MMG_outqua(pMesh mesh,pSol sol) { for (i=1; i<32; i++) j += his01[i]; - if(rapmax > 1e+9) + if(rapmax > 1e+9) imax = 9; - else - imax = M_MIN((int)rapmax,9); - + else + imax = M_MIN((int)rapmax,9); + for (i=M_MAX((int)rapmin,1); i<=imax; i++) { fprintf(stdout," %5d < Q < %5d %7d %6.2f %%\n", i,i+1,his10[i],100.*(his10[i]/(float)his01[0])); } /* quality per interval */ - if (j != 0) { + if (j != 0) { fprintf(stdout,"\n"); imax = (int)(M_MIN(3,log10(rapmax))); @@ -173,14 +173,14 @@ int MMG_outqua(pMesh mesh,pSol sol) { return(iout); } -double MMG_priworst(pMesh mesh, pSol sol) { +double MMG_priworst(pMesh mesh, pSol sol) { pTetra pt; int k,nbad,nreal,nex; double bad; - + /*worst quality*/ bad = 1.; - nbad = 0; + nbad = 0; nex = 0; nreal = 0; for(k=1 ; k<=mesh->ne ; k++) { @@ -194,8 +194,8 @@ double MMG_priworst(pMesh mesh, pSol sol) { nbad = k - nex; nreal = k; } - } - + } + if(nreal) printf(" worst quality %d (%d): %e %e\n",nreal,nbad,bad*ALPHAD,ALPHAC*MMG_calte1(mesh,sol,nreal)); return((&mesh->tetra[nreal])->qual); @@ -206,9 +206,9 @@ int MMG_outquacubic(pMesh mesh,pSol sol) { double rapmin,rapmax,rapavg,dcal,som; int his10[11],his01[5],rapnum,iout; int k,i,j,iel,ir,nn,nex,ielreal,hismin; - + iout = 0; - + rapmin = 0.; rapmax = 1.; rapavg = 0.0; @@ -217,7 +217,7 @@ int MMG_outquacubic(pMesh mesh,pSol sol) { ielreal = 0; nn = 0; - for (k=0; k<=5; k++) his01[k] = 0; + for (k=0; k<=4; k++) his01[k] = 0; for (k=0; k<=10; k++) his10[k] = 0; nex = 0; @@ -227,19 +227,19 @@ int MMG_outquacubic(pMesh mesh,pSol sol) { nex++; continue; } - nn++; - dcal = MMG_caltetcubic(mesh,sol,k); + nn++; + dcal = MMG_caltetcubic(mesh,sol,k); if(dcal > 1) { //printf("argggggg %d %e %e\n",k,dcal,MMG_caltet(mesh,sol,k)*ALPHAD); dcal = 1.; - } + } if(dcal == 0.) { printf("Wrong elt %d (qual %e)\n",k,dcal); iout += 1; } ir = (int)(dcal*10); if ( dcal < rapmax ) { - rapmax = dcal; + rapmax = dcal; iel = k; ielreal = k - nex; } @@ -252,17 +252,17 @@ int MMG_outquacubic(pMesh mesh,pSol sol) { his10[ir] += 1; his01[0] += 1; } - else if ( dcal > 1e-12 ) { + else if ( dcal > 1e-12 ) { if(dcal > 0.01) { his01[1] += 1; } else if (dcal > 0.001) { his01[2] += 1; } else if (dcal > 0.0001) { his01[3] += 1; - } else + } else his01[4] += 1; his01[0] += 1; - } + } } } @@ -285,30 +285,30 @@ int MMG_outquacubic(pMesh mesh,pSol sol) { j = 0; for (i=1; i<4; i++) j += his01[i]; - hismin = M_MIN((int)(rapmin*10),1); - som = 0; - if( hismin == 1) { + hismin = M_MIN((int)(rapmin*10),1); + som = 0; + if( hismin == 1) { fprintf(stdout," 0.9 < Q < 1.0 %7d %6.2f %%\n", his10[9]+his10[10],100.*((his10[9]+his10[10])/(float)his01[0])); - hismin = 9; + hismin = 9; som += 100.*((his10[9]+his10[10])/(float)his01[0]); } for (i=hismin; i>M_MAX((int)(rapmax*10),1); i--) { fprintf(stdout," 0.%d < Q < 0.%d %7d %6.2f %%\n", - i-1,i,his10[i-1],100.*(his10[i-1]/(float)his01[0])); - som += 100.*(his10[i-1]/(float)his01[0]); - } + i-1,i,his10[i-1],100.*(his10[i-1]/(float)his01[0])); + som += 100.*(his10[i-1]/(float)his01[0]); + } /* quality per interval */ if (j != 0) { - fprintf(stdout,"\n"); + fprintf(stdout,"\n"); j -= his01[1]; if(his01[1]!=0) fprintf(stdout," 0.01 < Q < 0.1 %7d %6.2f %%\n", his01[1],100.*(his01[1]/(float)his01[0])); if(j!=0) fprintf(stdout," 0.001 < Q < 0.01 %7d %6.2f %%\n", - his01[2],100.*(his01[1]/(float)his01[0])); + his01[2],100.*(his01[1]/(float)his01[0])); j -= his01[2]; if(j!=0) fprintf(stdout," 0.0001 < Q < 0.001 %7d %6.2f %%\n", diff --git a/contrib/mmg3d/build/sources/ratio.c b/contrib/mmg3d/build/sources/ratio.c index 79ee5e01012c5799c0555f6d33d6704c61fd320c..0f3cfaa4c32825514ae599ab8b7f6ade2dbf3982 100644 --- a/contrib/mmg3d/build/sources/ratio.c +++ b/contrib/mmg3d/build/sources/ratio.c @@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0 Co-auteurs : Cecile Dobrzynski et Pascal Frey. Propriétaires :IPB - UPMC -INRIA. -Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, +Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, diffusé sous les termes et conditions de la licence publique générale de GNU -Version 3 ou toute version ultérieure. +Version 3 ou toute version ultérieure. Ce fichier est une partie de MMG3D. MMG3D est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier suivant les termes de la licence publique générale de GNU Version 3 ou toute version ultérieure. -MMG3D est distribué dans l'espoir qu'il sera utile, mais SANS -AUCUNE GARANTIE ; sans même garantie de valeur marchande. +MMG3D est distribué dans l'espoir qu'il sera utile, mais SANS +AUCUNE GARANTIE ; sans même garantie de valeur marchande. Voir la licence publique générale de GNU pour plus de détails. -MMG3D est diffusé en espérant qu’il sera utile, -mais SANS AUCUNE GARANTIE, ni explicite ni implicite, -y compris les garanties de commercialisation ou -d’adaptation dans un but spécifique. +MMG3D est diffusé en espérant qu’il sera utile, +mais SANS AUCUNE GARANTIE, ni explicite ni implicite, +y compris les garanties de commercialisation ou +d’adaptation dans un but spécifique. Reportez-vous à la licence publique générale de GNU pour plus de détails. -Vous devez avoir reçu une copie de la licence publique générale de GNU -en même temps que ce document. +Vous devez avoir reçu une copie de la licence publique générale de GNU +en même temps que ce document. Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>. /**************************************************************************** Initial software: MMG3D Version 4.0 Co-authors: Cecile Dobrzynski et Pascal Frey. Owners: IPB - UPMC -INRIA. -Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, -spread under the terms and conditions of the license GNU General Public License +Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, +spread under the terms and conditions of the license GNU General Public License as published Version 3, or (at your option) any later version. This file is part of MMG3D @@ -41,74 +41,74 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with MMG3D. If not, see <http://www.gnu.org/licenses/>. +along with MMG3D. If not, see <http://www.gnu.org/licenses/>. ****************************************************************************/ -/* -ratio = -tet equi : 1. +/* +ratio = +tet equi : 1. tet rect (1 1 sqrt(2)) : 3.73 vs 1.93 (avec sqrt(lmax/lmin)) tet rect (1 1/sqrt(2) 1/sqrt(2)) : 2.2413 vs 1.49 */ -#include "mesh.h" +#include "mesh.h" int MMG_gauss(double mat[6][6],double rhs[6],double* met); /*compute the aniso ratio for an element k*/ -double MMG_rao(pMesh mesh,int k,FILE* inm) { +double MMG_rao(pMesh mesh,int k,FILE* inm) { pTetra pt; pPoint ppa,ppb; - double edg[6][3],mat[6][6],met[6],rhs[6]; + double edg[6][3],mat[6][6],met[6],rhs[6]; double lambda[3],v[3][3],lmin,lmax,rao; // double bufd[GmfMaxTyp]; int i,j; - + pt = &mesh->tetra[k]; - - /*compute the ellipsoide*/ + + /*compute the ellipsoide*/ for (i=0 ; i<6 ; i++) rhs[i] = 1; - + for (i=0 ; i<6 ; i++) { ppa = &mesh->point[pt->v[MMG_iare[i][0]]]; ppb = &mesh->point[pt->v[MMG_iare[i][1]]]; for (j=0 ; j<3 ; j++) { - edg[i][j] = ppb->c[j] - ppa->c[j]; - } + edg[i][j] = ppb->c[j] - ppa->c[j]; + } mat[i][0] = edg[i][0]*edg[i][0]; mat[i][1] = 2*edg[i][0]*edg[i][1]; mat[i][2] = 2*edg[i][0]*edg[i][2]; mat[i][3] = edg[i][1]*edg[i][1]; mat[i][4] = 2*edg[i][1]*edg[i][2]; mat[i][5] = edg[i][2]*edg[i][2]; - } - MMG_gauss(mat,rhs,met); - - /*find the eigenvalues of the metric*/ + } + MMG_gauss(mat,rhs,met); + + /*find the eigenvalues of the metric*/ if ( !eigenv(1,met,lambda,v) ) { for (j=0 ; j<6 ; j++) printf("%e %e %e %e %e %e\n",mat[j][0],mat[j][1],mat[j][2],mat[j][3],mat[j][4],mat[j][5]); printf("\n met %e %e %e %e %e %e\n",met[0],met[1],met[2],met[3],met[4],met[5]); - puts("pbs eigen"); + puts("pbs eigen"); return(0); } - /*calculate the aniso ratio obtained*/ + /*calculate the aniso ratio obtained*/ lmin = M_MIN(lambda[0],lambda[1]); - lmin = M_MIN(lmin,lambda[2]); + lmin = M_MIN(lmin,lambda[2]); lmax = M_MAX(lambda[0],lambda[1]); lmax = M_MAX(lmax,lambda[2]); - rao = sqrt(lmax / lmin); + rao = sqrt(lmax / lmin); if(inm) { /*for (i=0; i<6; i++) - bufd[i] = met[i]; + bufd[i] = met[i]; - bufd[2] = met[3]; - bufd[3] = met[2];*/ + bufd[2] = met[3]; + bufd[3] = met[2];*/ fprintf(inm,"%.15lg \n",rao); } - - return(rao); + + return(rao); } @@ -120,21 +120,21 @@ int MMG_avgmet(pSol sol,pTetra pt,double* mm) { ib = pt->v[1]; ic = pt->v[2]; id = pt->v[3]; - + if (sol->offset==1) { h1 = sol->met[ia]; h2 = sol->met[ib]; h3 = sol->met[ic]; h4 = sol->met[id]; h = 0.25*(h1 + h2 + h3 + h4); - mm[0] = h; - mm[1] = 0; - mm[2] = 0; - mm[3] = h; - mm[4] = 0; - mm[5] = h; + mm[0] = h; + mm[1] = 0; + mm[2] = 0; + mm[3] = h; + mm[4] = 0; + mm[5] = h; } else { - + /* average metric */ memset(mm,0,6*sizeof(double)); iadr = (ia-1)*sol->offset + 1; @@ -147,29 +147,29 @@ int MMG_avgmet(pSol sol,pTetra pt,double* mm) { md = &sol->met[iadr]; for (j=0; j<6; j++) mm[j] = 0.25 * (ma[j]+mb[j]+mc[j]+md[j]); - - } - - return(1); + + } + + return(1); } /* compute the prescribed and obtained anisotropic ratio print histo + save the ratio in a file */ -int MMG_ratio(pMesh mesh, pSol sol,char* firaoame) { +int MMG_ratio(pMesh mesh, pSol sol,char* firaoame) { FILE *inm; pTetra pt; - double met[6]; + double met[6]; double lambda[3],v[3][3],lmin,lmax,rao; int k,ne,typ; - char *ptr,data[128],chaine[128]; + char *ptr,data[128],chaine[128]; double rapmin,rapmax,rapavg; int his[10],rapnum; int iel,ir,nn,nex,ielreal; static double bd[9] = {1.0, 2., 10.0, 50., 100., 200., 500., 1000., 5000. }; /*save ratio obtained ?*/ - inm = 0; + inm = 0; if(firaoame) { strcpy(data,firaoame); ptr = strstr(data,".meshb"); @@ -187,26 +187,26 @@ int MMG_ratio(pMesh mesh, pSol sol,char* firaoame) { } else fprintf(stdout," %%%% %s OPENED\n",data); - + /*entete fichier*/ - strcpy(&chaine[0],"MeshVersionFormatted 2\n"); + strcpy(&chaine[0],"MeshVersionFormatted 2\n"); fprintf(inm,"%s",chaine); - strcpy(&chaine[0],"\n\nDimension 3\n"); + strcpy(&chaine[0],"\n\nDimension 3\n"); fprintf(inm,"%s ",chaine); typ = 1; - - ne = 0; + + ne = 0; for(k=1 ; k<=mesh->ne ; k++) { pt = &mesh->tetra[k]; if(!pt->v[0]) continue; ne++; } - strcpy(&chaine[0],"\n\nSolAtTetrahedra\n"); + strcpy(&chaine[0],"\n\nSolAtTetrahedra\n"); fprintf(inm,"%s",chaine); fprintf(inm,"%d\n",ne); fprintf(inm,"%d %d\n",1,typ); - + } if ( mesh->info.imprim < 0 ) { @@ -231,27 +231,28 @@ int MMG_ratio(pMesh mesh, pSol sol,char* firaoame) { continue; } nn++; - + /*mean metric*/ MMG_avgmet(sol,pt,met); - - /*find the eigenvalues of the prescribed metric*/ + + /*find the eigenvalues of the prescribed metric*/ if ( !eigenv(1,met,lambda,v) ) { - puts("pbs eigen"); + puts("pbs eigen"); + if(inm) fclose(inm); return(0); } - /*calculate the aniso ratio */ + /*calculate the aniso ratio */ lmin = M_MIN(lambda[0],lambda[1]); - lmin = M_MIN(lmin,lambda[2]); + lmin = M_MIN(lmin,lambda[2]); lmax = M_MAX(lambda[0],lambda[1]); lmax = M_MAX(lmax,lambda[2]); rao = sqrt(lmax / lmin); - /*histo prescribed*/ - ir = (int)rao; + /*histo prescribed*/ + ir = (int)rao; if ( rao > rapmax ) { - rapmax = rao; + rapmax = rao; iel = k; ielreal = k - nex; } @@ -273,16 +274,16 @@ int MMG_ratio(pMesh mesh, pSol sol,char* firaoame) { else if (rao < bd[8]) his[8]++; else his[9]++; } - - } + + } /* print histo ratio obtained*/ fprintf(stdout,"\n -- ANISOTROPIC RATIO PRESCRIBED %d\n",rapnum); fprintf(stdout," AVERAGE RATIO %12.4f\n",rapavg / rapnum); - fprintf(stdout," SMALLEST RATIO %12.4f\n",rapmin); + fprintf(stdout," SMALLEST RATIO %12.4f\n",rapmin); if (rapmax < 1.e4) { - fprintf(stdout," LARGEST RATIO %12.4f\n",rapmax); + fprintf(stdout," LARGEST RATIO %12.4f\n",rapmax); } else { - fprintf(stdout," LARGEST RATIO %12.4e\n",rapmax); + fprintf(stdout," LARGEST RATIO %12.4e\n",rapmax); } pt = &mesh->tetra[iel]; fprintf(stdout," ELEMENT %d (%d) %d %d %d %d\n", @@ -299,7 +300,7 @@ int MMG_ratio(pMesh mesh, pSol sol,char* firaoame) { his[9],100.*(his[9]/(float)rapnum)); } - + rapmin = 1.e20; rapmax = -1.e20; rapavg = 0.0; @@ -318,13 +319,13 @@ int MMG_ratio(pMesh mesh, pSol sol,char* firaoame) { continue; } nn++; - + rao = MMG_rao(mesh,k,inm); - - /*histo obtained*/ - ir = (int)rao; + + /*histo obtained*/ + ir = (int)rao; if ( rao > rapmax ) { - rapmax = rao; + rapmax = rao; iel = k; ielreal = k - nex; } @@ -347,11 +348,11 @@ int MMG_ratio(pMesh mesh, pSol sol,char* firaoame) { else if (rao < bd[8]) his[8]++; else his[9]++; } - + } if(inm) fclose(inm); - + /* print histo ratio obtained*/ if (mesh->info.imprim < 0){ fprintf(stdout," ANISOTROPIC RATIO (MEAN = %6.2g, MAX = %6.2g, MIN = %6.2f)\n",rapavg / rapnum, rapmax, rapmin); @@ -359,11 +360,11 @@ int MMG_ratio(pMesh mesh, pSol sol,char* firaoame) { else if (mesh->info.imprim < 0){ fprintf(stdout,"\n -- ANISOTROPIC RATIO OBTAINED %d\n",rapnum); fprintf(stdout," AVERAGE RATIO %12.4f\n",rapavg / rapnum); - fprintf(stdout," SMALLEST RATIO %12.4f\n",rapmin); + fprintf(stdout," SMALLEST RATIO %12.4f\n",rapmin); if (rapmax < 1.e4) { - fprintf(stdout," LARGEST RATIO %12.4f\n",rapmax); + fprintf(stdout," LARGEST RATIO %12.4f\n",rapmax); } else { - fprintf(stdout," LARGEST RATIO %12.4e\n",rapmax); + fprintf(stdout," LARGEST RATIO %12.4e\n",rapmax); } pt = &mesh->tetra[iel]; @@ -382,23 +383,23 @@ int MMG_ratio(pMesh mesh, pSol sol,char* firaoame) { if ( his[9] ) fprintf(stdout," 5000.00 < R %8d %5.2f %% \n", his[9],100.*(his[9]/(float)rapnum)); - - return(1); -} + + return(1); +} /* solve mat*met = rhs */ int MMG_gauss(double mat[6][6],double rhs[6],double* met) { - int i,j,l; - double tmp,piv; + int i,j,l; + double tmp,piv; /*printf("begin : \n"); for (j=0 ; j<6 ; j++) printf("%e %e %e %e %e %e\n",mat[j][0],mat[j][1],mat[j][2],mat[j][3],mat[j][4],mat[j][5]); */ - /* triangularisation*/ - for (i=0 ; i<5 ; i++) { - l = i+1; + /* triangularisation*/ + for (i=0 ; i<5 ; i++) { + l = i+1; while ( (fabs(mat[i][i]) < 1e-8) && (l<6)){ - for (j=0 ; j<6 ; j++) { + for (j=0 ; j<6 ; j++) { tmp = mat[i][j]; mat[i][j] = mat[l][j]; mat[l][j] = tmp; @@ -406,7 +407,7 @@ int MMG_gauss(double mat[6][6],double rhs[6],double* met) { tmp = rhs[i]; rhs[i] = rhs[l]; rhs[l] = tmp; - + l++; } if ((fabs(mat[i][i]) < 1e-8)) { @@ -416,14 +417,14 @@ int MMG_gauss(double mat[6][6],double rhs[6],double* met) { met[2] = 0; met[3] = 1e7; met[4] = 10; - met[5] = 1e7; + met[5] = 1e7; return(1); - } - for (j=i+1 ; j<6 ; j++) { + } + for (j=i+1 ; j<6 ; j++) { piv = mat[j][i]; - for (l=0 ; l<6 ; l++) { + for (l=0 ; l<6 ; l++) { mat[j][l] -= piv*mat[i][l] / mat[i][i]; - } + } rhs[j] -= piv*rhs[i]/ mat[i][i]; } } @@ -434,8 +435,8 @@ int MMG_gauss(double mat[6][6],double rhs[6],double* met) { for(l=j+1 ; l<6 ; l++) { met[j] += -mat[j][l]*met[l]; } - met[j] /= mat[j][j]; - } + met[j] /= mat[j][j]; + } return(1); } diff --git a/contrib/mmg3d/build/sources/simu710.c b/contrib/mmg3d/build/sources/simu710.c index 6fea0e70feb76f9e6f3225c6455f34a6596fc67f..9dfb31659a65c74fbcec6c462c245538dbcc40c0 100644 --- a/contrib/mmg3d/build/sources/simu710.c +++ b/contrib/mmg3d/build/sources/simu710.c @@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0 Co-auteurs : Cecile Dobrzynski et Pascal Frey. Propriétaires :IPB - UPMC -INRIA. -Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, +Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, diffusé sous les termes et conditions de la licence publique générale de GNU -Version 3 ou toute version ultérieure. +Version 3 ou toute version ultérieure. Ce fichier est une partie de MMG3D. MMG3D est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier suivant les termes de la licence publique générale de GNU Version 3 ou toute version ultérieure. -MMG3D est distribué dans l'espoir qu'il sera utile, mais SANS -AUCUNE GARANTIE ; sans même garantie de valeur marchande. +MMG3D est distribué dans l'espoir qu'il sera utile, mais SANS +AUCUNE GARANTIE ; sans même garantie de valeur marchande. Voir la licence publique générale de GNU pour plus de détails. -MMG3D est diffusé en espérant qu’il sera utile, -mais SANS AUCUNE GARANTIE, ni explicite ni implicite, -y compris les garanties de commercialisation ou -d’adaptation dans un but spécifique. +MMG3D est diffusé en espérant qu’il sera utile, +mais SANS AUCUNE GARANTIE, ni explicite ni implicite, +y compris les garanties de commercialisation ou +d’adaptation dans un but spécifique. Reportez-vous à la licence publique générale de GNU pour plus de détails. -Vous devez avoir reçu une copie de la licence publique générale de GNU -en même temps que ce document. +Vous devez avoir reçu une copie de la licence publique générale de GNU +en même temps que ce document. Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>. /**************************************************************************** Initial software: MMG3D Version 4.0 Co-authors: Cecile Dobrzynski et Pascal Frey. Owners: IPB - UPMC -INRIA. -Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, -spread under the terms and conditions of the license GNU General Public License +Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, +spread under the terms and conditions of the license GNU General Public License as published Version 3, or (at your option) any later version. This file is part of MMG3D @@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with MMG3D. If not, see <http://www.gnu.org/licenses/>. +along with MMG3D. If not, see <http://www.gnu.org/licenses/>. ****************************************************************************/ #include "mesh.h" @@ -53,8 +53,8 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { int iadr,*adja,k,adj,iel,iar; short voy; - for(k=0 ; k<=71 ; k++) qual[k] = -1; - + for(k=0 ; k<71 ; k++) qual[k] = -1; + iel = list->tetra[1] / 6; iar = list->tetra[1] % 6; pt = &mesh->tetra[iel]; @@ -63,7 +63,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { ia = pt->v[ MMG_iare[iar][0] ]; ib = pt->v[ MMG_iare[iar][1] ]; s1 = pt->v[ MMG_isar[iar][0] ]; - s2 = pt->v[ MMG_isar[iar][1] ]; + s2 = pt->v[ MMG_isar[iar][1] ]; iadr = (iel-1)*4 + 1; adja = &mesh->adja[iadr]; @@ -85,7 +85,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } else { puts("MMG_simu710: point s2 non existant"); exit(0); - } + } adj = adja[k] / 4; voy = adja[k] % 4; pt1 = &mesh->tetra[adj]; @@ -102,8 +102,8 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } else { printf("MMG_simu710: point s3 non existant %d \n",s3); exit(0); - } - + } + adj = adja[k] / 4; voy = adja[k] % 4; pt1 = &mesh->tetra[adj]; @@ -120,12 +120,12 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } else { puts("MMG_simu710: point s4 non existant"); exit(0); - } + } adj = adja[k] / 4; voy = adja[k] % 4; pt1 = &mesh->tetra[adj]; - s6 = pt1->v[voy]; - + s6 = pt1->v[voy]; + iadr = (iel-1)*4 + 1; adja = &mesh->adja[iadr]; k = MMG_isar[iar][1]; @@ -133,7 +133,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { voy = adja[k] % 4; pt1 = &mesh->tetra[adj]; s7 = pt1->v[voy]; - + /* printf("polygone : %d %d %d %d %d %d %d\n",s1,s2,s3,s4,s5,s6,s7); */ /*for(k=1 ; k<=7 ; k++) { @@ -141,7 +141,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { pt1 =&mesh->tetra[jel]; printf("tetra %d : %d %d %d %d\n",jel,pt1->v[0],pt1->v[1],pt1->v[2],pt1->v[3]); }*/ - + /*cas 1*/ do { pt1 = &mesh->tetra[0]; @@ -159,7 +159,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { qual[2] = caltab[1]; list->qual[1] = qual[1]; list->qual[2] = qual[2]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s1; @@ -191,7 +191,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { qual[6] = caltab[1]; list->qual[5] = qual[5]; list->qual[6] = qual[6]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s1; @@ -207,7 +207,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { qual[8] = caltab[1]; list->qual[7] = qual[7]; list->qual[8] = qual[8]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s1; @@ -225,7 +225,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { list->qual[10] = qual[10]; MMG_swpptr = MMG_swap710_1; - + return(71); } while(0); @@ -234,7 +234,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { if(!qual[1]) break; list->qual[1] = qual[1]; list->qual[2] = qual[2]; - + if(!qual[3]) break; else if(qual[3] == -1) { pt1 = &mesh->tetra[0]; @@ -250,10 +250,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[3] = caltab[0]; qual[4] = caltab[1]; - } + } list->qual[3] = qual[3]; list->qual[4] = qual[4]; - + if(!qual[5]) break; else if(qual[5] == -1) { pt1 = &mesh->tetra[0]; @@ -269,10 +269,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[5] = caltab[0]; qual[6] = caltab[1]; - } + } list->qual[5] = qual[5]; list->qual[6] = qual[6]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s1; @@ -288,8 +288,8 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { qual[12] = caltab[1]; list->qual[7] = qual[11]; list->qual[8] = qual[12]; - - + + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s5; @@ -304,18 +304,18 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { qual[13] = caltab[0]; qual[14] = caltab[1]; list->qual[9] = qual[13]; - list->qual[10] = qual[14]; - + list->qual[10] = qual[14]; + MMG_swpptr = MMG_swap710_2; return(72); - } while(0); - + } while(0); + /*cas 3*/ do { if(!qual[1]) break; list->qual[1] = qual[1]; list->qual[2] = qual[2]; - + if(!qual[3]) break; else if(qual[3] == -1) { pt1 = &mesh->tetra[0]; @@ -331,10 +331,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[3] = caltab[0]; qual[4] = caltab[1]; - } + } list->qual[3] = qual[3]; list->qual[4] = qual[4]; - + if(!qual[13]) break; else if(qual[13] == -1) { pt1 = &mesh->tetra[0]; @@ -350,7 +350,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[5] = qual[13]; list->qual[6] = qual[14]; @@ -364,7 +364,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[15] = 0; break; - } + } qual[15] = caltab[0]; qual[16] = caltab[1]; list->qual[7] = qual[15]; @@ -385,17 +385,17 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { qual[18] = caltab[1]; list->qual[9] = qual[17]; list->qual[10] = qual[18]; - + MMG_swpptr = MMG_swap710_3; return(73); } while(0); - + /*cas 4*/ do { if(!qual[1]) break; list->qual[1] = qual[1]; list->qual[2] = qual[2]; - + if(!qual[3]) break; else if(qual[3] == -1) { pt1 = &mesh->tetra[0]; @@ -411,10 +411,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[3] = caltab[0]; qual[4] = caltab[1]; - } + } list->qual[3] = qual[3]; list->qual[4] = qual[4]; - + if(!qual[17]) break; else if(qual[17] == -1) { pt1 = &mesh->tetra[0]; @@ -430,7 +430,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[17] = caltab[0]; qual[18] = caltab[1]; - } + } list->qual[5] = qual[17]; list->qual[6] = qual[18]; @@ -444,7 +444,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[19] = 0; break; - } + } qual[19] = caltab[0]; qual[20] = caltab[1]; list->qual[7] = qual[19]; @@ -465,17 +465,17 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { qual[22] = caltab[1]; list->qual[9] = qual[21]; list->qual[10] = qual[22]; - + MMG_swpptr = MMG_swap710_4; return(74); - } while(0); - + } while(0); + /*cas 5*/ do { if(!qual[1]) break; list->qual[1] = qual[1]; list->qual[2] = qual[2]; - + if(!qual[3]) break; else if(qual[3] == -1) { pt1 = &mesh->tetra[0]; @@ -491,10 +491,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[3] = caltab[0]; qual[4] = caltab[1]; - } + } list->qual[3] = qual[3]; list->qual[4] = qual[4]; - + if(!qual[9]) break; else if(qual[9] == -1) { pt1 = &mesh->tetra[0]; @@ -510,7 +510,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[5] = qual[9]; list->qual[6] = qual[10]; @@ -529,7 +529,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[21] = caltab[0]; qual[22] = caltab[1]; - } + } list->qual[7] = qual[21]; list->qual[8] = qual[22]; @@ -548,11 +548,11 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { qual[24] = caltab[1]; list->qual[9] = qual[23]; list->qual[10] = qual[24]; - + MMG_swpptr = MMG_swap710_5; return(75); } while(0); - + /*cas 6*/ do { if(!qual[5]) break; @@ -589,10 +589,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[7] = caltab[0]; qual[8] = caltab[1]; - } + } list->qual[3] = qual[7]; list->qual[4] = qual[8]; - + if(!qual[9]) break; else if(qual[9] == -1) { pt1 = &mesh->tetra[0]; @@ -608,7 +608,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[5] = qual[9]; list->qual[6] = qual[10]; @@ -622,12 +622,12 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; list->qual[7] = qual[25]; list->qual[8] = qual[26]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s1; @@ -646,7 +646,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { MMG_swpptr = MMG_swap710_6; return(76); } while(0); - + /*cas 7*/ do { if(!qual[5]) break; @@ -664,10 +664,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[5] = caltab[0]; qual[6] = caltab[1]; - } + } list->qual[1] = qual[5]; list->qual[2] = qual[6]; - + if(!qual[11]) break; else if (qual[11] == -1) { pt1 = &mesh->tetra[0]; @@ -686,7 +686,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } list->qual[3] = qual[11]; list->qual[4] = qual[12]; - + if(!qual[13]) break; else if(qual[13] == -1) { pt1 = &mesh->tetra[0]; @@ -702,10 +702,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[5] = qual[13]; list->qual[6] = qual[14]; - + if(!qual[25]) break; else if(qual[25] == -1) { pt1 = &mesh->tetra[0]; @@ -718,13 +718,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } list->qual[7] = qual[25]; list->qual[8] = qual[26]; - + if(!qual[27]) break; else if(qual[27] == -1) { pt1 = &mesh->tetra[0]; @@ -744,9 +744,9 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { list->qual[9] = qual[27]; list->qual[10] = qual[28]; MMG_swpptr = MMG_swap710_7; - return(77); - } while(0); - + return(77); + } while(0); + /*cas 8*/ do { if(!qual[13]) break; @@ -764,10 +764,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[1] = qual[13]; list->qual[2] = qual[14]; - + if(!qual[15]) break; else if(qual[15] == -1) { pt1 = &mesh->tetra[0]; @@ -780,13 +780,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[15] = 0; break; - } + } qual[15] = caltab[0]; qual[16] = caltab[1]; } list->qual[3] = qual[15]; list->qual[4] = qual[16]; - + if(!qual[17]) break; else if(qual[17] == -1) { pt1 = &mesh->tetra[0]; @@ -802,10 +802,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[17] = caltab[0]; qual[18] = caltab[1]; - } + } list->qual[5] = qual[17]; list->qual[6] = qual[18]; - + if(!qual[25]) break; else if(qual[25] == -1) { pt1 = &mesh->tetra[0]; @@ -818,13 +818,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } list->qual[7] = qual[25]; list->qual[8] = qual[26]; - + if(!qual[27]) break; else if(qual[27] == -1) { pt1 = &mesh->tetra[0]; @@ -844,9 +844,9 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { list->qual[9] = qual[27]; list->qual[10] = qual[28]; MMG_swpptr = MMG_swap710_8; - return(78); - } while(0); - + return(78); + } while(0); + /*cas 9*/ do { if(!qual[17]) break; @@ -864,10 +864,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[17] = caltab[0]; qual[18] = caltab[1]; - } + } list->qual[1] = qual[17]; list->qual[2] = qual[18]; - + if(!qual[19]) break; else if(qual[19] == -1) { pt1 = &mesh->tetra[0]; @@ -880,13 +880,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[19] = 0; break; - } + } qual[19] = caltab[0]; qual[20] = caltab[1]; } list->qual[3] = qual[19]; list->qual[4] = qual[20]; - + if(!qual[21]) break; else if(qual[21] == -1) { pt1 = &mesh->tetra[0]; @@ -902,10 +902,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[21] = caltab[0]; qual[22] = caltab[1]; - } + } list->qual[5] = qual[21]; list->qual[6] = qual[22]; - + if(!qual[25]) break; else if(qual[25] == -1) { pt1 = &mesh->tetra[0]; @@ -918,7 +918,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } @@ -944,9 +944,9 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { list->qual[9] = qual[27]; list->qual[10] = qual[28]; MMG_swpptr = MMG_swap710_9; - return(79); + return(79); } while(0); - + /*cas 10*/ do { if(!qual[9]) break; @@ -964,10 +964,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[1] = qual[9]; list->qual[2] = qual[10]; - + if(!qual[21]) break; else if(qual[21] == -1) { pt1 = &mesh->tetra[0]; @@ -983,10 +983,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[21] = caltab[0]; qual[22] = caltab[1]; - } + } list->qual[3] = qual[21]; list->qual[4] = qual[22]; - + if(!qual[23]) break; else if(qual[23] == -1) { pt1 = &mesh->tetra[0]; @@ -1005,7 +1005,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } list->qual[5] = qual[23]; list->qual[6] = qual[24]; - + if(!qual[25]) break; else if(qual[25] == -1) { pt1 = &mesh->tetra[0]; @@ -1018,13 +1018,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } list->qual[7] = qual[25]; list->qual[8] = qual[26]; - + if(!qual[27]) break; else if(qual[27] == -1) { pt1 = &mesh->tetra[0]; @@ -1043,12 +1043,12 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } list->qual[9] = qual[27]; list->qual[10] = qual[28]; - + MMG_swpptr = MMG_swap710_10; memset(pt1,0,sizeof(Tetra)); - return(80); + return(80); } while(0); - + /*cas 11*/ do { if(!qual[25]) break; @@ -1063,13 +1063,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } list->qual[1] = qual[25]; list->qual[2] = qual[26]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s1; @@ -1080,12 +1080,12 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; list->qual[3] = qual[29]; list->qual[4] = qual[30]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s2; @@ -1096,12 +1096,12 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[31] = 0; break; - } + } qual[31] = caltab[0]; qual[32] = caltab[1]; list->qual[5] = qual[31]; list->qual[6] = qual[32]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s2; @@ -1112,12 +1112,12 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[33] = 0; break; - } + } qual[33] = caltab[0]; qual[34] = caltab[1]; list->qual[7] = qual[33]; list->qual[8] = qual[34]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s2; @@ -1128,17 +1128,17 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[35] = 0; break; - } + } qual[35] = caltab[0]; qual[36] = caltab[1]; list->qual[9] = qual[35]; - list->qual[10] = qual[36]; - + list->qual[10] = qual[36]; + memset(pt1,0,sizeof(Tetra)); MMG_swpptr = MMG_swap710_11; return(81); } while(0); - + /*cas 12*/ do { if(!qual[29]) break; @@ -1153,13 +1153,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; } list->qual[1] = qual[29]; list->qual[2] = qual[30]; - + if(!qual[31]) break; else if(qual[31] == -1) { pt1 = &mesh->tetra[0]; @@ -1172,13 +1172,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[31] = 0; break; - } + } qual[31] = caltab[0]; qual[32] = caltab[1]; } list->qual[3] = qual[31]; list->qual[4] = qual[32]; - + if(!qual[33]) break; else if(qual[33] == -1) { pt1 = &mesh->tetra[0]; @@ -1191,13 +1191,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[33] = 0; break; - } + } qual[33] = caltab[0]; qual[34] = caltab[1]; } list->qual[5] = qual[33]; list->qual[6] = qual[34]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s3; @@ -1208,12 +1208,12 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; list->qual[7] = qual[37]; list->qual[8] = qual[38]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s2; @@ -1224,18 +1224,18 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[39] = 0; break; - } + } qual[39] = caltab[0]; qual[40] = caltab[1]; list->qual[9] = qual[39]; list->qual[10] = qual[40]; - + MMG_swpptr = MMG_swap710_12; memset(pt1,0,sizeof(Tetra)); - return(82); - + return(82); + } while(0); - + /*cas 13*/ do { if(!qual[29]) break; @@ -1250,13 +1250,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; } list->qual[1] = qual[29]; list->qual[2] = qual[30]; - + if(!qual[31]) break; else if(qual[31] == -1) { pt1 = &mesh->tetra[0]; @@ -1269,7 +1269,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[31] = 0; break; - } + } qual[31] = caltab[0]; qual[32] = caltab[1]; } @@ -1288,13 +1288,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } list->qual[5] = qual[37]; - list->qual[6] = qual[38]; - + list->qual[6] = qual[38]; + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s2; @@ -1305,12 +1305,12 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[41] = 0; break; - } + } qual[41] = caltab[0]; qual[42] = caltab[1]; list->qual[7] = qual[41]; list->qual[8] = qual[42]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s3; @@ -1321,16 +1321,16 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[43] = 0; break; - } + } qual[43] = caltab[0]; qual[44] = caltab[1]; list->qual[9] = qual[43]; list->qual[10] = qual[44]; MMG_swpptr = MMG_swap710_13; memset(pt1,0,sizeof(Tetra)); - return(84); + return(84); } while(0); - + /*cas 15*/ do { if(!qual[21]) break; @@ -1348,7 +1348,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[21] = caltab[0]; qual[22] = caltab[1]; - } + } list->qual[1] = qual[21]; list->qual[2] = qual[22]; @@ -1364,13 +1364,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } list->qual[3] = qual[25]; list->qual[4] = qual[26]; - + if(!qual[29]) break; else if(qual[29] == -1) { pt1 = &mesh->tetra[0]; @@ -1383,13 +1383,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; } list->qual[5] = qual[29]; list->qual[6] = qual[30]; - + if(!qual[31]) break; else if(qual[31] == -1) { pt1 = &mesh->tetra[0]; @@ -1402,13 +1402,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[31] = 0; break; - } + } qual[31] = caltab[0]; qual[32] = caltab[1]; } list->qual[7] = qual[31]; list->qual[8] = qual[32]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s2; @@ -1419,17 +1419,17 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[47] = 0; break; - } + } qual[47] = caltab[0]; qual[48] = caltab[1]; list->qual[9] = qual[47]; list->qual[10] = qual[48]; - + MMG_swpptr = MMG_swap710_15; memset(pt1,0,sizeof(Tetra)); - return(85); + return(85); } while(0); - + /*cas 16*/ do { if(!qual[9]) break; @@ -1447,10 +1447,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[1] = qual[9]; list->qual[2] = qual[10]; - + if(!qual[25]) break; else if(qual[25] == -1) { pt1 = &mesh->tetra[0]; @@ -1463,13 +1463,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } list->qual[3] = qual[25]; list->qual[4] = qual[26]; - + if(!qual[33]) break; else if(qual[33] == -1) { pt1 = &mesh->tetra[0]; @@ -1482,13 +1482,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[33] = 0; break; - } + } qual[33] = caltab[0]; qual[34] = caltab[1]; } list->qual[5] = qual[33]; list->qual[6] = qual[34]; - + if(!qual[35]) break; else if(qual[35] == -1) { pt1 = &mesh->tetra[0]; @@ -1501,13 +1501,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[35] = 0; break; - } + } qual[35] = caltab[0]; qual[36] = caltab[1]; } list->qual[7] = qual[35]; list->qual[8] = qual[36]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s1; @@ -1518,17 +1518,17 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[49] = 0; break; - } + } qual[49] = caltab[0]; qual[50] = caltab[1]; list->qual[9] = qual[49]; list->qual[10] = qual[50]; - + MMG_swpptr = MMG_swap710_16; memset(pt1,0,sizeof(Tetra)); - return(86); + return(86); } while(0); - + /*cas 17*/ do { if(!qual[9]) break; @@ -1546,10 +1546,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[1] = qual[9]; list->qual[2] = qual[10]; - + if(!qual[33]) break; else if(qual[33] == -1) { pt1 = &mesh->tetra[0]; @@ -1562,7 +1562,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[33] = 0; break; - } + } qual[33] = caltab[0]; qual[34] = caltab[1]; } @@ -1581,13 +1581,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } list->qual[5] = qual[37]; - list->qual[6] = qual[38]; - + list->qual[6] = qual[38]; + if(!qual[39]) break; else if(qual[39] == -1) { pt1 = &mesh->tetra[0]; @@ -1600,13 +1600,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[39] = 0; break; - } + } qual[39] = caltab[0]; qual[40] = caltab[1]; } list->qual[7] = qual[39]; list->qual[8] = qual[40]; - + if(!qual[49]) break; else if(qual[49] == -1) { pt1 = &mesh->tetra[0]; @@ -1619,18 +1619,18 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[49] = 0; break; - } + } qual[49] = caltab[0]; qual[50] = caltab[1]; } list->qual[9] = qual[49]; list->qual[10] = qual[50]; - + MMG_swpptr = MMG_swap710_17; memset(pt1,0,sizeof(Tetra)); - return(87); + return(87); } while(0); - + /*cas 18*/ do { if(!qual[9]) break; @@ -1648,7 +1648,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[1] = qual[9]; list->qual[2] = qual[10]; @@ -1664,13 +1664,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } list->qual[3] = qual[37]; - list->qual[4] = qual[38]; - + list->qual[4] = qual[38]; + if(!qual[41]) break; else if(qual[41] == -1) { pt1 = &mesh->tetra[0]; @@ -1683,13 +1683,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[41] = 0; break; - } + } qual[41] = caltab[0]; qual[42] = caltab[1]; } list->qual[5] = qual[41]; list->qual[6] = qual[42]; - + if(!qual[43]) break; else if(qual[43] == -1) { pt1 = &mesh->tetra[0]; @@ -1702,12 +1702,12 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[43] = 0; break; - } + } qual[43] = caltab[0]; qual[44] = caltab[1]; } list->qual[7] = qual[43]; - list->qual[8] = qual[44]; + list->qual[8] = qual[44]; if(!qual[49]) break; else if(qual[49] == -1) { @@ -1721,7 +1721,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[49] = 0; break; - } + } qual[49] = caltab[0]; qual[50] = caltab[1]; } @@ -1730,9 +1730,9 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { MMG_swpptr = MMG_swap710_18; memset(pt1,0,sizeof(Tetra)); - return(88); + return(88); } while(0); - + /*cas 19*/ do { if(!qual[9]) break; @@ -1750,7 +1750,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[1] = qual[9]; list->qual[2] = qual[10]; @@ -1769,7 +1769,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[21] = caltab[0]; qual[22] = caltab[1]; - } + } list->qual[3] = qual[21]; list->qual[4] = qual[22]; @@ -1785,7 +1785,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[41] = 0; break; - } + } qual[41] = caltab[0]; qual[42] = caltab[1]; } @@ -1804,13 +1804,13 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[45] = 0; break; - } + } qual[45] = caltab[0]; qual[46] = caltab[1]; } list->qual[7] = qual[45]; list->qual[8] = qual[46]; - + if(!qual[49]) break; else if(qual[49] == -1) { pt1 = &mesh->tetra[0]; @@ -1823,19 +1823,19 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[49] = 0; break; - } + } qual[49] = caltab[0]; qual[50] = caltab[1]; } list->qual[9] = qual[49]; list->qual[10] = qual[50]; - - + + MMG_swpptr = MMG_swap710_19; memset(pt1,0,sizeof(Tetra)); - return(89); + return(89); } while(0); - + /*cas 20*/ do { if(!qual[9]) break; @@ -1853,7 +1853,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[1] = qual[9]; list->qual[2] = qual[10]; @@ -1872,7 +1872,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { } qual[21] = caltab[0]; qual[22] = caltab[1]; - } + } list->qual[3] = qual[21]; list->qual[4] = qual[22]; @@ -1888,7 +1888,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } @@ -1907,12 +1907,12 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[47] = 0; break; - } + } qual[47] = caltab[0]; qual[48] = caltab[1]; } list->qual[7] = qual[47]; - list->qual[8] = qual[48]; + list->qual[8] = qual[48]; if(!qual[49]) break; else if(qual[49] == -1) { pt1 = &mesh->tetra[0]; @@ -1925,16 +1925,16 @@ int MMG_simu710(pMesh mesh,pSol sol,pList list,double crit) { memset(pt1,0,sizeof(Tetra)); qual[49] = 0; break; - } + } qual[49] = caltab[0]; qual[50] = caltab[1]; } list->qual[9] = qual[49]; list->qual[10] = qual[50]; - + MMG_swpptr = MMG_swap710_20; memset(pt1,0,sizeof(Tetra)); - return(90); + return(90); } while(0); /*cas 21*/ @@ -1955,12 +1955,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } list->qual[3] = qual[37]; - list->qual[4] = qual[38]; + list->qual[4] = qual[38]; if(!qual[43]) break; else if(qual[43] == -1) { @@ -1974,12 +1974,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[43] = 0; break; - } + } qual[43] = caltab[0]; qual[44] = caltab[1]; } list->qual[5] = qual[43]; - list->qual[6] = qual[44]; + list->qual[6] = qual[44]; if(!qual[69]) break; else if(qual[69] == -1) { @@ -1993,13 +1993,13 @@ do { memset(pt1,0,sizeof(Tetra)); qual[69] = 0; break; - } + } qual[69] = caltab[0]; qual[70] = caltab[1]; } list->qual[7] = qual[69]; list->qual[8] = qual[70]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s1; @@ -2010,15 +2010,15 @@ do { memset(pt1,0,sizeof(Tetra)); qual[51] = 0; break; - } + } qual[51] = caltab[0]; qual[52] = caltab[1]; list->qual[9] = qual[51]; - list->qual[10] = qual[52]; + list->qual[10] = qual[52]; MMG_swpptr = MMG_swap710_21; memset(pt1,0,sizeof(Tetra)); - return(91); + return(91); } while(0); /*cas 22*/ @@ -2042,10 +2042,10 @@ do { } qual[21] = caltab[0]; qual[22] = caltab[1]; - } + } list->qual[3] = qual[21]; list->qual[4] = qual[22]; - + if(!qual[45]) break; else if(qual[45] == -1) { pt1 = &mesh->tetra[0]; @@ -2058,15 +2058,15 @@ do { memset(pt1,0,sizeof(Tetra)); qual[45] = 0; break; - } + } qual[45] = caltab[0]; qual[46] = caltab[1]; } list->qual[5] = qual[45]; list->qual[6] = qual[46]; - + if(!qual[51]) break; - else if(qual[51] == -1) { + else if(qual[51] == -1) { pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s1; @@ -2077,12 +2077,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[51] = 0; break; - } + } qual[51] = caltab[0]; qual[52] = caltab[1]; } list->qual[7] = qual[51]; - list->qual[8] = qual[52]; + list->qual[8] = qual[52]; if(!qual[69]) break; else if(qual[69] == -1) { @@ -2096,16 +2096,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[69] = 0; break; - } + } qual[69] = caltab[0]; qual[70] = caltab[1]; } list->qual[9] = qual[69]; list->qual[10] = qual[70]; - + MMG_swpptr = MMG_swap710_22; memset(pt1,0,sizeof(Tetra)); - return(92); + return(92); } while(0); /*cas 23*/ @@ -2126,13 +2126,13 @@ do { memset(pt1,0,sizeof(Tetra)); qual[19] = 0; break; - } + } qual[19] = caltab[0]; qual[20] = caltab[1]; } list->qual[3] = qual[19]; list->qual[4] = qual[20]; - + if(!qual[21]) break; else if(qual[21] == -1) { pt1 = &mesh->tetra[0]; @@ -2148,12 +2148,12 @@ do { } qual[21] = caltab[0]; qual[22] = caltab[1]; - } + } list->qual[5] = qual[21]; list->qual[6] = qual[22]; if(!qual[51]) break; - else if(qual[51] == -1) { + else if(qual[51] == -1) { pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s1; @@ -2164,13 +2164,13 @@ do { memset(pt1,0,sizeof(Tetra)); qual[51] = 0; break; - } + } qual[51] = caltab[0]; qual[52] = caltab[1]; } list->qual[7] = qual[51]; - list->qual[8] = qual[52]; - + list->qual[8] = qual[52]; + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s3; @@ -2181,16 +2181,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[53] = 0; break; - } + } qual[53] = caltab[0]; qual[54] = caltab[1]; - + list->qual[9] = qual[53]; - list->qual[10] = qual[54]; - + list->qual[10] = qual[54]; + MMG_swpptr = MMG_swap710_23; memset(pt1,0,sizeof(Tetra)); - return(93); + return(93); } while(0); /*cas 24*/ @@ -2198,7 +2198,7 @@ do { if(!qual[1]) break; list->qual[1] = qual[1]; list->qual[2] = qual[2]; - + if(!qual[13]) break; else if(qual[13] == -1) { pt1 = &mesh->tetra[0]; @@ -2214,7 +2214,7 @@ do { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[3] = qual[13]; list->qual[4] = qual[14]; @@ -2230,15 +2230,15 @@ do { memset(pt1,0,sizeof(Tetra)); qual[15] = 0; break; - } + } qual[15] = caltab[0]; qual[16] = caltab[1]; } list->qual[5] = qual[15]; list->qual[6] = qual[16]; - + if(!qual[51]) break; - else if(qual[51] == -1) { + else if(qual[51] == -1) { pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s1; @@ -2249,15 +2249,15 @@ do { memset(pt1,0,sizeof(Tetra)); qual[51] = 0; break; - } + } qual[51] = caltab[0]; qual[52] = caltab[1]; } list->qual[7] = qual[51]; - list->qual[8] = qual[52]; + list->qual[8] = qual[52]; if(!qual[53]) break; - else if(qual[53] == -1) { + else if(qual[53] == -1) { pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s3; @@ -2268,16 +2268,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[53] = 0; break; - } + } qual[53] = caltab[0]; qual[54] = caltab[1]; } list->qual[9] = qual[53]; - list->qual[10] = qual[54]; - + list->qual[10] = qual[54]; + MMG_swpptr = MMG_swap710_24; memset(pt1,0,sizeof(Tetra)); - return(94); + return(94); } while(0); /*cas 25*/ @@ -2285,7 +2285,7 @@ do { if(!qual[1]) break; list->qual[1] = qual[1]; list->qual[2] = qual[2]; - + if(!qual[13]) break; else if(qual[13] == -1) { pt1 = &mesh->tetra[0]; @@ -2301,7 +2301,7 @@ do { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[3] = qual[13]; list->qual[4] = qual[14]; @@ -2317,15 +2317,15 @@ do { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } list->qual[5] = qual[37]; - list->qual[6] = qual[38]; + list->qual[6] = qual[38]; if(!qual[51]) break; - else if(qual[51] == -1) { + else if(qual[51] == -1) { pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s1; @@ -2336,12 +2336,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[51] = 0; break; - } + } qual[51] = caltab[0]; qual[52] = caltab[1]; } list->qual[7] = qual[51]; - list->qual[8] = qual[52]; + list->qual[8] = qual[52]; pt1 = &mesh->tetra[0]; pt1->v[0] = ia; @@ -2353,16 +2353,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[55] = 0; break; - } + } qual[55] = caltab[0]; qual[56] = caltab[1]; - + list->qual[9] = qual[55]; - list->qual[10] = qual[56]; + list->qual[10] = qual[56]; MMG_swpptr = MMG_swap710_25; memset(pt1,0,sizeof(Tetra)); - return(95); + return(95); } while(0); /*cas 26*/ @@ -2379,13 +2379,13 @@ do { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; } list->qual[1] = qual[29]; list->qual[2] = qual[30]; - + if(!qual[37]) break; else if(qual[37] == -1) { pt1 = &mesh->tetra[0]; @@ -2398,13 +2398,13 @@ do { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } list->qual[3] = qual[37]; list->qual[4] = qual[38]; - + if(!qual[43]) break; else if(qual[43] == -1) { pt1 = &mesh->tetra[0]; @@ -2417,12 +2417,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[43] = 0; break; - } + } qual[43] = caltab[0]; qual[44] = caltab[1]; } list->qual[5] = qual[43]; - list->qual[6] = qual[44]; + list->qual[6] = qual[44]; if(!qual[69]) break; else if(qual[69] == -1) { @@ -2436,13 +2436,13 @@ do { memset(pt1,0,sizeof(Tetra)); qual[69] = 0; break; - } + } qual[69] = caltab[0]; qual[70] = caltab[1]; } list->qual[7] = qual[69]; list->qual[8] = qual[70]; - + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s2; @@ -2453,15 +2453,15 @@ do { memset(pt1,0,sizeof(Tetra)); qual[57] = 0; break; - } + } qual[57] = caltab[0]; qual[58] = caltab[1]; list->qual[9] = qual[57]; - list->qual[10] = qual[58]; - + list->qual[10] = qual[58]; + MMG_swpptr = MMG_swap710_26; memset(pt1,0,sizeof(Tetra)); - return(96); + return(96); } while(0); /*cas 27*/ @@ -2481,7 +2481,7 @@ do { } qual[21] = caltab[0]; qual[22] = caltab[1]; - } + } list->qual[1] = qual[21]; list->qual[2] = qual[22]; @@ -2497,7 +2497,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; } @@ -2521,7 +2521,7 @@ do { qual[46] = caltab[1]; } list->qual[5] = qual[45]; - list->qual[6] = qual[46]; + list->qual[6] = qual[46]; if(!qual[57]) break; else if(qual[57] == -1) { @@ -2535,13 +2535,13 @@ do { memset(pt1,0,sizeof(Tetra)); qual[57] = 0; break; - } + } qual[57] = caltab[0]; qual[58] = caltab[1]; } list->qual[7] = qual[57]; - list->qual[8] = qual[58]; - + list->qual[8] = qual[58]; + pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s3; @@ -2552,14 +2552,14 @@ do { memset(pt1,0,sizeof(Tetra)); qual[69] = 0; break; - } + } qual[69] = caltab[0]; qual[70] = caltab[1]; list->qual[9] = qual[69]; - list->qual[10] = qual[70]; + list->qual[10] = qual[70]; MMG_swpptr = MMG_swap710_27; memset(pt1,0,sizeof(Tetra)); - return(97); + return(97); } while(0); /*cas 28*/ @@ -2576,13 +2576,13 @@ do { memset(pt1,0,sizeof(Tetra)); qual[19] = 0; break; - } + } qual[19] = caltab[0]; qual[20] = caltab[1]; } list->qual[1] = qual[19]; list->qual[2] = qual[20]; - + if(!qual[21]) break; else if(qual[21] == -1) { pt1 = &mesh->tetra[0]; @@ -2598,7 +2598,7 @@ do { } qual[21] = caltab[0]; qual[22] = caltab[1]; - } + } list->qual[3] = qual[21]; list->qual[4] = qual[22]; @@ -2614,7 +2614,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; } @@ -2622,7 +2622,7 @@ do { list->qual[6] = qual[30]; if(!qual[53]) break; - else if(qual[53] == -1) { + else if(qual[53] == -1) { pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s3; @@ -2633,12 +2633,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[53] = 0; break; - } + } qual[53] = caltab[0]; qual[54] = caltab[1]; } list->qual[7] = qual[53]; - list->qual[8] = qual[54]; + list->qual[8] = qual[54]; if(!qual[57]) break; else if(qual[57] == -1) { @@ -2652,16 +2652,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[57] = 0; break; - } + } qual[57] = caltab[0]; qual[58] = caltab[1]; } list->qual[9] = qual[57]; - list->qual[10] = qual[58]; + list->qual[10] = qual[58]; MMG_swpptr = MMG_swap710_28; memset(pt1,0,sizeof(Tetra)); - return(98); + return(98); } while(0); /*cas 29*/ @@ -2681,10 +2681,10 @@ do { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[1] = qual[13]; list->qual[2] = qual[14]; - + if(!qual[15]) break; else if(qual[15] == -1) { pt1 = &mesh->tetra[0]; @@ -2697,7 +2697,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[15] = 0; break; - } + } qual[15] = caltab[0]; qual[16] = caltab[1]; } @@ -2716,7 +2716,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; } @@ -2724,7 +2724,7 @@ do { list->qual[6] = qual[30]; if(!qual[53]) break; - else if(qual[53] == -1) { + else if(qual[53] == -1) { pt1 = &mesh->tetra[0]; pt1->v[0] = ia; pt1->v[1] = s3; @@ -2735,12 +2735,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[53] = 0; break; - } + } qual[53] = caltab[0]; qual[54] = caltab[1]; } list->qual[7] = qual[53]; - list->qual[8] = qual[54]; + list->qual[8] = qual[54]; if(!qual[57]) break; else if(qual[57] == -1) { @@ -2754,16 +2754,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[57] = 0; break; - } + } qual[57] = caltab[0]; qual[58] = caltab[1]; } list->qual[9] = qual[57]; - list->qual[10] = qual[58]; + list->qual[10] = qual[58]; MMG_swpptr = MMG_swap710_29; memset(pt1,0,sizeof(Tetra)); - return(99); + return(99); } while(0); /*cas 30*/ @@ -2783,7 +2783,7 @@ do { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[1] = qual[13]; list->qual[2] = qual[14]; @@ -2799,7 +2799,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; } @@ -2818,12 +2818,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } list->qual[5] = qual[37]; - list->qual[6] = qual[38]; + list->qual[6] = qual[38]; if(!qual[55]) break; else if(qual[55] == -1) { @@ -2837,13 +2837,13 @@ do { memset(pt1,0,sizeof(Tetra)); qual[55] = 0; break; - } + } qual[55] = caltab[0]; qual[56] = caltab[1]; } list->qual[8] = qual[55]; - list->qual[9] = qual[56]; - + list->qual[9] = qual[56]; + if(!qual[57]) break; else if(qual[57] == -1) { pt1 = &mesh->tetra[0]; @@ -2856,16 +2856,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[57] = 0; break; - } + } qual[57] = caltab[0]; qual[58] = caltab[1]; } list->qual[9] = qual[57]; - list->qual[10] = qual[58]; - + list->qual[10] = qual[58]; + MMG_swpptr = MMG_swap710_30; memset(pt1,0,sizeof(Tetra)); - return(100); + return(100); } while(0); /*cas 31*/ @@ -2882,7 +2882,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[19] = 0; break; - } + } qual[19] = caltab[0]; qual[20] = caltab[1]; } @@ -2904,7 +2904,7 @@ do { } qual[21] = caltab[0]; qual[22] = caltab[1]; - } + } list->qual[3] = qual[21]; list->qual[4] = qual[22]; @@ -2920,7 +2920,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } @@ -2939,7 +2939,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; } @@ -2956,15 +2956,15 @@ do { memset(pt1,0,sizeof(Tetra)); qual[59] = 0; break; - } + } qual[59] = caltab[0]; qual[60] = caltab[1]; list->qual[9] = qual[59]; list->qual[10] = qual[60]; - + MMG_swpptr = MMG_swap710_31; memset(pt1,0,sizeof(Tetra)); - return(101); + return(101); } while(0); /*cas 32*/ @@ -2984,10 +2984,10 @@ do { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[1] = qual[13]; list->qual[2] = qual[14]; - + if(!qual[15]) break; else if(qual[15] == -1) { pt1 = &mesh->tetra[0]; @@ -3000,7 +3000,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[15] = 0; break; - } + } qual[15] = caltab[0]; qual[16] = caltab[1]; } @@ -3019,7 +3019,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } @@ -3038,13 +3038,13 @@ do { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; } list->qual[7] = qual[29]; list->qual[8] = qual[30]; - + if(!qual[59]) break; else if(qual[59] == -1) { pt1 = &mesh->tetra[0]; @@ -3057,16 +3057,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[59] = 0; break; - } + } qual[59] = caltab[0]; qual[60] = caltab[1]; } list->qual[9] = qual[59]; list->qual[10] = qual[60]; - + MMG_swpptr = MMG_swap710_32; memset(pt1,0,sizeof(Tetra)); - return(102); + return(102); } while(0); /*cas 33*/ @@ -3090,10 +3090,10 @@ do { } qual[7] = caltab[0]; qual[8] = caltab[1]; - } + } list->qual[3] = qual[7]; list->qual[4] = qual[8]; - + if(!qual[9]) break; else if(qual[9] == -1) { pt1 = &mesh->tetra[0]; @@ -3109,7 +3109,7 @@ do { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[5] = qual[9]; list->qual[6] = qual[10]; @@ -3125,12 +3125,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } list->qual[7] = qual[37]; - list->qual[8] = qual[38]; + list->qual[8] = qual[38]; pt1 = &mesh->tetra[0]; pt1->v[0] = ia; @@ -3142,7 +3142,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[61] = 0; break; - } + } qual[61] = caltab[0]; qual[62] = caltab[1]; list->qual[9] = qual[61]; @@ -3150,7 +3150,7 @@ do { MMG_swpptr = MMG_swap710_33; memset(pt1,0,sizeof(Tetra)); - return(103); + return(103); } while(0); /*cas 34*/ @@ -3170,10 +3170,10 @@ do { } qual[7] = caltab[0]; qual[8] = caltab[1]; - } + } list->qual[1] = qual[7]; list->qual[2] = qual[8]; - + if(!qual[9]) break; else if(qual[9] == -1) { pt1 = &mesh->tetra[0]; @@ -3189,7 +3189,7 @@ do { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[3] = qual[9]; list->qual[4] = qual[10]; @@ -3205,12 +3205,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } list->qual[5] = qual[37]; - list->qual[6] = qual[38]; + list->qual[6] = qual[38]; if(!qual[39]) break; else if(qual[39] == -1) { @@ -3224,7 +3224,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[39] = 0; break; - } + } qual[39] = caltab[0]; qual[40] = caltab[1]; } @@ -3241,15 +3241,15 @@ do { memset(pt1,0,sizeof(Tetra)); qual[63] = 0; break; - } + } qual[63] = caltab[0]; qual[64] = caltab[1]; list->qual[9] = qual[63]; list->qual[10] = qual[64]; - + MMG_swpptr = MMG_swap710_34; memset(pt1,0,sizeof(Tetra)); - return(104); + return(104); } while(0); /*cas 35*/ @@ -3269,10 +3269,10 @@ do { } qual[7] = caltab[0]; qual[8] = caltab[1]; - } + } list->qual[1] = qual[7]; list->qual[2] = qual[8]; - + if(!qual[9]) break; else if(qual[9] == -1) { pt1 = &mesh->tetra[0]; @@ -3288,7 +3288,7 @@ do { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[3] = qual[9]; list->qual[4] = qual[10]; @@ -3304,7 +3304,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } @@ -3323,7 +3323,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[35] = 0; break; - } + } qual[35] = caltab[0]; qual[36] = caltab[1]; } @@ -3342,16 +3342,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[63] = 0; break; - } + } qual[63] = caltab[0]; qual[64] = caltab[1]; } list->qual[9] = qual[63]; list->qual[10] = qual[64]; - + MMG_swpptr = MMG_swap710_35; memset(pt1,0,sizeof(Tetra)); - return(105); + return(105); } while(0); /*cas 36*/ @@ -3378,7 +3378,7 @@ do { } list->qual[3] = qual[11]; list->qual[4] = qual[12]; - + if(!qual[13]) break; else if(qual[13] == -1) { pt1 = &mesh->tetra[0]; @@ -3394,7 +3394,7 @@ do { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[5] = qual[13]; list->qual[6] = qual[14]; @@ -3410,13 +3410,13 @@ do { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } list->qual[7] = qual[37]; list->qual[8] = qual[38]; - + if(!qual[61]) break; else if(qual[61] == -1) { pt1 = &mesh->tetra[0]; @@ -3429,16 +3429,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[61] = 0; break; - } + } qual[61] = caltab[0]; qual[62] = caltab[1]; } list->qual[9] = qual[61]; - list->qual[10] = qual[62]; - + list->qual[10] = qual[62]; + MMG_swpptr = MMG_swap710_36; memset(pt1,0,sizeof(Tetra)); - return(106); + return(106); } while(0); /*cas 37*/ @@ -3461,7 +3461,7 @@ do { } list->qual[1] = qual[11]; list->qual[2] = qual[12]; - + if(!qual[13]) break; else if(qual[13] == -1) { pt1 = &mesh->tetra[0]; @@ -3477,10 +3477,10 @@ do { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[3] = qual[13]; list->qual[4] = qual[14]; - + if(!qual[37]) break; else if(qual[37] == -1) { pt1 = &mesh->tetra[0]; @@ -3493,7 +3493,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } @@ -3512,7 +3512,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[39] = 0; break; - } + } qual[39] = caltab[0]; qual[40] = caltab[1]; } @@ -3531,16 +3531,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[63] = 0; break; - } + } qual[63] = caltab[0]; qual[64] = caltab[1]; } list->qual[9] = qual[63]; list->qual[10] = qual[64]; - + MMG_swpptr = MMG_swap710_37; memset(pt1,0,sizeof(Tetra)); - return(107); + return(107); } while(0); /*cas 38*/ @@ -3563,7 +3563,7 @@ do { } list->qual[1] = qual[11]; list->qual[2] = qual[12]; - + if(!qual[13]) break; else if(qual[13] == -1) { pt1 = &mesh->tetra[0]; @@ -3579,7 +3579,7 @@ do { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[3] = qual[13]; list->qual[4] = qual[14]; @@ -3595,7 +3595,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } @@ -3614,7 +3614,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[35] = 0; break; - } + } qual[35] = caltab[0]; qual[36] = caltab[1]; } @@ -3633,16 +3633,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[63] = 0; break; - } + } qual[63] = caltab[0]; qual[64] = caltab[1]; } list->qual[9] = qual[63]; list->qual[10] = qual[64]; - + MMG_swpptr = MMG_swap710_38; memset(pt1,0,sizeof(Tetra)); - return(108); + return(108); } while(0); /*cas 39*/ @@ -3662,7 +3662,7 @@ do { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[1] = qual[13]; list->qual[2] = qual[14]; @@ -3678,13 +3678,13 @@ do { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; } list->qual[3] = qual[29]; list->qual[4] = qual[30]; - + if(!qual[37]) break; else if(qual[37] == -1) { pt1 = &mesh->tetra[0]; @@ -3697,12 +3697,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } list->qual[5] = qual[37]; - list->qual[6] = qual[38]; + list->qual[6] = qual[38]; if(!qual[39]) break; else if(qual[39] == -1) { @@ -3716,7 +3716,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[39] = 0; break; - } + } qual[39] = caltab[0]; qual[40] = caltab[1]; } @@ -3733,15 +3733,15 @@ do { memset(pt1,0,sizeof(Tetra)); qual[65] = 0; break; - } + } qual[65] = caltab[0]; - qual[66] = caltab[1]; + qual[66] = caltab[1]; list->qual[9] = qual[65]; list->qual[10] = qual[66]; - + MMG_swpptr = MMG_swap710_39; memset(pt1,0,sizeof(Tetra)); - return(109); + return(109); } while(0); /*cas 40*/ @@ -3761,7 +3761,7 @@ do { } qual[13] = caltab[0]; qual[14] = caltab[1]; - } + } list->qual[1] = qual[13]; list->qual[2] = qual[14]; @@ -3777,7 +3777,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[25] = 0; break; - } + } qual[25] = caltab[0]; qual[26] = caltab[1]; } @@ -3796,7 +3796,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[29] = 0; break; - } + } qual[29] = caltab[0]; qual[30] = caltab[1]; } @@ -3815,7 +3815,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[35] = 0; break; - } + } qual[35] = caltab[0]; qual[36] = caltab[1]; } @@ -3834,16 +3834,16 @@ do { memset(pt1,0,sizeof(Tetra)); qual[65] = 0; break; - } + } qual[65] = caltab[0]; - qual[66] = caltab[1]; + qual[66] = caltab[1]; } list->qual[9] = qual[65]; list->qual[10] = qual[66]; MMG_swpptr = MMG_swap710_40; memset(pt1,0,sizeof(Tetra)); - return(110); + return(110); } while(0); /*cas 41*/ @@ -3867,7 +3867,7 @@ do { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[3] = qual[9]; list->qual[4] = qual[10]; @@ -3886,7 +3886,7 @@ do { } qual[21] = caltab[0]; qual[22] = caltab[1]; - } + } list->qual[5] = qual[21]; list->qual[6] = qual[22]; @@ -3902,7 +3902,7 @@ do { memset(pt1,0,sizeof(Tetra)); qual[45] = 0; break; - } + } qual[45] = caltab[0]; qual[46] = caltab[1]; } @@ -3919,15 +3919,15 @@ do { memset(pt1,0,sizeof(Tetra)); qual[67] = 0; break; - } + } qual[67] = caltab[0]; qual[68] = caltab[1]; list->qual[9] = qual[67]; list->qual[10] = qual[68]; - + MMG_swpptr = MMG_swap710_41; memset(pt1,0,sizeof(Tetra)); - return(111); + return(111); } while(0); /*cas 42*/ @@ -3951,7 +3951,7 @@ do { } qual[9] = caltab[0]; qual[10] = caltab[1]; - } + } list->qual[3] = qual[9]; list->qual[4] = qual[10]; @@ -3967,12 +3967,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[37] = 0; break; - } + } qual[37] = caltab[0]; qual[38] = caltab[1]; } list->qual[5] = qual[37]; - list->qual[6] = qual[38]; + list->qual[6] = qual[38]; if(!qual[43]) break; else if(qual[43] == -1) { @@ -3986,12 +3986,12 @@ do { memset(pt1,0,sizeof(Tetra)); qual[43] = 0; break; - } + } qual[43] = caltab[0]; qual[44] = caltab[1]; } list->qual[7] = qual[43]; - list->qual[8] = qual[44]; + list->qual[8] = qual[44]; if(!qual[67]) break; else if(qual[67] == -1) { @@ -4005,17 +4005,17 @@ do { memset(pt1,0,sizeof(Tetra)); qual[67] = 0; break; - } + } qual[67] = caltab[0]; qual[68] = caltab[1]; } list->qual[9] = qual[67]; list->qual[10] = qual[68]; - + MMG_swpptr = MMG_swap710_42; memset(pt1,0,sizeof(Tetra)); return(112); } while(0); - + return(0); } diff --git a/contrib/onelab/OnelabClients.cpp b/contrib/onelab/OnelabClients.cpp index 0952733e1a14996b0f92fc2dc7f7d8f911397826..d1c9564eff32914aea82381cc7f847be4424549f 100644 --- a/contrib/onelab/OnelabClients.cpp +++ b/contrib/onelab/OnelabClients.cpp @@ -1317,7 +1317,7 @@ bool chmod(std::string fileName){ struct stat info; stat(fileName.c_str(), &info); // chmod u=rwx - if (chmod(fileName.c_str(), S_IRWXU) != 0){ + if (chmod(fileName.c_str(), 0000700) != 0){ perror("chmod() error"); return false; }