]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
[SALOME platform 0013410]: SubMesh not taken into account with Netgen 1D-2D et 1D...
authoreap <eap@opencascade.com>
Tue, 16 Sep 2008 14:49:49 +0000 (14:49 +0000)
committereap <eap@opencascade.com>
Tue, 16 Sep 2008 14:49:49 +0000 (14:49 +0000)
 //================================================================================
 /*!
+ * \brief Return name of the algorithm that does not support submeshes and makes
+ * submesh creation useless
+ *  \retval char* - string is to be deleted!!!
+ */
+//================================================================================
+
+char* SMESHGUI_MeshOp::isSubmeshIgnored() const

src/SMESHGUI/SMESHGUI_MeshOp.cxx
src/SMESHGUI/SMESHGUI_MeshOp.h

index 11d298a6db9ad87391b8a15f3f3075a7a8d470ca..9257f2b6d544620bf7941dd3bb7d61b38ebfc1b9 100644 (file)
@@ -340,6 +340,53 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
   return false;
 }
 
+//================================================================================
+/*!
+ * \brief Return name of the algorithm that does not support submeshes and makes
+ * submesh creation useless 
+ *  \retval char* - string is to be deleted!!!
+ */
+//================================================================================
+
+char* SMESHGUI_MeshOp::isSubmeshIgnored() const
+{
+  if ( myToCreate && !myIsMesh ) {
+
+    QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
+    QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
+    _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.latin1() );
+    if ( pMesh ) {
+
+      QStringList algoNames;
+      THypList    algoList;
+      existingHyps(3, Algo, pMesh, algoNames, algoList);
+      if (!algoList.empty()) {
+        HypothesisData* algo = SMESH::GetHypothesisData( algoList[0].first->GetName() );
+        if ( algo &&
+             algo->InputTypes.empty() && // builds all dimensions it-self
+             !algo->IsSupportSubmeshes )
+          return CORBA::string_dup( algoNames[0].latin1() );
+      }
+
+//       GEOM::GEOM_Object_var geom;
+//       if (_PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.latin1() ))
+//         geom = SMESH::SObjectToInterface<GEOM::GEOM_Object>( pGeom );
+
+//       if ( !geom->_is_nil() && geom->GetShapeType() >= GEOM::FACE ) { // WIRE, EDGE as well
+        existingHyps(2, Algo, pMesh, algoNames, algoList);
+        if (!algoList.empty()) {
+          HypothesisData* algo = SMESH::GetHypothesisData( algoList[0].first->GetName() );
+          if ( algo &&
+               algo->InputTypes.empty() && // builds all dimensions it-self
+               !algo->IsSupportSubmeshes )
+            return CORBA::string_dup( algoNames[0].latin1() );
+        }
+//       }
+    }
+  }
+  return 0;
+}
+
 //================================================================================
 /*!
  * \brief find an existing submesh by the selected shape
@@ -526,8 +573,20 @@ void SMESHGUI_MeshOp::selectionDone()
             myDlg->selectObject( "", SMESHGUI_MeshDlg::Geom, "" );
             selectObject( _PTR(SObject)() );
             selectionDone();
+            return;
           }
         }
+        // discard selected mesh if submesh creation not allowed because of
+        // a global algorithm that does not support submeshes
+        if ( char* algoName = isSubmeshIgnored() ) {
+          SUIT_MessageBox::warn1( myDlg, tr( "SMESH_ERROR" ),
+                                  tr("SUBMESH_NOT_ALLOWED").arg(algoName), tr( "SMESH_BUT_OK" ));
+          CORBA::string_free( algoName );
+          myDlg->selectObject( "", SMESHGUI_MeshDlg::Mesh, "" );
+          selectObject( _PTR(SObject)() );
+          selectionDone();
+          return;
+        }
 
         // enable/disable popup for choice of geom selection way
         bool enable = false;
index c658fb74e33568594bcfa6fd53b3784d597ab978..0fbd27a4710b0e3a7282bb8eb9f85bacfe50f175 100644 (file)
@@ -100,7 +100,7 @@ private:
                                                 QStringList&    theHyps,
                                                 THypDataList&   theDataList,
                                                 HypothesisData* theAlgoData = 0 ) const;
-  void                           existingHyps( const int     theDim, 
+  static void                    existingHyps( const int     theDim, 
                                                const int     theHypType, 
                                                _PTR(SObject) theFather,
                                                QStringList&  theHyps, 
@@ -129,6 +129,7 @@ private:
   SMESH::SMESH_Hypothesis_var    getInitParamsHypothesis( const QString& aHypType,
                                                           const QString& aServerLib ) const;
   bool                           isSubshapeOk() const;
+  char*                          isSubmeshIgnored() const;
   _PTR(SObject)                  getSubmeshByGeom() const;
   void                           selectObject( _PTR(SObject) ) const;