diff --git a/Geo/GeoInterpolation.cpp b/Geo/GeoInterpolation.cpp index ed1e23b88afbe42a94e1055cc6c20ab4b63497b4..45ba40fb94c767b9ef97a3ea64405bf1fe33b830 100644 --- a/Geo/GeoInterpolation.cpp +++ b/Geo/GeoInterpolation.cpp @@ -736,7 +736,7 @@ static Vertex InterpolateExtrudedSurface(Surface *s, double u, double v) Vertex InterpolateSurface(Surface *s, double u, double v, int derivee, int u_v) { if(derivee == 1) { - double eps = 1.e-6; + double eps = 1.e-8; Vertex D[4]; if(u_v == 1) { if(u - eps < 0.0) { diff --git a/Mesh/BackgroundMesh.cpp b/Mesh/BackgroundMesh.cpp index e0c01c4ba12380ec1269653703f23a03dcd14f78..fc8fffdf6603245bf34bc31758cdede4583e6d8f 100644 --- a/Mesh/BackgroundMesh.cpp +++ b/Mesh/BackgroundMesh.cpp @@ -174,7 +174,7 @@ static SMetric3 metric_based_on_surface_curvature(const GFace *gf, double u, dou static SMetric3 metric_based_on_surface_curvature(const GEdge *ge, double u) { - SMetric3 mesh_size(1.e-05); + SMetric3 mesh_size(1.e-12); std::list<GFace *> faces = ge->faces(); std::list<GFace *>::iterator it = faces.begin(); int count = 0; @@ -192,6 +192,7 @@ static SMetric3 metric_based_on_surface_curvature(const GEdge *ge, double u) double Crv = ge->curvature(u); double lambda = ((2 * M_PI) /( fabs(Crv) * CTX::instance()->mesh.minCircPoints ) ); SMetric3 curvMetric (1./(lambda*lambda)); + return intersection(mesh_size,curvMetric); } diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp index 192e9b1cb5a2b1e4afe3582901698ba97d652e63..c7a5d197b2e6ff9c2ffc4c864a5c335925521b6d 100644 --- a/Mesh/Field.cpp +++ b/Mesh/Field.cpp @@ -1281,7 +1281,7 @@ class MinAnisoField : public Field else{ (*f) (x, y, z, ff, ge); } - v = intersection(v,ff); + v = intersection_conserve_mostaniso(v,ff); } } metr = v; diff --git a/Mesh/HighOrder.cpp b/Mesh/HighOrder.cpp index c7e17705f0189ae83240f9b83b5c05e1f1069cb2..1a9049d7bec2fec732d106907768f094a7f29a1f 100644 --- a/Mesh/HighOrder.cpp +++ b/Mesh/HighOrder.cpp @@ -122,7 +122,7 @@ static bool computeEquidistantParameters0(GEdge *ge, double u0, double uN, int N return false; } // 1 = geodesics -static int method_for_computing_intermediary_points = 0; +static int method_for_computing_intermediary_points = 1; static bool computeEquidistantParameters(GEdge *ge, double u0, double uN, int N, double *u, double underRelax){ if (method_for_computing_intermediary_points == 0) // use linear abscissa diff --git a/Mesh/meshGEdge.cpp b/Mesh/meshGEdge.cpp index 73c2a71ff826d76e509167ff4f98e9b1ccb4d6cf..bb79388eddfc12165965f0c802c7b14e70e1ff32 100644 --- a/Mesh/meshGEdge.cpp +++ b/Mesh/meshGEdge.cpp @@ -31,11 +31,8 @@ static double smoothPrimitive (GEdge *ge, double alpha, std::vector<IntPoint> &Points) { - for (int i=0; i< Points.size(); i++){ - IntPoint &pt = Points[i]; - SVector3 der = ge->firstDer(pt.t); - pt.xp = der.norm(); - } + // printf("alpha = %g\n",alpha); + int ITER = 0; while (1){ int count1 = 0; @@ -45,28 +42,34 @@ static double smoothPrimitive (GEdge *ge, // iterate forward and then backward // convergence is usually very fast. for (int i=1; i< Points.size(); i++){ - double hprime; - hprime = ((Points[i].xp/Points[i].lc) - (Points[i-1].xp/Points[i-1].lc))/(Points[i].t - Points[i-1].t); - if (hprime * Points[i].xp > alpha*1.01){ - double hnew = Points[i-1].xp / Points[i-1].lc + (Points[i].t - Points[i-1].t) * alpha / Points[i].xp; + double dh = (Points[i].xp/Points[i].lc - Points[i-1].xp/Points[i-1].lc); + double dt = Points[i].t - Points[i-1].t; + double dhdt = dh/dt; + if (dhdt / Points[i].xp > (alpha - 1.)*1.01){ + double hnew = Points[i-1].xp / Points[i-1].lc + dt * (alpha-1) * Points[i].xp; Points[i].lc = Points[i].xp / hnew; count1 ++; } } - + for (int i=Points.size()-1; i>0 ; i--){ - double hprime; - hprime = ((Points[i].xp/Points[i].lc) - (Points[i-1].xp/Points[i-1].lc))/(Points[i].t - Points[i-1].t); - if (-hprime * Points[i].xp > alpha*1.01){ - double hnew = Points[i].xp / Points[i].lc + (Points[i].t - Points[i-1].t) * alpha / Points[i-1].xp; + double dh = (Points[i-1].xp/Points[i-1].lc - Points[i].xp/Points[i].lc); + double dt = fabs(Points[i-1].t - Points[i].t); + double dhdt = dh/dt; + if (dhdt / Points[i-1].xp > (alpha-1.)*1.01){ + double hnew = Points[i].xp / Points[i].lc + dt * (alpha-1) * Points[i].xp; Points[i-1].lc = Points[i-1].xp / hnew; count2 ++; + // dh = (Points[i-1].xp/Points[i-1].lc - Points[i].xp/Points[i].lc); + // dt = fabs(Points[i-1].t - Points[i].t); + // dhdt = dh/dt; + // printf("dhdt / Points[i-1].xp } } - + ++ITER; - if (ITER > 1000){printf("OUUUUUH\n");break;} + if (ITER > 2000){break;} if (!(count1+count2))break; } // recompute the primitive @@ -226,7 +229,7 @@ static void RecursiveIntegration(GEdge *ge, IntPoint *from, IntPoint *to, double val3 = trapezoidal(&P, to); double err = fabs(val1 - val2 - val3); - if(((err < Prec) && (*depth > 1)) || (*depth > 25)) { + if(((err < Prec) && (*depth > 3)) || (*depth > 25)) { p1=Points.back(); P.p = p1.p + val2; Points.push_back(P); @@ -300,9 +303,11 @@ static void printFandPrimitive(int tag, std::vector<IntPoint> &Points) sprintf(name, "line%d.dat", tag); FILE *f = fopen(name, "w"); if(!f) return; + double l = 0; for (unsigned int i = 0; i < Points.size(); i++){ const IntPoint &P = Points[i]; - fprintf(f, "%g %g %g %g\n", P.t, 1./P.lc, P.p,P.lc); + if (i) l +=(P.t - Points[i-1].t)*P.xp; + fprintf(f, "%g %g %g %g %g\n", P.t, P.xp/P.lc, P.p,P.lc, l); } fclose(f); } @@ -313,7 +318,7 @@ void meshGEdge::operator() (GEdge *ge) FieldManager *fields = ge->model()->getFields(); BoundaryLayerField *blf = 0; if(fields->getBackgroundField() > 0){ - Field *bl_field = fields->get(fields->getBackgroundField()); + Field *bl_field = fields->get(fields->getBoundaryLayerField()); blf = dynamic_cast<BoundaryLayerField*> (bl_field); } #else @@ -395,8 +400,13 @@ void meshGEdge::operator() (GEdge *ge) CTX::instance()->mesh.lcIntegrationPrecision); // FIXME JF : MAYBE WE SHOULD NOT ALWAYS SMOOTH THE 1D MESH SIZE FIELD ?? + for (int i=0; i< Points.size(); i++){ + IntPoint &pt = Points[i]; + SVector3 der = ge->firstDer(pt.t); + pt.xp = der.norm(); + } //printFandPrimitive(ge->tag(), Points); - // a = smoothPrimitive (ge,CTX::instance()->mesh.smoothRatio*CTX::instance()->mesh.smoothRatio,Points); + a = smoothPrimitive (ge,/*CTX::instance()->mesh.smoothRatio*/CTX::instance()->mesh.smoothRatio,Points); // printf(" coucou %g\n",a); //printFandPrimitive(ge->tag()+10000, Points); diff --git a/Mesh/meshGFaceBoundaryLayers.cpp b/Mesh/meshGFaceBoundaryLayers.cpp index 889cd5ffc08f76afceab67e8b150afa9af8d917d..f313d257d34805a39e075de0cfb7bdf6d02d2013 100644 --- a/Mesh/meshGFaceBoundaryLayers.cpp +++ b/Mesh/meshGFaceBoundaryLayers.cpp @@ -241,9 +241,9 @@ BoundaryLayerColumns* buidAdditionalPoints2D (GFace *gf, double _treshold) } else if (angle >= _treshold){ int fanSize = angle / _treshold; - printf("ONE FAN HAS BEEN CREATED : %d %d %d %d ANGLE = %g | %g %g %g %g\n",e1.getVertex(0)->getNum(), - e1.getVertex(1)->getNum(),e2.getVertex(0)->getNum(),e2.getVertex(1)->getNum(), - angle/M_PI*180,N1[SIDE].x(),N1[SIDE].y(),N2[SIDE].x(),N2[SIDE].y()); + // printf("ONE FAN HAS BEEN CREATED : %d %d %d %d ANGLE = %g | %g %g %g %g\n",e1.getVertex(0)->getNum(), + // e1.getVertex(1)->getNum(),e2.getVertex(0)->getNum(),e2.getVertex(1)->getNum(), + // angle/M_PI*180,N1[SIDE].x(),N1[SIDE].y(),N2[SIDE].x(),N2[SIDE].y()); // if the angle is greater than PI, than reverse the sense double alpha1 = atan2(N1[SIDE].y(),N1[SIDE].x()); double alpha2 = atan2(N2[SIDE].y(),N2[SIDE].x()); diff --git a/Mesh/meshGFaceDelaunayInsertion.cpp b/Mesh/meshGFaceDelaunayInsertion.cpp index f42fdde41d5a012329d3cdd5f123e773e9c2a92f..0ffbe0d84f77f899bc9ecbe6b4ffb0d184353738 100644 --- a/Mesh/meshGFaceDelaunayInsertion.cpp +++ b/Mesh/meshGFaceDelaunayInsertion.cpp @@ -1129,7 +1129,8 @@ void bowyerWatsonFrontal(GFace *gf) // sprintf(name,"frontal%d-param.pos", gf->tag()); // _printTris (name, AllTris, Us, Vs,true); transferDataStructure(gf, AllTris, Us, Vs); - quadsToTriangles(gf,10000); + // in case of boundary layer meshing + // quadsToTriangles(gf,10000); } void optimalPointFrontalQuad (GFace *gf,