From 6228da72d4a6d7d647011c2b348bd86f1ce719ed Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 1 Aug 2001 18:01:04 +0000 Subject: [PATCH] coherence of surface mesh in extrusion --- Mesh/3D_Extrude.cpp | 54 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/Mesh/3D_Extrude.cpp b/Mesh/3D_Extrude.cpp index 87eb187684..60c08f64d6 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; } -- GitLab