diff --git a/Mesh/3D_Extrude.cpp b/Mesh/3D_Extrude.cpp index 87eb187684ce6bf99c07919b685dd8ec4962b56f..60c08f64d6f464d4fe260ce0e26c619ef8346b2d 100644 --- a/Mesh/3D_Extrude.cpp +++ b/Mesh/3D_Extrude.cpp @@ -1,4 +1,4 @@ -// $Id: 3D_Extrude.cpp,v 1.14 2001-08-01 15:52:33 geuzaine Exp $ +// $Id: 3D_Extrude.cpp,v 1.15 2001-08-01 18:01:04 geuzaine Exp $ #include "Gmsh.h" #include "Const.h" @@ -412,9 +412,11 @@ void Extrude_Seg (Vertex * V1, Vertex * V2){ if (are_exist (v3, v2, Tree_Ares)){ s = Create_Simplex (v3, v2, v1, NULL); s->iEnt = THES->Num; + s->Num = -s->Num; //Trick to tag triangles to re-extrude! Tree_Add (THES->Simplexes, &s); s = Create_Simplex (v3, v4, v2, NULL); s->iEnt = THES->Num; + s->Num = -s->Num; //Trick to tag triangles to re-extrude! Tree_Add (THES->Simplexes, &s); } else{ @@ -422,9 +424,11 @@ void Extrude_Seg (Vertex * V1, Vertex * V2){ are_cree (v1, v4, Tree_Ares); s = Create_Simplex (v3, v4, v1, NULL); s->iEnt = THES->Num; + s->Num = -s->Num; //Trick to tag triangles to re-extrude! Tree_Add (THES->Simplexes, &s); s = Create_Simplex (v1, v4, v2, NULL); s->iEnt = THES->Num; + s->Num = -s->Num; //Trick to tag triangles to re-extrude! Tree_Add (THES->Simplexes, &s); } } @@ -635,6 +639,25 @@ int Extrude_Mesh (Surface * s){ } +static Tree_T* tmp; +void Free_NegativeSimplex (void *a, void *b){ + Simplex *s = *(Simplex**)a; + if(s){ + if(s->Num>=0){ + Tree_Add (tmp, &s); + } + else{ + delete s; + s = NULL; + } + } +} + +void Untag_NegativeSimplex (void *a, void *b){ + Simplex *s = *(Simplex**)a; + if(s && s->Num<0) s->Num = -s->Num; +} + int Extrude_Mesh (Volume * v){ int i, j; Surface *ss; @@ -690,17 +713,24 @@ int Extrude_Mesh (Volume * v){ // so that now, the surface mesh is ok (edge swapping is easy in 2d). // cretainly not the most efficient way to do it but it seems to work - // but it doesn't :-( - /* - for (i = 0; i < List_Nbr (v->Surfaces); i++) - { - List_Read (v->Surfaces, i, &ss); - Tree_Action(ss->Simplexes, Free_Simplex); - Tree_Delete(ss->Simplexes); - ss->Simplexes = Tree_Create (sizeof (Simplex *), compareQuality); - Extrude_Mesh(ss); - } - */ + // j'ai rajoute un truc assez horrible pour ne pas supprimer les + // tri/qua qui ne doivent pas l'etre, i.e. tous ceux qui ne sont + // pas crees par l'extrusion. Je les tagge avec un numero negatif + // (qu'ils garderont si on ne maille pas en 3d...). + + for (i = 0; i < List_Nbr (v->Surfaces); i++){ + List_Read (v->Surfaces, i, &ss); + tmp = Tree_Create (sizeof (Simplex *), compareQuality); + Tree_Action(ss->Simplexes, Free_NegativeSimplex); + Tree_Delete(ss->Simplexes); + ss->Simplexes = tmp; + Extrude_Mesh(ss); + } + + for (i = 0; i < List_Nbr (v->Surfaces); i++){ + List_Read (v->Surfaces, i, &ss); + Tree_Action(ss->Simplexes, Untag_NegativeSimplex); + } return true; }