From fde80622e8486d9a24ef667b99638dc871829b9b Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Thu, 3 Nov 2005 02:39:24 +0000 Subject: [PATCH] fix gcc warnings + disable BDS optimization for now (it leads to wrong results with gcc 4; maybe we should have more intelligent tests in configure or in the makefiles to enable/disable optimization depending on which compiler is used) --- Mesh/BDS.cpp | 14 ++++++-------- Mesh/BDS.h | 3 ++- Mesh/Makefile | 5 ++++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Mesh/BDS.cpp b/Mesh/BDS.cpp index b0546b7abf..3988ee6fdd 100644 --- a/Mesh/BDS.cpp +++ b/Mesh/BDS.cpp @@ -1,4 +1,4 @@ -// $Id: BDS.cpp,v 1.40 2005-11-01 16:37:12 remacle Exp $ +// $Id: BDS.cpp,v 1.41 2005-11-03 02:39:24 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -151,7 +151,7 @@ void BDS_GeomEntity::getClosestTriangles ( double x, double y, double z, queryPt[1] = y; queryPt[2] = z; - double eps; + double eps = 0.; kdTree->annkSearch( // search queryPt, // query point nbK, // number of near neighbors @@ -670,7 +670,7 @@ void BDS_Mesh :: reverseEngineerCAD ( ) // printf("%d points plane surface %d ?? : %g %g %g\n",pts.size(),(*it)->classif_tag,RSLT(0),RSLT(1),RSLT(2)); bool plane = true; - for (int i=0;i<pts.size();i++) + for (unsigned int i=0;i<pts.size();i++) { const double dist = PLANE ( i , 0 ) * RSLT(0)+PLANE ( i , 1 ) * RSLT(1)+PLANE ( i , 2 ) * RSLT(2)+1; if (fabs(dist) > 1.e-5 * LC * sqrt (RSLT(0)*RSLT(0)+RSLT(1)*RSLT(1)+RSLT(2)*RSLT(2)) )plane = false; @@ -910,10 +910,8 @@ void BDS_Point :: compute_curvature ( ) } } -int compute_curvatures (std::list<BDS_Edge*> &edges) +void compute_curvatures (std::list<BDS_Edge*> &edges) { - const int init_inner = 1; - { std::list<BDS_Edge*>::iterator it = edges.begin(); std::list<BDS_Edge*>::iterator ite = edges.end(); @@ -999,7 +997,7 @@ void BDS_Mesh :: color_plane_surf ( double eps, int NB_T ) } if (!start)break; recur_color_plane_surf ( eps, start , start->N(),all,plane ); - if (plane.size() > NB_T) + if ((int)plane.size() > NB_T) { // printf("plane surface found %d triangles\n",plane.size()); std::list<BDS_Triangle*>::iterator xit = plane.begin(); @@ -1141,7 +1139,7 @@ void BDS_Mesh :: classify ( double angle, int NB_T ) { int MIN_FAC = 100000; int MAX_FAC = -100000; - std::map< std::pair<int,int> , int >::iterator found; + std::map< std::pair<int,int> , int >::iterator found = 0; BDS_GeomEntity *g; if ( e.numfaces() == 1) { diff --git a/Mesh/BDS.h b/Mesh/BDS.h index 8de723d097..c1bb9fd2f2 100644 --- a/Mesh/BDS.h +++ b/Mesh/BDS.h @@ -51,7 +51,7 @@ class BDS_Metric const double target,_min,_max,treshold, beta; const double nb_elements_per_radius_of_curvature; BDS_Metric ( double _target , double _mmin, double _mmax, double _b, double cc, double _tres = 0.7) - : target(_target),_min(_mmin),_max(_mmax), beta(_b),treshold(_tres),nb_elements_per_radius_of_curvature(cc) + : target(_target),_min(_mmin),_max(_mmax),treshold(_tres),beta(_b),nb_elements_per_radius_of_curvature(cc) {} inline double update_target_length( double _target, double old_target_length ) const { @@ -480,6 +480,7 @@ public: BDS_Point *o[3]; f1->getNodes (n); f2->getNodes (o); + n[3] = 0; //for stupid gcc warning if(o[0] != n[0] && o[0] != n[1] &&o[0] != n[2])n[3] = o[0]; if(o[1] != n[0] && o[1] != n[1] &&o[1] != n[2])n[3] = o[1]; if(o[2] != n[0] && o[2] != n[1] &&o[2] != n[2])n[3] = o[2]; diff --git a/Mesh/Makefile b/Mesh/Makefile index ee11a13c74..8789bf3f7d 100644 --- a/Mesh/Makefile +++ b/Mesh/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.97 2005-09-21 18:09:20 geuzaine Exp $ +# $Id: Makefile,v 1.98 2005-11-03 02:39:24 geuzaine Exp $ # # Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle # @@ -93,6 +93,9 @@ ${LIB}: ${OBJ} # Don't optimize 3D_Mesh: it sometimes mysteriously crashes on Linux 3D_Mesh.o: ${CXX} ${FLAGS} ${INCLUDE} -c $< +# Don't optimize BDS: it leads to erroneous results with gcc 4.0 +BDS.o: + ${CXX} ${FLAGS} ${INCLUDE} -c $< clean: rm -f *.o -- GitLab