diff --git a/Geo/GFaceCompound.h b/Geo/GFaceCompound.h index e3da8676697e52d4dc873f359a4b883ef2a4090d..efc4338452c6109f16018a95ba2bc649f5c877c3 100644 --- a/Geo/GFaceCompound.h +++ b/Geo/GFaceCompound.h @@ -24,6 +24,8 @@ #endif #define AR_MAX 5 //maximal geometrical aspect ratio +class rbf; + /* A GFaceCompound is a model face that is the compound of model faces. diff --git a/Mesh/meshGFaceLloyd.cpp b/Mesh/meshGFaceLloyd.cpp index c9b7d225d0b824dd4712967a143cb936d6ebaa29..b06f3a2b1e475967630b97294dd7bd3e342532b2 100644 --- a/Mesh/meshGFaceLloyd.cpp +++ b/Mesh/meshGFaceLloyd.cpp @@ -402,7 +402,7 @@ void smoothing::optimize_model(){ for(it=model->firstFace();it!=model->lastFace();it++) { gf = *it; - if(gf->getNumMeshElements()>0){ + if(gf->getNumMeshElements()>0 && gf->geomType()==GEntity::CompoundSurface){ optimize_face(gf); recombineIntoQuads(gf,1,1); } @@ -645,6 +645,9 @@ SPoint2 lpcvt::seed(DocRecord& triangulator,GFace* gf){ int index2; double x,y; SPoint2 x0,x1,x2; + + work_around = gf; + for(i=0;i<triangulator.numPoints;i++){ if(interior(triangulator,gf,i)){ num = triangulator._adjacencies[i].t_length; @@ -1126,7 +1129,7 @@ double lpcvt::get_rho(SPoint2 point,int p){ x = point.x(); y = point.y(); - h = backgroundMesh::current()->operator()(x,y,0.0); //0.1; + h = backgroundMesh::current()->operator()(x,y,0.0)*ratio(point); //0.1; if(h>=0.0){ rho = pow_int(1.0/h,p+1); //integer only, theoric value : p+2 } @@ -1220,6 +1223,18 @@ double lpcvt::drho_dy(SPoint2 point,int p){ return val; } +double lpcvt::ratio(SPoint2 point){ + double val; + double uv[2]; + double metric[3]; + + uv[0] = point.x(); + uv[1] = point.y(); + buildMetric(work_around,uv,metric); + val = 1.0/pow(metric[0]*metric[2]-metric[1]*metric[1],0.25); + return val; +} + void lpcvt::write(DocRecord& triangulator,GFace* gf,int p){ int i; double energy; diff --git a/Mesh/meshGFaceLloyd.h b/Mesh/meshGFaceLloyd.h index 58942d703c924fcb8dd42ea4252b7a2e74d30d83..045e6c1a7d37eb85e060c729fc9e760fdb5b1045 100644 --- a/Mesh/meshGFaceLloyd.h +++ b/Mesh/meshGFaceLloyd.h @@ -46,6 +46,7 @@ class lpcvt{ fullMatrix<double> gauss_weights; std::vector<metric> metrics; int gauss_num; + GFace* work_around; public : lpcvt(); ~lpcvt(); @@ -81,6 +82,7 @@ class lpcvt{ double get_rho(SPoint2,int); double drho_dx(SPoint2,int); double drho_dy(SPoint2,int); + double ratio(SPoint2); void write(DocRecord&,GFace*,int); void eval(DocRecord&,std::vector<SVector3>&,double&,int); void swap();