Skip to content

Commit

Permalink
Merge pull request #755 from epernod/fix_warnings
Browse files Browse the repository at this point in the history
[All] Fix some compilation warnings
  • Loading branch information
guparan authored Aug 30, 2018
2 parents c6698d8 + 4d6c115 commit d33f320
Show file tree
Hide file tree
Showing 80 changed files with 2,145 additions and 2,140 deletions.
32 changes: 16 additions & 16 deletions SofaKernel/framework/sofa/core/loader/MeshLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ void MeshLoader::updatePoints()
{
if (d_onlyAttachedPoints.getValue())
{
std::set<unsigned int> attachedPoints;
std::set<Topology::ElemID> attachedPoints;
{
helper::ReadAccessor<Data< helper::vector< Edge > > > elems = d_edges;
for (size_t i = 0; i < elems.size(); ++i)
Expand Down Expand Up @@ -535,12 +535,12 @@ void MeshLoader::updatePoints()
return; // all points are attached
}
helper::WriteAccessor<Data<helper::vector<sofa::defaulttype::Vec<3, SReal> > > > waPositions = d_positions;
helper::vector<unsigned int> old2new;
helper::vector<Topology::ElemID> old2new;
old2new.resize(waPositions.size());
unsigned int p = 0;
for (std::set<unsigned int>::const_iterator it = attachedPoints.begin(), itend = attachedPoints.end(); it != itend; ++it)
Topology::ElemID p = 0;
for (std::set<Topology::ElemID>::const_iterator it = attachedPoints.begin(), itend = attachedPoints.end(); it != itend; ++it)
{
unsigned int newp = *it;
Topology::ElemID newp = *it;
old2new[newp] = p;
if (p != newp)
{
Expand Down Expand Up @@ -698,7 +698,7 @@ void MeshLoader::addEdge(helper::vector<Edge >* pEdges, const Edge& p)
pEdges->push_back(p);
}

void MeshLoader::addEdge(helper::vector<Edge >* pEdges, unsigned int p0, unsigned int p1)
void MeshLoader::addEdge(helper::vector<Edge >* pEdges, Topology::EdgeID p0, Topology::EdgeID p1)
{
addEdge(pEdges, Edge(p0, p1));
}
Expand All @@ -718,7 +718,7 @@ void MeshLoader::addTriangle(helper::vector<Triangle >* pTriangles, const Triang
}
}

void MeshLoader::addTriangle(helper::vector<Triangle >* pTriangles, unsigned int p0, unsigned int p1, unsigned int p2)
void MeshLoader::addTriangle(helper::vector<Triangle >* pTriangles, Topology::TriangleID p0, Topology::TriangleID p1, Topology::TriangleID p2)
{
addTriangle(pTriangles, Triangle(p0, p1, p2));
}
Expand All @@ -738,16 +738,16 @@ void MeshLoader::addQuad(helper::vector<Quad >* pQuads, const Quad& p)
}
}

void MeshLoader::addQuad(helper::vector<Quad >* pQuads, unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3)
void MeshLoader::addQuad(helper::vector<Quad >* pQuads, Topology::QuadID p0, Topology::QuadID p1, Topology::QuadID p2, Topology::QuadID p3)
{
addQuad(pQuads, Quad(p0, p1, p2, p3));
}

void MeshLoader::addPolygon(helper::vector< helper::vector <unsigned int> >* pPolygons, const helper::vector<unsigned int>& p)
void MeshLoader::addPolygon(helper::vector< helper::vector <Topology::ElemID> >* pPolygons, const helper::vector<Topology::ElemID>& p)
{
if (d_flipNormals.getValue())
{
helper::vector<unsigned int> revertP(p.size());
helper::vector<Topology::ElemID> revertP(p.size());
std::reverse_copy(p.begin(), p.end(), revertP.begin());

pPolygons->push_back(revertP);
Expand All @@ -764,14 +764,14 @@ void MeshLoader::addTetrahedron(helper::vector< Tetrahedron >* pTetrahedra, cons
pTetrahedra->push_back(p);
}

void MeshLoader::addTetrahedron(helper::vector< Tetrahedron >* pTetrahedra, unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3)
void MeshLoader::addTetrahedron(helper::vector< Tetrahedron >* pTetrahedra, Topology::TetrahedronID p0, Topology::TetrahedronID p1, Topology::TetrahedronID p2, Topology::TetrahedronID p3)
{
addTetrahedron(pTetrahedra, Tetrahedron(p0, p1, p2, p3));
}

void MeshLoader::addHexahedron(helper::vector< Hexahedron >* pHexahedra,
unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3,
unsigned int p4, unsigned int p5, unsigned int p6, unsigned int p7)
Topology::HexahedronID p0, Topology::HexahedronID p1, Topology::HexahedronID p2, Topology::HexahedronID p3,
Topology::HexahedronID p4, Topology::HexahedronID p5, Topology::HexahedronID p6, Topology::HexahedronID p7)
{
addHexahedron(pHexahedra, Hexahedron(p0, p1, p2, p3, p4, p5, p6, p7));
}
Expand All @@ -782,8 +782,8 @@ void MeshLoader::addHexahedron(helper::vector< Hexahedron >* pHexahedra, const H
}

void MeshLoader::addPentahedron(helper::vector< Pentahedron >* pPentahedra,
unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3,
unsigned int p4, unsigned int p5)
Topology::ElemID p0, Topology::ElemID p1, Topology::ElemID p2, Topology::ElemID p3,
Topology::ElemID p4, Topology::ElemID p5)
{
addPentahedron(pPentahedra, Pentahedron(p0, p1, p2, p3, p4, p5));
}
Expand All @@ -794,7 +794,7 @@ void MeshLoader::addPentahedron(helper::vector< Pentahedron >* pPentahedra, cons
}

void MeshLoader::addPyramid(helper::vector< Pyramid >* pPyramids,
unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3, unsigned int p4)
Topology::ElemID p0, Topology::ElemID p1, Topology::ElemID p2, Topology::ElemID p3, Topology::ElemID p4)
{
addPyramid(pPyramids, Pyramid(p0, p1, p2, p3, p4));
}
Expand Down
30 changes: 15 additions & 15 deletions SofaKernel/framework/sofa/core/loader/MeshLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace loader
{

using sofa::defaulttype::Vector3;

using topology::Topology;

class SOFA_CORE_API MeshLoader : public BaseLoader
{
Expand Down Expand Up @@ -142,16 +142,16 @@ class SOFA_CORE_API MeshLoader : public BaseLoader
Data< helper::vector< Edge > > d_edges; ///< Edges of the mesh loaded
Data< helper::vector< Triangle > > d_triangles; ///< Triangles of the mesh loaded
Data< helper::vector< Quad > > d_quads; ///< Quads of the mesh loaded
Data< helper::vector< helper::vector <unsigned int> > > d_polygons; ///< Polygons of the mesh loaded
Data< helper::vector< helper::vector <Topology::ElemID> > > d_polygons; ///< Polygons of the mesh loaded
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< Hexahedron > > d_hexahedra; ///< Hexahedra of the mesh loaded

Data< helper::vector< Pentahedron > > d_pentahedra; ///< Pentahedra of the mesh loaded
Data< helper::vector< Pyramid > > d_pyramids; ///< Pyramids of the mesh loaded
Data< helper::vector< Hexahedron > > d_hexahedra; ///< Hexahedra 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

Expand Down Expand Up @@ -198,32 +198,32 @@ class SOFA_CORE_API MeshLoader : public BaseLoader
void addPolyline(helper::vector<Polyline>* pPolylines, Polyline p);

void addEdge(helper::vector<Edge>* pEdges, const Edge& p);
void addEdge(helper::vector<Edge>* pEdges, unsigned int p0, unsigned int p1);
void addEdge(helper::vector<Edge>* pEdges, Topology::EdgeID p0, Topology::EdgeID p1);

void addTriangle(helper::vector<Triangle>* pTriangles, const Triangle& p);
void addTriangle(helper::vector<Triangle>* pTriangles, unsigned int p0, unsigned int p1, unsigned int p2);
void addTriangle(helper::vector<Triangle>* pTriangles, Topology::TriangleID p0, Topology::TriangleID p1, Topology::TriangleID p2);

void addQuad(helper::vector<Quad>* pQuads, const Quad& p);
void addQuad(helper::vector<Quad>* pQuads, unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3);
void addQuad(helper::vector<Quad>* pQuads, Topology::QuadID p0, Topology::QuadID p1, Topology::QuadID p2, Topology::QuadID p3);

void addPolygon(helper::vector< helper::vector <unsigned int> >* pPolygons, const helper::vector<unsigned int>& p);
void addPolygon(helper::vector< helper::vector <Topology::ElemID> >* pPolygons, const helper::vector<Topology::ElemID>& p);

void addTetrahedron(helper::vector<Tetrahedron>* pTetrahedra, const Tetrahedron& p);
void addTetrahedron(helper::vector<Tetrahedron>* pTetrahedra, unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3);
void addTetrahedron(helper::vector<Tetrahedron>* pTetrahedra, Topology::TetrahedronID p0, Topology::TetrahedronID p1, Topology::TetrahedronID p2, Topology::TetrahedronID p3);

void addHexahedron(helper::vector< Hexahedron>* pHexahedra, const Hexahedron& p);
void addHexahedron(helper::vector< Hexahedron>* pHexahedra,
unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3,
unsigned int p4, unsigned int p5, unsigned int p6, unsigned int p7);
Topology::HexahedronID p0, Topology::HexahedronID p1, Topology::HexahedronID p2, Topology::HexahedronID p3,
Topology::HexahedronID p4, Topology::HexahedronID p5, Topology::HexahedronID p6, Topology::HexahedronID p7);

void addPentahedron(helper::vector< Pentahedron>* pPentahedra, const Pentahedron& p);
void addPentahedron(helper::vector< Pentahedron>* pPentahedra,
unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3,
unsigned int p4, unsigned int p5);
Topology::ElemID p0, Topology::ElemID p1, Topology::ElemID p2, Topology::ElemID p3,
Topology::ElemID p4, Topology::ElemID p5);

void addPyramid(helper::vector< Pyramid>* pPyramids, const Pyramid& p);
void addPyramid(helper::vector< Pyramid>* pPyramids,
unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3, unsigned int p4);
Topology::ElemID p0, Topology::ElemID p1, Topology::ElemID p2, Topology::ElemID p3, Topology::ElemID p4);

/// Temporary method that will copy all buffers from a io::Mesh into the corresponding Data. Will be removed as soon as work on unifying meshloader is finished
void copyMeshToData(helper::io::Mesh* _mesh);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
/// \param line_length number of column to render to to
/// \param wrapped the destination stream where to write the formatted text.
///
void simpleFormat(int jsize, const std::string& text, size_t line_length,
void simpleFormat(size_t jsize, const std::string& text, size_t line_length,
std::ostream& wrapped)
{
//TODO(dmarchal): All that code is a mess...need to be done for real.
Expand Down
2 changes: 1 addition & 1 deletion SofaKernel/framework/sofa/core/objectmodel/Base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ bool Base::parseField( const std::string& attribute, const std::string& value)
ok = false;
}
sout << "Link " << linkVec[l]->getName() << " = " << linkVec[l]->getValueString() << sendl;
unsigned int s = linkVec[l]->getSize();
unsigned int s = (unsigned int)linkVec[l]->getSize();
for (unsigned int i=0; i<s; ++i)
{
sout << " " << linkVec[l]->getLinkedPath(i) << " = ";
Expand Down
4 changes: 2 additions & 2 deletions SofaKernel/framework/sofa/core/objectmodel/BaseLink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ BaseLink::~BaseLink()
/// Print the value of the associated variable
void BaseLink::printValue( std::ostream& o ) const
{
std::size_t size = getSize();
unsigned int size = (unsigned int)getSize();
bool first = true;
for (std::size_t i = 0; i<size; ++i)
for (unsigned int i = 0; i<size; ++i)
{
std::string path = getLinkedPath(i);
if (path.empty()) continue;
Expand Down
2 changes: 1 addition & 1 deletion SofaKernel/framework/sofa/core/topology/BaseMeshTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class SOFA_CORE_API BaseMeshTopology : public core::topology::Topology
/// Checks if the topology has only one connected component. @return Return true if so.
virtual bool checkConnexity() {return true;}
/// Returns the number of connected component.
virtual unsigned int getNumberOfConnectedComponent() {return 0;}
virtual size_t getNumberOfConnectedComponent() {return 0;}
/// Returns the set of element indices connected to an input one (i.e. which can be reached by topological links)
virtual const sofa::helper::vector<index_type> getConnectedElement(index_type elem);
/// @}
Expand Down
23 changes: 12 additions & 11 deletions SofaKernel/framework/sofa/core/topology/Topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,18 @@ class SOFA_CORE_API Topology : public virtual core::objectmodel::BaseObject
//typedef int index_type;
typedef unsigned int index_type;
enum { InvalidID = (unsigned)-1 };
typedef index_type PointID;
typedef index_type EdgeID;
typedef index_type TriangleID;
typedef index_type QuadID;
typedef index_type TetraID;
typedef index_type TetrahedronID;
typedef index_type HexaID;
typedef index_type HexahedronID;
typedef index_type PentahedronID;
typedef index_type PentaID;
typedef index_type PyramidID;
typedef index_type ElemID;
typedef index_type PointID;
typedef index_type EdgeID;
typedef index_type TriangleID;
typedef index_type QuadID;
typedef index_type TetraID;
typedef index_type TetrahedronID;
typedef index_type HexaID;
typedef index_type HexahedronID;
typedef index_type PentahedronID;
typedef index_type PentaID;
typedef index_type PyramidID;


typedef sofa::helper::vector<index_type> SetIndex;
Expand Down
Loading

0 comments on commit d33f320

Please sign in to comment.