From: eap Date: Thu, 14 Jan 2016 11:49:35 +0000 (+0300) Subject: Fix compilation errors using gcc-5.X relating to explicit stream::operator bool() X-Git-Tag: V7_8_0a1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a6ff10e23f7e68d7109ae6b90bb255286b9159cf;p=plugins%2Fnetgenplugin.git Fix compilation errors using gcc-5.X relating to explicit stream::operator bool() + Fix compilation warnings --- diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx index 300c4cd..c362938 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx @@ -361,13 +361,13 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load) int is; double val; - isOK = (load >> val); + isOK = static_cast(load >> val); if (isOK) _maxSize = val; else load.clear(ios::badbit | load.rdstate()); - isOK = (load >> is); + isOK = static_cast(load >> is); if (isOK) SetFineness((Fineness) is); else @@ -375,32 +375,32 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load) if (_fineness == UserDefined) { - isOK = (load >> val); + isOK = static_cast(load >> val); if (isOK) _growthRate = val; else load.clear(ios::badbit | load.rdstate()); - isOK = (load >> val); + isOK = static_cast(load >> val); if (isOK) _nbSegPerEdge = val; else load.clear(ios::badbit | load.rdstate()); - isOK = (load >> val); + isOK = static_cast(load >> val); if (isOK) _nbSegPerRadius = val; else load.clear(ios::badbit | load.rdstate()); } - isOK = (load >> is); + isOK = static_cast(load >> is); if (isOK) _secondOrder = (bool) is; else load.clear(ios::badbit | load.rdstate()); - isOK = (load >> is); + isOK = static_cast(load >> is); if (isOK) _optimize = (bool) is; else @@ -409,18 +409,18 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load) std::string option_or_sm; bool hasLocalSize = false; - isOK = (load >> option_or_sm); + isOK = static_cast(load >> option_or_sm); if (isOK) if (option_or_sm == "__LOCALSIZE_BEGIN__") hasLocalSize = true; std::string smEntry, smValue; while (isOK && hasLocalSize) { - isOK = (load >> smEntry); + isOK = static_cast(load >> smEntry); if (isOK) { if (smEntry == "__LOCALSIZE_END__") break; - isOK = (load >> smValue); + isOK = static_cast(load >> smValue); } if (isOK) { std::istringstream tmp(smValue); @@ -433,15 +433,15 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load) if ( !hasLocalSize && !option_or_sm.empty() ) _minSize = atof( option_or_sm.c_str() ); - isOK = ( load >> _quadAllowed ); + isOK = static_cast( load >> _quadAllowed ); if ( !isOK ) _quadAllowed = GetDefaultQuadAllowed(); - isOK = ( load >> _surfaceCurvature ); + isOK = static_cast( load >> _surfaceCurvature ); if ( !isOK ) _surfaceCurvature = GetDefaultSurfaceCurvature(); - isOK = ( load >> _fuseEdges ); + isOK = static_cast( load >> _fuseEdges ); if ( !isOK ) _fuseEdges = GetDefaultFuseEdges(); diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index cda4863..9728a3c 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -276,7 +276,7 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp) const NETGENPlugin_Hypothesis::TLocalSize localSizes = hyp->GetLocalSizesAndEntries(); NETGENPlugin_Hypothesis::TLocalSize::const_iterator it = localSizes.begin(); - for (it ; it != localSizes.end() ; it++) + for ( ; it != localSizes.end() ; it++) { std::string entry = (*it).first; double val = (*it).second; @@ -334,8 +334,8 @@ int HashCode(const Link& aLink, int aLimit) Standard_Boolean IsEqual(const Link& aLink1, const Link& aLink2) { - return (aLink1.n1 == aLink2.n1 && aLink1.n2 == aLink2.n2 || - aLink1.n1 == aLink2.n2 && aLink1.n2 == aLink2.n1); + return (( aLink1.n1 == aLink2.n1 && aLink1.n2 == aLink2.n2 ) || + ( aLink1.n1 == aLink2.n2 && aLink1.n2 == aLink2.n1 )); } namespace @@ -381,7 +381,7 @@ namespace // get ordered EDGEs list< TopoDS_Edge > edges; list< int > nbEdgesInWire; - int nbWires = SMESH_Block::GetOrderedEdges( face, edges, nbEdgesInWire); + /*int nbWires =*/ SMESH_Block::GetOrderedEdges( face, edges, nbEdgesInWire); // find within list< TopoDS_Edge >::iterator eItFwd = edges.begin(); @@ -735,7 +735,7 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom, SMESH_ProxyMesh::Ptr proxyMesh) { TNode2IdMap nodeNgIdMap; - for ( int i = 1; i < nodeVec.size(); ++i ) + for ( size_t i = 1; i < nodeVec.size(); ++i ) nodeNgIdMap.insert( make_pair( nodeVec[i], i )); TopTools_MapOfShape visitedShapes; @@ -1116,7 +1116,7 @@ void NETGENPlugin_Mesher::FixIntFaces(const netgen::OCCGeometry& occgeom, { // duplicate faces int i, nbFaces = ngMesh.GetNSE(); - for (int i = 1; i <= nbFaces; ++i) + for ( i = 1; i <= nbFaces; ++i) { netgen::Element2d elem = ngMesh.SurfaceElement(i); if ( ngFaceIds.count( elem.GetIndex() )) @@ -1155,7 +1155,7 @@ bool NETGENPlugin_Mesher::FixFaceMesh(const netgen::OCCGeometry& occgeom, if ( occgeom.fmap.Extent() < faceID ) return false; - const TopoDS_Face& face = TopoDS::Face( occgeom.fmap( faceID )); + //const TopoDS_Face& face = TopoDS::Face( occgeom.fmap( faceID )); // find free links on the FACE NCollection_Map linkMap; @@ -1319,7 +1319,7 @@ void NETGENPlugin_Mesher::AddIntVerticesInFaces(const netgen::OCCGeometry& o vector& nodeVec, NETGENPlugin_Internals& internalShapes) { - if ( nodeVec.size() < ngMesh.GetNP() ) + if ((int) nodeVec.size() < ngMesh.GetNP() ) nodeVec.resize( ngMesh.GetNP(), 0 ); SMESHDS_Mesh* meshDS = internalShapes.getMesh().GetMeshDS(); @@ -1513,7 +1513,7 @@ void NETGENPlugin_Mesher::AddIntVerticesInSolids(const netgen::OCCGeometry& << "smesh = smeshBuilder.New(salome.myStudy)"<MissVertexNode() ) @@ -1754,7 +1754,7 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh, // (new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH, "Missing nodes on vertices")); } const vector& uvPtVec = wire->GetUVPtStruct(); - if ( uvPtVec.size() != wire->NbPoints() ) + if ((int) uvPtVec.size() != wire->NbPoints() ) return SMESH_ComputeError::New(COMPERR_BAD_INPUT_MESH, SMESH_Comment("Unexpected nb of points on wire ") << iW << ": " << uvPtVec.size()<<" != "<NbPoints()); @@ -1777,7 +1777,7 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh, if ( !wasNgMeshEmpty ) // fill node2ngID with nodes built by NETGEN { set< int > subIDs; // ids of sub-shapes of the FACE - for ( int iW = 0; iW < wires.size(); ++iW ) + for ( size_t iW = 0; iW < wires.size(); ++iW ) { StdMeshers_FaceSidePtr wire = wires[ iW ]; for ( int iE = 0, nbE = wire->NbEdges(); iE < nbE; ++iE ) @@ -1795,7 +1795,7 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh, if ( ngMesh.GetNFD() < 1 ) ngMesh.AddFaceDescriptor (netgen::FaceDescriptor(faceID, solidID, solidID, 0)); - for ( int iW = 0; iW < wires.size(); ++iW ) + for ( size_t iW = 0; iW < wires.size(); ++iW ) { StdMeshers_FaceSidePtr wire = wires[ iW ]; const vector& uvPtVec = wire->GetUVPtStruct(); @@ -1814,7 +1814,7 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh, int edgeID = 1, posID = -2; bool isInternalWire = false; double vertexNormPar = 0; - const int prevNbNGSeg = ngMesh.GetNSeg(); + //const int prevNbNGSeg = ngMesh.GetNSeg(); for ( int i = 0; i < nbSegments; ++i ) // loop on segments { // Add the first point of a segment @@ -2137,7 +2137,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo, for (int j=1; j <= elem.GetNP(); ++j) { int pind = elem.PNum(j); - if ( pind < 1 || pind >= nodeVec.size() ) + if ( pind < 1 || pind >= (int) nodeVec.size() ) break; if ( SMDS_MeshNode* node = nodeVec_ACCESS(pind)) { @@ -2149,7 +2149,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo, } } } - if ( nodes.size() != elem.GetNP() ) + if ((int) nodes.size() != elem.GetNP() ) { if ( comment.empty() ) comment << "Invalid netgen 2d element #" << i; @@ -2218,7 +2218,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo, for (int j=1; j <= elem.GetNP(); ++j) { int pind = elem.PNum(j); - if ( pind < 1 || pind >= nodeVec.size() ) + if ( pind < 1 || pind >= (int)nodeVec.size() ) break; if ( SMDS_MeshNode* node = nodeVec_ACCESS(pind) ) { @@ -2227,7 +2227,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo, meshDS->SetNodeInVolume(node, aSolid); } } - if ( nodes.size() != elem.GetNP() ) + if ((int) nodes.size() != elem.GetNP() ) { if ( comment.empty() ) comment << "Invalid netgen 3d element #" << i; @@ -3398,13 +3398,14 @@ NETGENPlugin_Mesher::ReadErrors(const vector& nodeVec) vector three1(3), three2(3); const char* badEdgeStr = " multiple times in surface mesh"; const int badEdgeStrLen = strlen( badEdgeStr ); + const int nbNodes = nodeVec.size(); while( !file.eof() ) { if ( strncmp( file, "Edge ", 5 ) == 0 && file.getInts( two ) && strncmp( file, badEdgeStr, badEdgeStrLen ) == 0 && - two[0] < nodeVec.size() && two[1] < nodeVec.size()) + two[0] < nbNodes && two[1] < nbNodes ) { err->myBadElements.push_back( new SMDS_LinearEdge( nodeVec[ two[0]], nodeVec[ two[1]] )); file += badEdgeStrLen; @@ -3422,9 +3423,9 @@ NETGENPlugin_Mesher::ReadErrors(const vector& nodeVec) ok = ok && file.getInts( three1 ); ok = ok && file.getInts( three2 ); for ( int i = 0; ok && i < 3; ++i ) - ok = ( three1[i] < nodeVec.size() && nodeVec[ three1[i]]); + ok = ( three1[i] < nbNodes && nodeVec[ three1[i]]); for ( int i = 0; ok && i < 3; ++i ) - ok = ( three2[i] < nodeVec.size() && nodeVec[ three2[i]]); + ok = ( three2[i] < nbNodes && nodeVec[ three2[i]]); if ( ok ) { err->myBadElements.push_back( new SMDS_FaceOfNodes( nodeVec[ three1[0]], diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx index 342d623..be18e4f 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx @@ -504,7 +504,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh, { netgen::mparam.minh = netgen::mparam.maxh; netgen::mparam.maxh = 0; - for ( int iW = 0; iW < wires.size(); ++iW ) + for ( size_t iW = 0; iW < wires.size(); ++iW ) { StdMeshers_FaceSidePtr wire = wires[ iW ]; const vector& uvPtVec = wire->GetUVPtStruct(); @@ -668,7 +668,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh, // compute edge length double ELen = 0; - if (_hypLengthFromEdges || !_hypLengthFromEdges && !_hypMaxElementArea) { + if (( _hypLengthFromEdges ) || ( !_hypLengthFromEdges && !_hypMaxElementArea )) { if ( nb1d > 0 ) ELen = fullLen / nb1d; } diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx index b16e00b..f2ef3d8 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx @@ -146,7 +146,7 @@ bool NETGENPlugin_NETGEN_3D::CheckHypothesis (SMESH_Mesh& aMesh, _progressByTic = -1.; list::const_iterator itl; - const SMESHDS_Hypothesis* theHyp; + //const SMESHDS_Hypothesis* theHyp; const list& hyps = GetUsedHypothesis(aMesh, aShape, /*ignoreAuxiliary=*/false); @@ -200,7 +200,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); SMESH_MesherHelper helper(aMesh); - bool _quadraticMesh = helper.IsQuadraticSubMesh(aShape); + _quadraticMesh = helper.IsQuadraticSubMesh(aShape); helper.SetElementsOnShape( true ); int Netgen_NbOfNodes = 0; @@ -586,13 +586,8 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, // --------------------------------- int Netgen_NbOfNodes = 0; - int Netgen_param2ndOrder = 0; - double Netgen_paramFine = 1.; - double Netgen_paramSize = pow( 72, 1/6. ) * pow( _maxElementVolume, 1/3. ); - double Netgen_point[3]; int Netgen_triangle[3]; - int Netgen_tetrahedron[4]; NETGENPlugin_NetgenLibWrapper ngLib; Ng_Mesh * Netgen_mesh = ngLib._ngMesh; diff --git a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cxx b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cxx index 9fd73bb..ad301a5 100644 --- a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cxx @@ -165,19 +165,19 @@ istream & NETGENPlugin_SimpleHypothesis_2D::LoadFrom(istream & load) bool isOK = true; double val; - isOK = (load >> val); + isOK = static_cast(load >> val); if (isOK) _nbSegments = (int) val; else load.clear(ios::badbit | load.rdstate()); - isOK = (load >> val); + isOK = static_cast(load >> val); if (isOK) _segmentLength = val; else load.clear(ios::badbit | load.rdstate()); - isOK = (load >> val); + isOK = static_cast(load >> val); if (isOK) _area = val; else diff --git a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_3D.cxx b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_3D.cxx index f52119c..113e4e4 100644 --- a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_3D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_3D.cxx @@ -106,7 +106,7 @@ istream & NETGENPlugin_SimpleHypothesis_3D::LoadFrom(istream & load) bool isOK = true; double val; - isOK = (load >> val); + isOK = static_cast(load >> val); if (isOK) _volume = val; else