From 113e6d14fdb527a976c8de71b80506ac9a6777e4 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 24 Mar 2006 21:37:14 +0000 Subject: [PATCH] fix crash + cleanup jf's msg --- Mesh/Print_Mesh.cpp | 6 ++--- Mesh/Read_Mesh.cpp | 56 ++++++++++++++++++++++----------------------- doc/TODO | 9 +++++++- 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/Mesh/Print_Mesh.cpp b/Mesh/Print_Mesh.cpp index 1dbd9819b8..19fbf65539 100644 --- a/Mesh/Print_Mesh.cpp +++ b/Mesh/Print_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Print_Mesh.cpp,v 1.71 2006-03-09 13:06:52 remacle Exp $ +// $Id: Print_Mesh.cpp,v 1.72 2006-03-24 21:37:14 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -566,12 +566,12 @@ static void _get_all_model_points ( std::list<Vertex*> &mp ) List_Read(curves, i, &c); if (c->Num >=0) { - if (points.find(c->beg) == points.end()) + if (c->beg && points.find(c->beg) == points.end()) { points.insert(c->beg); mp.push_back(c->beg); } - if (points.find(c->end) == points.end()) + if (c->end && points.find(c->end) == points.end()) { points.insert(c->end); mp.push_back(c->end); diff --git a/Mesh/Read_Mesh.cpp b/Mesh/Read_Mesh.cpp index a8dfccf177..c26fc82d19 100644 --- a/Mesh/Read_Mesh.cpp +++ b/Mesh/Read_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Read_Mesh.cpp,v 1.100 2006-03-19 20:34:14 geuzaine Exp $ +// $Id: Read_Mesh.cpp,v 1.101 2006-03-24 21:37:14 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -231,7 +231,8 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp) if(feof(fp)) break; - Msg(INFO, "%s\n", &String[1]); + Msg(INFO, "%s", &String[1]); + /* F o r m a t */ if(!strncmp(&String[1], "MeshFormat", 10)) { @@ -276,21 +277,20 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp) /* NODE'S PROCESSORS */ - else if(!strncmp(&String[1], "PARA", 4)) - { - fscanf(fp, "%d", &Nbr_Nodes); - Msg(INFO,"%d parallel nodes\n",Nbr_Nodes); - for(i_Node = 0; i_Node < Nbr_Nodes; i_Node++) { - int nbProc; - fscanf(fp, "%d %d",&Num, &nbProc); - for (int iProc=0;iProc<nbProc;iProc++) - { - int iProcNum; - fscanf(fp, "%d",&iProcNum); - nod2proc.insert(std::pair<int, int>(Num,iProcNum )); - } + else if(!strncmp(&String[1], "PARA", 4)){ + fscanf(fp, "%d", &Nbr_Nodes); + Msg(INFO, "%d parallel nodes", Nbr_Nodes); + for(i_Node = 0; i_Node < Nbr_Nodes; i_Node++) { + int nbProc; + fscanf(fp, "%d %d", &Num, &nbProc); + for (int iProc = 0; iProc < nbProc; iProc++){ + int iProcNum; + fscanf(fp, "%d", &iProcNum); + nod2proc.insert(std::pair<int, int>(Num, iProcNum)); } } + } + /* NODES */ else if(!strncmp(&String[1], "NOD", 3) || @@ -377,16 +377,14 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp) } } - for(j = 0; j < Nbr_Nodes; j++) - { - fscanf(fp, "%d", &verts[j].Num); - } - - if (nod2proc.size()) - { - Partition = getPartition ( nod2proc ,Nbr_Nodes , verts ); - } - + for(j = 0; j < Nbr_Nodes; j++){ + fscanf(fp, "%d", &verts[j].Num); + } + + if (nod2proc.size()){ + Partition = getPartition ( nod2proc ,Nbr_Nodes , verts ); + } + for(i = 0; i < Nbr_Nodes; i++) { vertsp[i] = &verts[i]; if(!(vertspp = (Vertex **) Tree_PQuery(M->Vertices, &vertsp[i]))) @@ -935,10 +933,10 @@ void Read_Mesh_SMS(Mesh * m, FILE * in) v4 = myS2->V[hh]; } if(!v1 || !v2 || !v3 || !v4) { - Msg(GERROR, "%d\n", NbFacesOnRegion); - Msg(GERROR, "%p %p %p %p\n", v1, v2, v3, v4); - Msg(GERROR, "%p %p %p \n", myS1->V[0], myS1->V[1], myS1->V[2]); - Msg(GERROR, "%p %p %p \n", myS2->V[0], myS2->V[1], myS2->V[2]); + Msg(GERROR, "%d", NbFacesOnRegion); + Msg(GERROR, "%p %p %p %p", v1, v2, v3, v4); + Msg(GERROR, "%p %p %p", myS1->V[0], myS1->V[1], myS1->V[2]); + Msg(GERROR, "%p %p %p", myS2->V[0], myS2->V[1], myS2->V[2]); return; } Simplex *s = Create_Simplex(v1, v2, v3, v4); diff --git a/doc/TODO b/doc/TODO index ac9b719beb..8ddc5a28d3 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,4 +1,11 @@ -$Id: TODO,v 1.2 2006-03-12 14:52:29 geuzaine Exp $ +$Id: TODO,v 1.3 2006-03-24 21:37:14 geuzaine Exp $ + +******************************************************************** + +if we try to mesh a surface from a single discrete curve mesh read +from a .msh file we get a "non contour" error in Mesh_2D (since we +List_Insert the vertices in c->Vertices, thus never having +last==first) ******************************************************************** -- GitLab