]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
IMP 23300: [EDF 12865] Independent calculation of sub-meshes
authoreap <eap@opencascade.com>
Mon, 1 Aug 2016 19:15:36 +0000 (22:15 +0300)
committereap <eap@opencascade.com>
Mon, 1 Aug 2016 19:15:36 +0000 (22:15 +0300)
14 files changed:
doc/salome/examples/creating_meshes_ex02.py
doc/salome/gui/SMESH/input/constructing_submeshes.doc
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.h
src/SMESHGUI/SMESHGUI_MeshDlg.cxx
src/SMESHGUI/SMESHGUI_MeshDlg.h
src/SMESHGUI/SMESHGUI_MeshOp.cxx
src/SMESHGUI/SMESHGUI_Operations.h
src/SMESHGUI/SMESHGUI_Selection.cxx
src/SMESHGUI/SMESH_msg_en.ts
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_SWIG/smeshBuilder.py
src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx

index 3980d4d74ebd3b4cd1fc5f8387981bb5c5faa9bc..230e67a00f8f9ec9886c5288fc37d5941c5d3677 100644 (file)
@@ -40,11 +40,27 @@ algo_local = mesh.Segment(EdgeX)
 algo_local.Arithmetic1D(1, 4)
 
 # define "Propagation" hypothesis that propagates algo_local and "Arithmetic1D" hypothesis
-# on all parallel edges of the box
+# from EdgeX to all parallel edges
 algo_local.Propagation()
 
 # assign a hexahedral algorithm
 mesh.Hexahedron()
 
-# compute the mesh
+
+# any sub-shape can be meshed individually --
+# compute mesh on two surfaces using different methods
+
+# get surfaces
+surfaces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+
+# method 1: no sub-mesh is created
+mesh.Compute( surfaces[0] )
+
+# method 2: a sub-mesh is created
+submesh = mesh.GetSubMesh( surfaces[2], "submesh 2" )
+submesh.Compute()
+
+
+
+# compute the whole mesh
 mesh.Compute()
index 04000e58245f439f018e8a105d88d6b4e3d8341c..b7fe2feee549fd60768816ed9c5949257d15cec3 100644 (file)
@@ -16,6 +16,10 @@ Creation of a sub-mesh allows to control individually meshing of a
 certain sub-shape, thus to get a locally coarser or finer mesh, to get
 elements of different types in the same mesh, etc.
 
+A sub-mesh can be meshed individually. To achieve this, select a
+sub-mesh and either invoke <b>Compute Sub-mesh</b> vai the contextual
+menu in the Object Browser or invoke <b> Mesh > Compute </b> menu.
+
 \section submesh_shape_section How to get a sub-shape for sub-mesh construction
 
 A sub-shape to create a sub-mesh on should be retrieved from the main shape
index a14b72eed2c353479538fccc2bf3a81b852e9896..075b3eb5407dda8a03de370552eb56664be5f74a 100644 (file)
@@ -2688,7 +2688,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpCreateMesh:
   case SMESHOp::OpCreateSubMesh:
   case SMESHOp::OpEditMeshOrSubMesh:
+  case SMESHOp::OpEditMesh:
+  case SMESHOp::OpEditSubMesh:
   case SMESHOp::OpCompute:
+  case SMESHOp::OpComputeSubMesh:
   case SMESHOp::OpPreCompute:
   case SMESHOp::OpEvaluate:
   case SMESHOp::OpMeshOrder:
@@ -3806,9 +3809,12 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction( SMESHOp::OpCreateMesh,           "CREATE_MESH",             "ICON_DLG_INIT_MESH" );
   createSMESHAction( SMESHOp::OpCreateSubMesh,        "CREATE_SUBMESH",          "ICON_DLG_ADD_SUBMESH" );
   createSMESHAction( SMESHOp::OpEditMeshOrSubMesh,    "EDIT_MESHSUBMESH",        "ICON_DLG_EDIT_MESH" );
+  createSMESHAction( SMESHOp::OpEditMesh,             "EDIT_MESH",               "ICON_DLG_EDIT_MESH" );
+  createSMESHAction( SMESHOp::OpEditSubMesh,          "EDIT_SUBMESH",            "ICON_DLG_EDIT_MESH" );
   createSMESHAction( SMESHOp::OpBuildCompoundMesh,    "BUILD_COMPOUND",          "ICON_BUILD_COMPOUND" );
   createSMESHAction( SMESHOp::OpCopyMesh,             "COPY_MESH",               "ICON_COPY_MESH" );
   createSMESHAction( SMESHOp::OpCompute,              "COMPUTE",                 "ICON_COMPUTE" );
+  createSMESHAction( SMESHOp::OpComputeSubMesh,        "COMPUTE_SUBMESH",         "ICON_COMPUTE" );
   createSMESHAction( SMESHOp::OpPreCompute,           "PRECOMPUTE",              "ICON_PRECOMPUTE" );
   createSMESHAction( SMESHOp::OpEvaluate,             "EVALUATE",                "ICON_EVALUATE" );
   createSMESHAction( SMESHOp::OpMeshOrder,            "MESH_ORDER",              "ICON_MESH_ORDER");
@@ -4303,24 +4309,26 @@ void SMESHGUI::initialize( CAM_Application* app )
   QString dc = "selcount"; // VSR : instead of QtxPopupSelection::defSelCountParam()
 
   myRules.clear();
-  QString OB = "'ObjectBrowser'",
-          View = "'" + SVTK_Viewer::Type() + "'",
-          pat = "'%1'",
-          mesh    = pat.arg( SMESHGUI_Selection::typeName( SMESH::MESH ) ),
-          group   = pat.arg( SMESHGUI_Selection::typeName( SMESH::GROUP ) ),
-          hypo    = pat.arg( SMESHGUI_Selection::typeName( SMESH::HYPOTHESIS ) ),
-          algo    = pat.arg( SMESHGUI_Selection::typeName( SMESH::ALGORITHM ) ),
-          elems   = QString( "'%1' '%2' '%3' '%4' '%5' '%6'" ).
-                       arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_VERTEX ) ).
-                       arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_EDGE ) ).
-                       arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_FACE ) ).
-                       arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_SOLID ) ).
-                       arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_COMPOUND ) ).
-                       arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH ) ),
-          subMesh = elems,
-          mesh_part = mesh + " " + subMesh + " " + group,
-          mesh_group = mesh + " " + group,
-          hyp_alg = hypo + " " + algo;
+  QString
+    OB      = "'ObjectBrowser'",
+    View    = "'" + SVTK_Viewer::Type() + "'",
+    pat     = "'%1'",
+    mesh    = pat.arg( SMESHGUI_Selection::typeName( SMESH::MESH ) ),
+    group   = pat.arg( SMESHGUI_Selection::typeName( SMESH::GROUP ) ),
+    hypo    = pat.arg( SMESHGUI_Selection::typeName( SMESH::HYPOTHESIS ) ),
+    algo    = pat.arg( SMESHGUI_Selection::typeName( SMESH::ALGORITHM ) ),
+    elems   = QString( "'%1' '%2' '%3' '%4' '%5' '%6'" ).
+    arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_VERTEX ) ).
+    arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_EDGE ) ).
+    arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_FACE ) ).
+    arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_SOLID ) ).
+    arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_COMPOUND ) ).
+    arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH ) ),
+    subMesh      = elems,
+    mesh_part    = mesh + " " + subMesh + " " + group,
+    mesh_group   = mesh + " " + group,
+    mesh_submesh = mesh + " " + subMesh,
+    hyp_alg      = hypo + " " + algo;
 
   // popup for object browser
   QString
@@ -4339,36 +4347,36 @@ void SMESHGUI::initialize( CAM_Application* app )
     hasVolumes("({'Volume'} in elemTypes)"),
     hasFacesOrVolumes("(({'Face'} in elemTypes) || ({'Volume'} in elemTypes)) ");
 
-  createPopupItem( SMESHOp::OpFileInformation,      OB, mesh, "&& selcount=1 && isImported" );
-  createPopupItem( SMESHOp::OpCreateSubMesh,        OB, mesh, "&& hasGeomReference");
-  createPopupItem( SMESHOp::OpEditMeshOrSubMesh,    OB, mesh );
-  createPopupItem( SMESHOp::OpEditMeshOrSubMesh,    OB, subMesh, "&& hasGeomReference" );
-  createPopupItem( SMESHOp::OpEditGroup,            OB, group );
+  createPopupItem( SMESHOp::OpFileInformation,   OB, mesh, "&& selcount=1 && isImported" );
+  createPopupItem( SMESHOp::OpCreateSubMesh,     OB, mesh, "&& hasGeomReference");
+  createPopupItem( SMESHOp::OpEditMesh,          OB, mesh, "&& selcount=1" );
+  createPopupItem( SMESHOp::OpEditSubMesh,       OB, subMesh, "&& selcount=1 && hasGeomReference" );
+  createPopupItem( SMESHOp::OpEditGroup,         OB, group );
   createPopupItem( SMESHOp::OpEditGeomGroupAsGroup, OB, group, "&& groupType != 'Group'" );
 
   popupMgr()->insert( separator(), -1, 0 );
-  createPopupItem( SMESHOp::OpCompute,                OB, mesh, "&& isComputable" );
-  createPopupItem( SMESHOp::OpPreCompute,             OB, mesh, "&& isPreComputable" );
-  createPopupItem( SMESHOp::OpEvaluate,               OB, mesh, "&& isComputable" );
-  createPopupItem( SMESHOp::OpMeshOrder,              OB, mesh, "&& isComputable && hasGeomReference" );
-  createPopupItem( SMESHOp::OpUpdate,                 OB, mesh_part );
-  createPopupItem( SMESHOp::OpMeshInformation,        OB, mesh_part );
-  createPopupItem( SMESHOp::OpFindElementByPoint,     OB, mesh_group );
-  createPopupItem( SMESHOp::OpOverallMeshQuality,     OB, mesh_part );
+  createPopupItem( SMESHOp::OpCompute,           OB, mesh, "&& selcount=1 && isComputable" );
+  createPopupItem( SMESHOp::OpComputeSubMesh,    OB, subMesh, "&& selcount=1 && isComputable" );
+  createPopupItem( SMESHOp::OpPreCompute,        OB, mesh, "&& selcount=1 && isPreComputable" );
+  createPopupItem( SMESHOp::OpEvaluate,          OB, mesh, "&& selcount=1 && isComputable" );
+  createPopupItem( SMESHOp::OpMeshOrder,         OB, mesh, "&& selcount=1 && isComputable && hasGeomReference" );
+  createPopupItem( SMESHOp::OpUpdate,            OB, mesh_part );
+  createPopupItem( SMESHOp::OpMeshInformation,   OB, mesh_part );
+  createPopupItem( SMESHOp::OpFindElementByPoint,OB, mesh_group, "&& selcount=1" );
+  createPopupItem( SMESHOp::OpOverallMeshQuality,OB, mesh_part );
   popupMgr()->insert( separator(), -1, 0 );
-  createPopupItem( SMESHOp::OpCreateGroup,            OB, mesh );
-  createPopupItem( SMESHOp::OpCreateGeometryGroup,    OB, mesh, "&& hasGeomReference" );
-  createPopupItem( SMESHOp::OpConstructGroup,         OB, subMesh );
+  createPopupItem( SMESHOp::OpCreateGroup,       OB, mesh, "&& selcount=1" );
+  createPopupItem( SMESHOp::OpCreateGeometryGroup, OB, mesh, "&& selcount=1 && hasGeomReference" );
+  createPopupItem( SMESHOp::OpConstructGroup,    OB, subMesh );
   popupMgr()->insert( separator(), -1, 0 );
-  createPopupItem( SMESHOp::OpEditHypothesis,         OB, hypo, "&& isEditableHyp");
-  createPopupItem( SMESHOp::OpUnassign,               OB, hyp_alg );     // REMOVE HYPOTHESIS / ALGORITHMS
+  createPopupItem( SMESHOp::OpEditHypothesis,    OB, hypo, "&& isEditableHyp");
+  createPopupItem( SMESHOp::OpUnassign,          OB, hyp_alg );
   popupMgr()->insert( separator(), -1, 0 );
-  createPopupItem( SMESHOp::OpConvertMeshToQuadratic, OB, mesh + " " + subMesh );  // convert to quadratic
-  createPopupItem( SMESHOp::OpCreateBoundaryElements, OB, mesh + " " + group,      // create 2D mesh from 3D
-                   "&& dim>=2");
+  createPopupItem( SMESHOp::OpConvertMeshToQuadratic, OB, mesh_submesh );
+  createPopupItem( SMESHOp::OpCreateBoundaryElements, OB, mesh_group, "&& selcount=1 && dim>=2");
   popupMgr()->insert( separator(), -1, 0 );
   createPopupItem( SMESHOp::OpClearMesh,              OB, mesh );
-  popupMgr()->insert( separator(), -1, 0 );
+  //popupMgr()->insert( separator(), -1, 0 );
 
   QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc );
   QString multiple_non_empty = QString( " && %1>0 && numberOfNodes>0" ).arg( dc );
@@ -5489,9 +5497,12 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const
       op = new SMESHGUI_MeshOp( true, false );
     break;
     case SMESHOp::OpEditMeshOrSubMesh:
+    case SMESHOp::OpEditMesh:
+    case SMESHOp::OpEditSubMesh:
       op = new SMESHGUI_MeshOp( false );
     break;
     case SMESHOp::OpCompute:
+    case SMESHOp::OpComputeSubMesh:
       op = new SMESHGUI_ComputeOp();
     break;
     case SMESHOp::OpPreCompute:
@@ -6219,8 +6230,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
               if (ac->IsA("SMESH_Actor")) {
                 SMESH_Actor* aGeomAc = SMESH_Actor::SafeDownCast(ac);
                 if (aGeomAc->hasIO()) {
-                  Handle(SALOME_InteractiveObject) io =
-                    Handle(SALOME_InteractiveObject)::DownCast(aGeomAc->getIO());
+                  Handle(SALOME_InteractiveObject) io = aGeomAc->getIO();
                   if (io->hasEntry() && strcmp(io->getEntry(), entry.toLatin1().data()) == 0) {
                     isFound = true;
                     vtkActors.Bind(viewIndex, aGeomAc);
index 8627f72fcd7d0f0604cc2ee5569bf299f8e2795b..072b481752a647c102876e2dcfde1d6e226e7315 100644 (file)
@@ -683,6 +683,7 @@ void SMESHGUI_BaseComputeOp::startOperation()
 
   myMesh      = SMESH::SMESH_Mesh::_nil();
   myMainShape = GEOM::GEOM_Object::_nil();
+  myCurShape  = GEOM::GEOM_Object::_nil();
 
   // check selection
   LightApp_SelectionMgr *Sel = selectionMgr();
@@ -698,7 +699,23 @@ void SMESHGUI_BaseComputeOp::startOperation()
   }
 
   myIObject = selected.First();
-  myMesh = SMESH::GetMeshByIO(myIObject);
+  CORBA::Object_var anObj = SMESH::IObjectToObject( myIObject );
+
+  myMesh = SMESH::SMESH_Mesh::_narrow(anObj);
+  if ( myMesh->_is_nil() )
+  {
+    SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj);
+    if ( !aSubMesh->_is_nil() )
+    {
+      myMesh      = aSubMesh->GetFather();
+      myCurShape  = aSubMesh->GetSubShape();
+    }
+  }
+  else
+  {
+    myCurShape = myMesh->GetShapeToMesh();
+  }
+
   if (myMesh->_is_nil()) {
     SUIT_MessageBox::warning(desktop(),
                              tr("SMESH_WRN_WARNING"),
@@ -706,6 +723,7 @@ void SMESHGUI_BaseComputeOp::startOperation()
     onCancel();
     return;
   }
+
   myMainShape = myMesh->GetShapeToMesh();
 
   SMESHGUI_Operation::startOperation();
@@ -882,10 +900,8 @@ void SMESHGUI_BaseComputeOp::computeMesh()
       myMesh->Clear();
     SUIT_OverrideCursor aWaitCursor;
     try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
       OCC_CATCH_SIGNALS;
-#endif
-      SMESHGUI_ComputeDlg_QThreadQDialog qthreaddialog(desktop(), gen, myMesh, myMainShape);
+      SMESHGUI_ComputeDlg_QThreadQDialog qthreaddialog(desktop(), gen, myMesh, myCurShape);
       qthreaddialog.exec();
       computeFailed = !qthreaddialog.result();
     }
@@ -893,9 +909,7 @@ void SMESHGUI_BaseComputeOp::computeMesh()
       memoryLack = true;
     }
     try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
       OCC_CATCH_SIGNALS;
-#endif
       aCompErrors = gen->GetComputeErrors( myMesh, myMainShape );
       // check if there are memory problems
       for ( CORBA::ULong i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
@@ -911,7 +925,8 @@ void SMESHGUI_BaseComputeOp::computeMesh()
 
     // NPAL16631: if ( !memoryLack )
     {
-      SMESH::ModifiedMesh( aMeshSObj,
+      _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID(myIObject->getEntry());
+      SMESH::ModifiedMesh( sobj,
                            !computeFailed && aHypErrors.isEmpty(),
                            myMesh->NbNodes() == 0);
       update( UF_ObjBrowser | UF_Model );
@@ -1245,8 +1260,9 @@ void SMESHGUI_BaseComputeOp::stopOperation()
 
 void SMESHGUI_BaseComputeOp::onPublishShape()
 {
-  GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
-  SALOMEDS::Study_var study = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
+  GEOM::GEOM_Gen_var      geomGen = SMESH::GetGEOMGen();
+  SALOMEDS::Study_var       study = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
+  GEOM::GEOM_Object_var meshShape = myMesh->GetShapeToMesh();
 
   QStringList entryList;
   QList<int> rows;
@@ -1754,14 +1770,15 @@ void SMESHGUI_PrecomputeOp::initDialog()
  */
 //================================================================================
 
-void SMESHGUI_PrecomputeOp::getAssignedAlgos(_PTR(SObject) theMesh,
+void SMESHGUI_PrecomputeOp::getAssignedAlgos(_PTR(SObject)  theMesh,
                                              QMap<int,int>& theModeMap)
 {
   if ( !theMesh ) return;
+
   _PTR(SObject)          aHypFolder;
   _PTR(GenericAttribute) anAttr;
   int aPart = SMESH::Tag_RefOnAppliedAlgorithms;
-  if ( theMesh->FindSubObject( aPart, aHypFolder ) )
+  if ( theMesh->FindSubObject( aPart, aHypFolder ))
   {
     _PTR(ChildIterator) anIter =
       SMESH::GetActiveStudyDocument()->NewChildIterator( aHypFolder );
index 759648dade0ef2e9c510f8c60c90c5f43129fa41..afd451c7427eddc06e1677ee3b1e8e6b87917741 100644 (file)
@@ -112,6 +112,7 @@ private:
 protected:
   SMESH::SMESH_Mesh_var            myMesh;
   GEOM::GEOM_Object_var            myMainShape;
+  GEOM::GEOM_Object_var            myCurShape;
   SMESH::TShapeDisplayer*          myTShapeDisplayer;
   SMESHGUI_MeshEditPreview*        myBadMeshDisplayer;
   Handle(SALOME_InteractiveObject) myIObject;
index 0716cdd8e447e91ed682f1073995574f75c40203..ad2adb52012d01396aaaaee9fdae95523baef115 100644 (file)
@@ -624,12 +624,32 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh
     objectWg( Mesh, Btn )->hide();
     objectWg( Geom, Btn )->hide();
   }
+  setTitile( theToCreate, theIsMesh );
 }
 
 SMESHGUI_MeshDlg::~SMESHGUI_MeshDlg()
 {
 }
 
+//================================================================================
+/*!
+ * \brief Set dialog title
+ */
+//================================================================================
+
+void SMESHGUI_MeshDlg::setTitile( const bool theToCreate, const bool theIsMesh )
+{
+  if ( theToCreate )
+  {
+    setWindowTitle( tr( theIsMesh ? "CREATE_MESH" : "CREATE_SUBMESH" ));
+  }
+  else
+  {
+    setWindowTitle( tr( theIsMesh ? "EDIT_MESH" : "EDIT_SUBMESH") );
+  }
+  
+}
+
 //================================================================================
 /*!
  * \brief Gets tab with given id
index 37742bbe7eec0d720ed54c2b0d2a6ccd68d70d54..9c0337420bd33907a9eeb3eefea934f9ecd95c23 100644 (file)
@@ -78,6 +78,7 @@ public:
   void                         setAvailableMeshType(const QStringList& );
   int                          currentMeshType();
   void                         setCurrentMeshType( const int );
+  void                         setTitile( const bool, const bool );
 
 signals:
   void                         hypoSet( const QString& );
index 30949d4621ed93a96aa2e8a3351605bd6718d00c..8677fad56262314587bcfdb03340fe6385e46876 100644 (file)
@@ -638,13 +638,14 @@ void SMESHGUI_MeshOp::selectionDone()
         {
           SMESH::SMESH_subMesh_var submeshVar =
             SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
+          myIsMesh = submeshVar->_is_nil();
+          myDlg->setTitile( myToCreate, myIsMesh );
           myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, !submeshVar->_is_nil() );
           myDlg->setObjectShown( SMESHGUI_MeshDlg::Geom, true );
           myDlg->objectWg( SMESHGUI_MeshDlg::Mesh, SMESHGUI_MeshDlg::Btn )->hide();
           myDlg->objectWg( SMESHGUI_MeshDlg::Geom, SMESHGUI_MeshDlg::Btn )->hide();
           myDlg->updateGeometry();
           myDlg->adjustSize();
-          myIsMesh = submeshVar->_is_nil();
           readMesh();
         }
         else
index 3d6589b0d070f73a591458544eebf6e340aa05c7..784940e90360707b108ff32f29c1df80e45c7789 100644 (file)
@@ -69,12 +69,15 @@ namespace SMESHOp {
     OpCreateMesh             = 2030,   // MENU MESH  - CREATE MESH
     OpCreateSubMesh          = 2031,   // MENU MESH  - CREATE SUBMESH
     OpEditMeshOrSubMesh      = 2032,   // MENU MESH  - EDIT MESH/SUBMESH
-    OpBuildCompoundMesh      = 2033,   // MENU MESH  - BUILD COMPOUND
-    OpCopyMesh               = 2034,   // MENU MESH  - COPY MESH
+    OpEditMesh               = 2033,   // POPUP  - EDIT MESH
+    OpEditSubMesh            = 2034,   // POPUP  - EDIT SUBMESH
+    OpBuildCompoundMesh      = 2035,   // MENU MESH  - BUILD COMPOUND
+    OpCopyMesh               = 2036,   // MENU MESH  - COPY MESH
     OpCompute                = 2040,   // MENU MESH  - COMPUTE
-    OpPreCompute             = 2041,   // MENU MESH  - PREVIEW
-    OpEvaluate               = 2042,   // MENU MESH  - EVALUATE
-    OpMeshOrder              = 2043,   // MENU MESH  - CHANGE SUBMESH PRIORITY
+    OpComputeSubMesh         = 2041,   // POPUP  - COMPUTE SUBMESH
+    OpPreCompute             = 2042,   // MENU MESH  - PREVIEW
+    OpEvaluate               = 2043,   // MENU MESH  - EVALUATE
+    OpMeshOrder              = 2044,   // MENU MESH  - CHANGE SUBMESH PRIORITY
     OpCreateGroup            = 2050,   // MENU MESH  - CREATE GROUP
     OpCreateGeometryGroup    = 2051,   // MENU MESH  - CREATE GROUPS FROM GEOMETRY
     OpConstructGroup         = 2052,   // MENU MESH  - CONSTRUCT GROUP
index ab6bad8120f1049d1bb8eb93fee46b20535b9f23..832c51ec18e0597a7b5d2b600d5bbb7dc338d030 100644 (file)
@@ -518,11 +518,18 @@ int SMESHGUI_Selection::dim( int ind ) const
 
 bool SMESHGUI_Selection::isComputable( int ind ) const
 {
-  if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] == "Mesh" )
+  if ( ind >= 0 && ind < myTypes.count() && ( myTypes[ind] == "Mesh" ||
+                                              myTypes[ind].startsWith("Mesh " )))
   {
     QMap<int,int> modeMap;
-    _PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
-    SMESHGUI_PrecomputeOp::getAssignedAlgos( so, modeMap );
+    _PTR(SObject) meshSO = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+
+    _PTR(SComponent) component = meshSO->GetFatherComponent();
+    if ( meshSO->Depth() - component->Depth() > 1 ) // sub-mesh, get a mesh
+      while ( meshSO->Depth() - component->Depth() > 1 )
+        meshSO = meshSO->GetFather();
+
+    SMESHGUI_PrecomputeOp::getAssignedAlgos( meshSO, modeMap );
     return modeMap.size() > 0;
   }
   return false;
index 6f6d0c605d7132530af644033543b95e51fb529a..5392e5504824dca2ca47f8831639e096f329bed0 100644 (file)
         <source>MEN_COMPUTE</source>
         <translation>Compute</translation>
     </message>
+    <message>
+        <source>MEN_COMPUTE_SUBMESH</source>
+        <translation>Compute Sub-mesh</translation>
+    </message>
     <message>
         <source>MEN_PRECOMPUTE</source>
         <translation>Preview</translation>
         <source>MEN_EDIT_MESHSUBMESH</source>
         <translation>Edit Mesh/Sub-mesh</translation>
     </message>
+    <message>
+        <source>MEN_EDIT_MESH</source>
+        <translation>Edit Mesh</translation>
+    </message>
+    <message>
+        <source>MEN_EDIT_SUBMESH</source>
+        <translation>Edit Sub-mesh</translation>
+    </message>
     <message>
         <source>MEN_EXPORT</source>
         <translation>Export</translation>
@@ -2929,6 +2941,10 @@ Use Display Entity menu command to show them.
         <source>STB_COMPUTE</source>
         <translation>Compute</translation>
     </message>
+    <message>
+        <source>STB_COMPUTE_SUBMESH</source>
+        <translation>Compute Sub-mesh</translation>
+    </message>
     <message>
         <source>STB_PRECOMPUTE</source>
         <translation>Preview</translation>
@@ -3061,6 +3077,14 @@ Use Display Entity menu command to show them.
         <source>STB_EDIT_MESHSUBMESH</source>
         <translation>Edit Mesh/Sub-mesh</translation>
     </message>
+    <message>
+        <source>STB_EDIT_MESH</source>
+        <translation>Edit Mesh</translation>
+    </message>
+    <message>
+        <source>STB_EDIT_SUBMESH</source>
+        <translation>Edit Sub-mesh</translation>
+    </message>
     <message>
         <source>STB_EXPORT_DAT</source>
         <translation>Export to DAT file</translation>
@@ -3597,6 +3621,10 @@ Use Display Entity menu command to show them.
         <source>TOP_COMPUTE</source>
         <translation>Compute</translation>
     </message>
+    <message>
+        <source>TOP_COMPUTE_SUBMESH</source>
+        <translation>Compute Sub-mesh</translation>
+    </message>
     <message>
         <source>TOP_PRECOMPUTE</source>
         <translation>Preview</translation>
@@ -3729,6 +3757,14 @@ Use Display Entity menu command to show them.
         <source>TOP_EDIT_MESHSUBMESH</source>
         <translation>Edit Mesh/Sub-mesh</translation>
     </message>
+    <message>
+        <source>TOP_EDIT_MESH</source>
+        <translation>Edit Mesh</translation>
+    </message>
+    <message>
+        <source>TOP_EDIT_SUBMESH</source>
+        <translation>Edit Sub-mesh</translation>
+    </message>
     <message>
         <source>TOP_EXPORT_DAT</source>
         <translation>Export to DAT file</translation>
@@ -6132,8 +6168,12 @@ Please specify them and try again</translation>
         <translation>3D</translation>
     </message>
     <message>
-        <source>EDIT_MESH_SUBMESH</source>
-        <translation>Edit mesh/sub-mesh</translation>
+        <source>EDIT_MESH</source>
+        <translation>Edit mesh</translation>
+    </message>
+    <message>
+        <source>EDIT_SUBMESH</source>
+        <translation>Edit sub-mesh</translation>
     </message>
     <message>
         <source>GEOMETRY</source>
index 757e3977f94d22d8cea3f48fe60e15ea4ea4786e..983a3173b2072df0884602157da477409d10763f 100644 (file)
@@ -1916,8 +1916,8 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
         myLocShape = SMESH_Mesh::PseudoShape();
       // call implementation compute
       ::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
-      myGen.PrepareCompute( myLocMesh, myLocShape);
-      bool ok = myGen.Compute( myLocMesh, myLocShape);
+      myGen.PrepareCompute( myLocMesh, myLocShape );
+      bool ok = myGen.Compute( myLocMesh, myLocShape, myLocShape != myLocMesh.GetShapeToMesh());
       meshServant->CreateGroupServants(); // algos can create groups (issue 0020918)
       myLocMesh.GetMeshDS()->Modified();
       return ok;
index b4da6ea8e8495ff4ba537f1d8a372ec09e680303..a37bffc803646fe4721540ff93347b086bd5b76a 100644 (file)
@@ -1497,11 +1497,12 @@ class Mesh:
                 print allReasons
             pass
         if salome.sg.hasDesktop() and self.mesh.GetStudyId() >= 0:
-            smeshgui = salome.ImportComponentGUI("SMESH")
-            smeshgui.Init(self.mesh.GetStudyId())
-            smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), ok, (self.NbNodes()==0) )
-            if refresh: salome.sg.updateObjBrowser(1)
-            pass
+            if not isinstance( refresh, list): # not a call from subMesh.Compute()
+                smeshgui = salome.ImportComponentGUI("SMESH")
+                smeshgui.Init(self.mesh.GetStudyId())
+                smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), ok, (self.NbNodes()==0) )
+                if refresh: salome.sg.updateObjBrowser(1)
+
         return ok
 
     ## Return a list of error messages (SMESH.ComputeError) of the last Compute()
@@ -5001,7 +5002,7 @@ class Mesh:
     pass # end of Mesh class
 
 
-## class used to compensate change of CORBA API of SMESH_Mesh for backward compatibility
+## Class used to compensate change of CORBA API of SMESH_Mesh for backward compatibility
 #  with old dump scripts which call SMESH_Mesh directly and not via smeshBuilder.Mesh
 #
 class meshProxy(SMESH._objref_SMESH_Mesh):
@@ -5017,7 +5018,40 @@ class meshProxy(SMESH._objref_SMESH_Mesh):
     pass
 omniORB.registerObjref(SMESH._objref_SMESH_Mesh._NP_RepositoryId, meshProxy)
 
-## class used to compensate change of CORBA API of SMESH_MeshEditor for backward compatibility
+
+## Class wrapping SMESH_SubMesh in order to add Compute()
+#
+class submeshProxy(SMESH._objref_SMESH_subMesh):
+    def __init__(self):
+        SMESH._objref_SMESH_subMesh.__init__(self)
+        self.mesh = None
+    def __deepcopy__(self, memo=None):
+        new = self.__class__()
+        return new
+
+    ## Computes the sub-mesh and returns the status of the computation
+    #  @param refresh if @c True, Object browser is automatically updated (when running in GUI)
+    #  @return True or False
+    #  @ingroup l2_construct
+    def Compute(self,refresh=False):
+        if not self.mesh:
+            self.mesh = Mesh( smeshBuilder(), None, self.GetMesh())
+
+        ok = self.mesh.Compute( self.GetSubShape(),refresh=[] )
+
+        if salome.sg.hasDesktop() and self.mesh.GetStudyId() >= 0:
+            smeshgui = salome.ImportComponentGUI("SMESH")
+            smeshgui.Init(self.mesh.GetStudyId())
+            smeshgui.SetMeshIcon( salome.ObjectToID( self ), ok, (self.GetNumberOfElements()==0) )
+            if refresh: salome.sg.updateObjBrowser(1)
+            pass
+
+        return ok
+    pass
+omniORB.registerObjref(SMESH._objref_SMESH_subMesh._NP_RepositoryId, submeshProxy)
+
+
+## Class used to compensate change of CORBA API of SMESH_MeshEditor for backward compatibility
 #  with old dump scripts which call SMESH_MeshEditor directly and not via smeshBuilder.Mesh
 #
 class meshEditor(SMESH._objref_SMESH_MeshEditor):
@@ -5129,7 +5163,7 @@ class algoCreator:
         raise RuntimeError, "No class found for algo type %s" % algoType
         return None
 
-# Private class used to substitute and store variable parameters of hypotheses.
+## Private class used to substitute and store variable parameters of hypotheses.
 #
 class hypMethodWrapper:
     def __init__(self, hyp, method):
@@ -5160,7 +5194,8 @@ class hypMethodWrapper:
         return result
     pass
 
-# A helper class that call UnRegister() of SALOME.GenericObj'es stored in it
+## A helper class that call UnRegister() of SALOME.GenericObj'es stored in it
+#
 class genObjUnRegister:
 
     def __init__(self, genObj=None):
@@ -5181,6 +5216,9 @@ class genObjUnRegister:
             if genObj and hasattr( genObj, "UnRegister" ):
                 genObj.UnRegister()
 
+
+## Bind methods creating mesher plug-ins to the Mesh class
+#
 for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ):
     #
     #print "pluginName: ", pluginName
index 2cf790a34b9a87adc18daaa85144b2a6eb178956..ff3b4c871b94ac4c030cabd2ecc542c19af12b3f 100644 (file)
@@ -1202,7 +1202,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::IsApplicable( const TopoDS_Shape & aShape
   for (TopExp_Explorer exp( aShape, TopAbs_FACE ); exp.More(); exp.Next(), ++nbFoundFaces )
   {
     StdMeshers_FaceSidePtr circSide, linSide1, linSide2;
-    int nbSides = analyseFace( aShape, NULL, circSide, linSide1, linSide2 );
+    int nbSides = analyseFace( exp.Current(), NULL, circSide, linSide1, linSide2 );
     bool ok = ( 0 < nbSides && nbSides <= 3 &&
                 isCornerInsideCircle( circSide, linSide1, linSide2 ));
     if( toCheckAll  && !ok ) return false;