Salome HOME
Fix compilation errors using gcc-5.X relating to explicit stream::operator bool()
[modules/smesh.git] / src / SMDS / SMDS_VolumeTool.cxx
index 8296de035dad4140e1a6b18f038d316e4d2157f0..06755badfe00214f35f00414d12a7fe3ee49537e 100644 (file)
@@ -843,7 +843,7 @@ bool SMDS_VolumeTool::GetBaryCenter(double & X, double & Y, double & Z) const
   if ( !myVolume )
     return false;
 
-  for ( int i = 0; i < myVolumeNodes.size(); i++ ) {
+  for ( size_t i = 0; i < myVolumeNodes.size(); i++ ) {
     X += myVolumeNodes[ i ]->X();
     Y += myVolumeNodes[ i ]->Y();
     Z += myVolumeNodes[ i ]->Z();
@@ -1011,7 +1011,7 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) const
     ori = ( minProj < 0 ? +1 : -1 );
     me->myPolyFacetOri[ faceIndex ] = ori;
 
-    if ( !me->myFwdLinks.empty() ) // concave polyhedron; collect oriented links
+    if ( !myFwdLinks.empty() ) // concave polyhedron; collect oriented links
       for ( int i = 0; i < myCurFace.myNbNodes; ++i )
       {
         NLink link( myCurFace.myNodes[i], myCurFace.myNodes[i+1], ori );
@@ -1024,10 +1024,10 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) const
 
   // concave polyhedron
 
-  if ( me->myFwdLinks.empty() ) // get links of the least ambiguously oriented facet
+  if ( myFwdLinks.empty() ) // get links of the least ambiguously oriented facet
   {
     for ( size_t i = 0; i < myPolyFacetOri.size() && !ori; ++i )
-      ori = me->myPolyFacetOri[ i ];
+      ori = myPolyFacetOri[ i ];
 
     if ( !ori ) // none facet is oriented yet
     {
@@ -1058,10 +1058,10 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) const
         me->myPolyFacetOri[ faceMostConvex ] = ori;
       }
     }
-    // collect links of the oriented facets in me->myFwdLinks
+    // collect links of the oriented facets in myFwdLinks
     for ( size_t iF = 0; iF < myPolyFacetOri.size(); ++iF )
     {
-      ori = me->myPolyFacetOri[ iF ];
+      ori = myPolyFacetOri[ iF ];
       if ( !ori ) continue;
       setFace( iF );
       for ( int i = 0; i < myCurFace.myNbNodes; ++i )
@@ -1079,8 +1079,8 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) const
   for ( int i = 0; i < myCurFace.myNbNodes && !ori; ++i )
   {
     NLink link( myCurFace.myNodes[i], myCurFace.myNodes[i+1] );
-    std::map<Link, int>::iterator l2o = me->myFwdLinks.find( link );
-    if ( l2o != me->myFwdLinks.end() )
+    std::map<Link, int>::const_iterator l2o = myFwdLinks.find( link );
+    if ( l2o != myFwdLinks.end() )
       ori = link.myOri * l2o->second * -1;
     links[ i ] = link;
   }
@@ -1089,15 +1089,15 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) const
     // orient and collect links of other non-oriented facets
     for ( size_t iF = 0; iF < myPolyFacetOri.size(); ++iF )
     {
-      if ( me->myPolyFacetOri[ iF ] ) continue; // already oriented
+      if ( myPolyFacetOri[ iF ] ) continue; // already oriented
       setFace( iF );
       links2.clear();
       ori = 0;
       for ( int i = 0; i < myCurFace.myNbNodes && !ori; ++i )
       {
         NLink link( myCurFace.myNodes[i], myCurFace.myNodes[i+1] );
-        std::map<Link, int>::iterator l2o = me->myFwdLinks.find( link );
-        if ( l2o != me->myFwdLinks.end() )
+        std::map<Link, int>::const_iterator l2o = myFwdLinks.find( link );
+        if ( l2o != myFwdLinks.end() )
           ori = link.myOri * l2o->second * -1;
         links2.push_back( link );
       }
@@ -1116,8 +1116,8 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) const
     ori = 0;
     for ( size_t i = 0; i < links.size() && !ori; ++i )
     {
-      std::map<Link, int>::iterator l2o = me->myFwdLinks.find( links[i] );
-      if ( l2o != me->myFwdLinks.end() )
+      std::map<Link, int>::const_iterator l2o = myFwdLinks.find( links[i] );
+      if ( l2o != myFwdLinks.end() )
         ori = links[i].myOri * l2o->second * -1;
     }
     me->myPolyFacetOri[ faceIndex ] = ori;
@@ -1390,7 +1390,7 @@ bool SMDS_VolumeTool::IsLinked (const SMDS_MeshNode* theNode1,
 
   // find nodes indices
   int i1 = -1, i2 = -1, nbFound = 0;
-  for ( int i = 0; i < myVolumeNodes.size() && nbFound < 2; i++ )
+  for ( size_t i = 0; i < myVolumeNodes.size() && nbFound < 2; i++ )
   {
     if ( myVolumeNodes[ i ] == theNode1 )
       i1 = i, ++nbFound;
@@ -1418,7 +1418,7 @@ bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
   int minInd = min( theNode1Index, theNode2Index );
   int maxInd = max( theNode1Index, theNode2Index );
 
-  if ( minInd < 0 || maxInd > myVolumeNodes.size() - 1 || maxInd == minInd )
+  if ( minInd < 0 || maxInd > (int)myVolumeNodes.size() - 1 || maxInd == minInd )
     return false;
 
   VolumeType type = GetVolumeType();
@@ -1535,7 +1535,7 @@ bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
 int SMDS_VolumeTool::GetNodeIndex(const SMDS_MeshNode* theNode) const
 {
   if ( myVolume ) {
-    for ( int i = 0; i < myVolumeNodes.size(); i++ ) {
+    for ( size_t i = 0; i < myVolumeNodes.size(); i++ ) {
       if ( myVolumeNodes[ i ] == theNode )
         return i;
     }
@@ -1596,8 +1596,8 @@ int SMDS_VolumeTool::GetAllExistingEdges(vector<const SMDS_MeshElement*> & edges
 {
   edges.clear();
   edges.reserve( myVolumeNodes.size() * 2 );
-  for ( int i = 0; i < myVolumeNodes.size()-1; ++i ) {
-    for ( int j = i + 1; j < myVolumeNodes.size(); ++j ) {
+  for ( size_t i = 0; i < myVolumeNodes.size()-1; ++i ) {
+    for ( size_t j = i + 1; j < myVolumeNodes.size(); ++j ) {
       if ( IsLinked( i, j )) {
         const SMDS_MeshElement* edge =
           SMDS_Mesh::FindEdge( myVolumeNodes[i], myVolumeNodes[j] );