Salome HOME
[box #38049][EDF] (2023-T3) Usages in SMESH
authoryoann.audouin <yoann.audouin@edf.fr>
Thu, 14 Mar 2024 07:11:26 +0000 (08:11 +0100)
committeryoann.audouin <yoann.audouin@edf.fr>
Thu, 14 Mar 2024 07:12:12 +0000 (08:12 +0100)
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI.h
src/SMESHGUI/SMESHGUI_ComputeDlg.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.h
src/SMESHGUI/SMESHGUI_MeshOp.cxx
src/SMESHGUI/SMESHGUI_MeshOp.h

index 69cbc7390bcfaa078d777a057ee03f7710147467..bbf36ce1eae6e140b7f6b591d570d37da8ea19b4 100644 (file)
@@ -2560,6 +2560,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
 
   //QAction* act = action( theCommandID );
+  bool logAction(false);
 
   switch (theCommandID) {
   case SMESHOp::OpDelete:
@@ -2877,6 +2878,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     break;
   case SMESHOp::OpCopyMesh:
     {
+      logAction = true;
       if (isStudyLocked()) break;
       EmitSignalDeactivateDialog();
       ( new SMESHGUI_CopyMeshDlg( this ) )->show();
@@ -3702,6 +3704,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     }
   case SMESHOp::OpTranslation:
     {
+      logAction = true;
       if(isStudyLocked()) break;
       if ( warnOnGeomModif() )
         break; // action forbidden as geometry modified
@@ -3717,6 +3720,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     }
   case SMESHOp::OpRotation:
     {
+      logAction = true;
       if(isStudyLocked()) break;
       if ( warnOnGeomModif() )
         break; // action forbidden as geometry modified
@@ -3732,6 +3736,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     }
   case SMESHOp::OpSymmetry:
     {
+      logAction = true;
       if(isStudyLocked()) break;
       if ( warnOnGeomModif() )
         break; // action forbidden as geometry modified
@@ -3747,6 +3752,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     }
   case SMESHOp::OpScale:
     {
+      logAction = true;
       if(isStudyLocked()) break;
       if ( warnOnGeomModif() )
         break; // action forbidden as geometry modified
@@ -3763,6 +3769,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
   case SMESHOp::OpOffset:
     {
+      logAction = true;
       if(isStudyLocked()) break;
       if ( warnOnGeomModif() )
         break; // action forbidden as geometry modified
@@ -3779,6 +3786,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
   case SMESHOp::OpSewing:
     {
+      logAction = true;
       if(isStudyLocked()) break;
       if ( warnOnGeomModif() )
         break; // action forbidden as geometry modified
@@ -4008,6 +4016,14 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
   anApp->updateActions(); //SRN: To update a Save button in the toolbar
   //updateObjBrowser();
+  if(logAction)
+  {
+    QAction* anAction = action( theCommandID );
+    CAM_Application::logStructuredUserEvent( "Mesh",
+                                             "Operation",
+                                             anAction->text(),
+                                             "activated" );
+  }
   return true;
 }
 
index 5bfe451953c1254317ab49c95828352838fe9303..08ecbdf51e117f3ac57a4803e5453334c7294960 100644 (file)
@@ -212,6 +212,7 @@ private:
                                                   const bool = false);
 
   void                            connectView( const SUIT_ViewWindow* );
+  void                            logSmeshGUIEvent(int theCommandID);
  
 
 private :
index d9808febd34d77ef085b5598122dbeb7731a3953..039a7cde27c92491bf39e3a770b24878b90dad0f 100644 (file)
@@ -896,6 +896,56 @@ void SMESHGUI_ComputeDlg_QThreadQDialog::closeEvent(QCloseEvent *event)
   event->accept();
 }
 
+//================================================================================
+void SMESHGUI_BaseComputeOp::logMeshSize()
+{
+  if(myMesh->_is_nil())
+  {
+    return;
+  }
+
+  SMESH::smIdType_array_var aRes = myMesh->GetMeshInfo();
+  QString aMessage = QString("%1").arg( aRes[SMDSAbs_EntityType::SMDSEntity_Node]) + " nodes";
+  CAM_Application::logStructuredUserEvent("Mesh",
+                                          "Result size",
+                                          "",
+                                          "",
+                                          aMessage);
+  
+  int nbEdges = aRes[SMDSAbs_EntityType::SMDSEntity_Edge] + aRes[SMDSAbs_EntityType::SMDSEntity_Quad_Edge];
+  aMessage = QString("%1").arg(nbEdges) + " edges";
+  CAM_Application::logStructuredUserEvent("Mesh",
+                                          "Result size",
+                                          "",
+                                          "",
+                                          aMessage);
+  
+  int nbFaces = aRes[SMDSAbs_EntityType::SMDSEntity_Triangle] + aRes[SMDSAbs_EntityType::SMDSEntity_Quad_Triangle] +
+                aRes[SMDSAbs_EntityType::SMDSEntity_BiQuad_Triangle] + aRes[SMDSAbs_EntityType::SMDSEntity_Quadrangle] +
+                aRes[SMDSAbs_EntityType::SMDSEntity_Quad_Quadrangle] + aRes[SMDSAbs_EntityType::SMDSEntity_BiQuad_Quadrangle] +
+                aRes[SMDSAbs_EntityType::SMDSEntity_Polygon] + aRes[SMDSAbs_EntityType::SMDSEntity_Quad_Polygon];
+  aMessage = QString("%1").arg(nbFaces) + " faces";
+  CAM_Application::logStructuredUserEvent("Mesh",
+                                          "Result size",
+                                          "",
+                                          "",
+                                          aMessage);
+  
+  int nbVolumes = aRes[SMDSAbs_EntityType::SMDSEntity_Tetra] + aRes[SMDSAbs_EntityType::SMDSEntity_Quad_Tetra] +
+                  aRes[SMDSAbs_EntityType::SMDSEntity_Pyramid] + aRes[SMDSAbs_EntityType::SMDSEntity_Quad_Pyramid] +
+                  aRes[SMDSAbs_EntityType::SMDSEntity_Hexa] + aRes[SMDSAbs_EntityType::SMDSEntity_Quad_Hexa] +
+                  aRes[SMDSAbs_EntityType::SMDSEntity_TriQuad_Hexa] + aRes[SMDSAbs_EntityType::SMDSEntity_Penta] +
+                  aRes[SMDSAbs_EntityType::SMDSEntity_Quad_Penta] + aRes[SMDSAbs_EntityType::SMDSEntity_BiQuad_Penta] +
+                  aRes[SMDSAbs_EntityType::SMDSEntity_Hexagonal_Prism] + aRes[SMDSAbs_EntityType::SMDSEntity_Polyhedra];
+  aMessage = QString("%1").arg(nbVolumes) + " volumes";
+  CAM_Application::logStructuredUserEvent("Mesh",
+                                          "Result size",
+                                          "",
+                                          "",
+                                          aMessage);
+
+}
+
 //================================================================================
 /*!
  * \brief computeMesh()
@@ -1122,9 +1172,13 @@ void SMESHGUI_BaseComputeOp::computeMesh()
     isShowResultDlg = true;
   }
 
+  //log Mesh size info
+  logMeshSize();
+
   // SHOW RESULTS
   if ( isShowResultDlg )
     showComputeResult( memoryLack, noCompError,aCompErrors, noHypoError, aHypErrors );
+
 }
 
 void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack,
index 230a264bc2f0f5df63fd93675472711d19e7d731..869a3185a2319c35b1e9d317a551971f461b877b 100644 (file)
@@ -95,6 +95,7 @@ protected:
                                                     const QString&);
 
   virtual bool                   isValid( SUIT_Operation* theOp ) const;
+  void                           logMeshSize();
     
 protected slots:
   virtual bool                   onApply();
index 80b73321a47b218033a43fb7dac1f53d90cce8c0..50132b41eee3cc0ea8f78e9816099d0e92af0036 100644 (file)
@@ -125,6 +125,57 @@ LightApp_Dialog* SMESHGUI_MeshOp::dlg() const
   return myDlg;
 }
 
+//================================================================================
+/*!
+ * \brief Log meshers info
+*/
+//================================================================================
+void SMESHGUI_MeshOp::logSmeshParams()
+{
+  QString mesherType;
+  int curMeshType = myDlg->currentMeshType();
+  switch ( curMeshType ) {
+  case MT_ANY:
+    mesherType = "Any";
+    break;
+  case MT_TRIANGULAR:
+    mesherType = "Triangular";
+    break;
+  case MT_QUADRILATERAL:
+    mesherType = "Quadrilateral";
+    break;
+  case MT_TETRAHEDRAL:
+    mesherType = "Tetrahedral";
+    break;
+  case MT_HEXAHEDRAL:
+    mesherType = "Hexahedral";
+    break;
+  default:
+    mesherType = "";
+  }
+
+  QString aMessage = QString("Mesh type is %1").arg(mesherType);
+  CAM_Application::logStructuredUserEvent( "Mesh",
+                                           "create mesh",
+                                           "",
+                                           "",
+                                           aMessage);
+
+  for ( int dim = 0; dim <= 3; ++dim )
+  {
+    HypothesisData * curAlgo = hypData( dim, Algo, currentHyp( dim, Algo ));
+    if(curAlgo)
+    {
+      aMessage = QString("%1D algorithm is %2").arg(dim).arg(curAlgo->Label);
+      CAM_Application::logStructuredUserEvent( "Mesh",
+                                           "create mesh",
+                                           "",
+                                           "",
+                                           aMessage);
+    }
+  }
+}
+
 //================================================================================
 /*!
  * \brief Creates or edits mesh
@@ -182,6 +233,7 @@ bool SMESHGUI_MeshOp::onApply()
   {
     if ( myToCreate )
       setDefaultName();
+    //connect(aAction, SIGNAL(triggered(bool)), this, SLOT(logSmeshParams()));
   }
   else
   {
@@ -190,6 +242,7 @@ bool SMESHGUI_MeshOp::onApply()
     SUIT_MessageBox::warning( myDlg, tr( "SMESH_ERROR" ), aMess );
   }
 
+  logSmeshParams();
   myHypoSet = 0;
 
   return aResult;
index 89f641c3158c83323f47e5449f749a6526a11002..de6803a4064b17fbd311d1837cde2fbe5b904544 100644 (file)
@@ -151,6 +151,7 @@ private:
   void                           updateHypoSets();
   void                           setFilteredAlgoData();
   QStringList                    getHypoNames();
+  void                           logSmeshParams();
 
 private: