Salome HOME
CoTech decision: move MEDWrapper from MED to SMESH
[modules/smesh.git] / src / SMESH / SMESH_Mesh.cxx
index b43a419619be3b80125541453de90b07237f659a..8ca54a4092537a0468d89ce16e356aca8bfbf7fb 100644 (file)
@@ -682,8 +682,7 @@ SMESH_Hypothesis::Hypothesis_Status
   
   SMESH_Hypothesis *anHyp = sc->mapHypothesis[anHypId];
   if(MYDEBUG) {
-    int hypType = anHyp->GetType();
-    SCRUTE(hypType);
+    SCRUTE(anHyp->GetType());
   }
   
   // shape 
@@ -813,7 +812,8 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape &    aSubS
 int SMESH_Mesh::GetHypotheses(const TopoDS_Shape &                aSubShape,
                               const SMESH_HypoFilter&             aFilter,
                               list <const SMESHDS_Hypothesis * >& aHypList,
-                              const bool                          andAncestors) const
+                              const bool                          andAncestors,
+                              list< TopoDS_Shape > *              assignedTo/*=0*/) const
 {
   set<string> hypTypes; // to exclude same type hypos from the result list
   int nbHyps = 0;
@@ -842,6 +842,7 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape &                aSubShape,
         nbHyps++;
         if ( !cSMESH_Hyp(*hyp)->IsAuxiliary() )
           mainHypFound = true;
+        if ( assignedTo ) assignedTo->push_back( aSubShape );
       }
   }
 
@@ -868,6 +869,7 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape &                aSubShape,
           nbHyps++;
           if ( !cSMESH_Hyp(*hyp)->IsAuxiliary() )
             mainHypFound = true;
+          if ( assignedTo ) assignedTo->push_back( curSh );
         }
     }
   }
@@ -918,10 +920,9 @@ SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
     if ( it.More() )
     {
       index = _myMeshDS->AddCompoundSubmesh( aSubShape, it.Value().ShapeType() );
-      if ( index > _nbSubShapes ) _nbSubShapes = index; // not to create sm for this group again
-
       // fill map of Ancestors
-      fillAncestorsMap(aSubShape);
+      while ( _nbSubShapes < index )
+        fillAncestorsMap( _myMeshDS->IndexToShape( ++_nbSubShapes ));
     }
   }
 //   if ( !index )
@@ -1247,19 +1248,21 @@ void SMESH_Mesh::ExportMED(const char *        file,
                            const char*         theMeshName, 
                            bool                theAutoGroups,
                            int                 theVersion,
-                           const SMESHDS_Mesh* meshPart) 
+                           const SMESHDS_Mesh* meshPart,
+                           bool                theAutoDimension)
   throw(SALOME_Exception)
 {
   Unexpect aCatch(SalomeException);
 
   DriverMED_W_SMESHDS_Mesh myWriter;
-  myWriter.SetFile    ( file, MED::EVersion(theVersion) );
-  myWriter.SetMesh    ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS   );
+  myWriter.SetFile         ( file, MED::EVersion(theVersion) );
+  myWriter.SetMesh         ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS   );
+  myWriter.SetAutoDimension( theAutoDimension );
   if ( !theMeshName ) 
-    myWriter.SetMeshId  ( _id         );
+    myWriter.SetMeshId     ( _id         );
   else {
-    myWriter.SetMeshId  ( -1          );
-    myWriter.SetMeshName( theMeshName );
+    myWriter.SetMeshId     ( -1          );
+    myWriter.SetMeshName   ( theMeshName );
   }
 
   if ( theAutoGroups ) {