From 01572b633102fe2275c9a99cc2a7fde050e1f9aa Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 17 Mar 2021 18:14:10 +0300 Subject: [PATCH] bos #20256: [CEA 18523] Porting SMESH to int 64 bits --- idl/NETGENPlugin_Algorithm.idl | 4 +- src/GUI/NETGENPluginGUI_HypothesisCreator.cxx | 8 +-- .../NETGENPlugin_Hypothesis_i.cxx | 8 +-- src/NETGENPlugin/NETGENPlugin_Mesher.cxx | 58 +++++++++---------- .../NETGENPlugin_NETGEN_2D_ONLY.cxx | 28 ++++----- src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx | 26 ++++----- src/NETGENPlugin/NETGENPlugin_Remesher_2D.cxx | 8 +-- .../NETGENPlugin_SimpleHypothesis_2D.cxx | 2 +- .../NETGENPlugin_SimpleHypothesis_2D.hxx | 10 ++-- .../NETGENPlugin_SimpleHypothesis_2D_i.cxx | 6 +- .../NETGENPlugin_SimpleHypothesis_2D_i.hxx | 4 +- 11 files changed, 81 insertions(+), 81 deletions(-) diff --git a/idl/NETGENPlugin_Algorithm.idl b/idl/NETGENPlugin_Algorithm.idl index 6af8e1e..64f84ad 100644 --- a/idl/NETGENPlugin_Algorithm.idl +++ b/idl/NETGENPlugin_Algorithm.idl @@ -248,12 +248,12 @@ module NETGENPlugin /*! * Sets value */ - void SetNumberOfSegments(in short nb) raises (SALOME::SALOME_Exception); + void SetNumberOfSegments(in long nb) raises (SALOME::SALOME_Exception); /*! * Returns value. * Can be zero in case if LocalLength() has been set */ - short GetNumberOfSegments(); + long GetNumberOfSegments(); /*! * Sets value diff --git a/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx b/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx index 99ef7d1..f38e717 100644 --- a/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx @@ -761,7 +761,7 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromHypo( NetgenHypothesisData NETGENPluginGUI_HypothesisCreator* that = (NETGENPluginGUI_HypothesisCreator*)this; NETGENPlugin::string_array_var myEntries = h->GetLocalSizeEntries(); - for ( size_t i = 0; i < myEntries->length(); i++ ) + for ( CORBA::ULong i = 0; i < myEntries->length(); i++ ) { QString entry = myEntries[i].in(); if (myLocalSizeMap.contains(entry) && @@ -826,17 +826,17 @@ bool NETGENPluginGUI_HypothesisCreator::storeParamsToHypo( const NetgenHypothesi if ( myNbSurfOptSteps ) { h->SetVarParameter ( h_data.myNbSurfOptStepsVar.toLatin1().constData(), "SetNbSurfOptSteps"); - h->SetNbSurfOptSteps( h_data.myNbSurfOptSteps ); + h->SetNbSurfOptSteps((CORBA::Short) h_data.myNbSurfOptSteps ); } if ( myNbVolOptSteps ) { h->SetVarParameter ( h_data.myNbVolOptStepsVar.toLatin1().constData(), "SetNbVolOptSteps"); - h->SetNbVolOptSteps( h_data.myNbVolOptSteps ); + h->SetNbVolOptSteps((CORBA::Short) h_data.myNbVolOptSteps ); } if ( myFuseEdges ) h->SetFuseEdges( h_data.myFuseEdges ); h->SetVarParameter ( h_data.myWorstElemMeasureVar.toLatin1().constData(), "SetWorstElemMeasure"); - h->SetWorstElemMeasure( h_data.myWorstElemMeasure ); + h->SetWorstElemMeasure((CORBA::Short) h_data.myWorstElemMeasure ); h->SetUseDelauney( h_data.myUseDelauney ); h->SetCheckOverlapping( h_data.myCheckOverlapping ); diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx index ecf7b6e..e667600 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx @@ -373,7 +373,7 @@ NETGENPlugin::string_array* NETGENPlugin_Hypothesis_i::GetLocalSizeEntries() NETGENPlugin::string_array_var result = new NETGENPlugin::string_array(); const ::NETGENPlugin_Hypothesis::TLocalSize localSizes = this->GetImpl()->GetLocalSizesAndEntries(); - result->length(localSizes.size()); + result->length((CORBA::ULong) localSizes.size()); ::NETGENPlugin_Hypothesis::TLocalSize::const_iterator it = localSizes.begin(); for (int i=0 ; it != localSizes.end() ; i++, it++) { @@ -490,7 +490,7 @@ void NETGENPlugin_Hypothesis_i::SetNbSurfOptSteps(CORBA::Short nb ) CORBA::Short NETGENPlugin_Hypothesis_i::GetNbSurfOptSteps() { - return GetImpl()->GetNbSurfOptSteps(); + return (CORBA::Short) GetImpl()->GetNbSurfOptSteps(); } //======================================================================= @@ -515,7 +515,7 @@ void NETGENPlugin_Hypothesis_i::SetNbVolOptSteps(CORBA::Short nb ) CORBA::Short NETGENPlugin_Hypothesis_i::GetNbVolOptSteps() { - return GetImpl()->GetNbVolOptSteps(); + return (CORBA::Short) GetImpl()->GetNbVolOptSteps(); } //======================================================================= @@ -563,7 +563,7 @@ void NETGENPlugin_Hypothesis_i::SetWorstElemMeasure(CORBA::Short val ) CORBA::Short NETGENPlugin_Hypothesis_i::GetWorstElemMeasure() { - return GetImpl()->GetWorstElemMeasure(); + return (CORBA::Short) GetImpl()->GetWorstElemMeasure(); } //======================================================================= diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index dddcd2e..ed60210 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -1162,7 +1162,7 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom, const vector& points = fSide.GetUVPtStruct(); if ( points.empty() ) return false; // invalid node params? - int i, nbSeg = fSide.NbSegments(); + smIdType i, nbSeg = fSide.NbSegments(); // remember EDGEs of fSide to treat only once for ( int iE = 0; iE < fSide.NbEdges(); ++iE ) @@ -2202,7 +2202,7 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh, // ---------------------------- // Check wires and count nodes // ---------------------------- - int nbNodes = 0; + smIdType nbNodes = 0; for ( size_t iW = 0; iW < wires.size(); ++iW ) { StdMeshers_FaceSidePtr wire = wires[ iW ]; @@ -2259,7 +2259,7 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh, { StdMeshers_FaceSidePtr wire = wires[ iW ]; const vector& uvPtVec = wire->GetUVPtStruct(); - const int nbSegments = wire->NbPoints() - 1; + const smIdType nbSegments = wire->NbPoints() - 1; // assure the 1st node to be in node2ngID, which is needed to correctly // "close chain of segments" (see below) in case if the 1st node is not @@ -2351,8 +2351,8 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh, SMESH_TNodeXYZ np1( n ), np2( uvPtVec[ i+1 ].node ); // get an average size of adjacent segments to avoid sharp change of // element size (regression on issue 0020452, note 0010898) - int iPrev = SMESH_MesherHelper::WrapIndex( i-1, nbSegments ); - int iNext = SMESH_MesherHelper::WrapIndex( i+1, nbSegments ); + int iPrev = SMESH_MesherHelper::WrapIndex( i-1, (int) nbSegments ); + int iNext = SMESH_MesherHelper::WrapIndex( i+1, (int) nbSegments ); double sumH = segLen[ iPrev ] + segLen[ i ] + segLen[ iNext ]; int nbSeg = ( int( segLen[ iPrev ] > sumH / 100.) + int( segLen[ i ] > sumH / 100.) + @@ -2465,14 +2465,14 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo, if ( quadHelper && !quadHelper->GetIsQuadratic() && quadHelper->GetTLinkNodeMap().empty() ) quadHelper = 0; - int i, nbInitNod = initState._nbNodes; + int ngID, nbInitNod = initState._nbNodes; if ( initState._elementsRemoved ) { // PAL23427. Update nodeVec to track removal of netgen free points as a result // of removal of faces in FillNgMesh() in the case of a shrunk sub-mesh - int ngID, nodeVecSize = nodeVec.size(); + size_t i, nodeVecSize = nodeVec.size(); const double eps = std::numeric_limits::min(); - for ( ngID = i = 1; i < nodeVecSize; ++ngID, ++i ) + for ( i = ngID = 1; i < nodeVecSize; ++ngID, ++i ) { gp_Pnt ngPnt( NGPOINT_COORDS( ngMesh.Point( ngID ))); gp_Pnt node ( SMESH_NodeXYZ (nodeVec_ACCESS(i) )); @@ -2494,7 +2494,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo, if ( nbNod > nbInitNod ) nodeVec.resize( nbNod + 1 ); - for ( i = nbInitNod+1; i <= nbNod; ++i ) + for ( int i = nbInitNod+1; i <= nbNod; ++i ) { const netgen::MeshPoint& ngPoint = ngMesh.Point(i); SMDS_MeshNode* node = NULL; @@ -2529,7 +2529,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo, // ------------------------------------------- int nbInitSeg = initState._nbSegments; - for (i = nbInitSeg+1; i <= nbSeg; ++i ) + for ( int i = nbInitSeg+1; i <= nbSeg; ++i ) { const netgen::Segment& seg = ngMesh.LineSegment(i); TopoDS_Edge aEdge; @@ -2611,7 +2611,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo, ngMesh.AddFaceDescriptor (netgen::FaceDescriptor(quadFaceID, /*solid1=*/0, /*solid2=*/0, 0)); vector nodes; - for (i = nbInitFac+1; i <= nbFac; ++i ) + for ( int i = nbInitFac+1; i <= nbFac; ++i ) { const netgen::Element2d& elem = ngMesh.SurfaceElement(i); const int aGeomFaceInd = elem.GetIndex(); @@ -2692,7 +2692,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo, // Create tetrahedra // ------------------ - for ( i = 1; i <= nbVol; ++i ) + for ( int i = 1; i <= nbVol; ++i ) { const netgen::Element& elem = ngMesh.VolumeElement(i); int aSolidInd = elem.GetIndex(); @@ -2957,7 +2957,7 @@ bool NETGENPlugin_Mesher::Compute() { // Pass 1D simple parameters to NETGEN // -------------------------------- - int nbSeg = _simpleHyp->GetNumberOfSegments(); + double nbSeg = (double) _simpleHyp->GetNumberOfSegments(); double segSize = _simpleHyp->GetLocalLength(); for ( int iE = 1; iE <= occgeo.emap.Extent(); ++iE ) { @@ -3184,7 +3184,7 @@ bool NETGENPlugin_Mesher::Compute() FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment, &quadHelper ); // compute prismatic boundary volumes - int nbQuad = _mesh->NbQuadrangles(); + smIdType nbQuad = _mesh->NbQuadrangles(); SMESH_ProxyMesh::Ptr viscousMesh; if ( _viscousLayersHyp ) { @@ -3442,9 +3442,9 @@ bool NETGENPlugin_Mesher::Compute() bool smComputed = nbVol && !sm->IsEmpty(); if ( smComputed && internals.hasInternalVertexInSolid( sm->GetId() )) { - int nbIntV = internals.getSolidsWithVertices().find( sm->GetId() )->second.size(); + size_t nbIntV = internals.getSolidsWithVertices().find( sm->GetId() )->second.size(); SMESHDS_SubMesh* smDS = sm->GetSubMeshDS(); - smComputed = ( smDS->NbElements() > 0 || smDS->NbNodes() > nbIntV ); + smComputed = ( smDS->NbElements() > 0 || smDS->NbNodes() > (smIdType) nbIntV ); } SMESH_ComputeErrorPtr& smError = sm->GetComputeError(); if ( !smComputed && ( !smError || smError->IsOK() )) @@ -3552,7 +3552,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap) // } // calculate total nb of segments and length of edges double fullLen = 0.0; - int fullNbSeg = 0; + smIdType fullNbSeg = 0; int entity = mparams.secondorder > 0 ? SMDSEntity_Quad_Edge : SMDSEntity_Edge; TopTools_DataMapOfShapeInteger Edge2NbSeg; for (TopExp_Explorer exp(_shape, TopAbs_EDGE); exp.More(); exp.Next()) @@ -3564,7 +3564,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap) double aLen = SMESH_Algo::EdgeLength(E); fullLen += aLen; - vector& aVec = aResMap[_mesh->GetSubMesh(E)]; + vector& aVec = aResMap[_mesh->GetSubMesh(E)]; if ( aVec.empty() ) aVec.resize( SMDSEntity_Last, 0); else @@ -3581,7 +3581,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap) int aGeomEdgeInd = seg.epgeominfo[0].edgenr; if (aGeomEdgeInd > 0 && aGeomEdgeInd <= occgeo.emap.Extent()) { - vector& aVec = aResMap[_mesh->GetSubMesh(occgeo.emap(aGeomEdgeInd))]; + vector& aVec = aResMap[_mesh->GetSubMesh(occgeo.emap(aGeomEdgeInd))]; aVec[ entity ]++; } } @@ -3589,12 +3589,12 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap) TopTools_DataMapIteratorOfDataMapOfShapeInteger Edge2NbSegIt(Edge2NbSeg); for (; Edge2NbSegIt.More(); Edge2NbSegIt.Next()) { - vector& aVec = aResMap[_mesh->GetSubMesh(Edge2NbSegIt.Key())]; + vector& aVec = aResMap[_mesh->GetSubMesh(Edge2NbSegIt.Key())]; if ( aVec[ entity ] > 1 && aVec[ SMDSEntity_Node ] == 0 ) aVec[SMDSEntity_Node] = mparams.secondorder > 0 ? 2*aVec[ entity ]-1 : aVec[ entity ]-1; fullNbSeg += aVec[ entity ]; - Edge2NbSeg( Edge2NbSegIt.Key() ) = aVec[ entity ]; + Edge2NbSeg( Edge2NbSegIt.Key() ) = (int) aVec[ entity ]; } if ( fullNbSeg == 0 ) return false; @@ -3610,12 +3610,12 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap) } else { // length from edges - mparams.maxh = fullLen/fullNbSeg; + mparams.maxh = fullLen / double( fullNbSeg ); mparams.grading = 0.2; // slow size growth } } mparams.maxh = min( mparams.maxh, occgeo.boundingbox.Diam()/2 ); - mparams.maxh = min( mparams.maxh, fullLen/fullNbSeg * (1. + mparams.grading)); + mparams.maxh = min( mparams.maxh, fullLen / double( fullNbSeg ) * (1. + mparams.grading)); for (TopExp_Explorer exp(_shape, TopAbs_FACE); exp.More(); exp.Next()) { @@ -3636,7 +3636,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap) int nbFaces = tooManyElems ? hugeNb : int( 4*anArea / (mparams.maxh*mparams.maxh*sqrt(3.))); int nbNodes = tooManyElems ? hugeNb : (( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 ); - vector aVec(SMDSEntity_Last, 0); + vector aVec(SMDSEntity_Last, 0); if( mparams.secondorder > 0 ) { int nb1d_in = (nbFaces*3 - nb1d) / 2; aVec[SMDSEntity_Node] = nbNodes + nb1d_in; @@ -3666,7 +3666,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap) // using previous length from faces } mparams.grading = 0.4; - mparams.maxh = min( mparams.maxh, fullLen/fullNbSeg * (1. + mparams.grading)); + mparams.maxh = min( mparams.maxh, fullLen / double( fullNbSeg ) * (1. + mparams.grading)); } GProp_GProps G; BRepGProp::VolumeProperties(_shape,G); @@ -3675,7 +3675,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap) tooManyElems = tooManyElems || ( aVolume/hugeNb > tetrVol ); int nbVols = tooManyElems ? hugeNb : int(aVolume/tetrVol); int nb1d_in = int(( nbVols*6 - fullNbSeg ) / 6 ); - vector aVec(SMDSEntity_Last, 0 ); + vector aVec(SMDSEntity_Last, 0 ); if ( tooManyElems ) // avoid FPE { aVec[SMDSEntity_Node] = hugeNb; @@ -3787,8 +3787,8 @@ NETGENPlugin_Mesher::ReadErrors(const vector& nodeVec) vector two(2); vector three1(3), three2(3); const char* badEdgeStr = " multiple times in surface mesh"; - const int badEdgeStrLen = strlen( badEdgeStr ); - const int nbNodes = nodeVec.size(); + const int badEdgeStrLen = (int) strlen( badEdgeStr ); + const int nbNodes = (int) nodeVec.size(); while( !file.eof() ) { @@ -3798,7 +3798,7 @@ NETGENPlugin_Mesher::ReadErrors(const vector& nodeVec) two[0] < nbNodes && two[1] < nbNodes ) { err->myBadElements.push_back( new SMDS_LinearEdge( nodeVec[ two[0]], nodeVec[ two[1]] )); - file += badEdgeStrLen; + file += (int) badEdgeStrLen; } else if ( strncmp( file, "Intersecting: ", 14 ) == 0 ) { diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx index 0739d65..84d4363 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx @@ -356,7 +356,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh, StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, faceErr, &helper, proxyMesh ); if ( faceErr && !faceErr->IsOK() ) continue; - int nbWires = wires.size(); + size_t nbWires = wires.size(); if ( nbWires == 0 ) { faceErr.reset @@ -382,21 +382,21 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh, if (_hypLengthFromEdges ) { // compute edgeLength as an average segment length - int nbSegments = 0; - for ( int iW = 0; iW < nbWires; ++iW ) + smIdType nbSegments = 0; + for ( size_t iW = 0; iW < nbWires; ++iW ) { edgeLength += wires[ iW ]->Length(); nbSegments += wires[ iW ]->NbSegments(); } if ( nbSegments ) - edgeLength /= nbSegments; + edgeLength /= double( nbSegments ); netgen::mparam.maxh = edgeLength; } else if ( isDefaultHyp ) { // set edgeLength by a longest segment double maxSeg2 = 0; - for ( int iW = 0; iW < nbWires; ++iW ) + for ( size_t iW = 0; iW < nbWires; ++iW ) { const UVPtStructVec& points = wires[ iW ]->GetUVPtStruct(); if ( points.empty() ) @@ -548,7 +548,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh, int nbNodes = ngMesh->GetNP(); int nbFaces = ngMesh->GetNSE(); - int nbInputNodes = nodeVec.size()-1; + int nbInputNodes = (int) nodeVec.size()-1; nodeVec.resize( nbNodes+1, 0 ); // add nodes @@ -646,7 +646,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh, return false; // collect info from edges - int nb0d = 0, nb1d = 0; + smIdType nb0d = 0, nb1d = 0; bool IsQuadratic = false; bool IsFirst = true; double fullLen = 0.0; @@ -664,9 +664,9 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh, smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this)); return false; } - std::vector aVec = (*anIt).second; + std::vector aVec = (*anIt).second; nb0d += aVec[SMDSEntity_Node]; - nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); + nb1d += std::max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); double aLen = SMESH_Algo::EdgeLength(E); fullLen += aLen; if(IsFirst) { @@ -680,7 +680,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh, double ELen = 0; if (( _hypLengthFromEdges ) || ( !_hypLengthFromEdges && !_hypMaxElementArea )) { if ( nb1d > 0 ) - ELen = fullLen / nb1d; + ELen = fullLen / double( nb1d ); } if ( _hypMaxElementArea ) { double maxArea = _hypMaxElementArea->GetMaxArea(); @@ -698,10 +698,10 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh, smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated.\nToo small element length",this)); return false; } - int nbFaces = (int) ( anArea / ( ELen*ELen*sqrt(3.) / 4 ) ); - int nbNodes = (int) ( ( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 ); - std::vector aVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i aVec(SMDSEntity_Last); + for(smIdType i=SMDSEntity_Node; i aVec = (*anIt).second; - nbtri += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); - nbqua += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); + std::vector aVec = (*anIt).second; + nbtri += std::max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); + nbqua += std::max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); GProp_GProps G; BRepGProp::SurfaceProperties(F,G); double anArea = G.Mass(); @@ -749,7 +749,7 @@ bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh, } // collect info from edges - int nb0d_e = 0, nb1d_e = 0; + smIdType nb0d_e = 0, nb1d_e = 0; bool IsQuadratic = false; bool IsFirst = true; TopTools_MapOfShape tmpMap; @@ -766,9 +766,9 @@ bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh, "Submesh can not be evaluated",this)); return false; } - std::vector aVec = (*anIt).second; + std::vector aVec = (*anIt).second; nb0d_e += aVec[SMDSEntity_Node]; - nb1d_e += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); + nb1d_e += std::max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); if(IsFirst) { IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]); IsFirst = false; @@ -776,7 +776,7 @@ bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh, } tmpMap.Clear(); - double ELen_face = sqrt(2.* ( fullArea/(nbtri+nbqua*2) ) / sqrt(3.0) ); + double ELen_face = sqrt(2.* ( fullArea/double(nbtri+nbqua*2) ) / sqrt(3.0) ); double ELen_vol = pow( 72, 1/6. ) * pow( _maxElementVolume, 1/3. ); double ELen = Min(ELen_vol,ELen_face*2); @@ -785,11 +785,11 @@ bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh, double aVolume = G.Mass(); double tetrVol = 0.1179*ELen*ELen*ELen; double CoeffQuality = 0.9; - int nbVols = int( aVolume/tetrVol/CoeffQuality ); - int nb1d_f = (nbtri*3 + nbqua*4 - nb1d_e) / 2; - int nb1d_in = (nbVols*6 - nb1d_e - nb1d_f ) / 5; - std::vector aVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i aVec(SMDSEntity_Last); + for(smIdType i=SMDSEntity_Node; i 1e-5 * avgLen ) tol = 0.1 * minLen; // minLen is not degenerate else @@ -779,8 +779,8 @@ bool NETGENPlugin_Remesher_2D::Compute(SMESH_Mesh& theMesh, } // find existing groups - const char* theNamePrefix = "Surface_"; - const int theNamePrefixLen = strlen( theNamePrefix ); + const char* theNamePrefix = "Surface_"; + const size_t theNamePrefixLen = strlen( theNamePrefix ); std::vector< SMESHDS_Group* > groups; if ( hyp && hyp->GetMakeGroupsOfSurfaces() ) { diff --git a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cxx b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cxx index b1caef4..0e17935 100644 --- a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cxx @@ -199,7 +199,7 @@ bool NETGENPlugin_SimpleHypothesis_2D::SetParametersByMesh(const SMESH_Mesh* t const TopoDS_Shape& theShape) { // Find out nb of segments. - int nbSeg = 0, nbEdges = 0; + smIdType nbSeg = 0, nbEdges = 0; TopExp_Explorer exp( theShape, TopAbs_EDGE ); for ( ; exp.More(); exp.Next() ) { SMESH_subMesh* sm = theMesh->GetSubMeshContaining( exp.Current() ); diff --git a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.hxx b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.hxx index a4756bd..1b6c513 100644 --- a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.hxx +++ b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.hxx @@ -29,7 +29,7 @@ #include "NETGENPlugin_Defs.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "smIdType.hxx" // Simplified parameters of NETGEN // @@ -48,7 +48,7 @@ public: * Returns value. * Can be zero in case if LocalLength() has been set */ - int GetNumberOfSegments() const { return _nbSegments; } + smIdType GetNumberOfSegments() const { return _nbSegments; } /*! * Sets value @@ -104,9 +104,9 @@ public: virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0); private: - int _nbSegments; - double _segmentLength, _area; - bool _allowQuad; + smIdType _nbSegments; + double _segmentLength, _area; + bool _allowQuad; }; #endif diff --git a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.cxx b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.cxx index 3725c92..d410a26 100644 --- a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.cxx +++ b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.cxx @@ -71,7 +71,7 @@ NETGENPlugin_SimpleHypothesis_2D_i::~NETGENPlugin_SimpleHypothesis_2D_i() * NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments */ //============================================================================= -void NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments(CORBA::Short nb) +void NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments(CORBA::Long nb) { ASSERT(myBaseImpl); try { @@ -88,10 +88,10 @@ void NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments(CORBA::Short nb) * NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments() */ //============================================================================= -CORBA::Short NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments() +CORBA::Long NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments() { ASSERT(myBaseImpl); - return this->GetImpl()->GetNumberOfSegments(); + return (CORBA::Long) this->GetImpl()->GetNumberOfSegments(); } //================================================================================ diff --git a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.hxx b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.hxx index a502360..1d7ba79 100644 --- a/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.hxx +++ b/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.hxx @@ -49,8 +49,8 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_SimpleHypothesis_2D_i: // Destructor virtual ~NETGENPlugin_SimpleHypothesis_2D_i(); - void SetNumberOfSegments(CORBA::Short nb); - CORBA::Short GetNumberOfSegments(); + void SetNumberOfSegments(CORBA::Long nb); + CORBA::Long GetNumberOfSegments(); void SetLocalLength(CORBA::Double segmentLength); CORBA::Double GetLocalLength(); -- 2.30.2