diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index 1073a0add53d4c224b652c6b36100f8876d2449b..ae4dc268764e02d18980f4bae99a7e67b066dd02 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -1,4 +1,4 @@ -// $Id: GEdge.cpp,v 1.28 2007-05-10 22:08:03 geuzaine Exp $ +// $Id: GEdge.cpp,v 1.29 2007-05-24 14:44:06 remacle Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -134,8 +134,8 @@ SPoint2 GEdge::reparamOnFace(GFace *face, double epar,int dir) const double GEdge::curvature(double par) const { - double eps1 = 1.e-3; - double eps2 = 1.e-3; + double eps1 = 1.e-5; + double eps2 = 1.e-5; Range<double> r = parBounds(0); if (r.low() == par) eps2 = 0; @@ -147,6 +147,8 @@ double GEdge::curvature(double par) const GPoint P1 = point(par - eps1); GPoint P2 = point(par + eps2); + + double D = sqrt ((P1.x() - P2.x()) * (P1.x() - P2.x()) + (P1.y() - P2.y()) * (P1.y() - P2.y()) + (P1.z() - P2.z()) * (P1.z() - P2.z())); diff --git a/Geo/GeoInterpolation.cpp b/Geo/GeoInterpolation.cpp index 3af64b29f22b310c11f0e0ad4ed3ded5b4b910db..b4b5ec0368e0097ac434405093f51ad60c0f6808 100644 --- a/Geo/GeoInterpolation.cpp +++ b/Geo/GeoInterpolation.cpp @@ -1,4 +1,4 @@ -// $Id: GeoInterpolation.cpp,v 1.26 2007-04-22 08:46:04 geuzaine Exp $ +// $Id: GeoInterpolation.cpp,v 1.27 2007-05-24 14:44:06 remacle Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -238,7 +238,7 @@ Vertex InterpolateCurve(Curve * c, double u, int derivee) V.u = u; if(derivee) { - double eps = 1.e-3; + double eps = 1.e-5; Vertex D[2]; D[0] = InterpolateCurve(c, u, 0); D[1] = InterpolateCurve(c, u + eps, 0); diff --git a/Mesh/BackgroundMesh.cpp b/Mesh/BackgroundMesh.cpp index c9a6de944d5dda3f2b259ddd4d387a71121770a3..530e54d4cc655af34b07f5f1f45ec247aaa9cef2 100644 --- a/Mesh/BackgroundMesh.cpp +++ b/Mesh/BackgroundMesh.cpp @@ -1,4 +1,4 @@ -// $Id: BackgroundMesh.cpp,v 1.21 2007-04-22 08:46:04 geuzaine Exp $ +// $Id: BackgroundMesh.cpp,v 1.22 2007-05-24 14:44:06 remacle Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -105,20 +105,26 @@ double LC_MVertex_CURV(GEntity *ge, double U, double V) case 1: { GEdge *ged = (GEdge *)ge; - //Crv = ged->curvature(U); - Crv = max_surf_curvature(ged, U); + Crv = ged->curvature(U); + // printf("coucou %12.5E %d\n",Crv,CTX.mesh.min_circ_points); + //Crv = max_surf_curvature(ged, U); } break; case 2: { - GFace *gf = (GFace *)ge; - Crv = gf->curvature(SPoint2(U, V)); + // GFace *gf = (GFace *)ge; + // Crv = gf->curvature(SPoint2(U, V)); } break; } - - if(Crv > 0) return 2*M_PI / Crv / CTX.mesh.min_circ_points; - else return MAX_LC; + + double lc = Crv > 0 ? 2*M_PI / Crv / CTX.mesh.min_circ_points : MAX_LC; + + // double lc_min = CTX.lc /300; + + + return lc; + } @@ -166,8 +172,10 @@ double BGM_MeshSize(GEntity *ge, double U, double V, double X, double Y, double l2 = LC_MVertex_PNTS(ge, U, V); if(CTX.mesh.lc_from_curvature && ge->dim() < 3) - l1 = std::max(l3 / 100., LC_MVertex_CURV(ge, U, V)); + l1 = LC_MVertex_CURV(ge, U, V); + // printf("l1 = %12.5E l2 = %12.5E\n",l1,l2); + double lc = std::min(std::min(std::min(l1, l2), l3), l4); return lc * CTX.mesh.lc_factor; } diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp index aa3fb16571286ef8003ae96bc59fb4dd4b8f316d..e7c7acb2aa830108ea9fbd368c309fab2ff4f417 100644 --- a/Mesh/meshGFace.cpp +++ b/Mesh/meshGFace.cpp @@ -1,4 +1,4 @@ -// $Id: meshGFace.cpp,v 1.78 2007-05-07 11:40:02 remacle Exp $ +// $Id: meshGFace.cpp,v 1.79 2007-05-24 14:44:06 remacle Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -314,7 +314,7 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT) if (l<L && (*it)->g && (*it)->g->classif_degree == 1)L=l; ++it; } - (*itp)->lc() = std::max(L,(*itp)->lc()); + (*itp)->lc() = std::min(L,(*itp)->lc()); ++itp; } } @@ -900,7 +900,7 @@ bool gmsh2DMeshGenerator ( GFace *gf , bool debug = true) m->del_point(m->find_point(-4)); // start mesh generation - // if (CTX.mesh.algo2d == ALGO_2D_MESHADAPT) + if (CTX.mesh.algo2d == ALGO_2D_MESHADAPT || gf->geomType() != GEntity::Plane) { RefineMesh (gf,*m,10); OptimizeMesh(gf, *m, 2); @@ -911,11 +911,11 @@ bool gmsh2DMeshGenerator ( GFace *gf , bool debug = true) m->recombineIntoQuads (gf->meshAttributes.recombineAngle,gf); } } - // char name[245]; - // sprintf(name,"param%d.pos",gf->tag()); - // outputScalarField(m->triangles, name,1); -// sprintf(name,"real%d.pos",gf->tag()); -// outputScalarField(m->triangles, name,0); + // char name[245]; + // sprintf(name,"param%d.pos",gf->tag()); + // outputScalarField(m->triangles, name,1); + // sprintf(name,"real%d.pos",gf->tag()); + // outputScalarField(m->triangles, name,0); // fill the small gmsh structures { @@ -960,10 +960,12 @@ bool gmsh2DMeshGenerator ( GFace *gf , bool debug = true) // the delaunay algo is based directly on internal gmsh structures // BDS mesh is passed in order not to recompute local coordinates // of vertices -// if (CTX.mesh.algo2d == ALGO_2D_DELAUNAY || CTX.mesh.algo2d == ALGO_2D_DELAUNAY) -// { -// insertVerticesInFace (gf,m) ; -// } + if ((CTX.mesh.algo2d == ALGO_2D_DELAUNAY || CTX.mesh.algo2d == ALGO_2D_DELAUNAY) && + gf->geomType() == GEntity::Plane) + { + printf("coucou\n"); + insertVerticesInFace (gf,m) ; + } // delete the mesh diff --git a/Mesh/meshGFaceDelaunayInsertion.cpp b/Mesh/meshGFaceDelaunayInsertion.cpp index a08cd3ceb1fcb983378f0e365275836ff230d1c6..4970c9e503579ac00b8641762903b7c249723e64 100644 --- a/Mesh/meshGFaceDelaunayInsertion.cpp +++ b/Mesh/meshGFaceDelaunayInsertion.cpp @@ -1,4 +1,4 @@ -// $Id: meshGFaceDelaunayInsertion.cpp,v 1.1 2007-01-12 13:16:59 remacle Exp $ +// $Id: meshGFaceDelaunayInsertion.cpp,v 1.2 2007-05-24 14:44:06 remacle Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -197,11 +197,11 @@ int inCircumCircle ( MTri3 *t , const double *p , const gmsh2dMetric &metric ) int MTri3::inCircumCircle ( const double *p ) const { -// double pa[2] = {base->getVertex(0)->x(),base->getVertex(0)->y()}; -// double pb[2] = {base->getVertex(1)->x(),base->getVertex(1)->y()}; -// double pc[2] = {base->getVertex(2)->x(),base->getVertex(2)->y()}; -// double result = gmsh::incircle(pa, pb, pc, (double*)p) * gmsh::orient2d(pa, pb, pc); -// return (result > 0) ? 1 : 0; + double pa[2] = {base->getVertex(0)->x(),base->getVertex(0)->y()}; + double pb[2] = {base->getVertex(1)->x(),base->getVertex(1)->y()}; + double pc[2] = {base->getVertex(2)->x(),base->getVertex(2)->y()}; + double result = gmsh::incircle(pa, pb, pc, (double*)p) * gmsh::orient2d(pa, pb, pc); + return (result > 0) ? 1 : 0; double eps, d1, d2, x[2]; diff --git a/benchmarks/2d/conge.geo b/benchmarks/2d/conge.geo index 56f3765ed8d652b8ed992621b88aac57de2e49de..86a5d8178ee5928d93d485b5ba91f5300a723d70 100644 --- a/benchmarks/2d/conge.geo +++ b/benchmarks/2d/conge.geo @@ -73,3 +73,5 @@ Plane Surface(22) = {21}; Line Loop(23) = {11,-12,13,14,1,2,-3,4,5,6,7,-8,9,10}; Plane Surface(24) = {23,21}; +Physical Line(25) = {9,1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,20,10}; +Physical Surface(26) = {22,24};