From 9309b7023078df5e172d1e3c2165c88d2ac00d16 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 3 Mar 2004 22:26:34 +0000 Subject: [PATCH] I forgot to commit these last week: it's just the beginning of some cleanup of the old 2D algorithm (removed non-functional voronoi insertion, fixed a couple of memory leaks, added some comments, etc.) --- Mesh/2D_Links.cpp | 38 +------ Mesh/2D_Mesh.cpp | 208 +++++++------------------------------- Mesh/2D_Mesh.h | 2 - Mesh/2D_Tree.cpp | 17 ++-- Mesh/2D_Util.cpp | 250 ++-------------------------------------------- Mesh/Mesh.h | 10 +- 6 files changed, 58 insertions(+), 467 deletions(-) diff --git a/Mesh/2D_Links.cpp b/Mesh/2D_Links.cpp index ce7c979df7..703a91a162 100644 --- a/Mesh/2D_Links.cpp +++ b/Mesh/2D_Links.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Links.cpp,v 1.17 2004-02-07 01:40:20 geuzaine Exp $ +// $Id: 2D_Links.cpp,v 1.18 2004-03-03 22:26:33 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -23,9 +23,10 @@ #include "Numeric.h" #include "Mesh.h" #include "2D_Mesh.h" +#include "Context.h" +extern Context_T CTX; extern PointRecord *gPointArray; -extern int LocalNewPoint; extern DocRecord *FGMESH; extern PointNumero First(PointNumero x); @@ -63,7 +64,7 @@ PointNumero *ConvertDlistToArray(DListPeek * dlist, int *n) max++; p = Pred(p); } while(p != *dlist); - ptr = (PointNumero *) Malloc((int)((max + 1) * sizeof(PointNumero))); + ptr = (PointNumero *) Malloc((max + 1) * sizeof(PointNumero)); if(ptr == NULL) return NULL; p = *dlist; @@ -96,7 +97,7 @@ int Conversion(DocPeek doc) gPointArray = doc->points; n = doc->numPoints; - striangle = (Striangle *) Malloc((int)(n * sizeof(Striangle))); + striangle = (Striangle *) Malloc(n * sizeof(Striangle)); count2 = (int)CountPointsOnHull(n, doc->points); /* nombre de triangles que l'on doit obtenir */ @@ -259,40 +260,11 @@ int CreateLinks(List_T * ListDelaunay, int NumDelaunay, if(!PtInTriangle(pt, del_Pi->t.a, del_Pi->t.b, del_Pi->t.c)) { if(!Find_Triangle(pt, FGMESH, A_TOUT_PRIX)) { - if(LocalNewPoint == VORONOI_INSERT) { - del_Pi->t.position = ACCEPTED; - } del_Pi->t.quality_value /= 1000.; } } } } - if((LocalNewPoint == VORONOI_INSERT)) { - for(i = 0; i < NumDelaunay; i++) { - del_Pi = *(Delaunay **) List_Pointer(ListDelaunay, i); - if(((del_Pi->t.position == NONACCEPTED) - || (del_Pi->t.position == INTERN)) && (del_Pi->t.info == TOLINK)) { - if((del_Pi->v.voisin1 == NULL) || (del_Pi->v.voisin2 == NULL) - || (del_Pi->v.voisin3 == NULL)) { - del_Pi->t.position = ACTIF; - } - else if((del_Pi->v.voisin1->t.position == ACCEPTED) && - (del_Pi->v.voisin2->t.position == ACCEPTED) && - (del_Pi->v.voisin3->t.position == ACCEPTED)) { - del_Pi->t.position = ACCEPTED; - } - else if((del_Pi->v.voisin1->t.position == ACCEPTED) || - (del_Pi->v.voisin2->t.position == ACCEPTED) || - (del_Pi->v.voisin3->t.position == ACCEPTED)) { - del_Pi->t.position = ACTIF; - } - else { - del_Pi->t.position = WAITING; - } - } - } - } - return (1); } diff --git a/Mesh/2D_Mesh.cpp b/Mesh/2D_Mesh.cpp index c4e3cc73ba..e3c91cd556 100644 --- a/Mesh/2D_Mesh.cpp +++ b/Mesh/2D_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Mesh.cpp,v 1.52 2004-02-28 00:48:49 geuzaine Exp $ +// $Id: 2D_Mesh.cpp,v 1.53 2004-03-03 22:26:33 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -19,21 +19,6 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. -/* - Maillage Delaunay d'une surface (Point insertion Technique) - - 3 types de maillages sont proposes - - Center of circum circle point insertion - - Voronoi Point Insertion (la meilleure en general) - - G Point insertion (intermediaire) - - Le maillage surfacique passe par la determination d'un plan - dont on minimise l'ecart au sens des moindes carres par rap- - port a la surface : - plan ax + bx + cz = 1 - tangeante = t = (a,b,c) -*/ - #include "Gmsh.h" #include "Numeric.h" #include "Geo.h" @@ -49,7 +34,7 @@ extern Context_T CTX; PointRecord *gPointArray; DocRecord *BGMESH, *FGMESH; -int LocalNewPoint, is_3D = 0; +int is_3D = 0; double LC2D; static Surface *THESURFACE, *THESUPPORT; @@ -234,35 +219,21 @@ void PutVertex_OnSurf(void *a, void *b) /* remplis la structure Delaunay d'un triangle cree */ -Delaunay *testconv(avlptr * root, int *conv, DocRecord * ptr) +Delaunay *testconv(avlptr *root, int *conv, DocRecord * ptr) { - avlptr *proot; double qual; - Delaunay *pdel; - - proot = root; - - pdel = NULL; + Delaunay *pdel = NULL; *conv = 0; if(*root == NULL) *conv = 1; else { - pdel = findrightest(*proot, ptr); + pdel = findrightest(*root, ptr); qual = pdel->t.quality_value; - switch (LocalNewPoint) { - case CENTER_CIRCCIRC: - case BARYCENTER: - if(qual < CONV_VALUE) - *conv = 1; - break; - case VORONOI_INSERT: - if((*root) == NULL) - *conv = 1; - break; - } + if(qual < CONV_VALUE) + *conv = 1; } - return (pdel); + return pdel; } @@ -274,15 +245,14 @@ int mesh_domain(ContourPeek * ListContours, int numcontours, DocRecord docm, *doc; int conv, i, j, nump, numact, numlink, numkil, numaloc, numtri, numtrr, numtrwait; - Delaunay *del, *del_P, *deladd, **listdel; + Delaunay *del, *del_P, *deladd; PointNumero aa, bb, cc, a, b, c; DListPeek list, p, q; - avlptr *root, *proot, *root_w, *root_acc; + avlptr *root, *root_w; double volume_old, volume_new; root = (avlptr *) Malloc(sizeof(avlptr)); root_w = (avlptr *) Malloc(sizeof(avlptr)); - root_acc = (avlptr *) Malloc(sizeof(avlptr)); nump = 0; for(i = 0; i < numcontours; i++) @@ -364,7 +334,7 @@ int mesh_domain(ContourPeek * ListContours, int numcontours, /* initialisation de l'arbre */ - (*root) = (*root_w) = (*root_acc) = NULL; + (*root) = (*root_w) = NULL; int onlyinit = OnlyTheInitialMesh; @@ -377,29 +347,10 @@ int mesh_domain(ContourPeek * ListContours, int numcontours, for(i = 0; i < doc->numTriangles; i++) { if(doc->delaunay[i].t.position != EXTERN) { del = &doc->delaunay[i]; - switch (LocalNewPoint) { - case CENTER_CIRCCIRC: - case BARYCENTER: - Insert_Triangle(root, del); - break; - case VORONOI_INSERT: - switch (del->t.position) { - case ACTIF: - case INTERN: - Insert_Triangle(root, del); - break; - case WAITING: - Insert_Triangle(root_w, del); - break; - case ACCEPTED: - Insert_Triangle(root_acc, del); - break; - } - } + Insert_Triangle(root, del); } } - /* maillage proprement dit : 1) Les triangles sont tries dans l'arbre suivant leur qualite 2) on ajoute un noeud au c.g du plus mauvais @@ -430,17 +381,7 @@ int mesh_domain(ContourPeek * ListContours, int numcontours, Delete_Triangle(root, del); Delete_Triangle(root_w, del); del->t.quality_value /= 10.; - switch (LocalNewPoint) { - case CENTER_CIRCCIRC: - case BARYCENTER: - Insert_Triangle(root, del); - break; - case VORONOI_INSERT: - del->t.position = ACCEPTED; - Insert_Triangle(root_acc, del); - break; - } - + Insert_Triangle(root, del); numlink = numkil = 0; if(list != NULL) { p = list; @@ -489,17 +430,7 @@ int mesh_domain(ContourPeek * ListContours, int numcontours, Delete_Triangle(root, del); Delete_Triangle(root_w, del); del->t.quality_value /= 10.; - switch (LocalNewPoint) { - case CENTER_CIRCCIRC: - case BARYCENTER: - Insert_Triangle(root, del); - break; - case VORONOI_INSERT: - del->t.position = ACCEPTED; - Insert_Triangle(root_acc, del); - break; - } - + Insert_Triangle(root, del); numlink = numkil = 0; if(list != NULL) { p = list; @@ -518,28 +449,9 @@ int mesh_domain(ContourPeek * ListContours, int numcontours, for(i = 0; i < numkil; i++) { del_P = *(Delaunay **) List_Pointer(kill_L, i); - - switch (LocalNewPoint) { - case CENTER_CIRCCIRC: - case BARYCENTER: - Delete_Triangle(root, del_P); - break; - case VORONOI_INSERT: - switch (del_P->t.position) { - case WAITING: - Delete_Triangle(root_w, del_P); - break; - case ACTIF: - case INTERN: - Delete_Triangle(root, del_P); - break; - case ACCEPTED: - Delete_Triangle(root_acc, del_P); - break; - } - } + Delete_Triangle(root, del_P); // MEMORY_LEAK -JF - // Free(del_P); + // Free(del_P); } *numpoints = doc->numPoints; @@ -579,25 +491,7 @@ int mesh_domain(ContourPeek * ListContours, int numcontours, for(j = 0; j < i; j++) { del_P = *(Delaunay **) List_Pointer(del_L, j + numlink); - switch (LocalNewPoint) { - case CENTER_CIRCCIRC: - case BARYCENTER: - Insert_Triangle(root, del_P); - break; - case VORONOI_INSERT: - switch (del_P->t.position) { - case ACTIF: - case INTERN: - Insert_Triangle(root, del_P); - break; - case WAITING: - Insert_Triangle(root_w, del_P); - break; - case ACCEPTED: - Insert_Triangle(root_acc, del_P); - break; - } - } + Insert_Triangle(root, del_P); } del = testconv(root, &conv, doc); @@ -606,29 +500,17 @@ int mesh_domain(ContourPeek * ListContours, int numcontours, List_Delete(kill_L); - numtri = 0; numtrwait = 0; - - if(*root_w != NULL) { - proot = root_w; - avltree_count(*proot, &numtrwait); - } + if(*root_w != NULL) + avltree_count(*root_w, &numtrwait); numtrr = 0; + avltree_count(*root, &numtrr); - proot = root; - switch (LocalNewPoint) { - case VORONOI_INSERT: - proot = root_acc; - break; - } - avltree_count(*proot, &numtrr); + mai->listdel = (delpeek *) Malloc((numtrr + numtrwait + 1) * sizeof(delpeek)); - alloue_Mai_Del(mai, numtrr + numtrwait + 1, 100); - - listdel = mai->listdel; numtri = 0; - avltree_print(*proot, listdel, &numtri); + avltree_print(*root, mai->listdel, &numtri); if(numtrwait != 0) { numtri = 0; avltree_print(*root_w, (Delaunay **) del_L->array, &numtri); @@ -770,9 +652,7 @@ void Maillage_Automatique_VieuxCode(Surface * pS, Mesh * m, int ori) ver[2]->Num = gPointArray[d].initial; err = 0; for(j = 0; j < 3; j++) { - if((pp[j] = (Vertex **) Tree_PQuery(pS->Vertices, &ver[j]))) { - } - else { + if(!(pp[j] = (Vertex **) Tree_PQuery(pS->Vertices, &ver[j]))) { err = 1; Msg(GERROR, "Unknown vertex %d", ver[j]->Num); } @@ -797,7 +677,9 @@ void Maillage_Automatique_VieuxCode(Surface * pS, Mesh * m, int ori) } // MEMORY LEAK (JF) - // Free(M.listdel[i]); + //printf("%d %d %d\n", M.listdel[i]->t.a, M.listdel[i]->t.b, M.listdel[i]->t.c); + //xxxxFree(M.listdel[i]); + } Free(M.listdel); Free(gPointArray); @@ -819,8 +701,8 @@ void Make_Mesh_With_Points(DocRecord * ptr, PointRecord * Liste, void filldel(Delaunay * deladd, int aa, int bb, int cc, PointRecord * points, DocRecord * mesh) { - double qual, newqual, L; - MPoint pt2, pt4; + double qual, newqual; + MPoint pt2; Vertex *v, *dum; deladd->t.a = aa; @@ -875,31 +757,13 @@ void filldel(Delaunay * deladd, int aa, int bb, int cc, Free_Vertex(&v, 0); } - switch (LocalNewPoint) { - case CENTER_CIRCCIRC: - case BARYCENTER: - deladd->t.quality_value = - sqrt((deladd->t.xc - points[cc].where.h) * (deladd->t.xc - - points[cc].where.h) + - (deladd->t.yc - points[cc].where.v) * (deladd->t.yc - - points[cc].where.v) - ) / newqual; - deladd->t.position = INTERN; - break; - - case VORONOI_INSERT: - pt4.h = points[bb].where.h; - pt4.v = points[bb].where.v; - //pt3.h = .5 * (points[bb].where.h + points[cc].where.h); - //pt3.v = .5 * (points[bb].where.v + points[cc].where.v); - deladd->t.quality_value = myhypot(pt2.h - pt4.h, pt2.v - pt4.v); - L = newqual / deladd->t.quality_value; - if(L > 1.5) - deladd->t.position = ACCEPTED; - else - deladd->t.position = NONACCEPTED; - break; - } + deladd->t.quality_value = + sqrt((deladd->t.xc - points[cc].where.h) * (deladd->t.xc - + points[cc].where.h) + + (deladd->t.yc - points[cc].where.v) * (deladd->t.yc - + points[cc].where.v) + ) / newqual; + deladd->t.position = INTERN; } void ActionEndTheCurve(void *a, void *b) @@ -933,8 +797,6 @@ void Maillage_Surface(void *data, void *dum) THESUPPORT = s->Support; THESURFACE = s; - LocalNewPoint = CTX.mesh.point_insertion; - if(Tree_Nbr(s->Simplexes)) Tree_Delete(s->Simplexes); s->Simplexes = Tree_Create(sizeof(Simplex *), compareQuality); diff --git a/Mesh/2D_Mesh.h b/Mesh/2D_Mesh.h index be9af0c591..6d5d1ab6ee 100644 --- a/Mesh/2D_Mesh.h +++ b/Mesh/2D_Mesh.h @@ -58,8 +58,6 @@ int Delete_Triangle ( avlstruct **root, Delaunay * del ); int Insert_Point (MPoint pt, int *numpoints, int *numalloc, DocRecord *doc, DocRecord *BGM, int is3d); MPoint Localize (Delaunay * del , DocRecord *MESH); -void alloue_Mai_Pts(maillage *mai , int Nballoc , int incrAlloc); -void alloue_Mai_Del(maillage *mai , int Nballoc , int incrAlloc); void InitBricks (DocRecord *MESH); int PtInTriangle(MPoint p , PointNumero a , PointNumero b , PointNumero c); diff --git a/Mesh/2D_Tree.cpp b/Mesh/2D_Tree.cpp index 18e4bca701..12556f3a8a 100644 --- a/Mesh/2D_Tree.cpp +++ b/Mesh/2D_Tree.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Tree.cpp,v 1.12 2004-02-07 01:40:21 geuzaine Exp $ +// $Id: 2D_Tree.cpp,v 1.13 2004-03-03 22:26:34 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -23,7 +23,7 @@ #include "Mesh.h" #include "2D_Mesh.h" -/* BOUSILLE L'ARBRE TOTALEMENT (pas les donnees mais les liens) */ +// deletes the tree (*not* the data! only the links) int avltree_remove(avlstruct ** root) { @@ -51,8 +51,7 @@ int avltree_remove(avlstruct ** root) return delete_this_node; } - -/* INSERE UN NOEUD */ +// inserts a node int avltree_insert(avlstruct ** root, void *item, int (*fcmp) (void *a, void *b)) @@ -75,9 +74,7 @@ int avltree_insert(avlstruct ** root, void *item, return (1); } - - -/* EFFACE UN NOEUD */ +// deletes a node int avltree_delete(avlstruct ** root, void *item, int (*fcmp) (void *a, void *b)) @@ -100,6 +97,7 @@ int avltree_delete(avlstruct ** root, void *item, else if((cmpresult == 0)) { if(((*root)->right == NULL) && (&(*root)->left == NULL)) { Free(*root); + *root = NULL; return (1); } else if((*root)->right == NULL) { @@ -130,7 +128,7 @@ int avltree_delete(avlstruct ** root, void *item, } -/* compte le nombre d'elements d'un arbre */ +// counts the number of nodes void avltree_count(avlptr root, int *numtri) { @@ -143,8 +141,7 @@ void avltree_count(avlptr root, int *numtri) } } - -/* deroule l'arbre dans un vecteur */ +// unrolls the tree into a vector void avltree_print(avlptr root, Delaunay ** listdel, int *numtri) { diff --git a/Mesh/2D_Util.cpp b/Mesh/2D_Util.cpp index e2b9903f45..4f41511150 100644 --- a/Mesh/2D_Util.cpp +++ b/Mesh/2D_Util.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Util.cpp,v 1.21 2004-02-07 01:40:21 geuzaine Exp $ +// $Id: 2D_Util.cpp,v 1.22 2004-03-03 22:26:34 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -26,7 +26,6 @@ #include "Context.h" extern Context_T CTX; -extern int LocalNewPoint; extern PointRecord *gPointArray; extern Mesh *THEM; @@ -141,7 +140,6 @@ void findtree(avlptr root, double *qualm, Delaunay ** delf, DocRecord * MESH) } } - Delaunay *findrightest(avlptr root, DocRecord * MESH) { Delaunay *del, **dee; @@ -158,8 +156,6 @@ Delaunay *findrightest(avlptr root, DocRecord * MESH) del = (Delaunay *) (exroot)->treedata; pt.h = del->t.xc; pt.v = del->t.yc; - if((LocalNewPoint == VORONOI_INSERT) || (LocalNewPoint == SQUARE_TRI)) - return del; if(Find_Triangle(pt, MESH, A_TOUT_PRIX) != NULL) return del; @@ -174,247 +170,21 @@ Delaunay *findrightest(avlptr root, DocRecord * MESH) return (del); } -double lengthseg(MPoint a, MPoint b) -{ - return (pow(DSQR(a.h - b.h) + DSQR(a.v - b.v), 0.5)); -} - - MPoint Localize(Delaunay * del, DocRecord * MESH) { - /* - Routine de localisation du point a inserer. - Variable globale LocalNewPoint : - - CENTER_CIRCCIRC : au centre du cercle circonscrit - - VORONOI_INSERT : sur une branche de voronoi - - BARYCENTER : au centre de gravite - - SQUARE_TRI : essaie de creer des triangles rectangles isoceles - dans le but de mailler avec des quadrangles - */ - - MPoint pt, pta, ptb, ptc, ptm; - PointNumero a = 0, b = 0; - double p, q, val, vec[2], ro, rm; - Delaunay *v1, *v2, *v3, *del2 = NULL; - - switch (LocalNewPoint) { - - case (CENTER_CIRCCIRC): - - pt.h = del->t.xc; - pt.v = del->t.yc; - - return (pt); - - case (BARYCENTER): + MPoint pt; + switch (CTX.mesh.point_insertion) { + case BARYCENTER: pt.h = (gPointArray[del->t.a].where.h + gPointArray[del->t.b].where.h + gPointArray[del->t.c].where.h) / 3.; pt.v = (gPointArray[del->t.a].where.v + gPointArray[del->t.b].where.v + gPointArray[del->t.c].where.v) / 3.; - - return (pt); - - case (VORONOI_INSERT): - case (SQUARE_TRI): - - /* - si le triangle est pres d'un bord -> ce bord est l'arete choisie - */ - if((v1 = del->v.voisin1) == NULL) { - /* v1 == NULL; */ - v2 = del->v.voisin2; - v3 = del->v.voisin3; - } - else if((v2 = del->v.voisin2) == NULL) { - v1 = NULL; - v2 = del->v.voisin1; - v3 = del->v.voisin3; - } - else if((v3 = del->v.voisin3) == NULL) { - v1 = NULL; - v2 = del->v.voisin1; - v3 = del->v.voisin2; - } - else { - v1 = del->v.voisin1; - v2 = del->v.voisin2; - v3 = del->v.voisin3; - } - - /* - Si l'arete est un bord -> - */ - if(v1 == NULL) { - - if((v2 != NULL) && (v3 != NULL)) { - - if(((del->t.a == v2->t.a) || (del->t.a == v2->t.b) - || (del->t.a == v2->t.c)) && ((del->t.a == v3->t.a) - || (del->t.a == v3->t.b) - || (del->t.a == v3->t.c))) { - a = del->t.b; - b = del->t.c; - } - else - if(((del->t.b == v2->t.a) || (del->t.b == v2->t.b) - || (del->t.b == v2->t.c)) && ((del->t.b == v3->t.a) - || (del->t.b == v3->t.b) - || (del->t.b == v3->t.c))) { - a = del->t.a; - b = del->t.c; - } - else - if(((del->t.c == v2->t.a) || (del->t.c == v2->t.b) - || (del->t.c == v2->t.c)) && ((del->t.c == v3->t.a) - || (del->t.c == v3->t.b) - || (del->t.c == v3->t.c))) { - a = del->t.a; - b = del->t.b; - } - else { - Msg(GERROR, "Voronoi insert 1"); - } - } - else if(v2 != NULL) { - if((del->t.a != v2->t.c) && (del->t.a != v2->t.c) - && (del->t.a != v2->t.c)) { - a = del->t.a; - b = del->t.b; - } - else if((del->t.b != v2->t.c) && (del->t.b != v2->t.c) - && (del->t.b != v2->t.c)) { - a = del->t.b; - b = del->t.c; - } - else if((del->t.c != v2->t.c) && (del->t.c != v2->t.c) - && (del->t.c != v2->t.c)) { - a = del->t.a; - b = del->t.c; - } - else { - Msg(GERROR, "Voronoi insert 2"); - } - } - else if(v3 != NULL) { - if((del->t.a != v3->t.c) && (del->t.a != v3->t.c) - && (del->t.a != v3->t.c)) { - a = del->t.a; - b = del->t.b; - } - else if((del->t.b != v3->t.c) && (del->t.b != v3->t.c) - && (del->t.b != v3->t.c)) { - a = del->t.b; - b = del->t.c; - } - else if((del->t.c != v3->t.c) && (del->t.c != v3->t.c) - && (del->t.c != v3->t.c)) { - a = del->t.a; - b = del->t.c; - } - else { - Msg(GERROR, "Voronoi insert 3"); - } - } - } - else { - if(v1->t.position == ACCEPTED) - del2 = v1; - else if(v2->t.position == ACCEPTED) - del2 = v2; - else if(v3->t.position == ACCEPTED) - del2 = v3; - else { - Msg(GERROR, "Coherence in Localize"); - } - - if((del->t.a != del2->t.a) && (del->t.a != del2->t.b) - && (del->t.a != del2->t.c)) { - a = del->t.b; - b = del->t.c; - } - else if((del->t.b != del2->t.a) && (del->t.b != del2->t.b) - && (del->t.b != del2->t.c)) { - a = del->t.a; - b = del->t.c; - } - else if((del->t.c != del2->t.a) && (del->t.c != del2->t.b) - && (del->t.c != del2->t.c)) { - a = del->t.a; - b = del->t.b; - } - else { - Msg(GERROR, "Voronoi insert"); - } - } - - /* - On sait que l'arete du nouveau triangle est a b - */ - - pta.h = gPointArray[a].where.h; - ptb.h = gPointArray[b].where.h; - pta.v = gPointArray[a].where.v; - ptb.v = gPointArray[b].where.v; - - /* - pte.h = gPointArray[c].where.h; - pte.v = gPointArray[c].where.v; - */ - - p = 0.5 * lengthseg(pta, ptb); - - ptc.h = del->t.xc; - ptc.v = del->t.yc; - - ptm.h = 0.5 * (pta.h + ptb.h); - ptm.v = 0.5 * (pta.v + ptb.v); - - q = lengthseg(ptm, ptc); - - vec[0] = (ptc.h - ptm.h) / q; - vec[1] = (ptc.v - ptm.v) / q; - - val = (p * p + q * q) / (2. * q); - - ro = find_quality(ptm, MESH) / RacineDeTrois; - - rm = ((ro > q) ? ro : ro); - rm = ((rm < val) ? rm : val); - - // WARNING RANDOM - - pt.h = ptm.h + vec[0] * (rm + pow(rm * rm - p * p, 0.5)); - //+ (double) (rand() % 1000) / 1.e8; - pt.v = ptm.v + vec[1] * (rm + pow(rm * rm - p * p, 0.5)); - //+ (double) (rand() % 1000) / 1.e8; - - return (pt); - } - - pt.h = 0.0; - pt.v = 0.0; - return pt; - -} - - -void alloue_Mai_Pts(maillage * mai, int Nballoc, int incrAlloc) -{ - int i; - - mai->points = (PointRecord *) Malloc(Nballoc * sizeof(PointRecord)); - for(i = 0; i < Nballoc; i++) { - mai->points[i].where.h = 0.0; - mai->points[i].where.v = 0.0; + return pt; + case CENTER_CIRCCIRC: + default: + pt.h = del->t.xc; + pt.v = del->t.yc; + return pt; } - mai->IncrAllocPoints = incrAlloc; - mai->NumAllocPoints = Nballoc; -} - -void alloue_Mai_Del(maillage * mai, int Nballoc, int incrAlloc) -{ - mai->listdel = (delpeek *) Malloc(Nballoc * sizeof(delpeek)); - mai->IncrAllocTri = incrAlloc; - mai->NumAllocTri = Nballoc; } diff --git a/Mesh/Mesh.h b/Mesh/Mesh.h index 664b7c6a62..8ecbe6ba36 100644 --- a/Mesh/Mesh.h +++ b/Mesh/Mesh.h @@ -65,16 +65,10 @@ #define A_TOUT_PRIX 2 #define CENTER_CIRCCIRC 1 -#define VORONOI_INSERT 2 -#define BARYCENTER 3 -#define SQUARE_TRI 4 +#define BARYCENTER 2 #define EXTERN 1 #define INTERN 2 -#define ACTIF 3 -#define WAITING 4 -#define ACCEPTED 5 -#define NONACCEPTED 6 #define CONSTANT 1 #define ONFILE 2 @@ -183,8 +177,6 @@ struct _MAILLAGE{ delpeek *listdel; edge *listedges; int numedges, numtriangles, numpoints; - int IncrAllocPoints, IncrAllocTri, IncrAllocEdges; - int NumAllocPoints, NumAllocTri, NumAllocEdges; int zone; }; -- GitLab