From 793d357782e8b8a80f0eccb2e7a2957e89f00879 Mon Sep 17 00:00:00 2001 From: epernod Date: Tue, 18 Dec 2018 17:19:19 +0100 Subject: [PATCH 1/9] [SofaKernel] Fix some unsigned int/int comparison warning. --- SofaKernel/modules/SofaBaseMechanics/DiagonalMass.h | 4 +++- .../modules/SofaBaseMechanics/DiagonalMass.inl | 13 ++++++------- .../TriangleLocalMinDistanceFilter.cpp | 4 ++-- .../TetrahedronDiffusionFEMForceField.inl | 10 +++++----- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/SofaKernel/modules/SofaBaseMechanics/DiagonalMass.h b/SofaKernel/modules/SofaBaseMechanics/DiagonalMass.h index 30b42ef971f..2859c3c52b0 100644 --- a/SofaKernel/modules/SofaBaseMechanics/DiagonalMass.h +++ b/SofaKernel/modules/SofaBaseMechanics/DiagonalMass.h @@ -109,7 +109,9 @@ class DiagonalMass : public core::behavior::Mass { public: typedef typename DiagonalMass::MassVector MassVector; - DMassPointHandler(DiagonalMass* _dm, sofa::component::topology::PointData* _data) : topology::TopologyDataHandler(_data), dm(_dm) {} + DMassPointHandler(DiagonalMass* _dm, sofa::component::topology::PointData* _data) + : topology::TopologyDataHandler(_data), dm(_dm) + {} void applyCreateFunction(unsigned int pointIndex, TMassType& m, const Point&, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &); diff --git a/SofaKernel/modules/SofaBaseMechanics/DiagonalMass.inl b/SofaKernel/modules/SofaBaseMechanics/DiagonalMass.inl index ccd95585ab9..ba6e1fbfa61 100644 --- a/SofaKernel/modules/SofaBaseMechanics/DiagonalMass.inl +++ b/SofaKernel/modules/SofaBaseMechanics/DiagonalMass.inl @@ -43,7 +43,7 @@ namespace mass { using sofa::core::objectmodel::ComponentState; - +using namespace sofa::core::topology; template DiagonalMass::DiagonalMass() @@ -815,7 +815,7 @@ void DiagonalMass::computeMass() Real mass=(Real)0; Real total_mass=(Real)0; - for (int i=0; i<_topology->getNbHexahedra(); ++i) + for (Topology::HexahedronID i=0; i<_topology->getNbHexahedra(); ++i) { const Hexahedron &h=_topology->getHexahedron(i); if (hexaGeo) @@ -854,9 +854,8 @@ void DiagonalMass::computeMass() Real mass=(Real)0; Real total_mass=(Real)0; - for (int i=0; i<_topology->getNbTetrahedra(); ++i) + for (Topology::TetrahedronID i=0; i<_topology->getNbTetrahedra(); ++i) { - const Tetrahedron &t=_topology->getTetrahedron(i); if(tetraGeo) { @@ -889,7 +888,7 @@ void DiagonalMass::computeMass() Real mass=(Real)0; Real total_mass=(Real)0; - for (int i=0; i<_topology->getNbQuads(); ++i) + for (Topology::QuadID i=0; i<_topology->getNbQuads(); ++i) { const Quad &t=_topology->getQuad(i); if(quadGeo) @@ -924,7 +923,7 @@ void DiagonalMass::computeMass() Real mass=(Real)0; Real total_mass=(Real)0; - for (int i=0; i<_topology->getNbTriangles(); ++i) + for (Topology::TriangleID i=0; i<_topology->getNbTriangles(); ++i) { const Triangle &t=_topology->getTriangle(i); if(triangleGeo) @@ -960,7 +959,7 @@ void DiagonalMass::computeMass() Real mass=(Real)0; Real total_mass=(Real)0; - for (int i=0; i<_topology->getNbEdges(); ++i) + for (Topology::EdgeID i=0; i<_topology->getNbEdges(); ++i) { const Edge &e=_topology->getEdge(i); if(edgeGeo) diff --git a/SofaKernel/modules/SofaMeshCollision/TriangleLocalMinDistanceFilter.cpp b/SofaKernel/modules/SofaMeshCollision/TriangleLocalMinDistanceFilter.cpp index ea51f09dff7..25f211d3ba5 100644 --- a/SofaKernel/modules/SofaMeshCollision/TriangleLocalMinDistanceFilter.cpp +++ b/SofaKernel/modules/SofaMeshCollision/TriangleLocalMinDistanceFilter.cpp @@ -111,7 +111,7 @@ void TriangleLocalMinDistanceFilter::init() helper::vector< PointInfo >& pInfo = *(m_pointInfo.beginEdit()); pInfo.resize(bmt->getNbPoints()); - int i; + unsigned int i; for (i=0; igetNbPoints(); i++) { pInfo[i].setLMDFilters(this); @@ -140,7 +140,7 @@ void TriangleLocalMinDistanceFilter::init() helper::vector< TriangleInfo >& tInfo = *(m_triangleInfo.beginEdit()); tInfo.resize(bmt->getNbTriangles()); - for (i=0; igetNbTriangles(); i++) + for (sofa::core::topology::Topology::TriangleID i=0; igetNbTriangles(); i++) { tInfo[i].setLMDFilters(this); tInfo[i].setBaseMeshTopology(bmt); diff --git a/SofaKernel/modules/SofaSimpleFem/TetrahedronDiffusionFEMForceField.inl b/SofaKernel/modules/SofaSimpleFem/TetrahedronDiffusionFEMForceField.inl index c99d0de3161..5a35b2c30dd 100644 --- a/SofaKernel/modules/SofaSimpleFem/TetrahedronDiffusionFEMForceField.inl +++ b/SofaKernel/modules/SofaSimpleFem/TetrahedronDiffusionFEMForceField.inl @@ -192,14 +192,14 @@ void TetrahedronDiffusionFEMForceField::init() if(tetraDiff.size()==0) { tetraDiff.resize(topology->getNbTetrahedra()); - for(int i=0; igetNbTetrahedra(); i++) + for(size_t i=0; igetNbTetrahedra(); i++) tetraDiff[i]=this->d_constantDiffusionCoefficient.getValue(); } /// possible input tetrahedral diffusion coefficient else { loadedDiffusivity = true; - if((int)(tetraDiff.size())!=topology->getNbTetrahedra()) + if(tetraDiff.size() != topology->getNbTetrahedra()) { msg_error() <<"Wrong size of potential input vector."; return; @@ -267,7 +267,7 @@ template typename TetrahedronDiffusionFEMForceField::Real TetrahedronDiffusionFEMForceField::getTetraDiffusionCoefficient(unsigned int i) { sofa::helper::vector tetraDiff = this->d_tetraDiffusionCoefficient.getValue(); - if((int) i <= topology->getNbTetrahedra()) + if(i <= topology->getNbTetrahedra()) { return tetraDiff[i]; } @@ -291,7 +291,7 @@ void TetrahedronDiffusionFEMForceField::setDiffusionCoefficient(const sofa::helper::vector & tetraDiff = *(d_tetraDiffusionCoefficient.beginEdit()); tetraDiff.clear(); tetraDiff.resize(topology->getNbTetrahedra()); - for(int i=0; igetNbTetrahedra(); i++) + for(size_t i=0; igetNbTetrahedra(); i++) tetraDiff[i] = d_constantDiffusionCoefficient.getValue(); d_tetraDiffusionCoefficient.endEdit(); @@ -309,7 +309,7 @@ void TetrahedronDiffusionFEMForceField::setDiffusionCoefficient(const // Save the new diffusion coefficient for each tetrahedron sofa::helper::vector & tetraDiff = *(d_tetraDiffusionCoefficient.beginEdit()); - for(int i=0; igetNbTetrahedra(); i++) + for(size_t i=0; igetNbTetrahedra(); i++) tetraDiff[i] = val[i]; d_tetraDiffusionCoefficient.endEdit(); From 86fb6914ffe61df2bb247f43fcfa075dfdc95b96 Mon Sep 17 00:00:00 2001 From: epernod Date: Tue, 18 Dec 2018 17:19:45 +0100 Subject: [PATCH 2/9] [SofaModules] Fix some unsigned int/int comparison warning. --- .../SofaGeneralSimpleFem/HexahedralFEMForceField.inl | 11 +++++------ .../TetrahedronHyperelasticityFEMForceField.inl | 5 ++--- modules/SofaMiscFem/TriangularFEMForceField.inl | 4 +++- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/SofaGeneralSimpleFem/HexahedralFEMForceField.inl b/modules/SofaGeneralSimpleFem/HexahedralFEMForceField.inl index 84e44094247..6266a2725a6 100644 --- a/modules/SofaGeneralSimpleFem/HexahedralFEMForceField.inl +++ b/modules/SofaGeneralSimpleFem/HexahedralFEMForceField.inl @@ -140,7 +140,7 @@ void HexahedralFEMForceField::reinit() hexahedronInf.resize(_topology->getNbHexahedra()); - for (int i=0; i<_topology->getNbHexahedra(); ++i) + for (unsigned int i=0; i<_topology->getNbHexahedra(); ++i) { hexahedronHandler->applyCreateFunction(i,hexahedronInf[i], _topology->getHexahedron(i), (const std::vector< unsigned int > )0, @@ -164,7 +164,7 @@ void HexahedralFEMForceField::addForce (const core::MechanicalParams* { case LARGE : { - for(int i = 0 ; i<_topology->getNbHexahedra(); ++i) + for(size_t i = 0 ; i<_topology->getNbHexahedra(); ++i) { accumulateForceLarge( _f, _p, i); } @@ -172,7 +172,7 @@ void HexahedralFEMForceField::addForce (const core::MechanicalParams* } case POLAR : { - for(int i = 0 ; i<_topology->getNbHexahedra(); ++i) + for(size_t i = 0 ; i<_topology->getNbHexahedra(); ++i) { accumulateForcePolar( _f, _p, i); } @@ -193,7 +193,7 @@ void HexahedralFEMForceField::addDForce (const core::MechanicalParams const helper::vector::HexahedronInformation>& hexahedronInf = hexahedronInfo.getValue(); - for(int i = 0 ; i<_topology->getNbHexahedra(); ++i) + for(unsigned int i = 0 ; i<_topology->getNbHexahedra(); ++i) { Transformation R_0_2; R_0_2.transpose(hexahedronInf[i].rotation); @@ -598,7 +598,6 @@ void HexahedralFEMForceField::addKToMatrix(const core::MechanicalPara { // Build Matrix Block for this ForceField int i,j,n1, n2; - size_t e; Index node1, node2; @@ -606,7 +605,7 @@ void HexahedralFEMForceField::addKToMatrix(const core::MechanicalPara const Real kFactor = (Real)mparams->kFactorIncludingRayleighDamping(this->rayleighStiffness.getValue()); const helper::vector::HexahedronInformation>& hexahedronInf = hexahedronInfo.getValue(); - for(e=0 ; e<_topology->getNbHexahedra() ; ++e) + for(unsigned int e=0 ; e<_topology->getNbHexahedra() ; ++e) { const ElementStiffness &Ke = hexahedronInf[e].stiffness; diff --git a/modules/SofaMiscFem/TetrahedronHyperelasticityFEMForceField.inl b/modules/SofaMiscFem/TetrahedronHyperelasticityFEMForceField.inl index 1d32eea7c00..8bc54afa59e 100644 --- a/modules/SofaMiscFem/TetrahedronHyperelasticityFEMForceField.inl +++ b/modules/SofaMiscFem/TetrahedronHyperelasticityFEMForceField.inl @@ -236,10 +236,9 @@ template void TetrahedronHyperelasticityFEMForceFieldmstate->read(core::ConstVecCoordId::restPosition())->getValue(); m_initialPoints=p; } - int i; /// initialize the data structure associated with each tetrahedron - for (i=0;igetNbTetrahedra();++i) + for (Topology::TetrahedronID i=0;igetNbTetrahedra();++i) { m_tetrahedronHandler->applyCreateFunction(i, tetrahedronInf[i], m_topology->getTetrahedron(i), (const vector< unsigned int > )0, @@ -737,7 +736,7 @@ void TetrahedronHyperelasticityFEMForceField::draw(const core::visual std::vector< Vector3 > points[4]; - for(int i = 0 ; igetNbTetrahedra();++i) + for(Topology::TetrahedronID i = 0 ; igetNbTetrahedra();++i) { const Tetrahedron t=m_topology->getTetrahedron(i); diff --git a/modules/SofaMiscFem/TriangularFEMForceField.inl b/modules/SofaMiscFem/TriangularFEMForceField.inl index 32731b56a7b..2301198d55b 100644 --- a/modules/SofaMiscFem/TriangularFEMForceField.inl +++ b/modules/SofaMiscFem/TriangularFEMForceField.inl @@ -57,6 +57,8 @@ namespace component namespace forcefield { +using namespace sofa::core::topology; + // -------------------------------------------------------------------------------------- // --- Topology Creation/Destruction functions // -------------------------------------------------------------------------------------- @@ -313,7 +315,7 @@ void TriangularFEMForceField::reinit() vertexInfo.endEdit(); - for (int i=0; i<_topology->getNbTriangles(); ++i) + for (Topology::TriangleID i=0; i<_topology->getNbTriangles(); ++i) { triangleHandler->applyCreateFunction(i, triangleInf[i], _topology->getTriangle(i), (const sofa::helper::vector< unsigned int > )0, (const sofa::helper::vector< double >)0); } From 27708f5ba13faa0b4b0fb1e3aeb2b196b7dc58de Mon Sep 17 00:00:00 2001 From: epernod Date: Fri, 21 Dec 2018 15:15:31 +0100 Subject: [PATCH 3/9] [SofaKernel] FIX: some warnings between int/uint --- .../SofaBaseTopology/HexahedronSetGeometryAlgorithms.inl | 6 +++--- .../modules/SofaBaseTopology/QuadSetGeometryAlgorithms.inl | 2 +- .../SofaBaseTopology/TetrahedronSetGeometryAlgorithms.inl | 2 +- SofaKernel/modules/SofaMeshCollision/LineModel.inl | 2 +- modules/SofaBoundaryCondition/EdgePressureForceField.inl | 4 ++-- modules/SofaBoundaryCondition/QuadPressureForceField.inl | 2 +- .../TetrahedralCorotationalFEMForceField.inl | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/SofaKernel/modules/SofaBaseTopology/HexahedronSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/HexahedronSetGeometryAlgorithms.inl index a1658c57e75..678513120ef 100644 --- a/SofaKernel/modules/SofaBaseTopology/HexahedronSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/HexahedronSetGeometryAlgorithms.inl @@ -648,7 +648,7 @@ int HexahedronSetGeometryAlgorithms< DataTypes >::findNearestElement(const Coord int index=-1; distance = 1e10; - for(int c=0; cm_topology->getNbHexahedra(); ++c) + for(size_t c=0; cm_topology->getNbHexahedra(); ++c) { const Real d = computeElementDistanceMeasure(c, pos); @@ -683,7 +683,7 @@ int HexahedronSetGeometryAlgorithms< DataTypes >::findNearestElementInRestPos(co int index=-1; distance = 1e10; - for(int c=0; cm_topology->getNbHexahedra(); ++c) + for(size_t c=0; cm_topology->getNbHexahedra(); ++c) { const Real d = computeElementRestDistanceMeasure(c, pos); @@ -780,7 +780,7 @@ void HexahedronSetGeometryAlgorithms::computeHexahedronVolume( BasicA { //const sofa::helper::vector &ta=this->m_topology->getHexahedra(); //const typename DataTypes::VecCoord& p =(this->object->read(core::ConstVecCoordId::position())->getValue()); - for(int i=0; im_topology->getNbHexahedra(); ++i) + for(size_t i=0; im_topology->getNbHexahedra(); ++i) { //const Hexahedron &t=this->m_topology->getHexahedron(i); //ta[i]; ai[i]=(Real)(0.0); /// @todo : implementation of computeHexahedronVolume diff --git a/SofaKernel/modules/SofaBaseTopology/QuadSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/QuadSetGeometryAlgorithms.inl index 6ab94fa6833..d26a3ee6054 100644 --- a/SofaKernel/modules/SofaBaseTopology/QuadSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/QuadSetGeometryAlgorithms.inl @@ -109,7 +109,7 @@ void QuadSetGeometryAlgorithms::computeQuadArea( BasicArrayInterface< size_t nb_quads = this->m_topology->getNbQuads(); const typename DataTypes::VecCoord& p =(this->object->read(core::ConstVecCoordId::position())->getValue()); - for(int i=0; im_topology->getQuad(i); //ta[i]; diff --git a/SofaKernel/modules/SofaBaseTopology/TetrahedronSetGeometryAlgorithms.inl b/SofaKernel/modules/SofaBaseTopology/TetrahedronSetGeometryAlgorithms.inl index e48fe2a3510..6a2e22b7b75 100644 --- a/SofaKernel/modules/SofaBaseTopology/TetrahedronSetGeometryAlgorithms.inl +++ b/SofaKernel/modules/SofaBaseTopology/TetrahedronSetGeometryAlgorithms.inl @@ -711,7 +711,7 @@ void TetrahedronSetGeometryAlgorithms< DataTypes >::getTetraInBall(const Coord& pa[0] = (Real) (c[0]); pa[1] = (Real) (c[1]); pa[2] = (Real) (c[2]); - for(int i = 0; i < this->m_topology->getNbTetrahedra(); ++i) + for(size_t i = 0; i < this->m_topology->getNbTetrahedra(); ++i) { if(isPointInTetrahedron(i, pa)) { diff --git a/SofaKernel/modules/SofaMeshCollision/LineModel.inl b/SofaKernel/modules/SofaMeshCollision/LineModel.inl index ff55f34fd72..d4275a21d40 100644 --- a/SofaKernel/modules/SofaMeshCollision/LineModel.inl +++ b/SofaKernel/modules/SofaMeshCollision/LineModel.inl @@ -146,7 +146,7 @@ void TLineModel::handleTopologyChange() { resize(bmt->getNbEdges()); - for(int i = 0; i < bmt->getNbEdges(); i++) + for(size_t i = 0; i < bmt->getNbEdges(); i++) { elems[i].p[0] = bmt->getEdge(i)[0]; elems[i].p[1] = bmt->getEdge(i)[1]; diff --git a/modules/SofaBoundaryCondition/EdgePressureForceField.inl b/modules/SofaBoundaryCondition/EdgePressureForceField.inl index b8274c4835d..fc0dd4c5b08 100644 --- a/modules/SofaBoundaryCondition/EdgePressureForceField.inl +++ b/modules/SofaBoundaryCondition/EdgePressureForceField.inl @@ -222,7 +222,7 @@ void EdgePressureForceField::initEdgeInformation() Vec3d sum; bool found = false; - int k = 0; + size_t k = 0; while ((!found) && (k < _completeTopology->getNbEdges())) { f = _completeTopology->getEdge(k); @@ -338,7 +338,7 @@ void EdgePressureForceField::selectEdgesAlongPlane() helper::vector inputEdges; - for (int n=0; n<_topology->getNbEdges(); ++n) + for (size_t n=0; n<_topology->getNbEdges(); ++n) { if ((vArray[_topology->getEdge(n)[0]]) && (vArray[_topology->getEdge(n)[1]])) { diff --git a/modules/SofaBoundaryCondition/QuadPressureForceField.inl b/modules/SofaBoundaryCondition/QuadPressureForceField.inl index b73f21d1567..592cbc4c735 100644 --- a/modules/SofaBoundaryCondition/QuadPressureForceField.inl +++ b/modules/SofaBoundaryCondition/QuadPressureForceField.inl @@ -175,7 +175,7 @@ void QuadPressureForceField::selectQuadsAlongPlane() sofa::helper::vector& my_subset = *(quadPressureMap).beginEdit(); helper::vector inputQuads; - for (int n=0; n<_topology->getNbQuads(); ++n) + for (size_t n=0; n<_topology->getNbQuads(); ++n) { if ((vArray[_topology->getQuad(n)[0]]) && (vArray[_topology->getQuad(n)[1]])&& (vArray[_topology->getQuad(n)[2]])&& (vArray[_topology->getQuad(n)[3]]) ) { diff --git a/modules/SofaGeneralSimpleFem/TetrahedralCorotationalFEMForceField.inl b/modules/SofaGeneralSimpleFem/TetrahedralCorotationalFEMForceField.inl index 0cbf33927eb..6e63701b81e 100644 --- a/modules/SofaGeneralSimpleFem/TetrahedralCorotationalFEMForceField.inl +++ b/modules/SofaGeneralSimpleFem/TetrahedralCorotationalFEMForceField.inl @@ -1277,7 +1277,7 @@ void TetrahedralCorotationalFEMForceField::draw(const core::visual::V std::vector< defaulttype::Vector3 > points[4]; - for(int i = 0 ; i<_topology->getNbTetrahedra(); ++i) + for(size_t i = 0 ; i<_topology->getNbTetrahedra(); ++i) { const core::topology::BaseMeshTopology::Tetrahedron t=_topology->getTetrahedron(i); From 590f86c9675286c89bb348d0ff9a6e8a95b71354 Mon Sep 17 00:00:00 2001 From: epernod Date: Fri, 21 Dec 2018 15:16:44 +0100 Subject: [PATCH 4/9] [SofaKernel] Fix: MeshLoader warning of init order. --- SofaKernel/framework/sofa/core/loader/MeshLoader.cpp | 2 +- SofaKernel/framework/sofa/core/loader/MeshLoader.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SofaKernel/framework/sofa/core/loader/MeshLoader.cpp b/SofaKernel/framework/sofa/core/loader/MeshLoader.cpp index 428960bce27..f8c087721cc 100644 --- a/SofaKernel/framework/sofa/core/loader/MeshLoader.cpp +++ b/SofaKernel/framework/sofa/core/loader/MeshLoader.cpp @@ -47,9 +47,9 @@ MeshLoader::MeshLoader() : BaseLoader() , d_tetrahedra(initData(&d_tetrahedra, "tetrahedra", "Tetrahedra of the mesh loaded")) , d_hexahedra(initData(&d_hexahedra, "hexahedra", "Hexahedra of the mesh loaded")) , d_pentahedra(initData(&d_pentahedra, "pentahedra", "Pentahedra of the mesh loaded")) - , d_pyramids(initData(&d_pyramids, "pyramids", "Pyramids of the mesh loaded")) , d_highOrderTetrahedronPositions(initData(&d_highOrderTetrahedronPositions, "highOrderTetrahedronPositions", "High order tetrahedron points of the mesh loaded")) , d_highOrderHexahedronPositions(initData(&d_highOrderHexahedronPositions, "highOrderHexahedronPositions", "High order hexahedron points of the mesh loaded")) + , d_pyramids(initData(&d_pyramids, "pyramids", "Pyramids of the mesh loaded")) , d_normals(initData(&d_normals, "normals", "Normals of the mesh loaded")) , d_edgesGroups(initData(&d_edgesGroups, "edgesGroups", "Groups of Edges")) , d_trianglesGroups(initData(&d_trianglesGroups, "trianglesGroups", "Groups of Triangles")) diff --git a/SofaKernel/framework/sofa/core/loader/MeshLoader.h b/SofaKernel/framework/sofa/core/loader/MeshLoader.h index 81e9622d662..5ee89ff9477 100644 --- a/SofaKernel/framework/sofa/core/loader/MeshLoader.h +++ b/SofaKernel/framework/sofa/core/loader/MeshLoader.h @@ -146,14 +146,14 @@ class SOFA_CORE_API MeshLoader : public BaseLoader Data< helper::vector< HighOrderEdgePosition > > d_highOrderEdgePositions; ///< High order edge points of the mesh loaded Data< helper::vector< HighOrderTrianglePosition > > d_highOrderTrianglePositions; ///< High order triangle points of the mesh loaded Data< helper::vector< HighOrderQuadPosition > > d_highOrderQuadPositions; ///< High order quad points of the mesh loaded - Data< helper::vector< Pyramid > > d_pyramids; ///< Pyramids of the mesh loaded + // Tab of 3D elements composition Data< helper::vector< Tetrahedron > > d_tetrahedra; ///< Tetrahedra of the mesh loaded - - Data< helper::vector< Pentahedron > > d_pentahedra; ///< Pentahedra of the mesh loaded Data< helper::vector< Hexahedron > > d_hexahedra; ///< Hexahedra of the mesh loaded + Data< helper::vector< Pentahedron > > d_pentahedra; ///< Pentahedra of the mesh loaded Data< helper::vector< HighOrderTetrahedronPosition > > d_highOrderTetrahedronPositions; ///< High order tetrahedron points of the mesh loaded Data< helper::vector< HighOrderHexahedronPosition > > d_highOrderHexahedronPositions; ///< High order hexahedron points of the mesh loaded + Data< helper::vector< Pyramid > > d_pyramids; ///< Pyramids of the mesh loaded // polygons in 3D ? From 176e10a540513f4c1ed7edcf09a54fb5360ccb82 Mon Sep 17 00:00:00 2001 From: epernod Date: Fri, 21 Dec 2018 21:50:42 +0100 Subject: [PATCH 5/9] [SofaKerner][Modules] FIX: some warnings of uint/int conversion. --- .../modules/SofaBaseVisual/VisualModelImpl.cpp | 4 ++-- SofaKernel/modules/SofaMeshCollision/LineModel.inl | 2 +- .../TriangleLocalMinDistanceFilter.cpp | 5 ++--- .../deformationMapping/BaseDeformationImpl.inl | 7 +++++-- .../OscillatingTorsionPressureForceField.inl | 2 +- .../TrianglePressureForceField.inl | 2 +- modules/SofaExporter/MeshExporter.cpp | 10 +++++----- modules/SofaExporter/VTKExporter.cpp | 8 ++++---- .../SofaGeneralSimpleFem/HexahedralFEMForceField.inl | 2 +- .../TetrahedralCorotationalFEMForceField.inl | 12 ++++++------ .../FastTetrahedralCorotationalForceField.inl | 5 ++--- .../SofaMiscFem/StandardTetrahedralFEMForceField.inl | 5 ++--- .../SofaMiscFem/TetrahedralTensorMassForceField.inl | 2 +- .../HexahedronCompositeFEMMapping.inl | 4 ++-- .../NonUniformHexahedralFEMForceFieldAndMass.inl | 4 ++-- modules/SofaOpenglVisual/DataDisplay.cpp | 2 +- .../Edge2QuadTopologicalMapping.cpp | 6 +++--- .../Hexa2QuadTopologicalMapping.cpp | 4 ++-- .../Hexa2TetraTopologicalMapping.cpp | 2 +- .../Quad2TriangleTopologicalMapping.cpp | 6 +++--- .../Tetra2TriangleTopologicalMapping.cpp | 6 +++--- .../Triangle2EdgeTopologicalMapping.cpp | 2 +- modules/SofaUserInteraction/EdgeSetController.inl | 2 +- 23 files changed, 52 insertions(+), 52 deletions(-) diff --git a/SofaKernel/modules/SofaBaseVisual/VisualModelImpl.cpp b/SofaKernel/modules/SofaBaseVisual/VisualModelImpl.cpp index 0c104123378..b68814087fe 100644 --- a/SofaKernel/modules/SofaBaseVisual/VisualModelImpl.cpp +++ b/SofaKernel/modules/SofaBaseVisual/VisualModelImpl.cpp @@ -1602,12 +1602,12 @@ void VisualModelImpl::handleTopologyChange() if(is_forgotten) { - int ind_forgotten = j_loc; + unsigned int ind_forgotten = j_loc; bool is_in_shell = false; for (unsigned int j_glob=0; j_glob::init() this->topology = bmt; resize( bmt->getNbEdges() ); - for(int i = 0; i < bmt->getNbEdges(); i++) + for(core::topology::BaseMeshTopology::EdgeID i = 0; i < bmt->getNbEdges(); i++) { elems[i].p[0] = bmt->getEdge(i)[0]; elems[i].p[1] = bmt->getEdge(i)[1]; diff --git a/SofaKernel/modules/SofaMeshCollision/TriangleLocalMinDistanceFilter.cpp b/SofaKernel/modules/SofaMeshCollision/TriangleLocalMinDistanceFilter.cpp index 25f211d3ba5..958ff5b63d2 100644 --- a/SofaKernel/modules/SofaMeshCollision/TriangleLocalMinDistanceFilter.cpp +++ b/SofaKernel/modules/SofaMeshCollision/TriangleLocalMinDistanceFilter.cpp @@ -111,8 +111,7 @@ void TriangleLocalMinDistanceFilter::init() helper::vector< PointInfo >& pInfo = *(m_pointInfo.beginEdit()); pInfo.resize(bmt->getNbPoints()); - unsigned int i; - for (i=0; igetNbPoints(); i++) + for (int i=0; igetNbPoints(); i++) { pInfo[i].setLMDFilters(this); pInfo[i].setBaseMeshTopology(bmt); @@ -126,7 +125,7 @@ void TriangleLocalMinDistanceFilter::init() helper::vector< LineInfo >& lInfo = *(m_lineInfo.beginEdit()); lInfo.resize(bmt->getNbEdges()); - for (i=0; igetNbEdges(); i++) + for (unsigned int i=0; igetNbEdges(); i++) { lInfo[i].setLMDFilters(this); lInfo[i].setBaseMeshTopology(bmt); diff --git a/applications/plugins/Flexible/deformationMapping/BaseDeformationImpl.inl b/applications/plugins/Flexible/deformationMapping/BaseDeformationImpl.inl index 29be144029b..c10d2e3edeb 100644 --- a/applications/plugins/Flexible/deformationMapping/BaseDeformationImpl.inl +++ b/applications/plugins/Flexible/deformationMapping/BaseDeformationImpl.inl @@ -57,8 +57,11 @@ void drawEllipsoid(const defaulttype::Mat<3,matdim,Real> & F, const defaulttype: for(size_t i=0; i<3; i++) transformMatrix[8+i]=(double)w[i]*scale*0.01; // arbitrarily small thickness } - for(size_t i=0; i<3; i++) transformMatrix[i+12]=p[i]; - for(size_t i=0; i<3; i++) transformMatrix[4*i+3]=0; transformMatrix[15] = 1; + for(unsigned i=0; i<3; i++) + transformMatrix[i+12]=p[i]; + for(unsigned i=0; i<3; i++) + transformMatrix[4*i+3]=0; + transformMatrix[15] = 1; glMultMatrixd(transformMatrix); GLUquadricObj* ellipsoid = gluNewQuadric(); diff --git a/modules/SofaBoundaryCondition/OscillatingTorsionPressureForceField.inl b/modules/SofaBoundaryCondition/OscillatingTorsionPressureForceField.inl index a3244497f57..096e2a1ba87 100644 --- a/modules/SofaBoundaryCondition/OscillatingTorsionPressureForceField.inl +++ b/modules/SofaBoundaryCondition/OscillatingTorsionPressureForceField.inl @@ -253,7 +253,7 @@ void OscillatingTorsionPressureForceField::selectTrianglesAlongPlane( sofa::helper::vector& my_subset = *(trianglePressureMap).beginEdit(); helper::vector inputTriangles; - for (int n=0; n<_topology->getNbTriangles(); ++n) + for (size_t n=0; n<_topology->getNbTriangles(); ++n) { if ((vArray[_topology->getTriangle(n)[0]]) && (vArray[_topology->getTriangle(n)[1]])&& (vArray[_topology->getTriangle(n)[2]]) ) { diff --git a/modules/SofaBoundaryCondition/TrianglePressureForceField.inl b/modules/SofaBoundaryCondition/TrianglePressureForceField.inl index f86814e234d..20732207b67 100644 --- a/modules/SofaBoundaryCondition/TrianglePressureForceField.inl +++ b/modules/SofaBoundaryCondition/TrianglePressureForceField.inl @@ -200,7 +200,7 @@ void TrianglePressureForceField::selectTrianglesAlongPlane() sofa::helper::vector& my_subset = *(trianglePressureMap).beginEdit(); helper::vector inputTriangles; - for (int n=0; n<_topology->getNbTriangles(); ++n) + for (size_t n=0; n<_topology->getNbTriangles(); ++n) { if ((vArray[_topology->getTriangle(n)[0]]) && (vArray[_topology->getTriangle(n)[1]])&& (vArray[_topology->getTriangle(n)[2]]) ) { diff --git a/modules/SofaExporter/MeshExporter.cpp b/modules/SofaExporter/MeshExporter.cpp index 00cf6fb1a01..5377d638e12 100644 --- a/modules/SofaExporter/MeshExporter.cpp +++ b/modules/SofaExporter/MeshExporter.cpp @@ -232,7 +232,7 @@ bool MeshExporter::writeMeshVTKXML() //write points outfile << " \n"; outfile << " \n"; - for (int i=0 ; i <# of attributes> <# of boundary markers (0 or 1)> outfile << nbp << ' ' << 3 << ' ' << 0 << ' ' << 0 << "\n"; // [attributes] [boundary marker] - for (int i=0 ; igetPX(i) << " " << topology->getPY(i) << " " << topology->getPZ(i) << std::endl; } @@ -625,7 +625,7 @@ void VTKExporter::writeVTKXML() *outfile << " " << std::endl; if (!pointsPos.empty()) { - for (int i = 0 ; i < nbp; i++) + for (size_t i = 0 ; i < nbp; i++) { *outfile << "\t" << pointsPos[i] << std::endl; } @@ -637,7 +637,7 @@ void VTKExporter::writeVTKXML() } else { - for (int i = 0; i < nbp; i++) + for (size_t i = 0; i < nbp; i++) *outfile << " " << topology->getPX(i) << " " << topology->getPY(i) << " " << topology->getPZ(i) << std::endl; } *outfile << " " << std::endl; diff --git a/modules/SofaGeneralSimpleFem/HexahedralFEMForceField.inl b/modules/SofaGeneralSimpleFem/HexahedralFEMForceField.inl index 6266a2725a6..157040ff87a 100644 --- a/modules/SofaGeneralSimpleFem/HexahedralFEMForceField.inl +++ b/modules/SofaGeneralSimpleFem/HexahedralFEMForceField.inl @@ -140,7 +140,7 @@ void HexahedralFEMForceField::reinit() hexahedronInf.resize(_topology->getNbHexahedra()); - for (unsigned int i=0; i<_topology->getNbHexahedra(); ++i) + for (size_t i=0; i<_topology->getNbHexahedra(); ++i) { hexahedronHandler->applyCreateFunction(i,hexahedronInf[i], _topology->getHexahedron(i), (const std::vector< unsigned int > )0, diff --git a/modules/SofaGeneralSimpleFem/TetrahedralCorotationalFEMForceField.inl b/modules/SofaGeneralSimpleFem/TetrahedralCorotationalFEMForceField.inl index 6e63701b81e..ad1cd2c1d25 100644 --- a/modules/SofaGeneralSimpleFem/TetrahedralCorotationalFEMForceField.inl +++ b/modules/SofaGeneralSimpleFem/TetrahedralCorotationalFEMForceField.inl @@ -168,7 +168,7 @@ void TetrahedralCorotationalFEMForceField::addForce(const core::Mecha { case SMALL : { - for(int i = 0 ; i<_topology->getNbTetrahedra(); ++i) + for(size_t i = 0 ; i<_topology->getNbTetrahedra(); ++i) { accumulateForceSmall( f, p, i ); } @@ -176,7 +176,7 @@ void TetrahedralCorotationalFEMForceField::addForce(const core::Mecha } case LARGE : { - for(int i = 0 ; i<_topology->getNbTetrahedra(); ++i) + for(size_t i = 0 ; i<_topology->getNbTetrahedra(); ++i) { accumulateForceLarge( f, p, i ); } @@ -184,7 +184,7 @@ void TetrahedralCorotationalFEMForceField::addForce(const core::Mecha } case POLAR : { - for(int i = 0 ; i<_topology->getNbTetrahedra(); ++i) + for(size_t i = 0 ; i<_topology->getNbTetrahedra(); ++i) { accumulateForcePolar( f, p, i ); } @@ -206,7 +206,7 @@ void TetrahedralCorotationalFEMForceField::addDForce(const core::Mech { case SMALL : { - for(int i = 0 ; i<_topology->getNbTetrahedra(); ++i) + for(size_t i = 0 ; i<_topology->getNbTetrahedra(); ++i) { const core::topology::BaseMeshTopology::Tetrahedron t=_topology->getTetrahedron(i); Index a = t[0]; @@ -220,7 +220,7 @@ void TetrahedralCorotationalFEMForceField::addDForce(const core::Mech } case LARGE : { - for(int i = 0 ; i<_topology->getNbTetrahedra(); ++i) + for(size_t i = 0 ; i<_topology->getNbTetrahedra(); ++i) { const core::topology::BaseMeshTopology::Tetrahedron t=_topology->getTetrahedron(i); Index a = t[0]; @@ -234,7 +234,7 @@ void TetrahedralCorotationalFEMForceField::addDForce(const core::Mech } case POLAR : { - for(int i = 0 ; i<_topology->getNbTetrahedra(); ++i) + for(size_t i = 0 ; i<_topology->getNbTetrahedra(); ++i) { const core::topology::BaseMeshTopology::Tetrahedron t=_topology->getTetrahedron(i); Index a = t[0]; diff --git a/modules/SofaMiscFem/FastTetrahedralCorotationalForceField.inl b/modules/SofaMiscFem/FastTetrahedralCorotationalForceField.inl index e343bee47d7..7d9806c1f80 100644 --- a/modules/SofaMiscFem/FastTetrahedralCorotationalForceField.inl +++ b/modules/SofaMiscFem/FastTetrahedralCorotationalForceField.inl @@ -222,10 +222,9 @@ template void FastTetrahedralCorotationalForceField _initialPoints=p; } - int i; /// initialize the data structure associated with each tetrahedron - for (i=0; i<_topology->getNbTetrahedra(); ++i) + for (size_t i=0; i<_topology->getNbTetrahedra(); ++i) { tetrahedronHandler->applyCreateFunction(i,tetrahedronInf[i],_topology->getTetrahedron(i), (const helper::vector< unsigned int > )0, @@ -626,7 +625,7 @@ void FastTetrahedralCorotationalForceField::draw(const core::visual:: std::vector< defaulttype::Vector3 > points[4]; - for (int i = 0; i<_topology->getNbTetrahedra(); ++i) + for (size_t i = 0; i<_topology->getNbTetrahedra(); ++i) { const core::topology::BaseMeshTopology::Tetrahedron t = _topology->getTetrahedron(i); diff --git a/modules/SofaMiscFem/StandardTetrahedralFEMForceField.inl b/modules/SofaMiscFem/StandardTetrahedralFEMForceField.inl index d5a415e0770..10a4b037f39 100644 --- a/modules/SofaMiscFem/StandardTetrahedralFEMForceField.inl +++ b/modules/SofaMiscFem/StandardTetrahedralFEMForceField.inl @@ -226,17 +226,16 @@ template void StandardTetrahedralFEMForceField::ini const VecCoord& p = this->mstate->read(core::ConstVecCoordId::restPosition())->getValue(); _initialPoints=p; } - int i; /// initialize the data structure associate with each tetrahedron - for (int i=0; i<_topology->getNbEdges(); i++) + for (size_t i=0; i<_topology->getNbEdges(); i++) { edgeInf[i].vertices[0] = (float) _topology->getEdge(i)[0]; edgeInf[i].vertices[1] = (float) _topology->getEdge(i)[1]; } /// initialize the data structure associated with each tetrahedron - for (i=0;i<_topology->getNbTetrahedra();++i) { + for (size_t i=0;i<_topology->getNbTetrahedra();++i) { tetrahedronHandler->applyCreateFunction(i, tetrahedronInf[i], _topology->getTetrahedron(i), (const helper::vector< unsigned int > )0, (const helper::vector< double >)0); diff --git a/modules/SofaMiscFem/TetrahedralTensorMassForceField.inl b/modules/SofaMiscFem/TetrahedralTensorMassForceField.inl index 9bf0746565f..c5a0167a75c 100644 --- a/modules/SofaMiscFem/TetrahedralTensorMassForceField.inl +++ b/modules/SofaMiscFem/TetrahedralTensorMassForceField.inl @@ -311,7 +311,7 @@ template void TetrahedralTensorMassForceField::init _initialPoints=p; } - int i; + size_t i; // set edge tensor to 0 for (i=0; i<_topology->getNbEdges(); ++i) { diff --git a/modules/SofaNonUniformFem/HexahedronCompositeFEMMapping.inl b/modules/SofaNonUniformFem/HexahedronCompositeFEMMapping.inl index f720b12bf05..4daf3884ee3 100644 --- a/modules/SofaNonUniformFem/HexahedronCompositeFEMMapping.inl +++ b/modules/SofaNonUniformFem/HexahedronCompositeFEMMapping.inl @@ -230,7 +230,7 @@ void HexahedronCompositeFEMMapping::apply( const sofa::core::Mecha // les deplacements des noeuds grossiers helper::vector< sofa::defaulttype::Vec< 24 > > coarseDisplacements( _sparseGrid->getNbHexahedra() ); - for(int i=0; i<_sparseGrid->getNbHexahedra(); ++i) + for(topology::MeshTopology::HexahedronID i=0; i<_sparseGrid->getNbHexahedra(); ++i) { const SparseGridTopologyT::Hexa& hexa = _sparseGrid->getHexahedron(i); // InCoord translation = computeTranslation( hexa, i ); @@ -307,7 +307,7 @@ void HexahedronCompositeFEMMapping::applyJ( const sofa::core::Mech // les deplacements des noeuds grossiers helper::vector< sofa::defaulttype::Vec< 24 > > coarseDisplacements( _sparseGrid->getNbHexahedra() ); - for(int i=0; i<_sparseGrid->getNbHexahedra(); ++i) + for(topology::MeshTopology::HexahedronID i=0; i<_sparseGrid->getNbHexahedra(); ++i) { const SparseGridTopologyT::Hexa& hexa = _sparseGrid->getHexahedron(i); diff --git a/modules/SofaNonUniformFem/NonUniformHexahedralFEMForceFieldAndMass.inl b/modules/SofaNonUniformFem/NonUniformHexahedralFEMForceFieldAndMass.inl index 3c33d146468..0b4e36bb375 100644 --- a/modules/SofaNonUniformFem/NonUniformHexahedralFEMForceFieldAndMass.inl +++ b/modules/SofaNonUniformFem/NonUniformHexahedralFEMForceFieldAndMass.inl @@ -170,13 +170,13 @@ void NonUniformHexahedralFEMForceFieldAndMass::reinit() { case HexahedralFEMForceFieldT::LARGE: { - for (int i=0; i_topology->getNbHexahedra(); ++i) + for (size_t i=0; i_topology->getNbHexahedra(); ++i) initLarge(i); } break; case HexahedralFEMForceFieldT::POLAR: { - for(int i=0; i_topology->getNbHexahedra(); ++i) + for(size_t i=0; i_topology->getNbHexahedra(); ++i) initPolar(i); } break; diff --git a/modules/SofaOpenglVisual/DataDisplay.cpp b/modules/SofaOpenglVisual/DataDisplay.cpp index 337f9d66d91..229e0b4da54 100644 --- a/modules/SofaOpenglVisual/DataDisplay.cpp +++ b/modules/SofaOpenglVisual/DataDisplay.cpp @@ -353,7 +353,7 @@ void DataDisplay::drawVisual(const core::visual::VisualParams* vparams) // Triangles glBegin(GL_TRIANGLES); - for (int i=0; igetNbTriangles(); ++i) + for (sofa::core::topology::Topology::TriangleID i=0; igetNbTriangles(); ++i) { const Triangle &t = topology->getTriangle(i); Vec4f color[3]; diff --git a/modules/SofaTopologyMapping/Edge2QuadTopologicalMapping.cpp b/modules/SofaTopologyMapping/Edge2QuadTopologicalMapping.cpp index 771fa39ded5..e0bfe19263b 100644 --- a/modules/SofaTopologyMapping/Edge2QuadTopologicalMapping.cpp +++ b/modules/SofaTopologyMapping/Edge2QuadTopologicalMapping.cpp @@ -391,7 +391,7 @@ void Edge2QuadTopologicalMapping::updateTopologicalMappingTopDown() ind_real_last = In2OutMap[last]; - if((int) k != last) + if (k != last) { In2OutMap.erase(In2OutMap.find(k)); @@ -414,7 +414,7 @@ void Edge2QuadTopologicalMapping::updateTopologicalMappingTopDown() sout << "INFO_print : Edge2QuadTopologicalMapping - In2OutMap should have the edge " << last << sendl; } - if( (int) ind_k[N-1] != ind_last) + if (ind_k[N-1] != ind_last) { In2OutMap.erase(In2OutMap.find(Loc2GlobVec[ind_last])); @@ -440,7 +440,7 @@ void Edge2QuadTopologicalMapping::updateTopologicalMappingTopDown() ind_last = ind_last-1; - if( (int) ind_k[N-1-j] != ind_last) + if (ind_k[N-1-j] != ind_last) { ind_tmp = Loc2GlobVec[ind_k[N-1-j]]; diff --git a/modules/SofaTopologyMapping/Hexa2QuadTopologicalMapping.cpp b/modules/SofaTopologyMapping/Hexa2QuadTopologicalMapping.cpp index b74d1ffdca0..bb20b36d524 100644 --- a/modules/SofaTopologyMapping/Hexa2QuadTopologicalMapping.cpp +++ b/modules/SofaTopologyMapping/Hexa2QuadTopologicalMapping.cpp @@ -215,7 +215,7 @@ void Hexa2QuadTopologicalMapping::updateTopologicalMappingTopDown() ind_real_last = Glob2LocMap[last]; - if((int) k != last) + if(k != last) { Glob2LocMap.erase(Glob2LocMap.find(k)); @@ -230,7 +230,7 @@ void Hexa2QuadTopologicalMapping::updateTopologicalMappingTopDown() } } - if((int) ind_k != ind_last) + if(ind_k != ind_last) { Glob2LocMap.erase(Glob2LocMap.find(Loc2GlobVec[ind_last])); diff --git a/modules/SofaTopologyMapping/Hexa2TetraTopologicalMapping.cpp b/modules/SofaTopologyMapping/Hexa2TetraTopologicalMapping.cpp index 0d2d54f79e7..ec7075491fa 100644 --- a/modules/SofaTopologyMapping/Hexa2TetraTopologicalMapping.cpp +++ b/modules/SofaTopologyMapping/Hexa2TetraTopologicalMapping.cpp @@ -116,7 +116,7 @@ void Hexa2TetraTopologicalMapping::init() } // Tesselation of each cube into 6 tetrahedra - for (int i=0; igetHexahedron(i); #define swap(a,b) { int t = a; a = b; b = t; } diff --git a/modules/SofaTopologyMapping/Quad2TriangleTopologicalMapping.cpp b/modules/SofaTopologyMapping/Quad2TriangleTopologicalMapping.cpp index bda330e2945..96018e36beb 100644 --- a/modules/SofaTopologyMapping/Quad2TriangleTopologicalMapping.cpp +++ b/modules/SofaTopologyMapping/Quad2TriangleTopologicalMapping.cpp @@ -295,7 +295,7 @@ void Quad2TriangleTopologicalMapping::updateTopologicalMappingTopDown() ind_real_last = In2OutMap[last]; - if((int) k != last) + if (k != last) { In2OutMap.erase(In2OutMap.find(k)); @@ -318,7 +318,7 @@ void Quad2TriangleTopologicalMapping::updateTopologicalMappingTopDown() sout << "INFO_print : Quad2TriangleTopologicalMapping - In2OutMap should have the quad " << last << sendl; } - if((int) ind_k[1] != ind_last) + if (ind_k[1] != ind_last) { In2OutMap.erase(In2OutMap.find(Loc2GlobVec[ind_last])); @@ -339,7 +339,7 @@ void Quad2TriangleTopologicalMapping::updateTopologicalMappingTopDown() ind_last = ind_last-1; - if((int) ind_k[0] != ind_last) + if (ind_k[0] != ind_last) { ind_tmp = Loc2GlobVec[ind_k[0]]; diff --git a/modules/SofaTopologyMapping/Tetra2TriangleTopologicalMapping.cpp b/modules/SofaTopologyMapping/Tetra2TriangleTopologicalMapping.cpp index a162e7fa4c4..2bfe559f6e2 100644 --- a/modules/SofaTopologyMapping/Tetra2TriangleTopologicalMapping.cpp +++ b/modules/SofaTopologyMapping/Tetra2TriangleTopologicalMapping.cpp @@ -209,7 +209,7 @@ void Tetra2TriangleTopologicalMapping::updateTopologicalMappingTopDown() ind_real_last = Glob2LocMap[last]; - if((int) k != last) + if (k != last) { Glob2LocMap.erase(Glob2LocMap.find(k)); @@ -224,7 +224,7 @@ void Tetra2TriangleTopologicalMapping::updateTopologicalMappingTopDown() } } - if((int) ind_k != ind_last) + if (ind_k != ind_last) { Glob2LocMap.erase(Glob2LocMap.find(Loc2GlobVec[ind_last])); @@ -407,7 +407,7 @@ void Tetra2TriangleTopologicalMapping::updateTopologicalMappingTopDown() ind_last = ind_last - 1; unsigned int ind_k = Glob2LocMap[k]; - if((int) ind_k != ind_last) + if (ind_k != ind_last) { Glob2LocMap.erase(Glob2LocMap.find(Loc2GlobVec[ind_last])); diff --git a/modules/SofaTopologyMapping/Triangle2EdgeTopologicalMapping.cpp b/modules/SofaTopologyMapping/Triangle2EdgeTopologicalMapping.cpp index 7bd43939378..4a78600012e 100644 --- a/modules/SofaTopologyMapping/Triangle2EdgeTopologicalMapping.cpp +++ b/modules/SofaTopologyMapping/Triangle2EdgeTopologicalMapping.cpp @@ -196,7 +196,7 @@ void Triangle2EdgeTopologicalMapping::updateTopologicalMappingTopDown() ind_real_last = Glob2LocMap[last]; - if((int) k != last) + if (k != last) { Glob2LocMap.erase(Glob2LocMap.find(k)); diff --git a/modules/SofaUserInteraction/EdgeSetController.inl b/modules/SofaUserInteraction/EdgeSetController.inl index 4e95aef9e1b..987419c5755 100644 --- a/modules/SofaUserInteraction/EdgeSetController.inl +++ b/modules/SofaUserInteraction/EdgeSetController.inl @@ -600,7 +600,7 @@ void EdgeSetController::draw(const core::visual::VisualParams* vparam vparams->drawTool()->disableLighting(); sofa::defaulttype::RGBAColor color(1.0,1.0,0.0,1.0); std::vector vertices; - for (int i=0; i<_topology->getNbEdges(); i++) + for (size_t i=0; i<_topology->getNbEdges(); i++) { Coord x0 = x[_topology->getEdge(i)[0]]; Coord x1 = x[_topology->getEdge(i)[1]]; From 008ab3f0e4e867f25abf64054012ffe16b9fb48c Mon Sep 17 00:00:00 2001 From: epernod Date: Fri, 21 Dec 2018 22:27:40 +0100 Subject: [PATCH 6/9] [SofaKernel] Fix some warning of bad init order or unused variables --- SofaKernel/modules/SofaMeshCollision/PointModel.inl | 1 + .../SofaSimpleFem/HexahedronFEMForceField.inl | 12 ++++++------ modules/SofaConstraint/GenericConstraintSolver.cpp | 2 +- modules/SofaGeneralEngine/MergeVectors.inl | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/SofaKernel/modules/SofaMeshCollision/PointModel.inl b/SofaKernel/modules/SofaMeshCollision/PointModel.inl index e1c0dcd3e97..794abce0d60 100644 --- a/SofaKernel/modules/SofaMeshCollision/PointModel.inl +++ b/SofaKernel/modules/SofaMeshCollision/PointModel.inl @@ -132,6 +132,7 @@ void TPointModel::init() template void TPointModel::draw(const core::visual::VisualParams*,int index) { + SOFA_UNUSED(index); //TODO(fred roy 2018-06-21)...please implement. } diff --git a/SofaKernel/modules/SofaSimpleFem/HexahedronFEMForceField.inl b/SofaKernel/modules/SofaSimpleFem/HexahedronFEMForceField.inl index 8a5a7a90045..d2cf849b49d 100644 --- a/SofaKernel/modules/SofaSimpleFem/HexahedronFEMForceField.inl +++ b/SofaKernel/modules/SofaSimpleFem/HexahedronFEMForceField.inl @@ -62,12 +62,7 @@ using namespace sofa::defaulttype; template HexahedronFEMForceField::HexahedronFEMForceField() - : _elementStiffnesses(initData(&_elementStiffnesses,"stiffnessMatrices", "Stiffness matrices per element (K_i)")) - , _mesh(NULL) - , _sparseGrid(NULL) - , _initialPoints(initData(&_initialPoints,"initialPoints", "Initial Position")) - , data(new HexahedronFEMForceFieldInternalData()) - , f_method(initData(&f_method,std::string("large"),"method","\"large\" or \"polar\" or \"small\" displacements" )) + : f_method(initData(&f_method,std::string("large"),"method","\"large\" or \"polar\" or \"small\" displacements" )) , f_poissonRatio(initData(&f_poissonRatio,(Real)0.45f,"poissonRatio","")) , f_youngModulus(initData(&f_youngModulus,(Real)5000,"youngModulus","")) , f_updateStiffnessMatrix(initData(&f_updateStiffnessMatrix,false,"updateStiffnessMatrix","")) @@ -77,6 +72,11 @@ HexahedronFEMForceField::HexahedronFEMForceField() , f_drawing(initData(&f_drawing,true,"drawing"," draw the forcefield if true")) , f_drawPercentageOffset(initData(&f_drawPercentageOffset,(Real)0.15,"drawPercentageOffset","size of the hexa")) , needUpdateTopology(false) + , _elementStiffnesses(initData(&_elementStiffnesses,"stiffnessMatrices", "Stiffness matrices per element (K_i)")) + , _mesh(NULL) + , _sparseGrid(NULL) + , _initialPoints(initData(&_initialPoints,"initialPoints", "Initial Position")) + , data(new HexahedronFEMForceFieldInternalData()) { data->initPtrData(this); _coef[0][0]=-1; diff --git a/modules/SofaConstraint/GenericConstraintSolver.cpp b/modules/SofaConstraint/GenericConstraintSolver.cpp index 75ca07be0ed..0e8253f5ed5 100644 --- a/modules/SofaConstraint/GenericConstraintSolver.cpp +++ b/modules/SofaConstraint/GenericConstraintSolver.cpp @@ -72,11 +72,11 @@ GenericConstraintSolver::GenericConstraintSolver() , currentIterations(initData(¤tIterations, 0, "currentIterations", "OUTPUT: current number of constraint groups")) , currentError(initData(¤tError, 0.0, "currentError", "OUTPUT: current error")) , reverseAccumulateOrder(initData(&reverseAccumulateOrder, false, "reverseAccumulateOrder", "True to accumulate constraints from nodes in reversed order (can be necessary when using multi-mappings or interaction constraints not following the node hierarchy)")) - , current_cp(&m_cpBuffer[0]) , d_constraintForces(initData(&d_constraintForces,"constraintForces","OUTPUT: constraint forces (stored only if computeConstraintForces=True)")) , d_computeConstraintForces(initData(&d_computeConstraintForces,false, "computeConstraintForces", "enable the storage of the constraintForces (default = False).")) + , current_cp(&m_cpBuffer[0]) , last_cp(NULL) { addAlias(&maxIt, "maxIt"); diff --git a/modules/SofaGeneralEngine/MergeVectors.inl b/modules/SofaGeneralEngine/MergeVectors.inl index 7fd81da455a..eaf9d0638f7 100644 --- a/modules/SofaGeneralEngine/MergeVectors.inl +++ b/modules/SofaGeneralEngine/MergeVectors.inl @@ -83,7 +83,7 @@ template void MergeVectors::doUpdate() { unsigned int nb = f_nbInputs.getValue(); - + SOFA_UNUSED(nb); helper::vectorData::merge( f_output, vf_inputs ); } From 0d59e1af3c20a2fdda3235115fdfdb738373f411 Mon Sep 17 00:00:00 2001 From: epernod Date: Fri, 21 Dec 2018 22:01:47 +0100 Subject: [PATCH 7/9] [Modules] Fix some break missing in switch loops. --- modules/SofaExporter/MeshExporter.cpp | 5 ++++- modules/SofaGeneralMeshCollision/TriangleOctree.cpp | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/SofaExporter/MeshExporter.cpp b/modules/SofaExporter/MeshExporter.cpp index 5377d638e12..1e19f1646ef 100644 --- a/modules/SofaExporter/MeshExporter.cpp +++ b/modules/SofaExporter/MeshExporter.cpp @@ -187,8 +187,11 @@ std::string MeshExporter::getMeshFilename(const char* ext) case 'E' : oss << nbce; break; case 'e' : oss << nbe; break; case '%' : oss << '%'; + msg_error() << "Invalid special character %: " << c << " in filename."; + break; default: - msg_error() << "Invalid special character %" << c << " in filename."; + msg_error() << "Invalid character: " << c << " in filename."; + break; } } } diff --git a/modules/SofaGeneralMeshCollision/TriangleOctree.cpp b/modules/SofaGeneralMeshCollision/TriangleOctree.cpp index b9db6dc4155..df4a8fac44b 100644 --- a/modules/SofaGeneralMeshCollision/TriangleOctree.cpp +++ b/modules/SofaGeneralMeshCollision/TriangleOctree.cpp @@ -424,7 +424,7 @@ int TriangleOctree::trace (const defaulttype::Vector3 & origin, if (idxMin != -1) return nearestTriangle (idxMin, origin1, direction1,result); } - + break; case END: if(idxMin==-1&&objects.size()) return nearestTriangle (objects[0], origin1, direction1,result); @@ -711,7 +711,7 @@ void TriangleOctree::traceAll (const defaulttype::Vector3 & origin, childVec[7 ^ a]->traceAll (origin, direction, txm, tym, tzm, tx1, ty1, tz1, a, b,origin1,direction1,results); } - + break; case END: allTriangles (origin1, direction1, results); return; From c91ef5e827897ac9fd3d1a6abb4d5f03f99945ae Mon Sep 17 00:00:00 2001 From: erik pernod Date: Tue, 25 Dec 2018 22:44:38 +0100 Subject: [PATCH 8/9] [SofaKernel] Fix some warning --- SofaKernel/modules/SofaMeshCollision/TriangleModel.h | 2 +- SofaKernel/modules/SofaMeshCollision/TriangleModel.inl | 2 +- modules/SofaUserInteraction/TopologicalChangeManager.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SofaKernel/modules/SofaMeshCollision/TriangleModel.h b/SofaKernel/modules/SofaMeshCollision/TriangleModel.h index bd2e97c6e6c..491d4042e35 100644 --- a/SofaKernel/modules/SofaMeshCollision/TriangleModel.h +++ b/SofaKernel/modules/SofaMeshCollision/TriangleModel.h @@ -145,7 +145,7 @@ class SOFA_MESH_COLLISION_API TTriangleModel : public core::CollisionModel virtual void updateFromTopology(); virtual void updateFlags(int ntri=-1); virtual void updateNormals(); - int getTriangleFlags(int i); + int getTriangleFlags(sofa::core::topology::BaseMeshTopology::TriangleID i); core::behavior::MechanicalState* mstate; Data computeNormals; ///< set to false to disable computation of triangles normal diff --git a/SofaKernel/modules/SofaMeshCollision/TriangleModel.inl b/SofaKernel/modules/SofaMeshCollision/TriangleModel.inl index a5c4363b043..92a978760fe 100644 --- a/SofaKernel/modules/SofaMeshCollision/TriangleModel.inl +++ b/SofaKernel/modules/SofaMeshCollision/TriangleModel.inl @@ -765,7 +765,7 @@ void TTriangleModel::setFilter(TriangleLocalMinDistanceFilter *lmdFil } template -int TTriangleModel::getTriangleFlags(int i) +int TTriangleModel::getTriangleFlags(Topology::TriangleID i) { int f = 0; sofa::core::topology::BaseMeshTopology::Triangle t = (*triangles)[i]; diff --git a/modules/SofaUserInteraction/TopologicalChangeManager.cpp b/modules/SofaUserInteraction/TopologicalChangeManager.cpp index 702cafe6609..dc6e28f69bc 100644 --- a/modules/SofaUserInteraction/TopologicalChangeManager.cpp +++ b/modules/SofaUserInteraction/TopologicalChangeManager.cpp @@ -231,7 +231,7 @@ int TopologicalChangeManager::removeItemsFromPointModel(sofa::component::collisi return 0; } - int nbt = topo_curr->getNbTriangles(); + size_t nbt = topo_curr->getNbTriangles(); for (unsigned int i = 0; i Date: Mon, 7 Jan 2019 14:56:51 +0100 Subject: [PATCH 9/9] [SofaGeneralMeshCollision] revert break in TriangleOctree.. --- modules/SofaGeneralMeshCollision/TriangleOctree.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/SofaGeneralMeshCollision/TriangleOctree.cpp b/modules/SofaGeneralMeshCollision/TriangleOctree.cpp index df4a8fac44b..684f70f77ee 100644 --- a/modules/SofaGeneralMeshCollision/TriangleOctree.cpp +++ b/modules/SofaGeneralMeshCollision/TriangleOctree.cpp @@ -424,7 +424,6 @@ int TriangleOctree::trace (const defaulttype::Vector3 & origin, if (idxMin != -1) return nearestTriangle (idxMin, origin1, direction1,result); } - break; case END: if(idxMin==-1&&objects.size()) return nearestTriangle (objects[0], origin1, direction1,result); @@ -711,7 +710,6 @@ void TriangleOctree::traceAll (const defaulttype::Vector3 & origin, childVec[7 ^ a]->traceAll (origin, direction, txm, tym, tzm, tx1, ty1, tz1, a, b,origin1,direction1,results); } - break; case END: allTriangles (origin1, direction1, results); return;