Salome HOME
Merge branch 'V9_9_BR'
[modules/smesh.git] / src / StdMeshers / StdMeshers_Import_1D.cxx
index af0ea24bd113dc76c3358d4bc0c2b354850f60a5..b1d68200d4427f689ed2b2de8884a64e1a0b6e0f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022  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
@@ -253,6 +253,7 @@ namespace // INTERNAL STUFF
     _chord2  = Max( _line.     SquareDistance( curve->Value( uf + 0.25 * ( ul - uf ))),
                     Max( _line.SquareDistance( curve->Value( uf + 0.5  * ( ul - uf ))),
                          _line.SquareDistance( curve->Value( uf + 0.75 * ( ul - uf )))));
+    _chord2 *= ( 1.05 * 1.05 ); // +5%
     _chord2  = Max( tol, _chord2 );
     _chord   = Sqrt( _chord2 );
 
@@ -434,6 +435,7 @@ namespace // INTERNAL STUFF
         case TopAbs_EDGE:
           if ( SMESH_Algo::isDegenerated( TopoDS::Edge( sm->GetSubShape() )))
             continue;
+          // fall through
         case TopAbs_FACE:
           _subM.insert( sm );
           if ( !sm->IsEmpty() )
@@ -692,14 +694,14 @@ namespace // INTERNAL STUFF
 
       if ( removeImport )
       {
-        // treate removal of Import algo from subMesh
+        // treat removal of Import algo from subMesh
         removeSubmesh( subMesh, (_ListenerData*) data );
       }
       else if ( modifHyp ||
                 ( SMESH_subMesh::CLEAN         == event &&
                   SMESH_subMesh::COMPUTE_EVENT == eventType))
       {
-        // treate modification of ImportSource hypothesis
+        // treat modification of ImportSource hypothesis
         clearSubmesh( subMesh, (_ListenerData*) data, /*all=*/false );
       }
       else if ( SMESH_subMesh::CHECK_COMPUTE_STATE == event &&
@@ -719,7 +721,7 @@ namespace // INTERNAL STUFF
                 d->_computedSubM.insert( *smIt);
           }
       }
-      // Clear _ImportData::_n2n if it's no more useful, i.e. when
+      // Clear _ImportData::_n2n if it isn't useful anymore, i.e. when
       // the event is not within mesh.Compute()
       if ( SMESH_subMesh::ALGO_EVENT == eventType )
         clearN2N( subMesh->GetFather() );
@@ -943,8 +945,8 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
   SMESHDS_Mesh* tgtMesh = theMesh.GetMeshDS();
 
   const TopoDS_Edge& geomEdge = TopoDS::Edge( theShape );
-  const double edgeTol = BRep_Tool::Tolerance( geomEdge );
-  const int shapeID = tgtMesh->ShapeToIndex( geomEdge );
+  const double        edgeTol = helper.MaxTolerance( geomEdge );
+  const int           shapeID = tgtMesh->ShapeToIndex( geomEdge );
 
 
   double geomTol = Precision::Confusion();
@@ -1082,7 +1084,7 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
   } // loop on groups
 
   if ( n2n->empty())
-    return error("Empty source groups");
+    return error("Source groups are empty or mismatching geometry");
 
   // check if the whole geom edge is covered by imported segments;
   // the check consist in passing by segments from one vetrex node to another
@@ -1309,7 +1311,7 @@ bool StdMeshers_Import_1D::Evaluate(SMESH_Mesh &         theMesh,
   if ( srcGroups.empty() )
     return error("Invalid source groups");
 
-  vector<int> aVec(SMDSEntity_Last,0);
+  vector<smIdType> aVec(SMDSEntity_Last,0);
 
   bool toCopyMesh, toCopyGroups;
   _sourceHyp->GetCopySourceMesh(toCopyMesh, toCopyGroups);