From 79412fbfaa95c348e3204e29addc4a3e7b24be75 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 15 Oct 2010 10:19:31 +0000 Subject: [PATCH] fix warnings --- Common/Options.cpp | 2 +- Geo/GModelIO_Mesh.cpp | 66 +++++++++++++++++++++---------------------- Solver/function.cpp | 2 +- 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/Common/Options.cpp b/Common/Options.cpp index 67d26d1faa..d7ee48ee72 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -5377,7 +5377,7 @@ double opt_mesh_line_width(OPT_ARGS_NUM) double opt_mesh_label_sampling(OPT_ARGS_NUM) { if(action & GMSH_SET) { - CTX::instance()->mesh.labelSampling = val; + CTX::instance()->mesh.labelSampling = (int)val; } #if defined(HAVE_FLTK) if(FlGui::available() && (action & GMSH_GUI)) diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index da54240a5e..62e3374b02 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -1266,7 +1266,6 @@ static int readElementsVRML(FILE *fp, std::vector<MVertex*> &vertexVector, int r int GModel::readPLY(const std::string &name) { - replaceCommaByDot(name); FILE *fp = fopen(name.c_str(), "r"); @@ -1275,7 +1274,6 @@ int GModel::readPLY(const std::string &name) return 0; } - std::vector<MVertex*> vertexVector; std::map<int, std::vector<MElement*> > elements[5]; std::map<int, std::vector<double> > properties; @@ -1453,6 +1451,38 @@ int GModel::readPLY2(const std::string &name) return 1; } +int GModel::writePLY2(const std::string &name) +{ + FILE *fp = fopen(name.c_str(), "w"); + if(!fp){ + Msg::Error("Unable to open file '%s'", name.c_str()); + return 0; + } + + int numVertices = indexMeshVertices(true); + int numTriangles = 0; + for(fiter it = firstFace(); it != lastFace(); ++it){ + numTriangles += (*it)->triangles.size(); + } + + fprintf(fp, "%d\n", numVertices); + fprintf(fp, "%d\n", numTriangles); + + std::vector<GEntity*> entities; + getEntities(entities); + for(unsigned int i = 0; i < entities.size(); i++) + for(unsigned int j = 0; j < entities[i]->mesh_vertices.size(); j++) + entities[i]->mesh_vertices[j]->writePLY2(fp); + + for(fiter it = firstFace(); it != lastFace(); ++it){ + for(unsigned int i = 0; i < (*it)->triangles.size(); i++) + (*it)->triangles[i]->writePLY2(fp); + } + + fclose(fp); + return 1; +} + int GModel::readVRML(const std::string &name) { FILE *fp = fopen(name.c_str(), "r"); @@ -1524,38 +1554,6 @@ int GModel::readVRML(const std::string &name) return 1; } -int GModel::writePLY2(const std::string &name) -{ - FILE *fp = fopen(name.c_str(), "w"); - if(!fp){ - Msg::Error("Unable to open file '%s'", name.c_str()); - return 0; - } - - int numVertices = indexMeshVertices(true); - int numTriangles = 0.0; - for(fiter it = firstFace(); it != lastFace(); ++it){ - numTriangles += (*it)->triangles.size(); - } - - fprintf(fp, "%d\n", numVertices); - fprintf(fp, "%d\n", numTriangles); - - std::vector<GEntity*> entities; - getEntities(entities); - for(unsigned int i = 0; i < entities.size(); i++) - for(unsigned int j = 0; j < entities[i]->mesh_vertices.size(); j++) - entities[i]->mesh_vertices[j]->writePLY2(fp); - - for(fiter it = firstFace(); it != lastFace(); ++it){ - for(unsigned int i = 0; i < (*it)->triangles.size(); i++) - (*it)->triangles[i]->writePLY2(fp); - } - - fclose(fp); - return 1; -} - int GModel::writeVRML(const std::string &name, bool saveAll, double scalingFactor) { FILE *fp = fopen(name.c_str(), "w"); diff --git a/Solver/function.cpp b/Solver/function.cpp index c0c1d5c036..c0b369225b 100644 --- a/Solver/function.cpp +++ b/Solver/function.cpp @@ -36,7 +36,7 @@ void function::setArgument(fullMatrix<double> &v, const function *f, int iMap) Msg::Error("Consecutive secondary caches"); dependencies.insert(dependency(iMap + it->iMap, it->f)); } - for (double i = 0; i < _functionReplaces.size(); i++) { + for (int i = 0; i < _functionReplaces.size(); i++) { functionReplace &replace = *_functionReplaces[i]; for (std::set<dependency>::iterator it = replace._fromParent.begin(); it != replace._fromParent.end(); it++) { -- GitLab