Skip to content
Snippets Groups Projects
Commit 6228da72 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

coherence of surface mesh in extrusion

parent f3674f84
No related branches found
No related tags found
No related merge requests found
// $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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment