diff --git a/Box/Main.cpp b/Box/Main.cpp index 2998d520ff0d6f2bef8de4cebba31d58530ec13a..e0af9828650e04fe924e057bf109007bc89dfdfb 100644 --- a/Box/Main.cpp +++ b/Box/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.53 2006-01-16 17:55:43 geuzaine Exp $ +// $Id: Main.cpp,v 1.54 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -45,7 +45,7 @@ char yyname[256] = ""; int yyerrorstate = 0; Context_T CTX; -Mesh M, *THEM = NULL, *LOCAL = NULL; +Mesh M, *THEM = NULL; // Print some help/info messages diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index 0cb20f06d8308cd4989f16ee03bceda7b9e32829..5ba4d6805d43747bbc3da82f83aebaee13e87dd0 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.85 2006-01-06 00:34:23 geuzaine Exp $ +// $Id: Main.cpp,v 1.86 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -46,7 +46,7 @@ char yyname[256] = ""; int yyerrorstate = 0; Context_T CTX; -Mesh M, *THEM = NULL, *LOCAL = NULL; +Mesh M, *THEM = NULL; GUI *WID = NULL; int main(int argc, char *argv[]) diff --git a/Mesh/1D_Mesh.cpp b/Mesh/1D_Mesh.cpp index ea0c7bbee1c2609ff05f527704502f83f664dfca..8f5bc0afdf7243d5c85ae1ef4f8efe6041aaf5ee 100644 --- a/Mesh/1D_Mesh.cpp +++ b/Mesh/1D_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: 1D_Mesh.cpp,v 1.47 2006-01-19 02:26:21 geuzaine Exp $ +// $Id: 1D_Mesh.cpp,v 1.48 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -106,10 +106,10 @@ double F_Lc(double t) Vertex der, point; double Lc, d; - if(THEM->BGM.Typ == ONFILE) { + if(THEM->BackgroundMeshType == ONFILE) { der = InterpolateCurve(THEC, t, 1); point = InterpolateCurve(THEC, t, 0); - Lc = Lc_XYZ(point.Pos.X, point.Pos.Y, point.Pos.Z, THEM); + Lc = BGMXYZ(point.Pos.X, point.Pos.Y, point.Pos.Z); d = sqrt(DSQR(der.Pos.X) + DSQR(der.Pos.Y) + DSQR(der.Pos.Z)); if(CTX.mesh.constrained_bgmesh) return MAX(d / Lc, THEM->Metric->getLc(t, THEC)); diff --git a/Mesh/2D_Mesh.cpp b/Mesh/2D_Mesh.cpp index e67b0c4e3a06860a9e51f8117be7af88f5f22265..ddbd4f5718819bb6125c9ede0e7e11cb0181a076 100644 --- a/Mesh/2D_Mesh.cpp +++ b/Mesh/2D_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Mesh.cpp,v 1.80 2006-01-06 00:34:25 geuzaine Exp $ +// $Id: 2D_Mesh.cpp,v 1.81 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -37,7 +37,6 @@ PointRecord *gPointArray; DocRecord *BGMESH, *FGMESH; double LC2D; -static int is_3D = 0; static Surface *THESURFACE, *THESUPPORT; void ProjetteSurface(void *a, void *b) @@ -301,7 +300,7 @@ int mesh_domain(ContourPeek * ListContours, int numcontours, Conversion(doc); remove_all_dlist(doc->numPoints, doc->points); - if(!is_3D || CTX.mesh.constrained_bgmesh) + if(THEM->BackgroundMeshType != ONFILE || CTX.mesh.constrained_bgmesh) BGMESH = doc; else BGMESH = NULL; @@ -453,7 +452,7 @@ int mesh_domain(ContourPeek * ListContours, int numcontours, } *numpoints = doc->numPoints; - Insert_Point(pt, numpoints, &numaloc, doc, BGMESH, is_3D); + Insert_Point(pt, numpoints, &numaloc, doc, BGMESH); doc->points = gPointArray; doc->numPoints = *numpoints; @@ -563,16 +562,7 @@ void Maillage_Automatique_VieuxCode(Surface * pS, Mesh * m, int ori) Simplex *s; double Xmin = 0., Xmax = 0., Ymin = 0., Ymax = 0.; - - if(m->BGM.Typ == WITHPOINTS) { - is_3D = 0; - } - else { - is_3D = 1; - } - - liste = - (ContourPeek *) Malloc(List_Nbr(pS->Contours) * sizeof(ContourPeek)); + liste = (ContourPeek *) Malloc(List_Nbr(pS->Contours) * sizeof(ContourPeek)); k = 0; @@ -722,24 +712,12 @@ void filldel(Delaunay * deladd, int aa, int bb, int cc, pt2.h = deladd->t.xc; pt2.v = deladd->t.yc; - if(!is_3D) { - if(mesh) { - newqual = find_quality(pt2, mesh); - } - else { - newqual = - (points[aa].quality + points[bb].quality + points[cc].quality) / 3.; - } - v = Create_Vertex(-1, pt2.h, pt2.v, 0.0, 0.0, 0.0); - Calcule_Z_Plan(&v, &dum); - Projette_Inverse(&v, &dum); - Free_Vertex(&v, 0); - } - else { + + if(THEM->BackgroundMeshType == ONFILE) { v = Create_Vertex(-1, pt2.h, pt2.v, 0.0, 0.0, 0.0); Calcule_Z_Plan(&v, &dum); Projette_Inverse(&v, &dum); - qual = Lc_XYZ(v->Pos.X, v->Pos.Y, v->Pos.Z, THEM); + qual = BGMXYZ(v->Pos.X, v->Pos.Y, v->Pos.Z); if(CTX.mesh.constrained_bgmesh) { if(mesh) { newqual = MIN(qual, find_quality(pt2, mesh)); @@ -755,6 +733,17 @@ void filldel(Delaunay * deladd, int aa, int bb, int cc, newqual = qual; Free_Vertex(&v, 0); } + else{ + if(mesh) + newqual = find_quality(pt2, mesh); + else + newqual = (points[aa].quality + points[bb].quality + + points[cc].quality) / 3.; + v = Create_Vertex(-1, pt2.h, pt2.v, 0.0, 0.0, 0.0); + Calcule_Z_Plan(&v, &dum); + Projette_Inverse(&v, &dum); + Free_Vertex(&v, 0); + } deladd->t.quality_value = sqrt((deladd->t.xc - points[cc].where.h) * (deladd->t.xc - diff --git a/Mesh/2D_Mesh.h b/Mesh/2D_Mesh.h index 191eb222c9c0f08d5499d143e0ef35f53d3f1de4..1ba709a82acf2d7d707947363dd7512a329bf0c5 100644 --- a/Mesh/2D_Mesh.h +++ b/Mesh/2D_Mesh.h @@ -56,7 +56,7 @@ Delaunay * Find_Triangle (MPoint pt, DocRecord *MESH, int typ); int Insert_Triangle (avlstruct **root, Delaunay * del); int Delete_Triangle ( avlstruct **root, Delaunay * del ); int Insert_Point (MPoint pt, int *numpoints, int *numalloc, - DocRecord *doc, DocRecord *BGM, int is3d); + DocRecord *doc, DocRecord *BGM); MPoint Localize (Delaunay * del , DocRecord *MESH); void InitBricks (DocRecord *MESH); diff --git a/Mesh/2D_Mesh_Aniso.cpp b/Mesh/2D_Mesh_Aniso.cpp index f42e61868eed85e96f06e50245f54410c624f270..d8dccdaba8af29166d705d2e6f5b7f048e645c37 100644 --- a/Mesh/2D_Mesh_Aniso.cpp +++ b/Mesh/2D_Mesh_Aniso.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Mesh_Aniso.cpp,v 1.47 2006-01-29 21:53:31 geuzaine Exp $ +// $Id: 2D_Mesh_Aniso.cpp,v 1.48 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -61,12 +61,12 @@ double Interpole_lcTriangle(Simplex * s, Vertex * vv) { double Xp, Yp, X[3], Y[3], det, u, v, q1, q2, q3; - if(THEM->BGM.Typ == ONFILE){ + if(THEM->BackgroundMeshType == ONFILE){ Vertex *v2 = Create_Vertex(-1, vv->Pos.X, vv->Pos.Y, 0.0, 0.0, 0.0); Vertex *dum; Calcule_Z_Plan(&v2, &dum); Projette_Inverse(&v2, &dum); - double val = Lc_XYZ(v2->Pos.X, v2->Pos.Y, v2->Pos.Z, THEM); + double val = BGMXYZ(v2->Pos.X, v2->Pos.Y, v2->Pos.Z); Free_Vertex(&v2, 0); return val; } @@ -962,8 +962,6 @@ Vertex *NewVertex_2D(Simplex * s) return (v); } -extern Mesh *LOCAL; - void TRIE_MON_GARS(void *a, void *b) { Simplex *s = *(Simplex **) a; @@ -1033,7 +1031,6 @@ int AlgorithmeMaillage2DAnisotropeModeJF(Surface * s) FACE_DIMENSION = 1; SURF = s; - LOCAL = NULL; if(s->Typ == MSH_SURF_PLAN || s->Typ == MSH_SURF_REGL || s->Typ == MSH_SURF_TRIC) diff --git a/Mesh/2D_Mesh_Triangle.cpp b/Mesh/2D_Mesh_Triangle.cpp index 66a7bb346f6980be13b14552dd0087abbbe8aaeb..f058875d92bd448ebb1e843395fe9d21bd06a990 100644 --- a/Mesh/2D_Mesh_Triangle.cpp +++ b/Mesh/2D_Mesh_Triangle.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Mesh_Triangle.cpp,v 1.14 2006-01-06 00:34:25 geuzaine Exp $ +// $Id: 2D_Mesh_Triangle.cpp,v 1.15 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -213,7 +213,7 @@ int Mesh_Triangle(Surface * s) mid.trianglearealist = (REAL *) Malloc(mid.numberoftriangles * sizeof(REAL)); for(i = 0; i < mid.numberoftriangles; i++) { - if(THEM->BGM.Typ == ONFILE) { + if(THEM->BackgroundMeshType == ONFILE) { double xx = 0.0, yy = 0.0; for(j = 0; j < mid.numberofcorners; j++) { k = mid.trianglelist[i * mid.numberofcorners + j]; @@ -226,7 +226,7 @@ int Mesh_Triangle(Surface * s) v = Create_Vertex(-1, xx, yy, 0.0, 0.0, 0.0); Calcule_Z_Plan(&v, &dum); Projette_Inverse(&v, &dum); - val = Lc_XYZ(v->Pos.X, v->Pos.Y, v->Pos.Z, THEM); + val = BGMXYZ(v->Pos.X, v->Pos.Y, v->Pos.Z); val = val * val / 1.2; // FIXME: bof Free_Vertex(&v, 0); } diff --git a/Mesh/2D_Util.cpp b/Mesh/2D_Util.cpp index 5c9086b5af9de236ab58d17758c79307a6e2e213..b87f7139aac72436404815757ebfcd1aa322e638 100644 --- a/Mesh/2D_Util.cpp +++ b/Mesh/2D_Util.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Util.cpp,v 1.24 2006-01-06 00:34:25 geuzaine Exp $ +// $Id: 2D_Util.cpp,v 1.25 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -78,7 +78,7 @@ int Delete_Triangle(avlstruct ** root, Delaunay * del) } int Insert_Point(MPoint pt, int *numpoints, int *numalloc, - DocRecord * doc, DocRecord * BGM, int is3d) + DocRecord * doc, DocRecord * BGM) { Vertex *v, *dum; double qual; @@ -95,19 +95,19 @@ int Insert_Point(MPoint pt, int *numpoints, int *numalloc, gPointArray[*numpoints].where.v = pt.v; gPointArray[*numpoints].numcontour = -1; gPointArray[*numpoints].initial = -1; - if(!is3d) - gPointArray[*numpoints].quality = find_quality(pt, BGM); - else { + if(THEM->BackgroundMeshType == ONFILE){ v = Create_Vertex(-1, pt.h, pt.v, 0.0, 0.0, 0.0); Calcule_Z_Plan(&v, &dum); Projette_Inverse(&v, &dum); - qual = Lc_XYZ(v->Pos.X, v->Pos.Y, v->Pos.Z, THEM); + qual = BGMXYZ(v->Pos.X, v->Pos.Y, v->Pos.Z); if(CTX.mesh.constrained_bgmesh) gPointArray[*numpoints].quality = MIN(find_quality(pt, BGM), qual); else gPointArray[*numpoints].quality = qual; Free_Vertex(&v, 0); } + else + gPointArray[*numpoints].quality = find_quality(pt, BGM); (*numpoints)++; diff --git a/Mesh/3D_BGMesh.cpp b/Mesh/3D_BGMesh.cpp index 4700c844f22993d2331e54801a8c536a86b7c989..7afe99787eafd65346698dfa50c42d399e020b08 100644 --- a/Mesh/3D_BGMesh.cpp +++ b/Mesh/3D_BGMesh.cpp @@ -1,4 +1,4 @@ -// $Id: 3D_BGMesh.cpp,v 1.44 2006-01-29 20:32:48 geuzaine Exp $ +// $Id: 3D_BGMesh.cpp,v 1.45 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -38,56 +38,42 @@ int BGMWithView(Post_View * ErrView) if(BGM_OCTREE) delete BGM_OCTREE; BGM_OCTREE = new OctreePost(ErrView); BGM_MAX = ErrView->Max; - Create_BgMesh(ONFILE, .2, THEM); + THEM->BackgroundMeshType = ONFILE; return 1 ; } -double Lc_XYZ(double X, double Y, double Z, Mesh * m) +double BGMXYZ(double X, double Y, double Z) { + if(!BGM_OCTREE){ + Msg(GERROR, "Missing background mesh"); + THEM->BackgroundMeshType = WITHPOINTS; + return 1.; + } + double l = 0.; double fact[9] = {0.001, 0.0025, 0.005, 0.0075, 0.01, 0.025, 0.05, 0.075, 0.1}; - switch (m->BGM.Typ) { - case FUNCTION: - // for testing... - l = 0.1 * fabs(cos(2 * 3.14159 * X) * cos( 2 * 3.14159 * Y)) + 0.01; - break; - case CONSTANT: - l = m->BGM.lc; - break; - case ONFILE: - if(!BGM_OCTREE->searchScalar(X, Y, Z, &l, 0)){ - // try really hard to find an element around the point - for(int i = 0; i < 9; i++){ - double eps = CTX.lc * fact[i]; - if(BGM_OCTREE->searchScalar(X + eps, Y, Z, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X - eps, Y, Z, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X, Y + eps, Z, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X, Y - eps, Z, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X, Y, Z + eps, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X, Y, Z - eps, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X + eps, Y - eps, Z - eps, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X + eps, Y + eps, Z - eps, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X - eps, Y - eps, Z - eps, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X - eps, Y + eps, Z - eps, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X + eps, Y - eps, Z + eps, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X + eps, Y + eps, Z + eps, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X - eps, Y - eps, Z + eps, &l, 0)) break; - if(BGM_OCTREE->searchScalar(X - eps, Y + eps, Z + eps, &l, 0)) break; - } + if(!BGM_OCTREE->searchScalar(X, Y, Z, &l, 0)){ + // try really hard to find an element around the point + for(int i = 0; i < 9; i++){ + double eps = CTX.lc * fact[i]; + if(BGM_OCTREE->searchScalar(X + eps, Y, Z, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X - eps, Y, Z, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X, Y + eps, Z, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X, Y - eps, Z, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X, Y, Z + eps, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X, Y, Z - eps, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X + eps, Y - eps, Z - eps, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X + eps, Y + eps, Z - eps, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X - eps, Y - eps, Z - eps, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X - eps, Y + eps, Z - eps, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X + eps, Y - eps, Z + eps, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X + eps, Y + eps, Z + eps, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X - eps, Y - eps, Z + eps, &l, 0)) break; + if(BGM_OCTREE->searchScalar(X - eps, Y + eps, Z + eps, &l, 0)) break; } - if(l <= 0) l = BGM_MAX; - break; - case WITHPOINTS: - Msg(GERROR, "We should never call Lc_XYZ with BGM.Typ == WITHPOINTS!"); - l = 1.0; - break; - } - - if(l <= 0.){ - Msg(WARNING, "Characteristic length <= 0 at point (%g,%g,%g)", X, Y, Z); - l = CTX.lc / 10.; } + if(l <= 0) l = BGM_MAX; return CTX.mesh.lc_factor * l; } diff --git a/Mesh/3D_Extrude_Old.cpp b/Mesh/3D_Extrude_Old.cpp index 59d374b6bbbbd497c3d61a2f410d91687b42a5c7..42859559d828a033ebde2bd991e76de2c847a3ae 100644 --- a/Mesh/3D_Extrude_Old.cpp +++ b/Mesh/3D_Extrude_Old.cpp @@ -1,4 +1,4 @@ -// $Id: 3D_Extrude_Old.cpp,v 1.40 2006-01-17 17:09:05 geuzaine Exp $ +// $Id: 3D_Extrude_Old.cpp,v 1.41 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -53,7 +53,7 @@ #include "Create.h" extern Context_T CTX; -extern Mesh *LOCAL, *THEM; +extern Mesh *THEM; static Tree_T *Tree_Ares = NULL, *Tree_Swaps = NULL; static Volume *THEV; @@ -648,15 +648,12 @@ void Extrude_Mesh_Old(Mesh * M) { InitExtrudeParams(); - Mesh MM; - LOCAL = &MM; THEM = M; // clean up Extruded_Points stuff (in case another extrusion was // performed before) Tree_Action(THEM->Vertices, FreeEP); - Create_BgMesh(WITHPOINTS, .2, LOCAL); THEV = Create_Volume(1, MSH_VOLUME); Tree_Add(M->Volumes, &THEV); diff --git a/Mesh/3D_Mesh.cpp b/Mesh/3D_Mesh.cpp index 2f127be2cb9c918210b6c2143406de14116a1e3f..b65126300d644fccff3e703889be1a955a8e7427 100644 --- a/Mesh/3D_Mesh.cpp +++ b/Mesh/3D_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: 3D_Mesh.cpp,v 1.71 2006-01-29 21:53:31 geuzaine Exp $ +// $Id: 3D_Mesh.cpp,v 1.72 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -38,7 +38,7 @@ #include "Create.h" #include "Context.h" -extern Mesh *THEM, *LOCAL; +extern Mesh *THEM; extern Context_T CTX; extern int FACE_DIMENSION; @@ -767,34 +767,6 @@ void suppress_simplex(void *data, void *dum) List_Add(Suppress, pv); } -void add_in_bgm(void *a, void *b) -{ - Simplex *s = *(Simplex **) a; - List_Add(LLL, s); -} - -void Bgm_With_Points(Mesh * bgm) -{ - bgm->BGM.bgm = List_Create(Tree_Nbr(bgm->Simplexes), 10, sizeof(Simplex)); - LLL = bgm->BGM.bgm; - Tree_Action(bgm->Simplexes, add_in_bgm); -} - -void Create_BgMesh(int Type, double lc, Mesh * m) -{ - m->BGM.Typ = Type; - switch (Type) { - case CONSTANT: - m->BGM.lc = lc; - break; - case ONFILE: - break; - case WITHPOINTS: - m->BGM.bgm = NULL; - break; - } -} - void Maillage_Volume(void *data, void *dum) { Volume *v, **pv; @@ -834,8 +806,7 @@ void Maillage_Volume(void *data, void *dum) Simplexes_New = List_Create(10, 10, sizeof(Simplex *)); Simplexes_Destroyed = List_Create(10, 10, sizeof(Simplex *)); - LOCAL = &M; - Create_BgMesh(THEM->BGM.Typ, .2, LOCAL); + Mesh *LOCAL = &M; s = &S; POINTS_TREE = Tree_Create(sizeof(Vertex *), comparePosition); @@ -906,7 +877,6 @@ void Maillage_Volume(void *data, void *dum) v->Simplexes = LOCAL->Simplexes; - Bgm_With_Points(LOCAL); POINTS_TREE = THEM->Simplexes; Tree_Right(LOCAL->Simplexes, &simp); diff --git a/Mesh/3D_Mesh_Netgen.cpp b/Mesh/3D_Mesh_Netgen.cpp index ab25fb011662a9ef158eeeb8fddbdff39765bd1c..ab8f18cc9ee8178c21fd6465b3070940e2582660 100644 --- a/Mesh/3D_Mesh_Netgen.cpp +++ b/Mesh/3D_Mesh_Netgen.cpp @@ -1,4 +1,4 @@ -// $Id: 3D_Mesh_Netgen.cpp,v 1.19 2006-01-28 19:53:18 geuzaine Exp $ +// $Id: 3D_Mesh_Netgen.cpp,v 1.20 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -279,7 +279,7 @@ int Mesh_Netgen(Volume * v) if(CTX.mesh.algo3d != FRONTAL_NETGEN) return 0; - if(THEM->BGM.Typ == ONFILE){ + if(THEM->BackgroundMeshType == ONFILE){ Msg(GERROR, "Netgen is not ready to be used with a background mesh"); return 0; } @@ -315,8 +315,9 @@ void Optimize_Netgen(Mesh *m) // cleanup 2nd order vertices, if any Degre1(); - // make sure we don't use any fancy background mesh - Create_BgMesh(WITHPOINTS, .2, m); + // make sure we don't have ONFILE (so that when we create simplices + // we don't try to compute the quality from the bgmesh) + m->BackgroundMeshType = WITHPOINTS; List_T *list = Tree2List(m->Volumes); for(int i = 0; i < List_Nbr(list); i++){ diff --git a/Mesh/3D_Mesh_Tetgen.cpp b/Mesh/3D_Mesh_Tetgen.cpp index 8cde1cb44bd60284d7f66590da60e9bc1e6bd5d9..fc35c351b378078923039f46c8820bf8d800c487 100644 --- a/Mesh/3D_Mesh_Tetgen.cpp +++ b/Mesh/3D_Mesh_Tetgen.cpp @@ -1,4 +1,4 @@ -// $Id: 3D_Mesh_Tetgen.cpp,v 1.5 2006-01-15 19:28:26 geuzaine Exp $ +// $Id: 3D_Mesh_Tetgen.cpp,v 1.6 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -51,7 +51,7 @@ int Mesh_Tetgen(Volume * vol) { if(CTX.mesh.algo3d != DELAUNAY_TETGEN) return 0; - if(THEM->BGM.Typ == ONFILE){ + if(THEM->BackgroundMeshType == ONFILE){ Msg(GERROR, "Tetgen is not ready to be used with a background mesh"); return 0; } diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index d0ce32d6803a220a07d0b6c1ffce7c1d0f2e73df..4df5babb39053639cf45e0800cb370821249451e 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -1,4 +1,4 @@ -// $Id: Generator.cpp,v 1.76 2006-01-29 21:53:31 geuzaine Exp $ +// $Id: Generator.cpp,v 1.77 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -360,7 +360,6 @@ void Init_Mesh0(Mesh * M) M->PhysicalGroups = NULL; M->Partitions = NULL; M->Metric = NULL; - M->BGM.bgm = NULL; } void Init_Mesh(Mesh * M) @@ -387,9 +386,9 @@ void Init_Mesh(Mesh * M) Tree_Action(M->Points, Free_Vertex); Tree_Delete(M->Points); - // Note: don't free the simplices here (with - // Tree_Action (M->Simplexes, Free_Simplex)): we free them - // in each curve, surface, volume + // Note: don't free the simplices here (with Tree_Action + // (M->Simplexes, Free_Simplex)): we free them in each curve, + // surface, volume Tree_Delete(M->Simplexes); Tree_Action(M->Curves, Free_Curve); @@ -416,8 +415,6 @@ void Init_Mesh(Mesh * M) if(M->Metric) delete M->Metric; - List_Delete(M->BGM.bgm); - if(M->normals) delete M->normals; @@ -432,12 +429,10 @@ void Init_Mesh(Mesh * M) M->PhysicalGroups = List_Create(5, 5, sizeof(PhysicalGroup *)); M->Partitions = List_Create(5, 5, sizeof(MeshPartition *)); M->Metric = new GMSHMetric; - M->BGM.bgm = NULL; M->normals = new smooth_normals(CTX.mesh.angle_smooth_normals); M->status = 0; - - Create_BgMesh(WITHPOINTS, .2, M); + M->BackgroundMeshType = WITHPOINTS; for(int i = 0; i < 3; i++){ M->timing[i] = 0.0; diff --git a/Mesh/Mesh.h b/Mesh/Mesh.h index 0fa0eeca73c5aae2b561c487fd4a3f6b98832a77..183fff3ecf9d52c7037cc1c499830c8d4190bfda 100644 --- a/Mesh/Mesh.h +++ b/Mesh/Mesh.h @@ -76,18 +76,13 @@ #define EXTERN 1 #define INTERN 2 -#define CONSTANT 1 #define ONFILE 2 #define WITHPOINTS 3 -#define FUNCTION 4 #define TRANSFINI 1 #define LIBRE 2 #define ELLIPTIC 3 -#define BOULE 1 -#define BOITE 2 - #define NB_HISTOGRAM 100 class BDS_Mesh; @@ -216,8 +211,7 @@ struct _Surf{ char Visible; int Method; int Recombine; -// -1 is left, +1 is right, 0 is alternated - int Recombine_Dir; + int Recombine_Dir; // -1 is left, +1 is right, 0 is alternated double RecombineAngle; int ipar[5]; int Nu, Nv; @@ -327,12 +321,6 @@ typedef struct{ typedef struct _Mesh Mesh; -typedef struct{ - int Typ; - double lc; - List_T *bgm; -}LcField; - typedef struct{ double t1, t2, f1, f2, incl; Vertex *v[4]; @@ -396,8 +384,8 @@ struct _Mesh{ Tree_T *EdgeLoops; List_T *PhysicalGroups; List_T *Partitions; + int BackgroundMeshType; smooth_normals *normals; // container for smooth normals - LcField BGM; // background mesh double timing[3]; // timing for 1d, 2d and 3d mesh double quality_gamma[3]; // mesh quality statistics double quality_eta[3]; // mesh quality statistics @@ -428,7 +416,6 @@ void mai3d(Mesh *M, int Asked); void Init_Mesh0(Mesh *M); void Init_Mesh(Mesh *M); -void Create_BgMesh(int i, double d, Mesh *m); void Print_Geo(Mesh *M, char *c); void Print_Mesh(Mesh *M, char *c, int Type); void Read_Mesh(Mesh *M, FILE *fp, char *filename, int Type); @@ -478,7 +465,7 @@ void ReOrientSurfaceMesh(Surface *s); void Move_SimplexBaseToSimplex(Mesh * M, int dimension); -double Lc_XYZ(double X, double Y, double Z, Mesh *m); +double BGMXYZ(double X, double Y, double Z); void ActionLiss(void *data, void *dummy); void ActionLissSurf(void *data, void *dummy); int Recombine(Tree_T *TreeAllVert, Tree_T *TreeAllSimp, Tree_T *TreeAllQuad, diff --git a/Mesh/Simplex.cpp b/Mesh/Simplex.cpp index ab339f4b1b5d6109ad4a1726c10b7df2c38cde3b..b0b8588e1a78874b7eca70ca0f4017b1c3ba678d 100644 --- a/Mesh/Simplex.cpp +++ b/Mesh/Simplex.cpp @@ -1,4 +1,4 @@ -// $Id: Simplex.cpp,v 1.46 2006-01-29 20:32:48 geuzaine Exp $ +// $Id: Simplex.cpp,v 1.47 2006-01-29 22:53:41 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -27,7 +27,7 @@ #include "Context.h" extern Context_T CTX; -extern Mesh *THEM, *LOCAL; +extern Mesh *THEM; extern Simplex MyNewBoundary; extern int edges_tetra[6][2]; @@ -406,8 +406,8 @@ void Simplex::Fourre_Simplexe(Vertex * v1, Vertex * v2, Vertex * v3, Center_Circum(); - if(N == 4 && LOCAL && THEM && THEM->BGM.Typ == ONFILE){ - Quality = fabs(4. * Radius / Lc_XYZ(Center.X, Center.Y, Center.Z, LOCAL)); + if(N == 4 && THEM && THEM->BackgroundMeshType == ONFILE){ + Quality = fabs(4. * Radius / BGMXYZ(Center.X, Center.Y, Center.Z)); } else{ Quality = (double)N *Radius / (V[0]->lc + V[1]->lc + V[2]->lc +