Fix some GCC warnings.

This commit is contained in:
Mateusz Skowroński 2016-06-26 18:12:21 +02:00 committed by wmayer
parent 803c136968
commit d7240c6b2b
22 changed files with 53 additions and 41 deletions

View File

@ -789,7 +789,7 @@ protected:
{ {
assert(ID >= 0); assert(ID >= 0);
myElementIDFactory->adjustMaxId(ID); myElementIDFactory->adjustMaxId(ID);
if (ID >= myCells.size()) if (ID >= static_cast<int>(myCells.size()))
myCells.resize(ID+SMDS_Mesh::chunkSize,0); myCells.resize(ID+SMDS_Mesh::chunkSize,0);
} }

View File

@ -192,7 +192,7 @@ inline SMDS_MeshInfo::SMDS_MeshInfo():
inline SMDS_MeshInfo& // operator= inline SMDS_MeshInfo& // operator=
SMDS_MeshInfo::operator=(const SMDS_MeshInfo& other) SMDS_MeshInfo::operator=(const SMDS_MeshInfo& other)
{ for ( int i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=(*other.myNb[i]); { for ( std::size_t i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=(*other.myNb[i]);
myNbPolygons = other.myNbPolygons; myNbPolygons = other.myNbPolygons;
myNbQuadPolygons = other.myNbQuadPolygons; myNbQuadPolygons = other.myNbQuadPolygons;
myNbPolyhedrons = other.myNbPolyhedrons; myNbPolyhedrons = other.myNbPolyhedrons;
@ -201,7 +201,7 @@ SMDS_MeshInfo::operator=(const SMDS_MeshInfo& other)
inline void // Clear inline void // Clear
SMDS_MeshInfo::Clear() SMDS_MeshInfo::Clear()
{ for ( int i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=0; { for ( std::size_t i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=0;
myNbPolygons=myNbQuadPolygons=myNbPolyhedrons=0; myNbPolygons=myNbQuadPolygons=myNbPolyhedrons=0;
} }
@ -297,7 +297,7 @@ SMDS_MeshInfo::NbElements(SMDSAbs_ElementType type) const
int nb = 0; int nb = 0;
switch (type) { switch (type) {
case SMDSAbs_All: case SMDSAbs_All:
for ( int i=1+index( SMDSAbs_Node,1 ); i<myNb.size(); ++i ) if ( myNb[i] ) nb += *myNb[i]; for ( std::size_t i=1+index( SMDSAbs_Node,1 ); i<myNb.size(); ++i ) if ( myNb[i] ) nb += *myNb[i];
nb += myNbPolygons + myNbQuadPolygons + myNbPolyhedrons; nb += myNbPolygons + myNbQuadPolygons + myNbPolyhedrons;
break; break;
case SMDSAbs_Volume: case SMDSAbs_Volume:
@ -359,6 +359,8 @@ SMDS_MeshInfo::NbEntities(SMDSAbs_EntityType type) const
#endif #endif
case SMDSEntity_Quad_Polyhedra: case SMDSEntity_Quad_Polyhedra:
break; break;
default:
break;
} }
return 0; return 0;
} }
@ -433,6 +435,8 @@ SMDS_MeshInfo::setNb(const SMDSAbs_EntityType geomType, const int nb)
#endif #endif
case SMDSEntity_Quad_Polyhedra: case SMDSEntity_Quad_Polyhedra:
break; break;
default:
break;
} }
} }

View File

@ -125,7 +125,7 @@ public:
int _algoDim; int _algoDim;
bool _isGlobalAlgo; bool _isGlobalAlgo;
TAlgoStateError(): _algoDim(0),_algo(0),_name(SMESH_Hypothesis::HYP_OK) {} TAlgoStateError(): _name(SMESH_Hypothesis::HYP_OK), _algo(0), _algoDim(0) {}
void Set(TAlgoStateErrorName name, const SMESH_Algo* algo, bool isGlobal) void Set(TAlgoStateErrorName name, const SMESH_Algo* algo, bool isGlobal)
{ _name = name; _algo = algo; _algoDim = algo->GetDim(); _isGlobalAlgo = isGlobal; } { _name = name; _algo = algo; _algoDim = algo->GetDim(); _isGlobalAlgo = isGlobal; }
void Set(TAlgoStateErrorName name, const int algoDim, bool isGlobal) void Set(TAlgoStateErrorName name, const int algoDim, bool isGlobal)

View File

@ -47,7 +47,7 @@ using namespace UNV;
namespace{ namespace{
typedef std::vector<size_t> TConnect; typedef std::vector<size_t> TConnect;
int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter, inline int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter,
TConnect& theConnect) TConnect& theConnect)
{ {
theConnect.clear(); theConnect.clear();

View File

@ -344,8 +344,8 @@ int HashCode(const Link& aLink, int aLimit)
Standard_Boolean IsEqual(const Link& aLink1, const Link& aLink2) Standard_Boolean IsEqual(const Link& aLink1, const Link& aLink2)
{ {
return (aLink1.n1 == aLink2.n1 && aLink1.n2 == aLink2.n2 || return ((aLink1.n1 == aLink2.n1 && aLink1.n2 == aLink2.n2) ||
aLink1.n1 == aLink2.n2 && aLink1.n2 == aLink2.n1); (aLink1.n1 == aLink2.n2 && aLink1.n2 == aLink2.n1));
} }
namespace namespace
@ -539,7 +539,7 @@ namespace
*/ */
//================================================================================ //================================================================================
void makeQuadratic( const TopTools_IndexedMapOfShape& shapes, inline void makeQuadratic( const TopTools_IndexedMapOfShape& shapes,
SMESH_Mesh* mesh ) SMESH_Mesh* mesh )
{ {
for ( int i = 1; i <= shapes.Extent(); ++i ) for ( int i = 1; i <= shapes.Extent(); ++i )

View File

@ -187,7 +187,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::CheckHypothesis (SMESH_Mesh& aMesh,
namespace namespace
{ {
void limitSize( netgen::Mesh* ngMesh, inline void limitSize( netgen::Mesh* ngMesh,
const double maxh ) const double maxh )
{ {
// get bnd box // get bnd box
@ -669,7 +669,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
// compute edge length // compute edge length
double ELen = 0; double ELen = 0;
if (_hypLengthFromEdges || !_hypLengthFromEdges && !_hypMaxElementArea) { if (_hypLengthFromEdges || (!_hypLengthFromEdges && !_hypMaxElementArea)) {
if ( nb1d > 0 ) if ( nb1d > 0 )
ELen = fullLen / nb1d; ELen = fullLen / nb1d;
} }

View File

@ -342,7 +342,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
namespace namespace
{ {
void limitVolumeSize( netgen::Mesh* ngMesh, inline void limitVolumeSize( netgen::Mesh* ngMesh,
double maxh ) double maxh )
{ {
// get average h of faces // get average h of faces

View File

@ -268,6 +268,7 @@ double* SMDS_MeshNode::getCoord() const
vtkUnstructuredGrid *grid; vtkUnstructuredGrid *grid;
coord2=(double *)malloc(3*sizeof(double)); coord2=(double *)malloc(3*sizeof(double));
if ( SMDS_Mesh::_meshList[myMeshId] != NULL ) if ( SMDS_Mesh::_meshList[myMeshId] != NULL )
{
if ( SMDS_Mesh::_meshList[myMeshId]->getGrid() != NULL ) if ( SMDS_Mesh::_meshList[myMeshId]->getGrid() != NULL )
{ {
grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
@ -278,6 +279,7 @@ double* SMDS_MeshNode::getCoord() const
return(coord2); return(coord2);
// return (double *)(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoints()->GetPoint(myVtkID,coord)); // return (double *)(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoints()->GetPoint(myVtkID,coord));
} }
}
else else
{ {
coord2[0]=0.; coord2[0]=0.;

View File

@ -160,7 +160,7 @@ void SMESH_Hypothesis::SetLibName(const char* theLibName)
SMESH_Mesh* SMESH_Hypothesis::GetMeshByPersistentID(int id) SMESH_Mesh* SMESH_Hypothesis::GetMeshByPersistentID(int id)
{ {
StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId); StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
map<int, SMESH_Mesh*>::iterator itm = itm = myStudyContext->mapMesh.begin(); map<int, SMESH_Mesh*>::iterator itm = myStudyContext->mapMesh.begin();
for ( ; itm != myStudyContext->mapMesh.end(); itm++) for ( ; itm != myStudyContext->mapMesh.end(); itm++)
{ {
SMESH_Mesh* mesh = (*itm).second; SMESH_Mesh* mesh = (*itm).second;

View File

@ -3610,7 +3610,7 @@ namespace { // Structures used by FixQuadraticElements()
/*! /*!
* \brief Dump QLink and QFace * \brief Dump QLink and QFace
*/ */
ostream& operator << (ostream& out, const QLink& l) inline ostream& operator << (ostream& out, const QLink& l)
{ {
out <<"QLink nodes: " out <<"QLink nodes: "
<< l.node1()->GetID() << " - " << l.node1()->GetID() << " - "
@ -3618,7 +3618,7 @@ namespace { // Structures used by FixQuadraticElements()
<< l.node2()->GetID() << endl; << l.node2()->GetID() << endl;
return out; return out;
} }
ostream& operator << (ostream& out, const QFace& f) inline ostream& operator << (ostream& out, const QFace& f)
{ {
out <<"QFace nodes: "/*<< &f << " "*/; out <<"QFace nodes: "/*<< &f << " "*/;
for ( TIDSortedNodeSet::const_iterator n = f.begin(); n != f.end(); ++n ) for ( TIDSortedNodeSet::const_iterator n = f.begin(); n != f.end(); ++n )

View File

@ -218,9 +218,9 @@ namespace
} }
} }
#else #else
void inSegmentsToFile( vector< InSegment>& inSegments) {} inline void inSegmentsToFile( vector< InSegment>& inSegments) {}
void dumpEdge( const TVDEdge* edge ) {} inline void dumpEdge( const TVDEdge* edge ) {}
void dumpCell( const TVDCell* cell ) {} inline void dumpCell( const TVDCell* cell ) {}
#endif #endif
} }
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
@ -1701,7 +1701,7 @@ bool SMESH_MAT2d::Branch::getParameter(const BranchPoint & p, double & u ) const
if ( p._iEdge > _params.size()-1 ) if ( p._iEdge > _params.size()-1 )
return false; return false;
if ( p._iEdge == _params.size()-1 ) if ( p._iEdge == _params.size()-1 )
return u = 1.; return (u = 1.);
u = ( _params[ p._iEdge ] * ( 1 - p._edgeParam ) + u = ( _params[ p._iEdge ] * ( 1 - p._edgeParam ) +
_params[ p._iEdge+1 ] * p._edgeParam ); _params[ p._iEdge+1 ] * p._edgeParam );
@ -1807,7 +1807,7 @@ bool SMESH_MAT2d::Branch::addDivPntForConcaVertex( std::vector< std::size_t >&
{ {
// look for a VERTEX of the opposite EDGE // look for a VERTEX of the opposite EDGE
// iNext - next after all null-length segments // iNext - next after all null-length segments
while ( maE = ++iNext ) while ( ( maE = ++iNext ))
{ {
iSeg2 = getBndSegment( maE ); iSeg2 = getBndSegment( maE );
if ( !_boundary->isConcaveSegment( ie1, iSeg2 )) if ( !_boundary->isConcaveSegment( ie1, iSeg2 ))
@ -1839,7 +1839,7 @@ bool SMESH_MAT2d::Branch::addDivPntForConcaVertex( std::vector< std::size_t >&
else if ( isConcaPrev ) else if ( isConcaPrev )
{ {
// all null-length segments passed, find their beginning // all null-length segments passed, find their beginning
while ( maE = iPrev.edgePrev() ) while ( ( maE = iPrev.edgePrev() ))
{ {
iSeg1 = getBndSegment( maE ); iSeg1 = getBndSegment( maE );
if ( _boundary->isConcaveSegment( edgeIDs1.back(), iSeg1 )) if ( _boundary->isConcaveSegment( edgeIDs1.back(), iSeg1 ))

View File

@ -535,7 +535,7 @@ namespace // internal utils
for ( int i = 0; i < 3; ++i ) for ( int i = 0; i < 3; ++i )
{ {
const gp_Pnt& pn = myNodes->Value(n[i]); const gp_Pnt& pn = myNodes->Value(n[i]);
if ( avoidTria = ( pn.SquareDistance( *avoidPnt ) <= tol2 )) if ( ( avoidTria = ( pn.SquareDistance( *avoidPnt ) <= tol2 )))
break; break;
if ( !projectedOnly ) if ( !projectedOnly )
minD2 = Min( minD2, pn.SquareDistance( p )); minD2 = Min( minD2, pn.SquareDistance( p ));

View File

@ -2731,7 +2731,7 @@ namespace
chn.back()->IsLinked( quad._eIntNodes[ iP ]->_intPoint )) chn.back()->IsLinked( quad._eIntNodes[ iP ]->_intPoint ))
{ {
chn.push_back( quad._eIntNodes[ iP ]); chn.push_back( quad._eIntNodes[ iP ]);
found = quad._eIntNodes[ iP ]->_usedInFace = &quad; found = (quad._eIntNodes[ iP ]->_usedInFace = &quad);
break; break;
} }
} while ( found && ! chn.back()->IsLinked( n2->_intPoint ) ); } while ( found && ! chn.back()->IsLinked( n2->_intPoint ) );
@ -2823,7 +2823,7 @@ namespace
( !avoidFace || quad._eIntNodes[ iP ]->IsOnFace( avoidFace ))) ( !avoidFace || quad._eIntNodes[ iP ]->IsOnFace( avoidFace )))
{ {
chn.push_back( quad._eIntNodes[ iP ]); chn.push_back( quad._eIntNodes[ iP ]);
found = quad._eIntNodes[ iP ]->_usedInFace = &quad; found = (quad._eIntNodes[ iP ]->_usedInFace = &quad);
break; break;
} }
} while ( found ); } while ( found );

View File

@ -132,7 +132,7 @@ namespace
// we expect SIGSEGV on a dead group // we expect SIGSEGV on a dead group
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
SMESH_Group* okGroup = 0; SMESH_Group* okGroup = 0;
map<int, SMESH_Mesh*>::iterator itm = itm = studyContext->mapMesh.begin(); map<int, SMESH_Mesh*>::iterator itm = studyContext->mapMesh.begin();
for ( ; !okGroup && itm != studyContext->mapMesh.end(); itm++) for ( ; !okGroup && itm != studyContext->mapMesh.end(); itm++)
{ {
SMESH_Mesh::GroupIteratorPtr gIt = itm->second->GetGroups(); SMESH_Mesh::GroupIteratorPtr gIt = itm->second->GetGroups();
@ -174,7 +174,7 @@ namespace
{ {
int tgtID = resMapKey.second; int tgtID = resMapKey.second;
SMESH_Mesh* tgtMesh = 0; SMESH_Mesh* tgtMesh = 0;
map<int, SMESH_Mesh*>::iterator itm = itm = studyContext->mapMesh.begin(); map<int, SMESH_Mesh*>::iterator itm = studyContext->mapMesh.begin();
for ( ; !tgtMesh && itm != studyContext->mapMesh.end(); itm++) for ( ; !tgtMesh && itm != studyContext->mapMesh.end(); itm++)
{ {
tgtMesh = (*itm).second; tgtMesh = (*itm).second;
@ -250,7 +250,7 @@ std::vector<SMESH_Mesh*> StdMeshers_ImportSource1D::GetSourceMeshes() const
StudyContextStruct* studyContext = _gen->GetStudyContext(_studyId); StudyContextStruct* studyContext = _gen->GetStudyContext(_studyId);
for ( set<int>::iterator id = meshIDs.begin(); id != meshIDs.end(); ++id ) for ( set<int>::iterator id = meshIDs.begin(); id != meshIDs.end(); ++id )
{ {
map<int, SMESH_Mesh*>::iterator itm = itm = studyContext->mapMesh.begin(); map<int, SMESH_Mesh*>::iterator itm = studyContext->mapMesh.begin();
for ( ; itm != studyContext->mapMesh.end(); itm++) for ( ; itm != studyContext->mapMesh.end(); itm++)
{ {
SMESH_Mesh* mesh = (*itm).second; SMESH_Mesh* mesh = (*itm).second;

View File

@ -800,7 +800,7 @@ void StdMeshers_Penta_3D::MakeMeshOnFxy1()
while(itf->more()) { while(itf->more()) {
const SMDS_MeshElement* pE0 = itf->next(); const SMDS_MeshElement* pE0 = itf->next();
aElementType = pE0->GetType(); aElementType = pE0->GetType();
if (!aElementType==SMDSAbs_Face) { if (!(aElementType==SMDSAbs_Face)) {
continue; continue;
} }
aNbNodes = pE0->NbNodes(); aNbNodes = pE0->NbNodes();

View File

@ -522,7 +522,7 @@ namespace {
return nbSides; return nbSides;
} }
void pointsToPython(const std::vector<gp_XYZ>& p) inline void pointsToPython(const std::vector<gp_XYZ>& p)
{ {
#ifdef _DEBUG_ #ifdef _DEBUG_
for ( int i = SMESH_Block::ID_V000; i < p.size(); ++i ) for ( int i = SMESH_Block::ID_V000; i < p.size(); ++i )

View File

@ -102,7 +102,7 @@ namespace HERE = StdMeshers_ProjectionUtils;
namespace { namespace {
static SMESHDS_Mesh* theMeshDS[2] = { 0, 0 }; // used for debug only static SMESHDS_Mesh* theMeshDS[2] = { 0, 0 }; // used for debug only
long shapeIndex(const TopoDS_Shape& S) inline long shapeIndex(const TopoDS_Shape& S)
{ {
if ( theMeshDS[0] && theMeshDS[1] ) if ( theMeshDS[0] && theMeshDS[1] )
return max(theMeshDS[0]->ShapeToIndex(S), theMeshDS[1]->ShapeToIndex(S) ); return max(theMeshDS[0]->ShapeToIndex(S), theMeshDS[1]->ShapeToIndex(S) );

View File

@ -431,7 +431,7 @@ namespace {
// get ordered src EDGEs // get ordered src EDGEs
TError err; TError err;
srcWires = StdMeshers_FaceSide::GetFaceWires( srcFace, *srcMesh,/*skipMediumNodes=*/0, err); srcWires = StdMeshers_FaceSide::GetFaceWires( srcFace, *srcMesh,/*skipMediumNodes=*/0, err);
if ( err && !err->IsOK() || srcWires.empty() ) if ( ( err && !err->IsOK() ) || srcWires.empty() )
return err; return err;
SMESH_MesherHelper srcHelper( *srcMesh ); SMESH_MesherHelper srcHelper( *srcMesh );
@ -942,7 +942,7 @@ namespace {
*/ */
//================================================================================ //================================================================================
bool projectQuads(const TopoDS_Face& tgtFace, inline bool projectQuads(const TopoDS_Face& tgtFace,
const TopoDS_Face& srcFace, const TopoDS_Face& srcFace,
const TSideVector& tgtWires, const TSideVector& tgtWires,
const TSideVector& srcWires, const TSideVector& srcWires,

View File

@ -196,7 +196,7 @@ namespace {
/*! /*!
* \brief return PropagationMgrData found on theEdge submesh * \brief return PropagationMgrData found on theEdge submesh
*/ */
PropagationMgrData* findData(SMESH_Mesh& theMesh, const TopoDS_Shape& theEdge) inline PropagationMgrData* findData(SMESH_Mesh& theMesh, const TopoDS_Shape& theEdge)
{ {
if ( theEdge.ShapeType() == TopAbs_EDGE ) if ( theEdge.ShapeType() == TopAbs_EDGE )
return findData( theMesh.GetSubMeshContaining( theEdge ) ); return findData( theMesh.GetSubMeshContaining( theEdge ) );

View File

@ -1629,7 +1629,7 @@ bool _ViscousBuilder::findSolidsWithLayers()
list< const SMESHDS_Hypothesis *>::const_iterator hyp = allHyps.begin(); list< const SMESHDS_Hypothesis *>::const_iterator hyp = allHyps.begin();
const StdMeshers_ViscousLayers* viscHyp = 0; const StdMeshers_ViscousLayers* viscHyp = 0;
for ( ; hyp != allHyps.end(); ++hyp ) for ( ; hyp != allHyps.end(); ++hyp )
if ( viscHyp = dynamic_cast<const StdMeshers_ViscousLayers*>( *hyp )) if ( ( viscHyp = dynamic_cast<const StdMeshers_ViscousLayers*>( *hyp )))
{ {
TopoDS_Shape hypShape; TopoDS_Shape hypShape;
filter.Init( filter.Is( viscHyp )); filter.Init( filter.Is( viscHyp ));
@ -6240,7 +6240,11 @@ bool _ViscousBuilder::refine(_SolidData& data)
if ( baseShapeId != prevBaseId ) if ( baseShapeId != prevBaseId )
{ {
map< TGeomID, TNode2Edge* >::iterator s2ne = data._s2neMap.find( baseShapeId ); map< TGeomID, TNode2Edge* >::iterator s2ne = data._s2neMap.find( baseShapeId );
n2eMap = ( s2ne == data._s2neMap.end() ) ? 0 : n2eMap = s2ne->second; if (s2ne == data._s2neMap.end())
n2eMap = 0;
else
n2eMap = s2ne->second;
//n2eMap = ( s2ne == data._s2neMap.end() ) ? 0 : n2eMap = s2ne->second;
prevBaseId = baseShapeId; prevBaseId = baseShapeId;
} }
_LayerEdge* edgeOnSameNode = 0; _LayerEdge* edgeOnSameNode = 0;

View File

@ -817,7 +817,7 @@ bool _ViscousBuilder2D::findEdgesWithLayers()
{ {
hasVL = false; hasVL = false;
for ( hyp = allHyps.begin(); hyp != allHyps.end() && !hasVL; ++hyp ) for ( hyp = allHyps.begin(); hyp != allHyps.end() && !hasVL; ++hyp )
if ( viscHyp = dynamic_cast<const THypVL*>( *hyp )) if ( ( viscHyp = dynamic_cast<const THypVL*>( *hyp ) ))
hasVL = viscHyp->IsShapeWithLayers( neighbourID ); hasVL = viscHyp->IsShapeWithLayers( neighbourID );
} }
if ( !hasVL ) if ( !hasVL )

View File

@ -610,13 +610,15 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, Resu
BOPCheck.MergeEdgeMode() = true; BOPCheck.MergeEdgeMode() = true;
#endif #endif
Base::TimeInfo start_time;
BOPCheck.Perform();
float bopAlgoTime = Base::TimeInfo::diffTimeF(start_time,Base::TimeInfo());
#ifdef FC_DEBUG #ifdef FC_DEBUG
Base::TimeInfo start_time;
#endif
BOPCheck.Perform();
#ifdef FC_DEBUG
float bopAlgoTime = Base::TimeInfo::diffTimeF(start_time,Base::TimeInfo());
std::cout << std::endl << "BopAlgo check time is: " << bopAlgoTime << std::endl << std::endl; std::cout << std::endl << "BopAlgo check time is: " << bopAlgoTime << std::endl << std::endl;
#else
Q_UNUSED(bopAlgoTime);
#endif #endif
if (!BOPCheck.HasFaulty()) if (!BOPCheck.HasFaulty())