Skip to content

Commit

Permalink
Merge pull request #873 from epernod/fix_warnings
Browse files Browse the repository at this point in the history
[All] Fix some warnings
  • Loading branch information
guparan authored Jan 9, 2019
2 parents 98a78a6 + de3f1a7 commit bc869d2
Show file tree
Hide file tree
Showing 43 changed files with 106 additions and 103 deletions.
2 changes: 1 addition & 1 deletion SofaKernel/framework/sofa/core/loader/MeshLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
6 changes: 3 additions & 3 deletions SofaKernel/framework/sofa/core/loader/MeshLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?

Expand Down
4 changes: 3 additions & 1 deletion SofaKernel/modules/SofaBaseMechanics/DiagonalMass.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ class DiagonalMass : public core::behavior::Mass<DataTypes>
{
public:
typedef typename DiagonalMass<DataTypes,TMassType>::MassVector MassVector;
DMassPointHandler(DiagonalMass<DataTypes,TMassType>* _dm, sofa::component::topology::PointData<MassVector>* _data) : topology::TopologyDataHandler<Point,MassVector>(_data), dm(_dm) {}
DMassPointHandler(DiagonalMass<DataTypes,TMassType>* _dm, sofa::component::topology::PointData<MassVector>* _data)
: topology::TopologyDataHandler<Point,MassVector>(_data), dm(_dm)
{}

void applyCreateFunction(unsigned int pointIndex, TMassType& m, const Point&, const sofa::helper::vector< unsigned int > &,
const sofa::helper::vector< double > &);
Expand Down
13 changes: 6 additions & 7 deletions SofaKernel/modules/SofaBaseMechanics/DiagonalMass.inl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace mass
{

using sofa::core::objectmodel::ComponentState;

using namespace sofa::core::topology;

template <class DataTypes, class MassType>
DiagonalMass<DataTypes, MassType>::DiagonalMass()
Expand Down Expand Up @@ -815,7 +815,7 @@ void DiagonalMass<DataTypes, MassType>::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)
Expand Down Expand Up @@ -854,9 +854,8 @@ void DiagonalMass<DataTypes, MassType>::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)
{
Expand Down Expand Up @@ -889,7 +888,7 @@ void DiagonalMass<DataTypes, MassType>::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)
Expand Down Expand Up @@ -924,7 +923,7 @@ void DiagonalMass<DataTypes, MassType>::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)
Expand Down Expand Up @@ -960,7 +959,7 @@ void DiagonalMass<DataTypes, MassType>::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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ int HexahedronSetGeometryAlgorithms< DataTypes >::findNearestElement(const Coord
int index=-1;
distance = 1e10;

for(int c=0; c<this->m_topology->getNbHexahedra(); ++c)
for(size_t c=0; c<this->m_topology->getNbHexahedra(); ++c)
{
const Real d = computeElementDistanceMeasure(c, pos);

Expand Down Expand Up @@ -683,7 +683,7 @@ int HexahedronSetGeometryAlgorithms< DataTypes >::findNearestElementInRestPos(co
int index=-1;
distance = 1e10;

for(int c=0; c<this->m_topology->getNbHexahedra(); ++c)
for(size_t c=0; c<this->m_topology->getNbHexahedra(); ++c)
{
const Real d = computeElementRestDistanceMeasure(c, pos);

Expand Down Expand Up @@ -780,7 +780,7 @@ void HexahedronSetGeometryAlgorithms<DataTypes>::computeHexahedronVolume( BasicA
{
//const sofa::helper::vector<Hexahedron> &ta=this->m_topology->getHexahedra();
//const typename DataTypes::VecCoord& p =(this->object->read(core::ConstVecCoordId::position())->getValue());
for(int i=0; i<this->m_topology->getNbHexahedra(); ++i)
for(size_t i=0; i<this->m_topology->getNbHexahedra(); ++i)
{
//const Hexahedron &t=this->m_topology->getHexahedron(i); //ta[i];
ai[i]=(Real)(0.0); /// @todo : implementation of computeHexahedronVolume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void QuadSetGeometryAlgorithms<DataTypes>::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; i<nb_quads; ++i)
for(size_t i=0; i<nb_quads; ++i)
{
// ta.size()
const Quad &t = this->m_topology->getQuad(i); //ta[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down
4 changes: 2 additions & 2 deletions SofaKernel/modules/SofaBaseVisual/VisualModelImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<shell.size(); ++j_glob)
{
is_in_shell = is_in_shell || ((int)shell[j_glob] == ind_forgotten);
is_in_shell = is_in_shell || (shell[j_glob] == ind_forgotten);
}

if(!is_in_shell)
Expand Down
4 changes: 2 additions & 2 deletions SofaKernel/modules/SofaMeshCollision/LineModel.inl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void TLineModel<DataTypes>::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];
Expand Down Expand Up @@ -146,7 +146,7 @@ void TLineModel<DataTypes>::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];
Expand Down
1 change: 1 addition & 0 deletions SofaKernel/modules/SofaMeshCollision/PointModel.inl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ void TPointModel<DataTypes>::init()
template<class DataTypes>
void TPointModel<DataTypes>::draw(const core::visual::VisualParams*,int index)
{
SOFA_UNUSED(index);
//TODO(fred roy 2018-06-21)...please implement.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ void TriangleLocalMinDistanceFilter::init()

helper::vector< PointInfo >& pInfo = *(m_pointInfo.beginEdit());
pInfo.resize(bmt->getNbPoints());
int i;
for (i=0; i<bmt->getNbPoints(); i++)
for (int i=0; i<bmt->getNbPoints(); i++)
{
pInfo[i].setLMDFilters(this);
pInfo[i].setBaseMeshTopology(bmt);
Expand All @@ -126,7 +125,7 @@ void TriangleLocalMinDistanceFilter::init()

helper::vector< LineInfo >& lInfo = *(m_lineInfo.beginEdit());
lInfo.resize(bmt->getNbEdges());
for (i=0; i<bmt->getNbEdges(); i++)
for (unsigned int i=0; i<bmt->getNbEdges(); i++)
{
lInfo[i].setLMDFilters(this);
lInfo[i].setBaseMeshTopology(bmt);
Expand All @@ -140,7 +139,7 @@ void TriangleLocalMinDistanceFilter::init()

helper::vector< TriangleInfo >& tInfo = *(m_triangleInfo.beginEdit());
tInfo.resize(bmt->getNbTriangles());
for (i=0; i<bmt->getNbTriangles(); i++)
for (sofa::core::topology::Topology::TriangleID i=0; i<bmt->getNbTriangles(); i++)
{
tInfo[i].setLMDFilters(this);
tInfo[i].setBaseMeshTopology(bmt);
Expand Down
2 changes: 1 addition & 1 deletion SofaKernel/modules/SofaMeshCollision/TriangleModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<DataTypes>* mstate;
Data<bool> computeNormals; ///< set to false to disable computation of triangles normal
Expand Down
2 changes: 1 addition & 1 deletion SofaKernel/modules/SofaMeshCollision/TriangleModel.inl
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ void TTriangleModel<DataTypes>::setFilter(TriangleLocalMinDistanceFilter *lmdFil
}

template<class DataTypes>
int TTriangleModel<DataTypes>::getTriangleFlags(int i)
int TTriangleModel<DataTypes>::getTriangleFlags(Topology::TriangleID i)
{
int f = 0;
sofa::core::topology::BaseMeshTopology::Triangle t = (*triangles)[i];
Expand Down
12 changes: 6 additions & 6 deletions SofaKernel/modules/SofaSimpleFem/HexahedronFEMForceField.inl
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ using namespace sofa::defaulttype;

template <class DataTypes>
HexahedronFEMForceField<DataTypes>::HexahedronFEMForceField()
: _elementStiffnesses(initData(&_elementStiffnesses,"stiffnessMatrices", "Stiffness matrices per element (K_i)"))
, _mesh(NULL)
, _sparseGrid(NULL)
, _initialPoints(initData(&_initialPoints,"initialPoints", "Initial Position"))
, data(new HexahedronFEMForceFieldInternalData<DataTypes>())
, 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",""))
Expand All @@ -77,6 +72,11 @@ HexahedronFEMForceField<DataTypes>::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<DataTypes>())
{
data->initPtrData(this);
_coef[0][0]=-1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ void TetrahedronDiffusionFEMForceField<DataTypes>::init()
if(tetraDiff.size()==0)
{
tetraDiff.resize(topology->getNbTetrahedra());
for(int i=0; i<topology->getNbTetrahedra(); i++)
for(size_t i=0; i<topology->getNbTetrahedra(); 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;
Expand Down Expand Up @@ -267,7 +267,7 @@ template <class DataTypes>
typename TetrahedronDiffusionFEMForceField<DataTypes>::Real TetrahedronDiffusionFEMForceField<DataTypes>::getTetraDiffusionCoefficient(unsigned int i)
{
sofa::helper::vector<Real> tetraDiff = this->d_tetraDiffusionCoefficient.getValue();
if((int) i <= topology->getNbTetrahedra())
if(i <= topology->getNbTetrahedra())
{
return tetraDiff[i];
}
Expand All @@ -291,7 +291,7 @@ void TetrahedronDiffusionFEMForceField<DataTypes>::setDiffusionCoefficient(const
sofa::helper::vector <Real>& tetraDiff = *(d_tetraDiffusionCoefficient.beginEdit());
tetraDiff.clear();
tetraDiff.resize(topology->getNbTetrahedra());
for(int i=0; i<topology->getNbTetrahedra(); i++)
for(size_t i=0; i<topology->getNbTetrahedra(); i++)
tetraDiff[i] = d_constantDiffusionCoefficient.getValue();
d_tetraDiffusionCoefficient.endEdit();

Expand All @@ -309,7 +309,7 @@ void TetrahedronDiffusionFEMForceField<DataTypes>::setDiffusionCoefficient(const

// Save the new diffusion coefficient for each tetrahedron
sofa::helper::vector <Real>& tetraDiff = *(d_tetraDiffusionCoefficient.beginEdit());
for(int i=0; i<topology->getNbTetrahedra(); i++)
for(size_t i=0; i<topology->getNbTetrahedra(); i++)
tetraDiff[i] = val[i];
d_tetraDiffusionCoefficient.endEdit();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions modules/SofaBoundaryCondition/EdgePressureForceField.inl
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void EdgePressureForceField<DataTypes>::initEdgeInformation()

Vec3d sum;
bool found = false;
int k = 0;
size_t k = 0;
while ((!found) && (k < _completeTopology->getNbEdges()))
{
f = _completeTopology->getEdge(k);
Expand Down Expand Up @@ -338,7 +338,7 @@ void EdgePressureForceField<DataTypes>::selectEdgesAlongPlane()
helper::vector<unsigned int> 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]]))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void OscillatingTorsionPressureForceField<DataTypes>::selectTrianglesAlongPlane(
sofa::helper::vector<TrianglePressureInformation>& my_subset = *(trianglePressureMap).beginEdit();
helper::vector<unsigned int> 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]]) )
{
Expand Down
2 changes: 1 addition & 1 deletion modules/SofaBoundaryCondition/QuadPressureForceField.inl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void QuadPressureForceField<DataTypes>::selectQuadsAlongPlane()
sofa::helper::vector<QuadPressureInformation>& my_subset = *(quadPressureMap).beginEdit();
helper::vector<unsigned int> 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]]) )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void TrianglePressureForceField<DataTypes>::selectTrianglesAlongPlane()
sofa::helper::vector<TrianglePressureInformation>& my_subset = *(trianglePressureMap).beginEdit();
helper::vector<unsigned int> 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]]) )
{
Expand Down
2 changes: 1 addition & 1 deletion modules/SofaConstraint/GenericConstraintSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ GenericConstraintSolver::GenericConstraintSolver()
, currentIterations(initData(&currentIterations, 0, "currentIterations", "OUTPUT: current number of constraint groups"))
, currentError(initData(&currentError, 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");
Expand Down
Loading

0 comments on commit bc869d2

Please sign in to comment.