diff --git a/Common/Options.cpp b/Common/Options.cpp index d4d17aec8e66dec820d4e851282549efc98bfd51..e55a2a16ba31fcc664aef2f861d60b8d8095eec9 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -136,9 +136,7 @@ static const char *GetOptionSaveLevel(int level) static void PrintStringOptionsDoc(StringXString s[], const char *prefix, FILE *file) { - int i = 0, j; - char tmp[1024]; - + int i = 0; while(s[i].str) { fprintf(file, "@item %s%s\n", prefix, s[i].str); fprintf(file, "%s@*\n", s[i].help); @@ -1928,7 +1926,7 @@ std::string opt_view_name(OPT_ARGS_STR) #if defined(HAVE_FLTK) // change name in GUI for the view and its aliases if(GUI::available()){ - for(unsigned int i = 0; i < PView::list.size(); i++){ + for(int i = 0; i < (int)PView::list.size(); i++){ if((i == num || PView::list[i]->getAliasOf() == view->getNum() || PView::list[i]->getNum() == view->getAliasOf()) && diff --git a/Common/StringUtils.cpp b/Common/StringUtils.cpp index 79a9e0ab1af6123caebb453b163c8602c02b81da..3669bfacb4348084b707cd413f16cfea7206327a 100644 --- a/Common/StringUtils.cpp +++ b/Common/StringUtils.cpp @@ -78,8 +78,8 @@ std::vector<std::string> SplitFileName(std::string fileName) // returns [path, baseName, extension] int idot = fileName.find_last_of('.'); int islash = fileName.find_last_of("/\\"); - if(idot == std::string::npos) idot = -1; - if(islash == std::string::npos) islash = -1; + if(idot == (int)std::string::npos) idot = -1; + if(islash == (int)std::string::npos) islash = -1; std::vector<std::string> s(3); if(idot > 0) s[2] = fileName.substr(idot); diff --git a/Fltk/Solvers.cpp b/Fltk/Solvers.cpp index 391ca8aa91983013964245216940a4931d9b8785..6e9e73992a42aedd0c89050ea188871adaef9cb6 100644 --- a/Fltk/Solvers.cpp +++ b/Fltk/Solvers.cpp @@ -304,7 +304,7 @@ int Solver(int num, const char *args) !initOption[3] || !initOption[4]){ // some options have been changed for(int i = 0; i < SINFO[num].nboptions; i++) { GUI::instance()->solver[num]->choice[i]->clear(); - for(int j = 0; j < SINFO[num].option[i].size(); j++) + for(unsigned int j = 0; j < SINFO[num].option[i].size(); j++) GUI::instance()->solver[num]->choice[i]->add(SINFO[num].option[i][j].c_str()); GUI::instance()->solver[num]->choice[i]->value(0); } diff --git a/Fltk/classificationEditor.cpp b/Fltk/classificationEditor.cpp index 10e610a5123e474c0e4b2c0d952341df57389b69..beed453202b7e62a24043c1575e807f6e024f93e 100644 --- a/Fltk/classificationEditor.cpp +++ b/Fltk/classificationEditor.cpp @@ -196,17 +196,6 @@ static void class_ok_cb(Fl_Widget *w, void *data) Msg::StatusBar(3, false, ""); } -static void class_okcolor_cb(Fl_Widget *w, void *data) -{ - classificationEditor *e = (classificationEditor*)data; - e->edge_detec->deactivate(); - e->edge_detec->show(); - e->face_color->deactivate(); - e->face_color->hide(); - // class_save_cb(w,data); - Msg::StatusBar(3, false, ""); -} - static int maxEdgeNum() { GModel::eiter it = GModel::current()->firstEdge(); @@ -386,7 +375,7 @@ static void class_color_cb(Fl_Widget* w, void* data) printf("NEW edge with tag = %d \n", ge->tag()); std::list<MLine*> segments; - for (int i=0; i < ge->lines.size(); i++){ + for (unsigned int i = 0; i < ge->lines.size(); i++){ segments.push_back(ge->lines[i]); } @@ -406,7 +395,6 @@ static void class_color_cb(Fl_Widget* w, void* data) for (int i=0; i<2; i++) { - bool found = false; for (std::list<MLine*>::iterator it = segments.begin() ; it != segments.end(); ++it){ MVertex *v1 = (*it)->getVertex(0); MVertex *v2 = (*it)->getVertex(1); @@ -486,7 +474,7 @@ static void updateedges_cb(Fl_Widget* w, void* data) { classificationEditor *e = (classificationEditor*)data; - printf("%d inside edges detected\n", e->edges_detected.size()); + printf("%d inside edges detected\n", (int)e->edges_detected.size()); for(unsigned int i = 0; i < e->temporary->lines.size(); i++){ delete e->temporary->lines[i]; @@ -501,7 +489,7 @@ static void updateedges_cb(Fl_Widget* w, void* data) e->temporary->lines.push_back(new MLine(ea.v1, ea.v2)); } - printf("%d boundary edges detected\n", e->edges_lonly.size()); + printf("%d boundary edges detected\n", (int)e->edges_lonly.size()); if(e->_togbuttons[CLASSTOGBUTTON_CLOS]->value()){ for(unsigned int i = 0 ; i < e->edges_lonly.size(); i++){ edge_angle ea = e->edges_lonly[i]; diff --git a/Fltk/fieldWindow.cpp b/Fltk/fieldWindow.cpp index 24445826744cec40ac25df40ad7a595a914e9c25..192993dd5142a0178c92a749040ef0dc58fc08ab 100644 --- a/Fltk/fieldWindow.cpp +++ b/Fltk/fieldWindow.cpp @@ -72,7 +72,7 @@ static void field_put_on_view_cb(Fl_Widget *w, void *data) Field *field = (Field*)GUI::instance()->fields->editor_group->user_data(); if(mb->value() == 0) field->putOnNewView(); - else if(mb->value() - 1 < PView::list.size()) + else if(mb->value() - 1 < (int)PView::list.size()) field->putOnView(PView::list[mb->value() - 1]); GUI::instance()->updateViews(); Draw(); diff --git a/Fltk/pluginWindow.cpp b/Fltk/pluginWindow.cpp index 7431b4f5b136b94d85b2c2e7786b35f580acf1c1..125cf6d02693bd45ca4170349325607a02ba0601 100644 --- a/Fltk/pluginWindow.cpp +++ b/Fltk/pluginWindow.cpp @@ -143,13 +143,6 @@ static void plugin_run_cb(Fl_Widget *w, void *data) Draw(); } -static void plugin_cancel_cb(Fl_Widget *w, void *data) -{ - GUI::instance()->plugins->win->hide(); - CTX::instance()->post.pluginDrawFunction = NULL; - Draw(); -} - void pluginWindow::_createDialogBox(GMSH_Plugin *p, int x, int y, int width, int height) { diff --git a/Fltk/projectionEditor.cpp b/Fltk/projectionEditor.cpp index 9e3129a0d95b8a37077ede1534c26223dedaa185..a098fadd3b66227ae5ff79a9b8e7ce3393eacbe9 100644 --- a/Fltk/projectionEditor.cpp +++ b/Fltk/projectionEditor.cpp @@ -648,7 +648,7 @@ static void blend_cb(Fl_Widget *w, void *data) m->getFMInternals()->makeGFace(m->getFMInternals()->current()-> GetGroup(0)->GetBlendGroup()-> GetPatch(i),m); - for (int i = 0; i < faces.size(); i++) { + for (unsigned int i = 0; i < faces.size(); i++) { //delete_fourier(faces[i]); faces[i]->setVisibility(0, true); } @@ -1041,8 +1041,8 @@ projectionEditor::projectionEditor() "Blend"); b1->callback(blend_cb, this); - Fl_Button *b2 = new Fl_Button(2 * WB + BB, height - WB - BH, BB, - BH, "Intersect"); + //Fl_Button *b2 = new Fl_Button(2 * WB + BB, height - WB - BH, BB, + // BH, "Intersect"); } _window->end(); diff --git a/Fltk/solverWindow.cpp b/Fltk/solverWindow.cpp index 2348d9d46162b03daab6e0f0da5bafff5f2ee576..4cbaf93a3f9a5a5bd08dd76775721d0b25c6916e 100644 --- a/Fltk/solverWindow.cpp +++ b/Fltk/solverWindow.cpp @@ -129,7 +129,7 @@ static void solver_command_cb(Fl_Widget *w, void *data) return; } int val = GUI::instance()->solver[num]->choice[usedopts]->value(); - if(val < SINFO[num].option[usedopts].size()) + if(val < (int)SINFO[num].option[usedopts].size()) sprintf(command, SINFO[num].button_command[idx].c_str(), SINFO[num].option[usedopts][val].c_str()); else{ diff --git a/Fltk/visibilityWindow.cpp b/Fltk/visibilityWindow.cpp index ade9229e28ca6c91fe6204902496632be04c830f..5daf0933f6f0473af736dfc11e6ed9fa102a7a41 100644 --- a/Fltk/visibilityWindow.cpp +++ b/Fltk/visibilityWindow.cpp @@ -1025,7 +1025,8 @@ static void visibility_per_window_cb(Fl_Widget *w, void *data) std::string what = (const char*)data; if(what == "item"){ drawContext *ctx = GUI::instance()->getCurrentOpenglWindow()->getDrawContext(); - for(int i = 0; i < GUI::instance()->visibility->per_window->size(); i++){ + for(unsigned int i = 0; + i < (unsigned int)GUI::instance()->visibility->per_window->size(); i++){ if(i < GModel::list.size()){ GModel *m = GModel::list[i]; if(GUI::instance()->visibility->per_window->selected(i + 1)) ctx->show(m); diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index ebbb1eb82c54afb106c405025c0a2a10683a22ce..77fcf8961e2d1e370f0b8785e3cc9613fda5144b 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -240,7 +240,6 @@ double GEdge::length(const double &u0, const double &u1, const int nbQuadPoints) GPoint GEdge::closestPoint(const SPoint3 &q, double &t) const { double tolerance = 1.e-12; - double dist = 1.; Range<double> interval = parBounds(0); @@ -283,7 +282,6 @@ double GEdge::parFromPoint(const SPoint3 &P) const bool GEdge::XYZToU(const double X, const double Y, const double Z, double &u, const double relax) const { - const double Precision = 1.e-8; const int MaxIter = 25; const int NumInitGuess = 11; diff --git a/Geo/GEdgeCompound.cpp b/Geo/GEdgeCompound.cpp index b4c0c0c6a522286a8697129b4f0fa716269b88fd..40aaaeb53e35885c0677a5d3a4aa043f05fe9ee8 100644 --- a/Geo/GEdgeCompound.cpp +++ b/Geo/GEdgeCompound.cpp @@ -39,7 +39,7 @@ void GEdgeCompound::orderEdges() std::vector<GEdge*> _c ; std::list<GEdge*> edges ; - for (int i=0;i<_compound.size();i++){ + for (unsigned int i=0;i<_compound.size();i++){ //printf("set compound %d for edge %d \n", tag(), _compound[i]->tag()); _compound[i]->setCompound(this); edges.push_back(_compound[i]); @@ -136,7 +136,7 @@ void GEdgeCompound::orderEdges() if (_orientation[0] && _compound[0]->getEndVertex() != _compound[1]->getEndVertex() && _compound[0]->getEndVertex() != _compound[1]->getBeginVertex()){ // printf("coucou again\n"); - for (int i=0;i<_compound.size();i++){ + for (unsigned int i = 0; i < _compound.size(); i++){ _orientation[i] = !_orientation[i] ; } } @@ -154,23 +154,28 @@ void GEdgeCompound::orderEdges() } -int GEdgeCompound::minimumMeshSegments() const{ +int GEdgeCompound::minimumMeshSegments() const +{ int N = 0; - for (int i=0;i<_compound.size();i++)N +=_compound[i]->minimumMeshSegments(); + for (unsigned int i = 0; i < _compound.size(); i++) + N +=_compound[i]->minimumMeshSegments(); return N; } -int GEdgeCompound::minimumDrawSegments() const{ + +int GEdgeCompound::minimumDrawSegments() const +{ int N = 0; - for (int i=0;i<_compound.size();i++)N +=_compound[i]->minimumDrawSegments(); + for (unsigned int i = 0; i < _compound.size(); i++) + N +=_compound[i]->minimumDrawSegments(); return N; } - GEdgeCompound::~GEdgeCompound() { } -Range<double> GEdgeCompound::parBounds(int i) const { +Range<double> GEdgeCompound::parBounds(int i) const +{ return Range<double>(0, _pars[_compound.size()]); } @@ -185,7 +190,7 @@ void GEdgeCompound::getLocalParameter ( const double &t, double & tLoc) const { - for (iEdge=0 ; iEdge<_compound.size() ;iEdge++){ + for (iEdge = 0; iEdge < (int)_compound.size(); iEdge++){ //printf("iEdge=%d tmin=%g\n",iEdge,_pars[iEdge]); double tmin = _pars[iEdge]; double tmax = _pars[iEdge+1]; @@ -203,7 +208,7 @@ void GEdgeCompound::getLocalParameter ( const double &t, void GEdgeCompound::parametrize() { _pars.push_back(0.0); - for (int i=0;i<_compound.size();i++){ + for (unsigned int i = 0; i < _compound.size(); i++){ Range<double> b = _compound[i]->parBounds(0); _pars.push_back(_pars[_pars.size()-1]+(b.high() - b.low())); } @@ -214,7 +219,6 @@ void GEdgeCompound::parametrize() } - double GEdgeCompound::curvature(double par) const { double tLoc; @@ -239,4 +243,3 @@ SVector3 GEdgeCompound::firstDer(double par) const getLocalParameter(par,iEdge,tLoc); return _compound[iEdge]->firstDer(tLoc); } - diff --git a/Geo/GEntity.cpp b/Geo/GEntity.cpp index b3cad39c423da2b18790e9658eb49f184b40eeb2..97cbbd215948ec2ca3acc32b45213ab067efdaad 100644 --- a/Geo/GEntity.cpp +++ b/Geo/GEntity.cpp @@ -17,7 +17,7 @@ GEntity::GEntity(GModel *m, int t) : _model(m), _tag(t), _visible(1), _selection(0), - _allElementsVisible(1), va_lines(0), va_triangles(0), _obb(0) + _allElementsVisible(1), _obb(0), va_lines(0), va_triangles(0) { _color = CTX::instance()->packColor(0, 0, 255, 0); } diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 631f6c243a7a437b8753c66c9d20d2a523bd2434..c44c79949e111e07e5b9a4352d5623dc2d7c8653 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -338,7 +338,7 @@ void GModel::setSelection(int val) // reset selection in elements (stored in the visibility flag to // save space) if(val == 0){ - for(int j = 0; j < entities[i]->getNumMeshElements(); j++) + for(unsigned int j = 0; j < entities[i]->getNumMeshElements(); j++) if(entities[i]->getMeshElement(j)->getVisibility() == 2) entities[i]->getMeshElement(j)->setVisibility(1); } @@ -1040,7 +1040,7 @@ void GModel::createTopologyFromMesh() } } else { - for(int i = 0; i < myEdges.size(); i++){ + for(unsigned int i = 0; i < myEdges.size(); i++){ if (myEdges[i].getVertex(0)->onWhat()->dim() == 1) { int tagEdge = myEdges[i].getVertex(0)->onWhat()->tag(); //printf("tagedge =%d \n", tagEdge); @@ -1141,7 +1141,7 @@ void GModel::createTopologyFromMesh() add(e); Dedges.push_back(e); std::list<MVertex*> all_vertices; - for(int i = 0; i < myLines.size(); i++) { + for(unsigned int i = 0; i < myLines.size(); i++) { MVertex *v0 = myLines[i].getVertex(0); MVertex *v1 = myLines[i].getVertex(1); e->lines.push_back(new MLine( v0, v1)); diff --git a/Geo/GModelIO_Fourier.h b/Geo/GModelIO_Fourier.h index 8d17278dd262d60fddb497793fa62c140839be76..80f41c3e026f85ce88d1fce252c32d56cf87a587 100644 --- a/Geo/GModelIO_Fourier.h +++ b/Geo/GModelIO_Fourier.h @@ -28,10 +28,9 @@ class FM_Internals { void buildGModel(FM::Reader* reater, GModel* model); FM::Reader* getReader(int tag) - { - if (tag < reader.size()) - return reader[tag]; - } + { + if(tag < (int)reader.size()) return reader[tag]; + } int getSize() { return reader.size(); } FM::Reader* current() { return reader[reader.size() - 1]; } }; diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp index 43ac4ac82174d9dbaf7bd4e6453dfc41c98bc257..009431674d180a7094fbec96dbd7650b6408ede1 100644 --- a/Geo/Geo.cpp +++ b/Geo/Geo.cpp @@ -904,7 +904,6 @@ static Curve *DuplicateCurve(Curve *c, bool copyMeshingMethod) static void CopySurface(Surface *s, Surface *ss, bool copyMeshingMethod) { - int i, j; ss->Typ = s->Typ; if(copyMeshingMethod){ ss->Method = s->Method; @@ -2932,7 +2931,7 @@ bool ProjectPointOnSurface(Surface *s, Vertex &p, double uv[2]) } { int NSAMPLES = 500; - double uok, vok; + double uok = 0.5, vok = 0.5; double dmin = 1.e22; for (int i = 0; i < NSAMPLES; i++){ const double U = i / (double)(NSAMPLES - 1); diff --git a/Geo/GeomMeshMatcher.cpp b/Geo/GeomMeshMatcher.cpp index 5842f0c4fc18e4ae7b7a56fc78e3268dd6f5640f..a3b460df4ee12a35f4f1697101d7280480fcf942 100644 --- a/Geo/GeomMeshMatcher.cpp +++ b/Geo/GeomMeshMatcher.cpp @@ -113,7 +113,7 @@ vector<Pair<GVertex*,GVertex*> >* GeomMeshMatcher::matchVertices(GModel* m1, GMo entity2++) { if ((*entity2)->dim() != 0) continue; - for (int ed = 0; + for (unsigned int ed = 0; ed < ((discreteVertex*) *entity2)->getNumMeshElements(); ed++) { @@ -159,8 +159,6 @@ vector<Pair<GEdge*,GEdge*> >* GeomMeshMatcher::matchEdges(GModel* m1, GModel* m vector<GEntity*> m2_entities; m2->getEntities(m2_entities); - int counter1 = 0; - for (vector<GEntity*>::iterator entity1 = m1_entities.begin(); entity1 != m1_entities.end(); entity1++) @@ -248,8 +246,6 @@ vector<Pair<GFace*,GFace*> >* GeomMeshMatcher:: matchFaces(GModel* m1, GModel* m vector<GEntity*> m2_entities; m2->getEntities(m2_entities); - int counter1 = 0; - for (vector<GEntity*>::iterator entity1 = m1_entities.begin(); entity1 != m1_entities.end(); entity1++) @@ -271,7 +267,6 @@ vector<Pair<GFace*,GFace*> >* GeomMeshMatcher:: matchFaces(GModel* m1, GModel* m num_matched_faces++; } else if (common_faces.size() > 1) { - int N; // Then, compute the minimal bounding box SOrientedBoundingBox geo_obb = ((GFace*)(*entity1))->getOBB(); @@ -326,8 +321,6 @@ vector<Pair<GRegion*,GRegion*> >* GeomMeshMatcher:: matchRegions(GModel* m1, GMo vector<GEntity*> m2_entities; m2->getEntities(m2_entities); - int counter1 = 0; - for (vector<GEntity*>::iterator entity1 = m1_entities.begin(); entity1 != m1_entities.end(); entity1++) @@ -373,15 +366,9 @@ vector<Pair<GRegion*,GRegion*> >* GeomMeshMatcher:: matchRegions(GModel* m1, GMo */ list<GEdge*> boundaries = ((GRegion*) *entity1)->edges(); - const int N = 10; - int count = 0; - const int N_total = N*boundaries.size(); - double** vertices = new double*[N_total]; - // Then, compute the minimal bounding box SOrientedBoundingBox geo_obb = ((GRegion*) *entity1)->getOBB(); - GRegion* choice = 0; double best_score = DBL_MAX; // Next, let's iterate over the mesh entities. diff --git a/Geo/MElementCut.h b/Geo/MElementCut.h index e16892e6b99d156a48a0b25c9dcd1564b67847b2..cfef4956b175f3939f6429e4e803b270b60e9369 100644 --- a/Geo/MElementCut.h +++ b/Geo/MElementCut.h @@ -25,9 +25,8 @@ class MPolyhedron : public MElement { void _init(); public: MPolyhedron(std::vector<MVertex*> v, int num=0, int part=0) - : MElement(num, part) + : MElement(num, part), _owner(false), _orig(0) { - _orig = NULL; _owner = false; /*_parts.push_back(new MTetrahedron(v[0], v[1], v[2], v[3])); for(unsigned int i = 4; i < v.size(); i++) { unsigned int k; @@ -62,15 +61,14 @@ class MPolyhedron : public MElement { }*/ } MPolyhedron(std::vector<MTetrahedron*> vT, int num=0, int part=0) - : MElement(num, part) + : MElement(num, part), _owner(false), _orig(0) { - _orig = NULL; _owner = false; for(unsigned int i = 0; i < vT.size(); i++) _parts.push_back(vT[i]); _init(); } MPolyhedron(std::vector<MTetrahedron*> vT, MElement* orig, bool owner, int num=0, int part=0) - : MElement(num, part), _orig(orig), _owner(owner) + : MElement(num, part), _owner(owner), _orig(orig) { for(unsigned int i = 0; i < vT.size(); i++) _parts.push_back(vT[i]); @@ -156,24 +154,22 @@ class MPolygon : public MElement { void _initVertices(); public: MPolygon(std::vector<MVertex*> v, int num=0, int part=0) - : MElement(num, part) + : MElement(num, part), _owner(false), _orig(0) { - _orig = NULL; _owner = false; for(unsigned int i = 0; i < v.size(); i++) _vertices.push_back(v[i]); for(unsigned int i = 1; i < v.size() - 1; i++) _parts.push_back(new MTriangle(v[0], v[i], v[i+1])); } MPolygon(std::vector<MTriangle*> vT, int num=0, int part=0) - : MElement(num, part) + : MElement(num, part), _owner(false), _orig(0) { - _orig = NULL; _owner = false; for(unsigned int i = 0; i < vT.size(); i++) _parts.push_back(vT[i]); _initVertices(); } MPolygon(std::vector<MTriangle*> vT, MElement* orig, bool owner, int num=0, int part=0) - : MElement(num, part), _orig(orig), _owner(owner) + : MElement(num, part), _owner(owner), _orig(orig) { for(unsigned int i = 0; i < vT.size(); i++) _parts.push_back(vT[i]); diff --git a/Geo/MTetrahedron.cpp b/Geo/MTetrahedron.cpp index 9e932d9e4bbfde2b299f0ae68740d20f01350e4e..26b3a708d8a003a7d424d9bf12d0a3de106c6264 100644 --- a/Geo/MTetrahedron.cpp +++ b/Geo/MTetrahedron.cpp @@ -202,8 +202,7 @@ static void _myGetFaceRep(MTetrahedron *tet, int num, double *x, double *y, doub const double d = 1. / numSubEdges; SPoint3 pnt1, pnt2, pnt3; - double J1[2][3], J2[2][3], J3[2][3]; - double u1,v1,u2,v2,u3,v3; + double u1, v1, u2, v2, u3, v3; if (ix % 2 == 0){ u1 = ix / 2 * d; v1= iy*d; u2 = (ix / 2 + 1) * d ; v2 = iy * d; @@ -227,16 +226,16 @@ static void _myGetFaceRep(MTetrahedron *tet, int num, double *x, double *y, doub double W2 = pp[iVertex1][2] * (1.-u2-v2) + pp[iVertex2][2] * u2 + pp[iVertex3][2] * v2; double W3 = pp[iVertex1][2] * (1.-u3-v3) + pp[iVertex2][2] * u3 + pp[iVertex3][2] * v3; - tet->pnt(U1,V1,W1,pnt1); - tet->pnt(U2,V2,W2,pnt2); - tet->pnt(U3,V3,W3,pnt3); + tet->pnt(U1, V1, W1, pnt1); + tet->pnt(U2, V2, W2, pnt2); + tet->pnt(U3, V3, W3, pnt3); x[0] = pnt1.x(); x[1] = pnt2.x(); x[2] = pnt3.x(); y[0] = pnt1.y(); y[1] = pnt2.y(); y[2] = pnt3.y(); z[0] = pnt1.z(); z[1] = pnt2.z(); z[2] = pnt3.z(); - SVector3 d1(x[1]-x[0],y[1]-y[0],z[1]-z[0]); - SVector3 d2(x[2]-x[0],y[2]-y[0],z[2]-z[0]); + SVector3 d1(x[1] - x[0], y[1] - y[0], z[1] - z[0]); + SVector3 d2(x[2] - x[0], y[2] - y[0], z[2] - z[0]); n[0] = crossprod(d1, d2); n[0].normalize(); n[1] = n[0]; diff --git a/Geo/OCC_Connect.cpp b/Geo/OCC_Connect.cpp index b4fa00f45c77240db2bbfb4241f99b0a35aa909f..aba904d4814224be369464c9759ffcfa24030ec3 100644 --- a/Geo/OCC_Connect.cpp +++ b/Geo/OCC_Connect.cpp @@ -205,7 +205,7 @@ void dump(std::vector<std::pair<int,int> > const &e2v, std::ostream &out, const char *name="name") { out << "graph " << name << " {\n"; - for(int e=0; e<e2v.size(); e++) { + for(unsigned int e = 0; e < e2v.size(); e++) { out << " " << e2v[e].first << " -- " << e2v[e].second << "[label=" << e+1 << "]\n"; } out << "}\n"; @@ -262,7 +262,7 @@ void OCC_Connect::FaceCutters::Build(TopoDS_Face const &face, /* First we create some data structures to access the topology */ TopTools_IndexedMapOfShape vertices; std::vector<std::pair<int,int> > e2v; - for(int i=0; i<edges.size(); i++) { + for(unsigned int i = 0; i < edges.size(); i++) { TopExp::MapShapes(edges[i],TopAbs_VERTEX,vertices); TopoDS_Vertex v1, v2; TopExp::Vertices(edges[i],v1,v2); @@ -271,17 +271,17 @@ void OCC_Connect::FaceCutters::Build(TopoDS_Face const &face, } std::vector<std::set<int> > v2e; - for(int e=0; e<e2v.size(); e++) { - if(e2v[e].first>=v2e.size()) + for(unsigned int e = 0; e < e2v.size(); e++) { + if(e2v[e].first >= (int)v2e.size()) v2e.resize(e2v[e].first+1); v2e[e2v[e].first].insert(e); - if(e2v[e].second>=v2e.size()) + if(e2v[e].second >= (int)v2e.size()) v2e.resize(e2v[e].second+1); v2e[e2v[e].second].insert(e); } std::set<int> open, odd; - for(int i=0; i<v2e.size(); i++) { + for(unsigned int i = 0; i < v2e.size(); i++) { if(v2e[i].size()==0) continue; else if(v2e[i].size()==1) @@ -294,11 +294,11 @@ void OCC_Connect::FaceCutters::Build(TopoDS_Face const &face, std::cerr << "Inconsistent open loops\n"; if(odd.size()&1) std::cerr << "Inconsistent odd loops\n"; - int first_edge=-1; + for(;;) { - int open_mode; + int open_mode = -1; std::set<int> current_vertices; - for(int start=0; start<v2e.size(); start++) { + for(unsigned int start = 0; start < v2e.size(); start++) { if(v2e[start].size()==1) { if(verbose&Cutting) std::cout << "start open at " << start << "\n"; @@ -308,7 +308,7 @@ void OCC_Connect::FaceCutters::Build(TopoDS_Face const &face, } } if(!current_vertices.size()) { - for(int start=0; start<v2e.size(); start++) { + for(unsigned int start = 0; start < v2e.size(); start++) { if(v2e[start].size()) { if(verbose&Cutting) std::cout << "start closed at " << start << "\n"; @@ -421,7 +421,7 @@ void OCC_Connect::FaceCutters::Build(TopoDS_Face const &face, BRep_Builder BB; TopoDS_Compound compound; BB.MakeCompound(compound); - for(int i=0; i<edges.size(); i++) + for(unsigned int i = 0; i < edges.size(); i++) BB.Add(compound,edges[i]); BRepTools::Write(compound,"cutter.brep"); ofstream out("cutter.dot",ios::trunc|ios::out); @@ -502,7 +502,6 @@ inline OCC_Connect::cutmap_t OCC_Connect::SelectCuttingEdges( void OCC_Connect::Intersect(BRep_Builder &BB, TopoDS_Shape &target, TopoDS_Shape &shape, TopoDS_Shape &tool) { - int t=0; /*************************************************************************** We start by splitting edges at all the edge-edge intersections. This may generate new vertices and edges. @@ -940,7 +939,7 @@ bool OCC_Connect::CanMergeFace(TopoDS_Face face1,TopoDS_Face face2) const // FIXME, this really does not work. return 1; - double tol=1e-7; + //double tol=1e-7; Handle(Geom_Surface) surface=BRep_Tool::Surface(face1); Standard_Real u1, u2, v1, v2; diff --git a/Geo/SOrientedBoundingBox.cpp b/Geo/SOrientedBoundingBox.cpp index c24d317ee677f14d5b2de9715abb1fdd3d484956..fda9f31e98d85e0594b017b5556b2df63417b5a0 100644 --- a/Geo/SOrientedBoundingBox.cpp +++ b/Geo/SOrientedBoundingBox.cpp @@ -313,7 +313,7 @@ SOrientedBoundingBox* SOrientedBoundingBox::buildOBB(vector<SPoint3> vertices) { */ // We take the smallest component, then project the data on the plane defined by the other twos - int smallest_comp; + int smallest_comp = 0; if (sizes[0] <= sizes[1] && sizes[0] <= sizes[2]) smallest_comp = 0; else if (sizes[1] <= sizes[0] && sizes[1] <= sizes[2]) @@ -344,7 +344,7 @@ SOrientedBoundingBox* SOrientedBoundingBox::buildOBB(vector<SPoint3> vertices) { DocRecord record(points.size()); record.numPoints = points.size(); srand((unsigned)time(0)); - for (int i = 0; i < points.size(); i++) { + for (unsigned int i = 0; i < points.size(); i++) { record.points[i].where.h = points[i]->x()+(10e-6)*sizes[smallest_comp==0?1:0]*(-0.5+((double)rand())/RAND_MAX); record.points[i].where.v = points[i]->y()+(10e-6)*sizes[smallest_comp==2?1:0]*(-0.5+((double)rand())/RAND_MAX); record.points[i].adjacent = NULL; diff --git a/Geo/discreteEdge.cpp b/Geo/discreteEdge.cpp index 361ca618abba93a10e3bd9c6a5fa7a73d548fdad..9e33a280affe14052a059f96cd396aac8a0d4247 100644 --- a/Geo/discreteEdge.cpp +++ b/Geo/discreteEdge.cpp @@ -53,7 +53,7 @@ void discreteEdge::orderMLines() std::list<MLine*> segments; //store all lines in a list : segments - for (int i=0;i<lines.size();i++){ + for (unsigned int i = 0; i < lines.size(); i++){ //printf("BEFORE ORDERING segment i=%d, vert=%d, %d\n", i, lines[i]->getVertex(0)->getNum(), lines[i]->getVertex(1)->getNum() ); segments.push_back(lines[i]); } @@ -142,7 +142,7 @@ void discreteEdge::orderMLines() if (_orientation[0] && lines[0]->getVertex(1) != lines[1]->getVertex(1) && lines[0]->getVertex(1) != lines[1]->getVertex(0)){ printf("coucou here \n"); - for (int i=0;i<lines.size();i++) _orientation[i] = !_orientation[i] ; + for (unsigned int i = 0; i < lines.size(); i++) _orientation[i] = !_orientation[i] ; } // for (int i=0;i<lines.size();i++){ @@ -236,7 +236,7 @@ void discreteEdge::setBoundVertices() void discreteEdge::parametrize() { - for (int i=0;i<lines.size()+1;i++){ + for (unsigned int i = 0; i < lines.size() + 1; i++){ _pars.push_back(i); } @@ -250,7 +250,7 @@ void discreteEdge::parametrize() MVertex *vL = getBeginVertex()->mesh_vertices[0]; int i = 0; - for(i=0 ; i < lines.size()-1; i++){ + for(i = 0 ; i < (int)lines.size() - 1; i++){ MVertex *vR ; if (_orientation[i] == 1 ) vR = lines[i]->getVertex(1); else vR = lines[i]->getVertex(0); @@ -402,7 +402,7 @@ void discreteEdge::computeNormals () const void discreteEdge::getLocalParameter(const double &t, int &iLine, double &tLoc) const { - for (iLine=0 ; iLine<lines.size() ;iLine++){ + for (iLine = 0; iLine < (int)lines.size(); iLine++){ double tmin = _pars[iLine]; double tmax = _pars[iLine+1]; if (t >= tmin && t <= tmax){ diff --git a/Geo/discreteFace.cpp b/Geo/discreteFace.cpp index 235fe26504a908a09688744f340635571be65fab..486330b46a576593db92220efe572d69cd5b03da 100644 --- a/Geo/discreteFace.cpp +++ b/Geo/discreteFace.cpp @@ -28,7 +28,7 @@ void discreteFace::findEdges(std::map<MEdge, std::vector<int>, Less_Edge > &map_ //find the boundary edges std::list<MEdge> bound_edges; - for (int iFace = 0; iFace < getNumMeshElements() ; iFace++) { + for (unsigned int iFace = 0; iFace < getNumMeshElements() ; iFace++) { std::vector<MVertex*> fv; MElement *e = getMeshElement(iFace); e->getFaceVertices(0, fv); diff --git a/Graphics/drawContext.cpp b/Graphics/drawContext.cpp index 876b0304a51cce2b2ef477bf1e60f1abf478a5b5..879edf6b27020f428b6c4417d23ff84de34c70b2 100644 --- a/Graphics/drawContext.cpp +++ b/Graphics/drawContext.cpp @@ -398,7 +398,7 @@ void drawContext::initProjection(int xpick, int ypick, int wpick, int hpick) if(_bgImage.empty()){ int idot = CTX::instance()->bgImageFileName.find_last_of('.'); std::string ext; - if(idot > 0 && idot < CTX::instance()->bgImageFileName.size()) + if(idot > 0 && idot < (int)CTX::instance()->bgImageFileName.size()) ext = CTX::instance()->bgImageFileName.substr(idot + 1); Fl_RGB_Image *img = 0; if(ext == "jpg" || ext == "JPG" || ext == "jpeg" || ext == "JPEG") diff --git a/Graphics/drawScales.cpp b/Graphics/drawScales.cpp index e2cb4870fca13bcba1c77cd5d011beb8680b17fa..c4cc7baff8855816371cf4eb075be562f6ced53d 100644 --- a/Graphics/drawScales.cpp +++ b/Graphics/drawScales.cpp @@ -159,7 +159,7 @@ static void drawScaleLabel(drawContext *ctx, PView *p, double xmin, double ymin, PViewData *data; // requested by Laurent: but is this really what we should be doing? - if(opt->externalViewIndex >= 0 && opt->externalViewIndex < PView::list.size()) + if(opt->externalViewIndex >= 0 && opt->externalViewIndex < (int)PView::list.size()) data = PView::list[opt->externalViewIndex]->getData(); else data = p->getData(); diff --git a/Numeric/Numeric.cpp b/Numeric/Numeric.cpp index 3567d89b9b7f371282924bfc1597d43407695b03..5a70e6736a1f573150a2cb2159fd80dfecc40446 100644 --- a/Numeric/Numeric.cpp +++ b/Numeric/Numeric.cpp @@ -590,16 +590,13 @@ f(x+a*d) = f(x) + f'(x) ( */ -void gmshLineSearch (double (*func)(gmshVector<double> &, void *), void* data, - gmshVector<double> &x, - gmshVector<double> &p, - gmshVector<double> &g, - double &f, - double stpmax, int &check) +void gmshLineSearch(double (*func)(gmshVector<double> &, void *), void* data, + gmshVector<double> &x, gmshVector<double> &p, + gmshVector<double> &g, double &f, + double stpmax, int &check) { int i; - double alam,alam2,alamin,f2,fold2,rhs1,rhs2,sum,temp, - tmplam; + double alam, alam2 = 1., alamin, f2 = 0., fold2 = 0., rhs1, rhs2, temp, tmplam; const double ALF = 1.0e-4; const double TOLX = 1.0e-9; diff --git a/Post/adaptiveData.cpp b/Post/adaptiveData.cpp index d25b469c631b055169597cc04af0212564085ebb..d5b584fd1d565f20620d96c2b60f99d79762bbb0 100644 --- a/Post/adaptiveData.cpp +++ b/Post/adaptiveData.cpp @@ -927,7 +927,7 @@ void adaptiveElements<T>::adapt(double tol, int numComp, } int numVals = _coeffsVal ? _coeffsVal->size1() : T::numNodes; - if(numVals != values.size()){ + if(numVals != (int)values.size()){ Msg::Error("Wrong number of values in adaptation %d != %i", numVals, values.size()); return; @@ -970,7 +970,7 @@ void adaptiveElements<T>::adapt(double tol, int numComp, } int numNodes = _coeffsGeom ? _coeffsGeom->size1() : T::numNodes; - if(numNodes != coords.size()){ + if(numNodes != (int)coords.size()){ Msg::Error("Wrong number of nodes in adaptation %d != %i", numNodes, coords.size()); return;