diff --git a/Geo/CAD.cpp b/Geo/CAD.cpp index 910f29d78fddbca8cf206ffbec8cd610129ecc39..58c6a1c6c7595c70e72a63170682431dcb109fb6 100644 --- a/Geo/CAD.cpp +++ b/Geo/CAD.cpp @@ -1,4 +1,4 @@ -// $Id: CAD.cpp,v 1.55 2003-02-19 00:17:01 geuzaine Exp $ +// $Id: CAD.cpp,v 1.56 2003-02-20 10:05:09 remacle Exp $ // // Copyright (C) 1997 - 2003 C. Geuzaine, J.-F. Remacle // @@ -1910,6 +1910,7 @@ bool IntersectCurves (Curve *c1, Curve *c2, if(check) return false; v1 = InterpolateCurve(c1,x[1],0); v2 = InterpolateCurve(c2,x[2],0); + // Msg(INFO, "success : %lf %lf,%lf,%lf\n",v1.Pos.X,v1.Pos.Y,x[1],x[2]); if(x[1] <= c1->ubeg) return false; if(x[1] >= c1->uend) return false; if(x[2] <= c2->ubeg) return false; diff --git a/Numeric/gsl_newt.cpp b/Numeric/gsl_newt.cpp index 571a6d1a85e744383ef969c1b83694af5e4eba8c..5c67e2cc50f57e1de653cff0ac56421477243143 100644 --- a/Numeric/gsl_newt.cpp +++ b/Numeric/gsl_newt.cpp @@ -1,4 +1,4 @@ -// $Id: gsl_newt.cpp,v 1.2 2003-02-18 07:13:57 geuzaine Exp $ +// $Id: gsl_newt.cpp,v 1.3 2003-02-20 10:05:09 remacle Exp $ // // Copyright (C) 1997 - 2003 C. Geuzaine, J.-F. Remacle // @@ -46,20 +46,21 @@ void convert_vector_from_gsl(const gsl_vector *gv, double * v){ int i, m; m=gv->size; for (i=0;i<m;i++){ - v[i]=gsl_vector_get(gv,i); + v[i+1]=gsl_vector_get(gv,i); } } void convert_vector_to_gsl(double *v, int n, gsl_vector *gv){ int i; for (i=0;i<n;i++){ - gsl_vector_set (gv, i, v[i]); + gsl_vector_set (gv, i, v[i+1]); } } int gslfunc(const gsl_vector *xx, void *params, gsl_vector *f){ convert_vector_from_gsl(xx,gsl_u); (*nrfunc)(gsl_dim,gsl_u,gsl_v); + // Msg(INFO, "f(%lf,%lf) = %lf %lf\n",gsl_u[1],gsl_u[2],gsl_v[1],gsl_v[2]); convert_vector_to_gsl(gsl_v,gsl_dim,f); return GSL_SUCCESS; } @@ -86,16 +87,23 @@ void newt(double x[], int n, int *check, void (*func)(int, double [],double [])) do{ iter++; status = gsl_multiroot_fsolver_iterate(s); + // Msg(INFO, "status %d %d %d %lf %lf\n",status,n,iter,gsl_vector_get(s->x,0),gsl_vector_get(s->x,1)); if(status) break; // solver problem status = gsl_multiroot_test_residual(s->f, n*PREC); } while(status == GSL_CONTINUE && iter < MAXITER); - if (status == GSL_CONTINUE) - *check=1; - else - *check=0; - + if (status == GSL_CONTINUE)// problem !!! + { + *check=1; + } + else// converged + { + // Msg(INFO, "status %d %d %d %lf %lf\n",status,n,iter,gsl_vector_get(s->x,0),gsl_vector_get(s->x,1)); + convert_vector_from_gsl(s->x,x); + *check=0; + } + gsl_multiroot_fsolver_free(s); gsl_vector_free(xx); } diff --git a/benchmarks/bugs/intersect.geo b/benchmarks/bugs/intersect.geo index 4ec694f89ef00ef99e7d097f94a0c1d432f97914..9a75164f49e9d18e407532de201388b714d36163 100644 --- a/benchmarks/bugs/intersect.geo +++ b/benchmarks/bugs/intersect.geo @@ -4,16 +4,17 @@ Point(2) = {.1, 0, 0, lc} ; Point(3) = {.1, .3, 0, lc} ; Point(4) = {0, .3, 0, lc} ; -Line(1) = {1,2} ; -Line(2) = {3,2} ; -Line(3) = {3,4} ; -Line(4) = {4,1} ; +//Line(1) = {1,2} ; +//Line(2) = {3,2} ; +//Line(3) = {3,4} ; +//Line(4) = {4,1} ; -Line Loop(5) = {4,1,-2,3} ; -Plane Surface(6) = {5} ; +//Line Loop(5) = {4,1,-2,3} ; +//Plane Surface(6) = {5} ; Line(101) = {2,4}; Line(102) = {1,3}; Intersect; +