Salome HOME
IPAL0053055: Import-1D2D algorithm fails
[modules/smesh.git] / src / SMESH / SMESH_MesherHelper.cxx
index 3e52ed9b482b5d89415fbc118f53104bac8b7eb2..043c0b71b931f5049fb03c0b996eddc39d388f18 100644 (file)
@@ -2904,6 +2904,10 @@ bool SMESH_MesherHelper::IsReversedSubMesh (const TopoDS_Face& theFace)
             bool ok = true;
             double u0 = GetNodeU( TopoDS::Edge( E ), nn[0], nn[1], &ok );
             double u1 = GetNodeU( TopoDS::Edge( E ), nn[1], nn[0], &ok );
+            // check that the 2 nodes are connected with a segment (IPAL53055)
+            if ( SMESHDS_SubMesh* sm = GetMeshDS()->MeshElements( E ))
+              if ( sm->NbElements() > 0 && !GetMeshDS()->FindEdge( nn[0], nn[1] ))
+                ok = false;
             if ( ok )
             {
               isReversed = ( u0 > u1 );
@@ -4059,12 +4063,13 @@ namespace { // Structures used by FixQuadraticElements()
 
   const QFace* QLink::GetContinuesFace( const QFace* face ) const
   {
-    for ( size_t i = 0; i < _faces.size(); ++i ) {
-      if ( _faces[i] == face ) {
-        int iF = i < 2 ? 1-i : 5-i;
-        return iF < (int)_faces.size() ? _faces[iF] : 0;
+    if ( _faces.size() <= 4 )
+      for ( size_t i = 0; i < _faces.size(); ++i ) {
+        if ( _faces[i] == face ) {
+          int iF = i < 2 ? 1-i : 5-i;
+          return iF < (int)_faces.size() ? _faces[iF] : 0;
+        }
       }
-    }
     return 0;
   }
   //================================================================================