diff --git a/Mesh/2D_Mesh_Aniso.cpp b/Mesh/2D_Mesh_Aniso.cpp index 8e1e07a391fb050017ab50f28aabe4c07dc52c1e..2ed6069ebc79c2ad6603418648f0d18a8719a801 100644 --- a/Mesh/2D_Mesh_Aniso.cpp +++ b/Mesh/2D_Mesh_Aniso.cpp @@ -1,4 +1,4 @@ -// $Id: 2D_Mesh_Aniso.cpp,v 1.23 2001-12-03 08:41:44 geuzaine Exp $ +// $Id: 2D_Mesh_Aniso.cpp,v 1.24 2002-02-16 14:14:47 remacle Exp $ /* Jean-Francois Remacle @@ -22,6 +22,16 @@ extern double LC2D ; void draw_polygon_2d (double r, double g, double b, int n, double *x, double *y, double *z); +inline void cgsmpl (Simplex *s, double &x, double &y) +{ + x = (1./3.) * ( s->V[0]->Pos.X + + s->V[1]->Pos.X + + s->V[2]->Pos.X); + y = (1./3.) * ( s->V[0]->Pos.Y + + s->V[1]->Pos.Y + + s->V[2]->Pos.Y); +} + MeshParameters:: MeshParameters (): NbSmoothing (3), DelaunayAlgorithm (DELAUNAY_ANISO), @@ -112,9 +122,15 @@ void TmatXmat (int n, double mat1[3][3], double mat2[3][3], double Res[3][3]){ Simplex * Create_Simplex_For2dmesh (Vertex * v1, Vertex * v2, Vertex * v3, Vertex * v4){ Simplex *s; double p12, p23, p13; - - s = Create_Simplex (v1, v2, v3, v4); - + double srf = ((v2->Pos.X - v1->Pos.X) * + (v3->Pos.Y - v2->Pos.Y) - + (v3->Pos.X - v2->Pos.X) * + (v2->Pos.Y - v1->Pos.Y)); + if(srf > 0) + s = Create_Simplex (v3, v2, v1, v4); + else + s = Create_Simplex (v1, v2, v3, v4); + THEM->Metric->setSimplexQuality (s, PARAMETRIC); if (PARAMETRIC){ @@ -630,6 +646,19 @@ bool Bowyer_Watson_2D (Surface * sur, Vertex * v, Simplex * S, int force){ } for (i = 0; i < List_Nbr (Simplexes_New); i++){ List_Read (Simplexes_New, i, &s); + if(0 || !force) + { + double xc = s->Center.X; + double yc = s->Center.Y; + double rd = s->Radius; + cgsmpl (s,x,y); + THEM->Metric->setMetric (x, y, sur->Support); + THEM->Metric->setSimplexQuality (s, sur->Support); + s->Center.X = xc; + s->Center.Y = yc; + s->Radius = rd; + if(force)THEM->Metric->Identity(); + } draw_simplex2d (sur, s, 1); Tree_Add (sur->Simplexes, &s); } diff --git a/Mesh/3D_Mesh.cpp b/Mesh/3D_Mesh.cpp index 00f784c3d1fc5ff1cc24f487aa90eef47c5105dd..6124f7f6581d939b19fc28dfabe1cafc720b155e 100644 --- a/Mesh/3D_Mesh.cpp +++ b/Mesh/3D_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: 3D_Mesh.cpp,v 1.35 2002-01-03 10:25:06 geuzaine Exp $ +// $Id: 3D_Mesh.cpp,v 1.36 2002-02-16 14:14:47 remacle Exp $ /* @@ -632,6 +632,20 @@ bool Bowyer_Watson (Mesh * m, Vertex * v, Simplex * S, int force){ for (i = 0; i < List_Nbr (Simplexes_New); i++){ Simplex *theNewS; List_Read (Simplexes_New, i, &theNewS); + /* if(force) + { + double xc = theNewS->Center.X; + double yc = theNewS->Center.Y; + double zc = theNewS->Center.Z; + double rd = theNewS->Radius; + cgsmpl (theNewS,x,y,z); + THEM->Metric->setMetric (x, y, z); + THEM->Metric->setSimplexQuality (theNewS); + theNewS->Center.X = xc; + theNewS->Center.Y = yc; + theNewS->Center.Z = zc; + theNewS->Radius = rd; + }*/ Tree_Add (m->Simplexes, &theNewS); } diff --git a/Mesh/Metric.cpp b/Mesh/Metric.cpp index 5638cf9e9b1c5b20329ad99ca835013a6511b75c..31662140966c3abc24dda9fb9d19673f84f2d294 100644 --- a/Mesh/Metric.cpp +++ b/Mesh/Metric.cpp @@ -1,4 +1,4 @@ -// $Id: Metric.cpp,v 1.9 2002-02-01 14:34:05 remacle Exp $ +// $Id: Metric.cpp,v 1.10 2002-02-16 14:14:47 remacle Exp $ #include <time.h> #include "Gmsh.h" #include "Numeric.h" @@ -159,7 +159,7 @@ Local_Metric_Of_Attractors ( double X, double Y, double Z, x1 = (1. - u) + u * a->lc1; x2 = (1. - u) + u * a->lc2; // cout << " dist from "<< X << " " << Y << " = " << d << endl; - if (u > 0.) + if (u > 1.e-2) { if (a->v) { @@ -414,6 +414,10 @@ setSimplexQuality (Simplex * s) } else { + //double x = (s->V[0]->Pos.X + s->V[1]->Pos.X + s->V[2]->Pos.X + s->V[3]->Pos.X) / 4.; + //double y = (s->V[0]->Pos.Y + s->V[1]->Pos.Y + s->V[2]->Pos.Y + s->V[3]->Pos.Y) / 4.; + // double z = (s->V[0]->Pos.Z + s->V[1]->Pos.Z + s->V[2]->Pos.Z + s->V[3]->Pos.Z) / 4.; + // setMetric(x,y,z); s->Center_Ellipsum_3D (m); s->Quality = 4. * s->Radius / (s->V[0]->lc + s->V[1]->lc + s->V[2]->lc + s->V[3]->lc); } diff --git a/Mesh/Utils.cpp b/Mesh/Utils.cpp index 6d7d3b2b6ba4c13bbecb10be33b7df605c450873..523e2ecff13f4bc0fdd69baa613546e3aa21f21a 100644 --- a/Mesh/Utils.cpp +++ b/Mesh/Utils.cpp @@ -1,4 +1,4 @@ -// $Id: Utils.cpp,v 1.9 2002-02-12 20:11:34 geuzaine Exp $ +// $Id: Utils.cpp,v 1.10 2002-02-16 14:14:47 remacle Exp $ #include "Gmsh.h" #include "Numeric.h" @@ -131,19 +131,20 @@ void MeanPlane(List_T *points, Surface *s){ end: res[3] = (xm*res[0]+ym*res[1]+zm*res[2]); + for(i=0; i<3; i++) s->plan[0][i] = t1[i]; + for(i=0; i<3; i++) s->plan[1][i] = t2[i]; + for(i=0; i<3; i++) s->plan[2][i] = res[i]; + s->a = res[0]; s->b = res[1]; s->c = res[2]; s->d = res[3]; - for(i=0; i<3; i++) s->plan[0][i] = t1[i]; - for(i=0; i<3; i++) s->plan[1][i] = t2[i]; - for(i=0; i<3; i++) s->plan[2][i] = res[i]; Msg(DEBUG1, "Surface: %d", s->Num); Msg(DEBUG2, "SVD : %g,%g,%g (min=%d)", svd[0],svd[1],svd[2],min); Msg(DEBUG2, "Plane : (%g x + %g y + %g z = %g)", s->a, s->b, s->c, s->d); Msg(DEBUG2, "Normal : (%g , %g , %g )", s->a, s->b, s->c); - Msg(DEBUG2, "t1 : (%g , %g , %g )", t1[0], t1[1], t1[2]); + Msg(DEBUG3, "t1 : (%g , %g , %g )", t1[0], t1[1], t1[2]); Msg(DEBUG3, "t2 : (%g , %g , %g )", t2[0], t2[1], t2[2]); for(i=0;i<3;i++){ diff --git a/benchmarks/2d/Square-Attr2.geo b/benchmarks/2d/Square-Attr2.geo index 31609c461c19c30080a3bb81cfa868be10f2d811..36885a49d42733d817b34864e8127f21652a2c06 100644 --- a/benchmarks/2d/Square-Attr2.geo +++ b/benchmarks/2d/Square-Attr2.geo @@ -32,5 +32,5 @@ Line(12) = {16,17}; Line(13) = {17,18}; Line(14) = {18,19}; Line(15) = {19,20}; -Attractor Line{7,8,9,10,11,12,13,14,15} = {.1,0.01,10} ; +Attractor Line{7,8,9,10,11,12,13,14,15} = {.2,0.002,10} ; Mesh.Algorithm = 2;