From e8fd74f2548050125fd85db4fd286292df3edd51 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 24 Sep 2007 08:14:30 +0000 Subject: [PATCH] fixed g++ warnings --- Common/CommandLine.cpp | 4 +-- Common/Options.cpp | 8 +++--- Fltk/Callbacks.cpp | 26 ++++++++--------- Fltk/GUI.cpp | 12 ++++---- Fltk/GUI_Classifier.cpp | 16 +++++------ Fltk/GUI_Projection.cpp | 17 +++++------ Fltk/Solvers.cpp | 4 +-- Geo/GFace.cpp | 4 +-- Geo/Geo.cpp | 8 ++++-- Graphics/Geom.cpp | 4 +-- Graphics/Graph2D.cpp | 5 ++-- Graphics/Post.cpp | 13 ++++----- Mesh/Field.cpp | 61 +++++++++++++++++++--------------------- Mesh/meshGEdge.cpp | 10 +++---- Mesh/meshGFace.cpp | 7 ++--- Parser/OpenFile.cpp | 6 ++-- Plugin/CutMap.cpp | 4 +-- Plugin/Evaluate.cpp | 4 +-- Plugin/ExtractEdges.cpp | 4 +-- Plugin/FieldView.cpp | 4 +-- Plugin/Levelset.cpp | 4 +-- Plugin/Plugin.cpp | 4 +-- Plugin/Probe.cpp | 4 +-- Post/PViewDataGModel.cpp | 6 +++- Post/PViewDataList.cpp | 39 +++++++++++++------------ 25 files changed, 136 insertions(+), 142 deletions(-) diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index 0465ee2a43..4e747388ee 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -1,4 +1,4 @@ -// $Id: CommandLine.cpp,v 1.104 2007-09-10 04:47:01 geuzaine Exp $ +// $Id: CommandLine.cpp,v 1.105 2007-09-24 08:14:28 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -288,7 +288,7 @@ void Get_Options(int argc, char *argv[]) while(i < argc) { char filename[256]; sprintf(filename, "%s_new", argv[i]); - int n = PView::list.size(); + unsigned int n = PView::list.size(); OpenProject(argv[i]); // convert post-processing views to latest binary format for(unsigned int j = n; j < PView::list.size(); j++) diff --git a/Common/Options.cpp b/Common/Options.cpp index 47abcd5b82..ca50d51528 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.361 2007-09-22 23:25:02 geuzaine Exp $ +// $Id: Options.cpp,v 1.362 2007-09-24 08:14:28 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -200,7 +200,7 @@ void Print_OptionCategory(int level, int diff, int help, char *cat, FILE * file) GmshColorTable *Get_ColorTable(int num) { PViewOptions *opt; - if(PView::list.empty() || num < 0 || num > PView::list.size() - 1) + if(PView::list.empty() || num < 0 || num > (int)PView::list.size() - 1) opt = &PViewOptions::reference; else{ opt = PView::list[num]->getOptions(); @@ -213,7 +213,7 @@ GmshColorTable *Get_ColorTable(int num) void Print_ColorTable(int num, int diff, char *prefix, FILE *file) { PViewOptions *opt; - if(PView::list.empty() || num < 0 || num > PView::list.size() - 1) + if(PView::list.empty() || num < 0 || num > (int)PView::list.size() - 1) opt = &PViewOptions::reference; else opt = PView::list[num]->getOptions(); @@ -842,7 +842,7 @@ int Get_ColorForString(StringX4Int SX4I[], int alpha, if(PView::list.empty()) \ opt = &PViewOptions::reference; \ else{ \ - if(num < 0 || num >= PView::list.size()){ \ + if(num < 0 || num >= (int)PView::list.size()){ \ Msg(WARNING, "View[%d] does not exist", num); \ return (error_val); \ } \ diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 4a4ec378d8..1c20ea2f7b 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.548 2007-09-22 23:25:02 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.549 2007-09-24 08:14:28 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -495,9 +495,9 @@ void ManualPlay(int time, int step) } else { // hide all views except view_in_cycle if(step > 0) { - if((view_in_cycle += step) >= PView::list.size()) + if((view_in_cycle += step) >= (int)PView::list.size()) view_in_cycle = 0; - for(unsigned int i = 0; i < PView::list.size(); i += step) + for(int i = 0; i < (int)PView::list.size(); i += step) opt_view_visible(i, GMSH_SET | GMSH_GUI, (i == view_in_cycle)); } else { @@ -621,7 +621,7 @@ void file_open_cb(CALLBACK_ARGS) OpenProject(file_chooser_get_name(1)); Draw(); } - if(n != PView::list.size()) + if(n != (int)PView::list.size()) WID->set_context(menu_post, 0); } @@ -634,7 +634,7 @@ void file_merge_cb(CALLBACK_ARGS) MergeFile(file_chooser_get_name(i)); Draw(); } - if(n != PView::list.size()) + if(n != (int)PView::list.size()) WID->set_context(menu_post, 0); } @@ -1200,7 +1200,7 @@ void view_options_cb(CALLBACK_ARGS) void view_options_timestep_cb(CALLBACK_ARGS) { int links = (int)opt_post_link(0, GMSH_GET, 0); - for(unsigned int i = 0; i < PView::list.size(); i++) { + for(int i = 0; i < (int)PView::list.size(); i++) { if((links == 2 || links == 4) || ((links == 1 || links == 3) && opt_view_visible(i, GMSH_GET, 0)) || (links == 0 && i == WID->view_number)) { @@ -1213,7 +1213,7 @@ void view_options_timestep_cb(CALLBACK_ARGS) void view_options_timestep_decr_cb(CALLBACK_ARGS) { int links = (int)opt_post_link(0, GMSH_GET, 0); - for(unsigned int i = 0; i < PView::list.size(); i++) { + for(int i = 0; i < (int)PView::list.size(); i++) { if((links == 2 || links == 4) || ((links == 1 || links == 3) && opt_view_visible(i, GMSH_GET, 0)) || (links == 0 && i == WID->view_number)) { @@ -1227,7 +1227,7 @@ void view_options_timestep_decr_cb(CALLBACK_ARGS) void view_options_timestep_incr_cb(CALLBACK_ARGS) { int links = (int)opt_post_link(0, GMSH_GET, 0); - for(unsigned int i = 0; i < PView::list.size(); i++) { + for(int i = 0; i < (int)PView::list.size(); i++) { if((links == 2 || links == 4) || ((links == 1 || links == 3) && opt_view_visible(i, GMSH_GET, 0)) || (links == 0 && i == WID->view_number)) { @@ -1374,7 +1374,7 @@ void view_options_ok_cb(CALLBACK_ARGS) char gen_raise2[256]; strcpy(gen_raise2, opt_view_gen_raise2(current, GMSH_GET, NULL)); // modify only the views that need to be updated - for(unsigned int i = 0; i < PView::list.size(); i++) { + for(int i = 0; i < (int)PView::list.size(); i++) { if((links == 2 || links == 4) || ((links == 1 || links == 3) && opt_view_visible(i, GMSH_GET, 0)) || (links == 0 && i == current)) { @@ -4216,7 +4216,7 @@ void view_toggle_cb(CALLBACK_ARGS) static void _view_reload(int index) { - if(index >= 0 && index < PView::list.size()){ + if(index >= 0 && index < (int)PView::list.size()){ PView *p = PView::list[index]; if(StatFile((char*)p->getData()->getFileName().c_str())){ @@ -4229,7 +4229,7 @@ static void _view_reload(int index) // FIXME: use fileIndex MergeFile((char*)p->getData()->getFileName().c_str()); - if(PView::list.size() > n){ // we loaded a new view + if((int)PView::list.size() > n){ // we loaded a new view // delete old data and replace with new delete p->getData(); p->setData(PView::list.back()->getData()); @@ -4432,7 +4432,7 @@ void view_all_visible_cb(CALLBACK_ARGS) void view_applybgmesh_cb(CALLBACK_ARGS) { int index = (int)(long)data; - if(index >= 0 && index < PView::list.size()){ + if(index >= 0 && index < (int)PView::list.size()){ Field *field = new PostViewField(PView::list[index]); BGMReset(); BGMAddField(field); @@ -4549,7 +4549,7 @@ void view_plugin_run_cb(CALLBACK_ARGS) for(int i = 1; i <= WID->plugin_view_browser->size(); i++) { if(WID->plugin_view_browser->selected(i)) { try{ - if(i - 1 >= 0 && i - 1 < PView::list.size()) + if(i - 1 >= 0 && i - 1 < (int)PView::list.size()) p->execute(PView::list[i - 1]); else p->execute(0); diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 3c7acc3631..b034047c6a 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.642 2007-09-22 23:25:03 geuzaine Exp $ +// $Id: GUI.cpp,v 1.643 2007-09-24 08:14:28 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -602,7 +602,7 @@ int GUI::global_shortcuts(int event) } else if(Fl::test_shortcut(FL_SHIFT + 'w')) { if(PView::list.size()) - if(view_number >= 0 && view_number < PView::list.size()) + if(view_number >= 0 && view_number < (int)PView::list.size()) create_view_options_window(view_number); else create_view_options_window(0); @@ -610,7 +610,7 @@ int GUI::global_shortcuts(int event) } else if(Fl::test_shortcut(FL_SHIFT + 'u')) { if(PView::list.size()) - if(view_number >= 0 && view_number < PView::list.size()) + if(view_number >= 0 && view_number < (int)PView::list.size()) create_plugin_window(view_number); else create_plugin_window(0); @@ -3416,7 +3416,7 @@ void GUI::create_option_window() void GUI::update_view_window(int num) { - if(num < 0 || num >= PView::list.size()) return; + if(num < 0 || num >= (int)PView::list.size()) return; view_number = num; @@ -3703,7 +3703,7 @@ void GUI::reset_plugin_view_browser() plugin_view_browser->add(str); } for(int i = 0; i < plugin_view_browser->size(); i++){ - if(i < state.size() && state[i]) + if(i < (int)state.size() && state[i]) plugin_view_browser->select(i + 1); } } @@ -3725,7 +3725,7 @@ void GUI::create_plugin_window(int numview) if(plugin_window) { reset_plugin_view_browser(); - if(numview >= 0 && numview < PView::list.size()){ + if(numview >= 0 && numview < (int)PView::list.size()){ plugin_view_browser->deselect(); plugin_view_browser->select(numview + 1); view_plugin_browser_cb(NULL, NULL); diff --git a/Fltk/GUI_Classifier.cpp b/Fltk/GUI_Classifier.cpp index 3c4a5ce87f..f6201f4d7b 100644 --- a/Fltk/GUI_Classifier.cpp +++ b/Fltk/GUI_Classifier.cpp @@ -183,7 +183,7 @@ void class_color_cb(Fl_Widget* w, void* data) GModel::eiter ite = GModel::current()->lastEdge(); for( ;it!=ite;++it) { - for (int i=0;i<(*it)->lines.size();i++)lines[(*it)->lines[i] ] = *it; + for (unsigned int i=0;i<(*it)->lines.size();i++)lines[(*it)->lines[i] ] = *it; } } @@ -194,7 +194,7 @@ void class_color_cb(Fl_Widget* w, void* data) while (it != e->_faces.end()) { GFace *gf = *it; - for (int i=0;i<gf->triangles.size();i++) + for (unsigned int i=0;i<gf->triangles.size();i++) { tris.push_back (new MTri3 ( gf->triangles [i] , 0 ) ); } @@ -256,13 +256,13 @@ void updateedges_cb(Fl_Widget* w, void* data) // printf("%d edges detected\n",e->edges_detected.size()); - for (int i=0;i<e->temporary->lines.size();i++) + for (unsigned int i=0;i<e->temporary->lines.size();i++) { delete e->temporary->lines[i]; } e->temporary->lines.clear(); - for ( int i=0 ; i<e->edges_detected.size();i++) + for (unsigned int i=0 ; i<e->edges_detected.size();i++) { edge_angle ea = e->edges_detected[i]; // printf("angle = %g\n",ea.angle); @@ -273,7 +273,7 @@ void updateedges_cb(Fl_Widget* w, void* data) if (e->_togbuttons[CLASSTOGBUTTON_CLOS]->value()) { - for ( int i=0 ; i<e->edges_lonly.size();i++) + for (unsigned int i=0 ; i<e->edges_lonly.size();i++) { edge_angle ea = e->edges_lonly[i]; e->temporary->lines.push_back(new MLine(ea.v1, ea.v2)); @@ -357,7 +357,7 @@ classificationEditor::classificationEditor() _window = new Dialog_Window(width, height, "Classify"); - Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 2 * WB); + new Fl_Tabs(WB, WB, width - 2 * WB, height - 2 * WB); { Fl_Group *o = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Edge Detection"); edge_detec = o; @@ -608,7 +608,7 @@ void class_deleteedge_cb(Fl_Widget *w, void *data) std::vector<MLine*> temp = e->temporary->lines; e->temporary->lines.clear(); - for(int i=0;i<temp.size();i++) + for(unsigned int i=0;i<temp.size();i++) { std::vector<MLine*>::iterator it = std::find (ele.begin(),ele.end(),temp[i]); if (it != ele.end()) @@ -645,7 +645,7 @@ void class_clear_cb(Fl_Widget *w, void *data) { classificationEditor *e = (classificationEditor*)data; - for (int i=0;i<e->temporary->lines.size();i++) + for (unsigned int i=0;i<e->temporary->lines.size();i++) { delete e->temporary->lines[i]; } diff --git a/Fltk/GUI_Projection.cpp b/Fltk/GUI_Projection.cpp index 8fbc78d64a..32b85317e5 100644 --- a/Fltk/GUI_Projection.cpp +++ b/Fltk/GUI_Projection.cpp @@ -119,7 +119,7 @@ void uvPlot::draw() static char min[256], max[256], pts[256]; sprintf(min, "%g", _dmin); sprintf(max, "%g", _dmax); - sprintf(pts, "[%d pts]", _u.size()); + sprintf(pts, "[%d pts]", (int)_u.size()); fl_draw(min, 5, h() - 5); fl_draw(pts, pw / 2 - (int)fl_width(pts) / 2, h() - 5); fl_draw(max, pw - (int)fl_width(max) - 5, h() - 5); @@ -369,10 +369,8 @@ projectionEditor::projectionEditor() } { - Fl_Button *b1 = new Fl_Button(WB, height - 2 * WB - 2 * BH, - BB, BH, "Blend"); - Fl_Button *b2 = new Fl_Button(2 * WB + BB, height - 2 * WB - 2 * BH, - BB, BH, "Intersect"); + new Fl_Button(WB, height - 2 * WB - 2 * BH, BB, BH, "Blend"); + new Fl_Button(2 * WB + BB, height - 2 * WB - 2 * BH, BB, BH, "Intersect"); } Fl_Button *b = new Fl_Button(width - WB - BB, height - WB - BH, BB, BH, "Cancel"); @@ -510,7 +508,6 @@ void set_position_cb(Fl_Widget *w, void *data) projectionEditor *e = (projectionEditor*)data; projection *p = e->getCurrentProjection(); if(p){ - FM::ProjectionSurface *ps = p->face->GetProjectionSurface(); std::vector<GVertex*> vertices; std::vector<GEdge*> edges; std::vector<GFace*> faces; @@ -739,7 +736,7 @@ void filter_cb(Fl_Widget *w, void *data) for(unsigned int i = 0; i < ent.size(); i++){ GVertex *gv = dynamic_cast<GVertex*>(ent[i]); if(gv){ - double uu, vv, p[3], n[3]; + double uu, vv, p[3]; ps->OrthoProjectionOnSurface(gv->x(), gv->y(), gv->z(), uu, vv); ps->F(uu, vv, p[0], p[1], p[2]); double dx = gv->x() - p[0], dy = gv->y() - p[1], dz = gv->z() - p[2]; @@ -753,7 +750,7 @@ void filter_cb(Fl_Widget *w, void *data) std::vector<MElement*> &ele(e->getElements()); for(unsigned int i = 0; i < ele.size(); i++){ SPoint3 pc = ele[i]->barycenter(); - double uu, vv, p[3], n[3]; + double uu, vv, p[3]; ps->OrthoProjectionOnSurface(pc.x(), pc.y(), pc.z(), uu, vv); ps->F(uu, vv, p[0], p[1], p[2]); double dx = pc.x() - p[0], dy = pc.y() - p[1], dz = pc.z() - p[2]; @@ -816,7 +813,7 @@ void save_selection_cb(Fl_Widget *w, void *data) verts.insert(ele[i]->getVertex(j)); } } - fprintf(fp, "$NOD\n%d\n", verts.size()); + fprintf(fp, "$NOD\n%d\n", (int)verts.size()); for(std::set<MVertex*>::iterator it = verts.begin(); it != verts.end(); it++) (*it)->writeMSH(fp); fprintf(fp, "$ENDNOD\n$ELM\n%d\n", nelm); @@ -908,7 +905,7 @@ void compute_cb(Fl_Widget *w, void *data) int uModes = e->getMode(0); int vModes = e->getMode(1); - if(f.size() < uModes * vModes){ + if((int)f.size() < uModes * vModes){ Msg(GERROR, "Number of points < uModes * vModes"); return; } diff --git a/Fltk/Solvers.cpp b/Fltk/Solvers.cpp index 0a0e5385c0..236ca52946 100644 --- a/Fltk/Solvers.cpp +++ b/Fltk/Solvers.cpp @@ -1,4 +1,4 @@ -// $Id: Solvers.cpp,v 1.56 2007-09-10 04:47:02 geuzaine Exp $ +// $Id: Solvers.cpp,v 1.57 2007-09-24 08:14:28 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -231,7 +231,7 @@ int Solver(int num, char *args) int n = PView::list.size(); MergeFile(message); Draw(); - if(n != PView::list.size()) + if(n != (int)PView::list.size()) WID->set_context(menu_post, 0); } break; diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp index 4ab4e4c43f..4fc415a5b2 100644 --- a/Geo/GFace.cpp +++ b/Geo/GFace.cpp @@ -1,4 +1,4 @@ -// $Id: GFace.cpp,v 1.36 2007-09-19 19:03:01 geuzaine Exp $ +// $Id: GFace.cpp,v 1.37 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -538,7 +538,7 @@ SPoint2 GFace::parFromPoint(const SPoint3 &p) const void GFace::computeGraphicsRep(int nu, int nv) { _graphicsRep.resize(nu); - for(unsigned int i = 0; i < nu; i++) _graphicsRep[i].resize(nv); + for(int i = 0; i < nu; i++) _graphicsRep[i].resize(nv); Range<double> ubounds = parBounds(0); Range<double> vbounds = parBounds(1); diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp index f1bddc384d..e0bfde9253 100644 --- a/Geo/Geo.cpp +++ b/Geo/Geo.cpp @@ -1,4 +1,4 @@ -// $Id: Geo.cpp,v 1.96 2007-09-08 21:26:04 geuzaine Exp $ +// $Id: Geo.cpp,v 1.97 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -3027,13 +3027,15 @@ bool IntersectCurvesWithSurface(List_T *curve_ids, int surface_id, List_T *shape Shape s; s.Type = MSH_POINT; s.Num = v->Num; - double num = v->Num; List_Add(shapes, &s); } } - else + else{ Msg(GERROR, "Uknown curve %d", (int)curve_id); + return false; + } } + return true; } // Bunch of utility routines diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index d0df3bd6aa..34962d9933 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.139 2007-09-03 20:09:14 geuzaine Exp $ +// $Id: Geom.cpp,v 1.140 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -246,7 +246,7 @@ class drawGFace { { std::vector<std::vector<graphics_point> > &gr(f->getGraphicsRep()); - const int N = 64; + const unsigned int N = 64; // We create data here and the routine is not designed to be // reentrant, so we must lock it to avoid race conditions when diff --git a/Graphics/Graph2D.cpp b/Graphics/Graph2D.cpp index 3425c4b5d0..a1ea2e80b8 100644 --- a/Graphics/Graph2D.cpp +++ b/Graphics/Graph2D.cpp @@ -1,4 +1,4 @@ -// $Id: Graph2D.cpp,v 1.69 2007-09-15 15:01:02 geuzaine Exp $ +// $Id: Graph2D.cpp,v 1.70 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -85,7 +85,7 @@ static bool getGraphData(PView *p, std::vector<double> &x, double &xmin, bool space = (opt->Type == PViewOptions::Plot2DSpace); - SPoint3 p0; + SPoint3 p0(0., 0., 0.); numy = 0; for(int i = 0; i < data->getNumElements(); i++){ @@ -335,7 +335,6 @@ static void drawGraphCurves(PView *p, double xleft, double ytop, double width, double height, std::vector<double> &x, double xmin, double xmax, std::vector<std::vector<double> > &y) { - PViewData *data = p->getData(); PViewOptions *opt = p->getOptions(); glPointSize(opt->PointSize); diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index c0ee985a11..722ccfc445 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -1,4 +1,4 @@ -// $Id: Post.cpp,v 1.139 2007-09-22 23:25:03 geuzaine Exp $ +// $Id: Post.cpp,v 1.140 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -133,7 +133,7 @@ bool getExternalValues(PView *p, int index, int iele, int numNodes, opt->ExternalMin = opt->TmpMin; opt->ExternalMax = opt->TmpMax; - if(index < 0 || index >= PView::list.size()) return false; + if(index < 0 || index >= (int)PView::list.size()) return false; PView *p2 = PView::list[index]; PViewData *data2 = p2->getData(); @@ -360,7 +360,7 @@ void addScalarLine(PView *p, double xyz[NMAX][3], double val[NMAX][9], bool pre, for(int k = 0; k < opt->NbIso; k++) { if(vmin == vmax) k = opt->NbIso / 2; double iso = opt->getScaleValue(k, opt->NbIso, vmin, vmax); - double x2[1], y2[1], z2[1], v2[1]; + double x2[1], y2[1], z2[1]; int nb = IsoLine(x, y, z, v, iso, x2, y2, z2); if(nb == 1){ unsigned int color = opt->getColor(k, opt->NbIso); @@ -494,7 +494,7 @@ void addScalarTriangle(PView *p, double xyz[NMAX][3], double val[NMAX][9], bool for(int k = 0; k < opt->NbIso; k++) { if(vmin == vmax) k = opt->NbIso / 2; double iso = opt->getScaleValue(k, opt->NbIso, vmin, vmax); - double x2[3], y2[3], z2[3], v2[3]; + double x2[3], y2[3], z2[3]; int nb = IsoTriangle(x, y, z, v, iso, x2, y2, z2); if(nb == 2){ unsigned int color = opt->getColor(k, opt->NbIso); @@ -598,7 +598,7 @@ void addScalarTetrahedron(PView *p, double xyz[NMAX][3], double val[NMAX][9], bo for(int k = 0; k < opt->NbIso; k++) { if(vmin == vmax) k = opt->NbIso / 2; double iso = opt->getScaleValue(k, opt->NbIso, vmin, vmax); - double x2[NMAX], y2[NMAX], z2[NMAX], v2[NMAX], nn[3]; + double x2[NMAX], y2[NMAX], z2[NMAX], nn[3]; int nb = IsoSimplex(x, y, z, v, iso, x2, y2, z2, nn); if(nb >= 3){ unsigned int color = opt->getColor(k, opt->NbIso); @@ -1148,14 +1148,12 @@ class initPView { int _estimateNumPoints(PView *p) { PViewData *data = p->getData(); - PViewOptions *opt = p->getOptions(); int heuristic = data->getNumElements(PViewData::Point); return heuristic + 10000; } int _estimateNumLines(PView *p) { PViewData *data = p->getData(); - PViewOptions *opt = p->getOptions(); int heuristic = data->getNumElements(PViewData::Line); return heuristic + 10000; } @@ -1183,7 +1181,6 @@ class initPView { int _estimateNumVectors(PView *p) { PViewData *data = p->getData(); - PViewOptions *opt = p->getOptions(); int heuristic = data->getNumVectors(); return heuristic + 1000; } diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp index cf8f4eecac..8bb2c69339 100644 --- a/Mesh/Field.cpp +++ b/Mesh/Field.cpp @@ -1,4 +1,4 @@ -// $Id: Field.cpp,v 1.6 2007-09-10 04:47:04 geuzaine Exp $ +// $Id: Field.cpp,v 1.7 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -265,7 +265,7 @@ FunctionField::~FunctionField() double PostViewField::operator()(double x, double y, double z) { // FIXME: should test unique view num instead, but that would be slower - if(view_index < 0 || view_index >= PView::list.size()) return MAX_LC; + if(view_index < 0 || view_index >= (int)PView::list.size()) return MAX_LC; double l = 0.; double fact[9] = {0.001, 0.0025, 0.005, 0.0075, 0.01, 0.025, 0.05, 0.075, 0.1}; @@ -408,46 +408,43 @@ void AttractorField::addGEdge(GEdge *c, int N) } } -void addMapLc (std::map<MVertex*,double> &maplc, MVertex *v, double l) +void addMapLc (std::map<MVertex*, double> &maplc, MVertex *v, double l) { - std::map<MVertex*,double> :: iterator it = maplc.find(v); - if (it == maplc.end())maplc[v] = l; - else if (it->second > l) it->second = l; + std::map<MVertex*, double>::iterator it = maplc.find(v); + if(it == maplc.end()) maplc[v] = l; + else if(it->second > l) it->second = l; } - -AttractorField_1DMesh::AttractorField_1DMesh (GModel *m, double dmax, double dmin, double lcmax) +AttractorField_1DMesh::AttractorField_1DMesh(GModel *m, double dmax, double dmin, + double lcmax) : _dmax(dmax), _dmin(dmin), _lcmax(lcmax) { GModel::eiter it = m->firstEdge(); - std::map<MVertex*,double> maplc; - - while (it != m->lastEdge()) - { - MVertex *first = (*it)->getBeginVertex()->mesh_vertices[0]; - for (int i=1;i<=(*it)->mesh_vertices.size();++i) - { - MVertex *last = i==(*it)->mesh_vertices.size() ? (*it)->getEndVertex()->mesh_vertices[0]:(*it)->mesh_vertices[i]; - double l = sqrt((first->x()-last->x())*(first->x()-last->x())+ - (first->y()-last->y())*(first->y()-last->y())+ - (first->z()-last->z())*(first->z()-last->z())); - addMapLc(maplc,first,l); - addMapLc(maplc,last,l); - first = last; - } - } - - std::map<MVertex*,double> :: iterator itm = maplc.begin(); + std::map<MVertex*, double> maplc; + + while(it != m->lastEdge()){ + MVertex *first = (*it)->getBeginVertex()->mesh_vertices[0]; + for(unsigned int i = 1; i <= (*it)->mesh_vertices.size(); ++i){ + MVertex *last = (i == (*it)->mesh_vertices.size()) ? + (*it)->getEndVertex()->mesh_vertices[0] : (*it)->mesh_vertices[i]; + double l = sqrt((first->x() - last->x()) * (first->x() - last->x()) + + (first->y() - last->y()) * (first->y() - last->y()) + + (first->z() - last->z()) * (first->z() - last->z())); + addMapLc(maplc, first, l); + addMapLc(maplc, last, l); + first = last; + } + } + + std::map<MVertex*, double>::iterator itm = maplc.begin(); - while (itm != maplc.end()) - { - addPoint(itm->first->x(),itm->first->y(),itm->first->z()); - lcs.push_back(itm->second); - } + while(itm != maplc.end()){ + addPoint(itm->first->x(), itm->first->y(), itm->first->z()); + lcs.push_back(itm->second); + } } - double AttractorField_1DMesh::operator()(double X, double Y, double Z) { #ifdef HAVE_ANN_ diff --git a/Mesh/meshGEdge.cpp b/Mesh/meshGEdge.cpp index e98d2ce648..b7887242c0 100644 --- a/Mesh/meshGEdge.cpp +++ b/Mesh/meshGEdge.cpp @@ -1,4 +1,4 @@ -// $Id: meshGEdge.cpp,v 1.42 2007-09-12 20:14:34 geuzaine Exp $ +// $Id: meshGEdge.cpp,v 1.43 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -49,7 +49,7 @@ static std::vector<xi2lc> interpLc; void smoothInterpLc(bool periodic, int nbSmooth) { if(periodic){ - for(int i = 0; i < interpLc.size() * nbSmooth; i++){ + for(int i = 0; i < (int)interpLc.size() * nbSmooth; i++){ xi2lc &left = interpLc[(i - 1) % interpLc.size()]; xi2lc &mid = interpLc[i % interpLc.size()]; xi2lc &right = interpLc[(i + 1) % interpLc.size()]; @@ -59,10 +59,10 @@ void smoothInterpLc(bool periodic, int nbSmooth) } else{ for(int j = 0; j < nbSmooth; j++){ - for(int i = 0 ; i < interpLc.size(); i++){ + for(int i = 0 ; i < (int)interpLc.size(); i++){ xi2lc &left = (i == 0) ? interpLc[0] : interpLc[i - 1]; xi2lc &mid = interpLc[i]; - xi2lc &right = (i == interpLc.size() - 1) ? + xi2lc &right = (i == (int)interpLc.size() - 1) ? interpLc[interpLc.size() - 1] : interpLc[i+1]; if(1. / mid.lc > 1.1 * 1. / left.lc) mid.lc = left.lc / 1.1; if(1. / mid.lc > 1.1 * 1. / right.lc) mid.lc = right.lc / 1.1; @@ -74,7 +74,7 @@ void smoothInterpLc(bool periodic, int nbSmooth) void printInterpLc(const char *name) { FILE *f = fopen(name,"w"); - for(int i = 0; i < interpLc.size(); i++){ + for(unsigned int i = 0; i < interpLc.size(); i++){ xi2lc &interp = interpLc[i]; fprintf(f,"%12.5E %12.5E\n", interp.xi, 1 / interp.lc); } diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp index e407d13940..7dde59d0fb 100644 --- a/Mesh/meshGFace.cpp +++ b/Mesh/meshGFace.cpp @@ -1,4 +1,4 @@ -// $Id: meshGFace.cpp,v 1.88 2007-09-19 14:21:56 geuzaine Exp $ +// $Id: meshGFace.cpp,v 1.89 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -380,7 +380,6 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT) mid = m.add_point(++m.MAXPOINTNUMBER, coord * (*it)->p1->u + (1 - coord) * (*it)->p2->u, coord * (*it)->p1->v + (1 - coord) * (*it)->p2->v,gf); - double l1; // if (BGMExists()) mid->lcBGM() = BGM_MeshSize(gf, (coord * (*it)->p1->u + (1 - coord) * (*it)->p2->u)*m.scalingU, @@ -482,7 +481,7 @@ void RefineMesh ( GFace *gf, BDS_Mesh &m , const int NIT) bool recover_medge ( BDS_Mesh *m, GEdge *ge, std::set<EdgeToRecover> *e2r, int pass_) { - BDS_GeomEntity *g; + BDS_GeomEntity *g=0; if (pass_ == 2) { m->add_geom (ge->tag(), 1); @@ -761,7 +760,7 @@ bool gmsh2DMeshGenerator ( GFace *gf , bool debug = true) V = V_[num]; } - BDS_Point *pp = m->add_point ( num, U,V, gf); + m->add_point ( num, U,V, gf); } Msg(DEBUG1,"Meshing of the convex hull (%d points) done",all_vertices.size()); diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp index 56cedb83b7..efc3b64980 100644 --- a/Parser/OpenFile.cpp +++ b/Parser/OpenFile.cpp @@ -1,4 +1,4 @@ -// $Id: OpenFile.cpp,v 1.162 2007-09-15 15:01:03 geuzaine Exp $ +// $Id: OpenFile.cpp,v 1.163 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -237,7 +237,7 @@ int ParseFile(char *f, int close, int warn_if_missing) yyviewindex = yyviewindex_old; #if defined(HAVE_FLTK) - if(!CTX.batch && numViewsBefore != PView::list.size()) + if(!CTX.batch && numViewsBefore != (int)PView::list.size()) WID->update_views(); #endif @@ -398,7 +398,7 @@ int MergeFile(char *name, int warn_if_missing) checkHighOrderTriangles(m); #if defined(HAVE_FLTK) - if(!CTX.batch && numViewsBefore != PView::list.size()) + if(!CTX.batch && numViewsBefore != (int)PView::list.size()) WID->update_views(); #endif diff --git a/Plugin/CutMap.cpp b/Plugin/CutMap.cpp index e4a808cd70..46a9338cad 100644 --- a/Plugin/CutMap.cpp +++ b/Plugin/CutMap.cpp @@ -1,4 +1,4 @@ -// $Id: CutMap.cpp,v 1.54 2007-09-11 14:01:54 geuzaine Exp $ +// $Id: CutMap.cpp,v 1.55 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -53,7 +53,7 @@ double GMSH_CutMapPlugin::callbackA(int num, int action, double value) if(action > 0){ int iview = (int)CutMapOptions_Number[6].def; if(iview < 0) iview = num; - if(iview >= 0 && iview < PView::list.size()){ + if(iview >= 0 && iview < (int)PView::list.size()){ min = PView::list[iview]->getData()->getMin(); max = PView::list[iview]->getData()->getMax(); } diff --git a/Plugin/Evaluate.cpp b/Plugin/Evaluate.cpp index 17f26759f3..2bff783e42 100644 --- a/Plugin/Evaluate.cpp +++ b/Plugin/Evaluate.cpp @@ -1,4 +1,4 @@ -// $Id: Evaluate.cpp,v 1.31 2007-09-11 14:01:55 geuzaine Exp $ +// $Id: Evaluate.cpp,v 1.32 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -240,7 +240,7 @@ PView *GMSH_EvaluatePlugin::execute(PView *v) PView *v2 = v1; if(externalView >= 0){ - if(externalView < PView::list.size()) + if(externalView < (int)PView::list.size()) Msg(GERROR, "View[%d] does not exist: using self", externalView); else v2 = PView::list[externalView]; diff --git a/Plugin/ExtractEdges.cpp b/Plugin/ExtractEdges.cpp index 6be4ce8c2a..d4ca06ad2b 100644 --- a/Plugin/ExtractEdges.cpp +++ b/Plugin/ExtractEdges.cpp @@ -1,4 +1,4 @@ -// $Id: ExtractEdges.cpp,v 1.6 2007-09-11 14:01:55 geuzaine Exp $ +// $Id: ExtractEdges.cpp,v 1.7 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -76,7 +76,7 @@ void GMSH_ExtractEdgesPlugin::catchErrorMessage(char *errorMessage) const PView *GMSH_ExtractEdgesPlugin::execute(PView *v) { int iView = (int)ExtractEdgesOptions_Number[1].def; - double angle = ExtractEdgesOptions_Number[0].def; + //double angle = ExtractEdgesOptions_Number[0].def; PView *v1 = getView(iView, v); if(!v1) return v; diff --git a/Plugin/FieldView.cpp b/Plugin/FieldView.cpp index a858e22a51..550b4279a6 100644 --- a/Plugin/FieldView.cpp +++ b/Plugin/FieldView.cpp @@ -1,4 +1,4 @@ -// $Id: FieldView.cpp,v 1.3 2007-09-11 14:01:55 geuzaine Exp $ +// $Id: FieldView.cpp,v 1.4 2007-09-24 08:14:29 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -75,7 +75,7 @@ static void evaluate(Field *field, List_T *list1, int nbElm1, int nbNod, { if(!nbElm1) return; int nb = List_Nbr(list1) / nbElm1; - for(int i = 0, i2 = 0; i < List_Nbr(list1); i += nb) { + for(int i = 0; i < List_Nbr(list1); i += nb) { double *x = (double *)List_Pointer_Fast(list1, i); double *y = (double *)List_Pointer_Fast(list1, i + nbNod); double *z = (double *)List_Pointer_Fast(list1, i + 2 * nbNod); diff --git a/Plugin/Levelset.cpp b/Plugin/Levelset.cpp index 82cb909b6f..c61617fa44 100644 --- a/Plugin/Levelset.cpp +++ b/Plugin/Levelset.cpp @@ -1,4 +1,4 @@ -// $Id: Levelset.cpp,v 1.36 2007-09-15 16:20:49 geuzaine Exp $ +// $Id: Levelset.cpp,v 1.37 2007-09-24 08:14:30 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -555,7 +555,7 @@ PView *GMSH_LevelsetPlugin::execute(PView *v) if(_valueView < 0) { w = v; } - else if(_valueView > PView::list.size() - 1){ + else if(_valueView > (int)PView::list.size() - 1){ Msg(GERROR, "View[%d] does not exist: reverting to View[%d]", _valueView, v->getIndex()); w = v; diff --git a/Plugin/Plugin.cpp b/Plugin/Plugin.cpp index b5e26ebd0e..79b0c5e34a 100644 --- a/Plugin/Plugin.cpp +++ b/Plugin/Plugin.cpp @@ -1,4 +1,4 @@ -// $Id: Plugin.cpp,v 1.91 2007-09-11 14:01:55 geuzaine Exp $ +// $Id: Plugin.cpp,v 1.92 2007-09-24 08:14:30 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -26,7 +26,7 @@ PView *GMSH_Post_Plugin::getView(int index, PView *view) if(index < 0) index = view ? view->getIndex() : 0; - if(index >= 0 && index < PView::list.size()){ + if(index >= 0 && index < (int)PView::list.size()){ return PView::list[index]; } else{ diff --git a/Plugin/Probe.cpp b/Plugin/Probe.cpp index 9369e5f581..81a3e06cf6 100644 --- a/Plugin/Probe.cpp +++ b/Plugin/Probe.cpp @@ -1,4 +1,4 @@ -// $Id: Probe.cpp,v 1.17 2007-09-11 14:01:55 geuzaine Exp $ +// $Id: Probe.cpp,v 1.18 2007-09-24 08:14:30 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -57,7 +57,7 @@ void GMSH_ProbePlugin::draw() #if defined(HAVE_FLTK) int num = (int)ProbeOptions_Number[3].def; if(num < 0) num = iview; - if(num >= 0 && num < PView::list.size()){ + if(num >= 0 && num < (int)PView::list.size()){ double x = ProbeOptions_Number[0].def; double y = ProbeOptions_Number[1].def; double z = ProbeOptions_Number[2].def; diff --git a/Post/PViewDataGModel.cpp b/Post/PViewDataGModel.cpp index b0048b9e6a..636544db48 100644 --- a/Post/PViewDataGModel.cpp +++ b/Post/PViewDataGModel.cpp @@ -1,4 +1,4 @@ -// $Id: PViewDataGModel.cpp,v 1.4 2007-09-13 06:31:37 geuzaine Exp $ +// $Id: PViewDataGModel.cpp,v 1.5 2007-09-24 08:14:30 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -71,20 +71,24 @@ bool PViewDataGModel::writePOS(std::string name, bool binary, bool parsed, bool append) { // model->writePOS() + return false; } bool PViewDataGModel::writeSTL(std::string name) { // model->writeSTL() + return false; } bool PViewDataGModel::writeTXT(std::string name) { // model->writeTXT() + return false; } bool PViewDataGModel::writeMSH(std::string name) { // model->writeMSH() + return false; } diff --git a/Post/PViewDataList.cpp b/Post/PViewDataList.cpp index f731c8c860..217e4c5043 100644 --- a/Post/PViewDataList.cpp +++ b/Post/PViewDataList.cpp @@ -1,4 +1,4 @@ -// $Id: PViewDataList.cpp,v 1.10 2007-09-15 16:30:21 geuzaine Exp $ +// $Id: PViewDataList.cpp,v 1.11 2007-09-24 08:14:30 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -33,22 +33,22 @@ extern Context_T CTX; PViewDataList::PViewDataList(bool allocate) : PViewData(), DataSize(sizeof(double)), NbTimeStep(0), Min(VAL_INF), Max(-VAL_INF), Time(0), - NbSP(0), SP(0), NbVP(0), VP(0), NbTP(0), TP(0), - NbSL(0), SL(0), NbVL(0), VL(0), NbTL(0), TL(0), - NbSL2(0), SL2(0), NbVL2(0), VL2(0), NbTL2(0), TL2(0), - NbST(0), ST(0), NbVT(0), VT(0), NbTT(0), TT(0), - NbST2(0), ST2(0), NbVT2(0), VT2(0), NbTT2(0), TT2(0), - NbSQ(0), SQ(0), NbVQ(0), VQ(0), NbTQ(0), TQ(0), - NbSQ2(0), SQ2(0), NbVQ2(0), VQ2(0), NbTQ2(0), TQ2(0), - NbSS(0), SS(0), NbVS(0), VS(0), NbTS(0), TS(0), - NbSS2(0), SS2(0), NbVS2(0), VS2(0), NbTS2(0), TS2(0), - NbSH(0), SH(0), NbVH(0), VH(0), NbTH(0), TH(0), - NbSH2(0), SH2(0), NbVH2(0), VH2(0), NbTH2(0), TH2(0), - NbSI(0), SI(0), NbVI(0), VI(0), NbTI(0), TI(0), - NbSI2(0), SI2(0), NbVI2(0), VI2(0), NbTI2(0), TI2(0), - NbSY(0), SY(0), NbVY(0), VY(0), NbTY(0), TY(0), - NbSY2(0), SY2(0), NbVY2(0), VY2(0), NbTY2(0), TY2(0), - NbT2(0), T2D(0), T2C(0), NbT3(0), T3D(0), T3C(0), adaptive(0), + NbSP(0), NbVP(0), NbTP(0), SP(0), VP(0), TP(0), + NbSL(0), NbVL(0), NbTL(0), NbSL2(0), NbVL2(0), NbTL2(0), + SL(0), VL(0), TL(0), SL2(0), VL2(0), TL2(0), + NbST(0), NbVT(0), NbTT(0), NbST2(0), NbVT2(0), NbTT2(0), + ST(0), VT(0), TT(0), ST2(0), VT2(0), TT2(0), + NbSQ(0), NbVQ(0), NbTQ(0), NbSQ2(0), NbVQ2(0), NbTQ2(0), + SQ(0), VQ(0), TQ(0), SQ2(0), VQ2(0), TQ2(0), + NbSS(0), NbVS(0), NbTS(0), NbSS2(0), NbVS2(0), NbTS2(0), + SS(0), VS(0), TS(0), SS2(0), VS2(0), TS2(0), + NbSH(0), NbVH(0), NbTH(0), NbSH2(0), NbVH2(0), NbTH2(0), + SH(0), VH(0), TH(0), SH2(0), VH2(0), TH2(0), + NbSI(0), NbVI(0), NbTI(0), NbSI2(0), NbVI2(0), NbTI2(0), + SI(0), VI(0), TI(0), SI2(0), VI2(0), TI2(0), + NbSY(0), NbVY(0), NbTY(0), NbSY2(0), NbVY2(0), NbTY2(0), + SY(0), VY(0), TY(0), SY2(0), VY2(0), TY2(0), + NbT2(0), NbT3(0), T2D(0), T2C(0), T3D(0), T3C(0), adaptive(0), _lastElement(-1), _lastDimension(-1), _lastNumNodes(-1), _lastNumComponents(-1), _lastNumEdges(-1), _lastXYZ(0), _lastVal(0) { @@ -194,13 +194,13 @@ double PViewDataList::getTime(int step) double PViewDataList::getMin(int step) { - if(step < 0 || step >= TimeStepMin.size()) return Min; + if(step < 0 || step >= (int)TimeStepMin.size()) return Min; return TimeStepMin[step]; } double PViewDataList::getMax(int step) { - if(step < 0 || step >= TimeStepMax.size()) return Max; + if(step < 0 || step >= (int)TimeStepMax.size()) return Max; return TimeStepMax[step]; } @@ -391,7 +391,6 @@ void PViewDataList::_getString(int dim, int i, int timestep, std::string &str, // T2C is a list of chars: string\0,string\0,string\0,string\0,... // Parser format is: T2(x,y,style){"str","str",...}; - int nb = (dim == 2) ? NbT2 : NbT3; List_T *td = (dim == 2) ? T2D : T3D; List_T *tc = (dim == 2) ? T2C : T3C; int nbd = (dim == 2) ? 4 : 5; -- GitLab