Salome HOME
Fix regressions
[modules/smesh.git] / src / SMESH_I / SMESH_Gen_i.cxx
index 8c44cfdd97eb76cf8c269e4b5ef9107f5e25f99b..6371c3806294b26a9685e11e6b9e2d5a0f21a148 100644 (file)
@@ -876,10 +876,17 @@ CORBA::Boolean SMESH_Gen_i::GetSoleSubMeshUsingHyp( SMESH::SMESH_Hypothesis_ptr
     {
       if ( !foundMesh->_is_nil() ) // not a sole mesh
       {
-        GEOM::GEOM_Object_var s1 = mesh_i   ->GetShapeToMesh();
-        GEOM::GEOM_Object_var s2 = foundMesh->GetShapeToMesh();
-        if ( ! ( isSole = s1->IsSame( s2 )))
-          break;
+        if ( !foundMesh->HasShapeToMesh() ||
+             !mesh_i   ->HasShapeToMesh() )
+        {
+          isSole = ( foundMesh->HasShapeToMesh() == mesh_i->HasShapeToMesh() );
+        }
+        else
+        {
+          GEOM::GEOM_Object_var s1 = mesh_i   ->GetShapeToMesh();
+          GEOM::GEOM_Object_var s2 = foundMesh->GetShapeToMesh();
+          isSole = s1->IsSame( s2 );
+        }
       }
       foundMesh = SMESH::SMESH_Mesh::_narrow( obj );
     }
@@ -953,7 +960,7 @@ void SMESH_Gen_i::SetOption(const char* name, const char* value)
     {
       vector<int> color;
       string str = value;
-      // color must be presented as a string of next form:
+      // color must be presented as a string of following form:
       if ( str.at(0) == '#' && str.length() == 7 ) { // hexadecimal color ("#ffaa00", for example)
         str = str.substr(1);
         for ( size_t i = 0; i < str.length()/2; i++ )
@@ -1917,7 +1924,10 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
       // call implementation compute
       ::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
       myGen.PrepareCompute( myLocMesh, myLocShape );
-      bool ok = myGen.Compute( myLocMesh, myLocShape, myLocShape != myLocMesh.GetShapeToMesh());
+      int how = ::SMESH_Gen::COMPACT_MESH;
+      if ( myLocShape != myLocMesh.GetShapeToMesh() ) // compute a sub-mesh
+        how |= ::SMESH_Gen::SHAPE_ONLY;
+      bool ok = myGen.Compute( myLocMesh, myLocShape, how );
       meshServant->CreateGroupServants(); // algos can create groups (issue 0020918)
       myLocMesh.GetMeshDS()->Modified();
       return ok;