Salome HOME
bos #20584 EDF 22720 - degenerated edge / projection
[modules/smesh.git] / src / StdMeshers / StdMeshers_Regular_1D.cxx
index 32270cdcc92af858c2ebf614bc383240250faf05..c6e41cbb2b48aea869f7ffb67f042a73745e6e0f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -78,9 +78,8 @@ using namespace StdMeshers;
 //=============================================================================
 
 StdMeshers_Regular_1D::StdMeshers_Regular_1D(int         hypId,
-                                             int         studyId,
                                              SMESH_Gen * gen)
-  :SMESH_1D_Algo( hypId, studyId, gen )
+  :SMESH_1D_Algo( hypId, gen )
 {
   _name = "Regular_1D";
   _shapeType = (1 << TopAbs_EDGE);
@@ -363,7 +362,10 @@ static bool computeParamByFunc(Adaptor3d_Curve& C3d,
   int nbPnt = 1 + nbSeg;
   vector<double> x( nbPnt, 0. );
 
-  if ( !buildDistribution( func, 0.0, 1.0, nbSeg, x, 1E-4 ))
+
+  const double eps = Min( 1E-4, 1./nbSeg/100. );
+
+  if ( !buildDistribution( func, 0.0, 1.0, nbSeg, x, eps ))
      return false;
 
   // apply parameters in range [0,1] to the space of the curve
@@ -538,7 +540,7 @@ void StdMeshers_Regular_1D::SetEventListener(SMESH_subMesh* subMesh)
  */
 //=============================================================================
 
-void StdMeshers_Regular_1D::SubmeshRestored(SMESH_subMesh* subMesh)
+void StdMeshers_Regular_1D::SubmeshRestored(SMESH_subMesh* /*subMesh*/)
 {
 }
 
@@ -629,7 +631,7 @@ void StdMeshers_Regular_1D::redistributeNearVertices (SMESH_Mesh &          theM
         double L = GCPnts_AbscissaPoint::Length( theC3d, *itU, l);
         static StdMeshers_Regular_1D* auxAlgo = 0;
         if ( !auxAlgo ) {
-          auxAlgo = new StdMeshers_Regular_1D( _gen->GetANewId(), _studyId, _gen );
+          auxAlgo = new StdMeshers_Regular_1D( _gen->GetANewId(), _gen );
           auxAlgo->_hypType = BEG_END_LENGTH;
         }
         auxAlgo->_value[ BEG_LENGTH_IND ] = Lm;
@@ -975,6 +977,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
       an = eltSize;
       eltSize *= q;
       ++nbParams;
+      if ( q < 1. && eltSize < 1e-100 )
+        return error("Too small common ratio causes too many segments");
     }
     if ( nbParams > 1 )
     {