Salome HOME
bos #20256: [CEA 18523] Porting SMESH to int 64 bits occ/20256_v2 V9_7_0a1 V9_7_0a2 V9_7_0b1
authoreap <eap@opencascade.com>
Wed, 17 Mar 2021 15:14:10 +0000 (18:14 +0300)
committervsr <vsr@opencascade.com>
Mon, 19 Apr 2021 14:33:29 +0000 (17:33 +0300)
idl/NETGENPlugin_Algorithm.idl
src/GUI/NETGENPluginGUI_HypothesisCreator.cxx
src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx
src/NETGENPlugin/NETGENPlugin_Mesher.cxx
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx
src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx
src/NETGENPlugin/NETGENPlugin_Remesher_2D.cxx
src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cxx
src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.hxx
src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.cxx
src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.hxx

index 6af8e1e57e2d92d3b0f5357f12416610fe1bb2f2..64f84ad06caefc31add62dd47ab9d267d2287022 100644 (file)
@@ -248,12 +248,12 @@ module NETGENPlugin
     /*!
      * Sets <number of segments> value
      */
-    void SetNumberOfSegments(in short nb) raises (SALOME::SALOME_Exception);
+    void SetNumberOfSegments(in long nb) raises (SALOME::SALOME_Exception);
     /*!
      * Returns <number of segments> value.
      * Can be zero in case if LocalLength() has been set
      */
-    short GetNumberOfSegments();
+    long GetNumberOfSegments();
 
     /*!
      * Sets <segment length> value
index 99ef7d15efd4fa4d10688c73e023e2d2e354d0e1..f38e71768baa94b41cbda0ab637478ebdaffb07f 100644 (file)
@@ -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 );
index ecf7b6e9fb5b816872808cc4a47eb908927ff124..e66760001145c79d50da00a5d1f43784b848bdd4 100644 (file)
@@ -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();
 }
 
 //=======================================================================
index dddcd2ef72d4b9b286de46e6f30901693154e0db..ed6021089369bdb10565e735407cb2bb8d4492e6 100644 (file)
@@ -1162,7 +1162,7 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry&           occgeom,
         const vector<UVPtStruct>& 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<UVPtStruct>& 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<double>::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<const SMDS_MeshNode*> 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<int>& aVec = aResMap[_mesh->GetSubMesh(E)];
+    vector<smIdType>& 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<int>& aVec = aResMap[_mesh->GetSubMesh(occgeo.emap(aGeomEdgeInd))];
+      vector<smIdType>& 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<int>& aVec = aResMap[_mesh->GetSubMesh(Edge2NbSegIt.Key())];
+    vector<smIdType>& 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<int> aVec(SMDSEntity_Last, 0);
+    vector<smIdType> 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<int> aVec(SMDSEntity_Last, 0 );
+    vector<smIdType> aVec(SMDSEntity_Last, 0 );
     if ( tooManyElems ) // avoid FPE
     {
       aVec[SMDSEntity_Node] = hugeNb;
@@ -3787,8 +3787,8 @@ NETGENPlugin_Mesher::ReadErrors(const vector<const SMDS_MeshNode* >& nodeVec)
   vector<int> two(2);
   vector<int> 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<const SMDS_MeshNode* >& 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 )
     {
index 0739d65e50a99890217afd4c436c737186119b02..84d4363fbf46589663fb73ddbfe79fbafc860752 100644 (file)
@@ -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<int> aVec = (*anIt).second;
+    std::vector<smIdType> 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<int> aVec(SMDSEntity_Last);
-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
+  smIdType nbFaces = (smIdType) ( anArea / ( ELen*ELen*sqrt(3.) / 4 ) );
+  smIdType nbNodes = (smIdType) ( ( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );
+  std::vector<smIdType> aVec(SMDSEntity_Last);
+  for(smIdType i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
   if( IsQuadratic ) {
     aVec[SMDSEntity_Node] = nbNodes;
     aVec[SMDSEntity_Quad_Triangle] = nbFaces;
index aed5cd2098e31b0b102a16bc769d65865a007876..de45d54d0bd11cc0ece20cbe0d069de69c7812dd 100644 (file)
@@ -728,7 +728,7 @@ bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh,
                                       const TopoDS_Shape& aShape,
                                       MapShapeNbElems& aResMap)
 {
-  int nbtri = 0, nbqua = 0;
+  smIdType nbtri = 0, nbqua = 0;
   double fullArea = 0.0;
   for (TopExp_Explorer expF(aShape, TopAbs_FACE); expF.More(); expF.Next()) {
     TopoDS_Face F = TopoDS::Face( expF.Current() );
@@ -739,9 +739,9 @@ bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh,
       smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
       return false;
     }
-    std::vector<int> aVec = (*anIt).second;
-    nbtri += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
-    nbqua += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+    std::vector<smIdType> 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<int> aVec = (*anIt).second;
+    std::vector<smIdType> 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<int> aVec(SMDSEntity_Last);
-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
+  smIdType nbVols = (smIdType)( aVolume/tetrVol/CoeffQuality );
+  smIdType nb1d_f = (nbtri*3 + nbqua*4 - nb1d_e) / 2;
+  smIdType nb1d_in = (nbVols*6 - nb1d_e - nb1d_f ) / 5;
+  std::vector<smIdType> aVec(SMDSEntity_Last);
+  for(smIdType i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
   if( IsQuadratic ) {
     aVec[SMDSEntity_Node] = nb1d_in/6 + 1 + nb1d_in;
     aVec[SMDSEntity_Quad_Tetra] = nbVols - nbqua*2;
index 10f622caf4f4f97d2161502ca294f69a1543506f..5851a777c2cdf30bb47e33f9901120d81c307f24 100644 (file)
@@ -141,7 +141,7 @@ namespace
     {
       // define tolerance
       double tol, len, sumLen = 0, minLen = 1e100;
-      int     nbSeg = 0;
+      size_t nbSeg = 0;
       for ( size_t i = 0; i < holes.size(); ++i )
       {
         nbSeg += holes[i].size();
@@ -155,7 +155,7 @@ namespace
           p1 = p2;
         }
       }
-      double avgLen = sumLen / nbSeg;
+      double avgLen = sumLen / double( nbSeg );
       if ( minLen > 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() )
   {
index b1caef4178116d090fa769fffce4020df5a10648..0e179358892419f57230a28dc6daf17313c9e8e7 100644 (file)
@@ -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() );
index a4756bd7f48fa894c2234af9c329888a6d205b29..1b6c51396f71b0cf4a0c3a74fcf2831419aa529d 100644 (file)
@@ -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 <number of segments> value.
    * Can be zero in case if LocalLength() has been set
    */
-  int GetNumberOfSegments() const { return _nbSegments; }
+  smIdType GetNumberOfSegments() const { return _nbSegments; }
 
   /*!
    * Sets <segment length> 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
index 3725c9245abd1d3390f76a6f689f4219968958f9..d410a2662054f6cf349b99edf3c1588d35ec56ec 100644 (file)
@@ -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();
 }
 
 //================================================================================
index a5023606b60a500bff2f5519ef3d1236b555011f..1d7ba79fe930529af49cfb073afdcde5c955be70 100644 (file)
@@ -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();