Salome HOME
Adding element generation with cartesian core and global physical size
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Mon, 13 Mar 2017 13:50:19 +0000 (14:50 +0100)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Mon, 13 Mar 2017 13:50:19 +0000 (14:50 +0100)
12 files changed:
CMakeLists.txt
idl/HYBRIDPlugin_Algorithm.idl
src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx
src/GUI/HYBRIDPluginGUI_HypothesisCreator.h
src/GUI/HYBRIDPlugin_msg_en.ts
src/GUI/HYBRIDPlugin_msg_fr.ts
src/GUI/HYBRIDPlugin_msg_ja.ts
src/HYBRIDPlugin/HYBRIDPluginBuilder.py
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.hxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx

index 95fc5362d72a38525dc7a95ace0cc21d330ba293..346f4dedbc12dd71e87878eb7c373094d3c2766a 100755 (executable)
@@ -213,6 +213,7 @@ SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME
 # Specific to HYBRIDPLUGIN:
 SET(SALOME_HYBRIDPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/hybridplugin" CACHE PATH 
     "Install path: SALOME HYBRIDPLUGIN specific data")
+SET(SALOME_HYBRIDPLUGIN_INSTALL_TESTS ${SALOME_INSTALL_BINS})
 
 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
@@ -237,6 +238,9 @@ ADD_SUBDIRECTORY(bin)
 IF(SALOME_BUILD_DOC)
   ADD_SUBDIRECTORY(doc)
 ENDIF(SALOME_BUILD_DOC)
+IF(SALOME_BUILD_TESTS)
+  ADD_SUBDIRECTORY(tests)
+ENDIF(SALOME_BUILD_TESTS)
 
 # Header configuration
 # ====================
index 9732ad5af104905bcd371fca1bf663c7af9e74b9..29893d2e3f6dd0511fbd3143820ca7dd214891e6 100644 (file)
@@ -121,7 +121,7 @@ module HYBRIDPlugin
     void SetBoundaryLayersGrowth(in short level) raises (SALOME::SALOME_Exception);
     short GetBoundaryLayersGrowth();
     /*!
-     * ElementGeneration: 0-Generation_Tetra_Dominant, 1-Generation_Hexa_Dominant. Default is Generation_Tetra_Dominant
+     * ElementGeneration: 0-Generation_Tetra_Dominant, 1-Generation_Hexa_Dominant, 2-Generation_Cartesian_Core. Default is Generation_Tetra_Dominant
      */
     void SetElementGeneration(in short level) raises (SALOME::SALOME_Exception);
     short GetElementGeneration();
@@ -149,6 +149,12 @@ module HYBRIDPlugin
      */
     void SetBoundaryLayersProgression(in double BLP) raises (SALOME::SALOME_Exception);
     double GetBoundaryLayersProgression();
+    /*!
+     * To set core size.
+     * Default is 0.0
+     */
+    void SetCoreSize(in double CS) raises (SALOME::SALOME_Exception);
+    double GetCoreSize();
     /*!
      * To set multinormals angle threshold at opening ridges.
      * Default is 30.0
index f34c87e2b22e79d9be4c20e47e09c9b7052ed691..6ffdef7819d867f06c71aac9e98566474bbcf153 100644 (file)
@@ -445,9 +445,14 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
   aStdLayout->addWidget( myElementGenerationCombo, row++, 1, 1, 1 );
   
   QStringList typesElementGeneration;
-  typesElementGeneration << tr( "HYBRID_GENERATION_TETRA_DOMINANT" ) << tr( "HYBRID_GENERATION_HEXA_DOMINANT" );
+  typesElementGeneration << tr( "HYBRID_GENERATION_TETRA_DOMINANT" ) << tr( "HYBRID_GENERATION_HEXA_DOMINANT" ) << tr( "HYBRID_GENERATION_CARTESIAN_CORE" );
   myElementGenerationCombo->addItems( typesElementGeneration );
   
+  aStdLayout->addWidget( new QLabel( tr( "HYBRID_CORE_SIZE" ), myStdGroup ), row, 0, 1, 1 );
+  myCoreSizeSpin = new SMESHGUI_SpinBox( myStdGroup );
+  myCoreSizeSpin->RangeStepAndValidator(0., COORD_MAX, 10., "length_precision");
+  aStdLayout->addWidget( myCoreSizeSpin, row++, 1, 1, 1 );
+
   myAddMultinormalsCheck = new QCheckBox( tr( "HYBRID_ADD_MULTINORMALS" ), myStdGroup );
   aStdLayout->addWidget( myAddMultinormalsCheck, row++, 0, 1, 1 );
   
@@ -1520,6 +1525,10 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
   myHeightFirstLayerSpin          -> setValue( data.myHeightFirstLayer );
   myNbOfBoundaryLayersSpin        -> setValue( data.myNbOfBoundaryLayers );
   myBoundaryLayersProgressionSpin -> setValue( data.myBoundaryLayersProgression );
+  if (data.myCoreSize <= 0)
+    myCoreSizeSpin->setText("");
+  else
+    myCoreSizeSpin                -> setValue( data.myCoreSize );
   myMultinormalsAngleSpin         -> setValue( data.myMultinormalsAngle );
   myFaceSelector                  ->SetListOfIDs( data.myFaceWLIds );
 
@@ -1748,6 +1757,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData
   h_data.mySmoothNormals              = h->GetSmoothNormals();
   h_data.myHeightFirstLayer           = h->GetHeightFirstLayer();
   h_data.myBoundaryLayersProgression  = h->GetBoundaryLayersProgression();
+  h_data.myCoreSize                   = h->GetCoreSize();
   h_data.myMultinormalsAngle          = h->GetMultinormalsAngle();
   h_data.myNbOfBoundaryLayers         = h->GetNbOfBoundaryLayers();
   h_data.myFaceWLIds                  = h->GetFacesWithLayers();
@@ -1855,6 +1865,8 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
       h->SetHeightFirstLayer       ( h_data.myHeightFirstLayer );
     if ( h->GetBoundaryLayersProgression() != h_data.myBoundaryLayersProgression )
       h->SetBoundaryLayersProgression       ( h_data.myBoundaryLayersProgression );
+    if ( h->GetCoreSize() != h_data.myCoreSize )
+      h->SetCoreSize       ( h_data.myCoreSize );
     if ( h->GetMultinormalsAngle() != h_data.myMultinormalsAngle )
       h->SetMultinormalsAngle       ( h_data.myMultinormalsAngle );
     if ( h->GetNbOfBoundaryLayers() != h_data.myNbOfBoundaryLayers )
@@ -1979,6 +1991,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD
   h_data.myHeightFirstLayer           = myHeightFirstLayerSpin -> value();
   h_data.myNbOfBoundaryLayers         = myNbOfBoundaryLayersSpin -> value();
   h_data.myBoundaryLayersProgression  = myBoundaryLayersProgressionSpin -> value();
+  h_data.myCoreSize                   = myCoreSizeSpin->text().isEmpty() ? 0.0 : myCoreSizeSpin -> value();
   h_data.myMultinormalsAngle          = myMultinormalsAngleSpin -> value();
   h_data.myFaceWLIds                  = myFaceSelector->GetListOfIDs();
 
index 07263119a7443015fb5b70a69aff381991ac2bcb..19ae823371225b9140cff5cd84fb36e22ca7125f 100644 (file)
@@ -161,6 +161,7 @@ typedef struct
           mySmoothNormals;
   double  myHeightFirstLayer,
           myBoundaryLayersProgression,
+          myCoreSize,
           myMultinormalsAngle;
   short   myNbOfBoundaryLayers;
   SMESH::long_array_var myFaceWLIds;
@@ -272,6 +273,7 @@ private:
   SMESHGUI_SpinBox*   myHeightFirstLayerSpin;
   QSpinBox*           myNbOfBoundaryLayersSpin;
   SMESHGUI_SpinBox*   myBoundaryLayersProgressionSpin;
+  SMESHGUI_SpinBox*   myCoreSizeSpin;
   SMESHGUI_SpinBox*   myMultinormalsAngleSpin;
   QCheckBox*          mySmoothNormalsCheck;
 
index bf8f942d8b79313c4443c0f95e7ee7a52ec3121e..77a630acf89cb00aa3eba2c86c80b5c3297eaab5 100644 (file)
@@ -66,6 +66,14 @@ downward means inward and upward means outward ...
         <source>HYBRID_GENERATION_HEXA_DOMINANT</source>
         <translation>Hexahedra dominant</translation>
     </message>
+    <message>
+        <source>HYBRID_GENERATION_CARTESIAN_CORE</source>
+        <translation>Cartesian core</translation>
+    </message>
+    <message>
+        <source>HYBRID_CORE_SIZE</source>
+        <translation>Core elements size (cartesian core only)</translation>
+    </message>
     <message>
         <source>HYBRID_ADD_MULTINORMALS</source>
         <translation>Add extra normals at opening ridges and corners</translation>
index 18c76e23bfea2fe43b1083eb86c79ed2396c90ca..2fa24d463726e59e08014f7ee705472c1bc86205 100755 (executable)
@@ -66,6 +66,14 @@ en conséquence au dessous signifie à l&apos;intérieur et au dessus signifie 
         <source>HYBRID_GENERATION_HEXA_DOMINANT</source>
         <translation>Dominance d&apos;hexaèdres</translation>
     </message>
+    <message>
+        <source>HYBRID_GENERATION_CARTESIAN_CORE</source>
+        <translation>Cœur cartésien</translation>
+    </message>
+    <message>
+        <source>HYBRID_CORE_SIZE</source>
+        <translation>Taille des éléments du cœur (cœur cartésien uniquement)</translation>
+    </message>
     <message>
         <source>HYBRID_ADD_MULTINORMALS</source>
         <translation>Ajout d&apos;extra normales extérieures aux arêtes et coins</translation>
index 4f3d84ae54787f773ced5701de9007399b0f26ee..ccc5cdcd27abfacade733348f4238c6289035723 100644 (file)
@@ -67,6 +67,14 @@ downward means inward and upward means outward ...
       <source>HYBRID_GENERATION_HEXA_DOMINANT</source>
       <translation>主に六面体</translation>
     </message>
+    <message>
+        <source>HYBRID_GENERATION_CARTESIAN_CORE</source>
+        <translation type="unfinished">Cartesian core</translation>
+    </message>
+    <message>
+        <source>HYBRID_CORE_SIZE</source>
+        <translation type="unfinished">Core elements size (cartesian core only)</translation>
+    </message>
     <message>
       <source>HYBRID_ADD_MULTINORMALS</source>
       <translation>開いたリッジと角に別の法線を追加</translation>
index a84a91bfca3350f3b0ef19e6978f4da6c0c1e7d2..574f151b9ce9bad5b7b6f78273e3a0b18b459a5c 100644 (file)
@@ -46,7 +46,7 @@ Decrease_Collision_Mode, Stop_Collision_Mode = 0,1
 Layer_Growth_Inward, Layer_Growth_Outward = 0,1
 
 # Mesh with element type Tetra Dominant or hexa Dominant in the remaining volume (outside layers).
-Generation_Tetra_Dominant, Generation_Hexa_Dominant = 0,1
+Generation_Tetra_Dominant, Generation_Hexa_Dominant, Generation_Cartesian_Core = 0,1,2
 
 #----------------------------
 # Mesh algo type identifiers
@@ -187,6 +187,7 @@ class HYBRID_Algorithm(Mesh_Algorithm):
     #  @param mode, one of the following values
     #  - Generation_Tetra_Dominant
     #  - Generation_Hexa_Dominant
+    #  - Generation_Cartesian_Core
     #  .
     # Default is Generation_Tetra_Dominant
     def SetElementGeneration(self, mode):
@@ -221,6 +222,13 @@ class HYBRID_Algorithm(Mesh_Algorithm):
         self.Parameters().SetBoundaryLayersProgression(boundaryLayersProgression)
         pass
 
+    ## Set core elements size.
+    # Default is 0.0
+    # @param CoreSize double value
+    def SetCoreSize(self, CoreSize):
+        self.Parameters().SetCoreSize(CoreSize)
+        pass
+
     ## To set multinormals angle threshold at opening ridges.
     # Default is 30.0
     # @param multinormalsAngle double value
index 4d2f0222ed6e0c5795bc338d27147059c8ff22db..de92a756b2e2f23eb4de5a81c7eb5d1db8783c7d 100644 (file)
@@ -62,6 +62,7 @@ HYBRIDPlugin_Hypothesis::HYBRIDPlugin_Hypothesis(int hypId, int studyId, SMESH_G
   mySmoothNormals(DefaultSmoothNormals()),
   myHeightFirstLayer(DefaultHeightFirstLayer()),
   myBoundaryLayersProgression(DefaultBoundaryLayersProgression()),
+  myCoreSize(DefaultCoreSize()),
   myMultinormalsAngle(DefaultMultinormalsAngle()),
   myNbOfBoundaryLayers(DefaultNbOfBoundaryLayers()),
   _enfVertexList(DefaultHYBRIDEnforcedVertexList()),
@@ -391,6 +392,27 @@ double HYBRIDPlugin_Hypothesis::GetBoundaryLayersProgression() const
   return myBoundaryLayersProgression;
 }
 
+//=======================================================================
+//function : SetCoreSize
+//=======================================================================
+
+void HYBRIDPlugin_Hypothesis::SetCoreSize(double toCoreSize)
+{
+  if ( myCoreSize != toCoreSize ) {
+    myCoreSize = toCoreSize;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : GetCoreSize
+//=======================================================================
+
+double HYBRIDPlugin_Hypothesis::GetCoreSize() const
+{
+  return myCoreSize;
+}
+
 //=======================================================================
 //function : SetMultinormalsAngle
 //=======================================================================
@@ -425,7 +447,7 @@ void HYBRIDPlugin_Hypothesis::SetNbOfBoundaryLayers(short toNbOfBoundaryLayers)
 }
 
 //=======================================================================
-//function : GetMultinormalsAngle
+//function : GetCoreSize
 //=======================================================================
 
 short HYBRIDPlugin_Hypothesis::GetNbOfBoundaryLayers() const
@@ -1293,6 +1315,14 @@ double HYBRIDPlugin_Hypothesis::DefaultBoundaryLayersProgression()
   return 1.0;
 }
 
+//=======================================================================
+//function : DefaultCoreSize
+//=======================================================================
+double HYBRIDPlugin_Hypothesis::DefaultCoreSize()
+{
+  return 0.0;
+}
+
 //=======================================================================
 //function : DefaultMultinormalsAngle
 //=======================================================================
@@ -1329,6 +1359,8 @@ std::ostream & HYBRIDPlugin_Hypothesis::SaveTo(std::ostream & save)
   save << (int) myKeepFiles << " ";
   save << myWorkingDirectory << " ";
   save << myVerboseLevel << " ";
+  save << myCoreSize << " ";
+
   if (!myTextOption.empty()) {
     save << "__OPTIONS_BEGIN__ ";
     save << myTextOption << " ";
@@ -1501,6 +1533,11 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
   else
     load.clear(ios::badbit | load.rdstate());
 
+  isOK = static_cast<bool>(load >> d);
+  if (isOK)
+    myCoreSize = d;
+  else
+    load.clear(ios::badbit | load.rdstate());
 
   std::string separator;
   bool hasOptions = false;
@@ -1784,13 +1821,11 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis*
   bool p_eg    = ( hyp && hyp->myTextOption.find("--element_generation ") != std::string::npos );
   bool p_cm    = ( hyp && hyp->myTextOption.find("--collision_mode ") != std::string::npos );
   bool p_am    = ( hyp && hyp->myTextOption.find("--add_multinormals ") != std::string::npos );
+  bool p_cs    = ( hyp && hyp->myTextOption.find("--global_physical_size ") != std::string::npos );
   bool p_mat   = ( hyp && hyp->myTextOption.find("--multinormal_angle_threshold ") != std::string::npos );
   bool p_sn    = ( hyp && hyp->myTextOption.find("--smooth_normals ") != std::string::npos );
 
   //missing options :
-  //- global_physical_size
-  //- boundary_layer_size_mode
-  //- boundary_layer_initial_height_on_surface_tags
   //- boundary_layer_max_element_angle
 
   bool nolayers = false;
@@ -1862,12 +1897,18 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis*
   }
 
   if ( !p_eg && hyp ) {
-    if ( hyp->myElementGeneration >= 0 && hyp->myElementGeneration <= 1 ) {
-      const char* value[] = { "tetra-dominant" , "hexa-dominant" };
+    if ( hyp->myElementGeneration >= 0 && hyp->myElementGeneration <= 2 ) {
+      const char* value[] = { "tetra-dominant" , "hexa-dominant", "cartesian_core" };
       cmd << " --element_generation " << value[ hyp->myElementGeneration ];
     }
   }
-  
+
+  if ( !p_cs && hyp ) {
+    if ( hyp->myCoreSize >= 0 ) {
+      cmd << " --global_physical_size " << hyp->myCoreSize;
+    }
+  }
+
   if ( !p_cm && hyp ) {
     if ( hyp->myCollisionMode >= 0 && hyp->myCollisionMode <= 1 ) {
       const char* value[] = { "decrease" , "stop" };
index 0bbd71861be6e1441669883ac60c8d52536ce7e8..f4953fa019af14b126c3425792c90a0e0b9eef7f 100644 (file)
@@ -172,9 +172,9 @@ public:
   void SetBoundaryLayersGrowth(BoundaryLayersGrowth level);
   BoundaryLayersGrowth GetBoundaryLayersGrowth() const;
   /*!
-   * ElementGeneration: 0-Generation_Tetra_Dominant, 1-Generation_Hexa_Dominant. Default is Generation_Tetra_Dominant
+   * ElementGeneration: 0-Generation_Tetra_Dominant, 1-Generation_Hexa_Dominant, 2-Generation_Cartesian_Core. Default is Generation_Tetra_Dominant
    */
-  enum ElementGeneration { Generation_Tetra_Dominant = 0, Generation_Hexa_Dominant };
+  enum ElementGeneration { Generation_Tetra_Dominant = 0, Generation_Hexa_Dominant, Generation_Cartesian_Core };
   void SetElementGeneration(ElementGeneration level);
   ElementGeneration GetElementGeneration() const;
     /*!
@@ -200,6 +200,12 @@ public:
      */
     void SetBoundaryLayersProgression(double BLP);
     double GetBoundaryLayersProgression() const;
+    /*!
+     * Set core elements size.
+     * Default is 0.0
+     */
+    void SetCoreSize(double CS);
+    double GetCoreSize() const;
     /*!
      * To set multinormals angle threshold at opening ridges.
      * Default is 30.0
@@ -380,6 +386,7 @@ public:
   static short  DefaultNbOfBoundaryLayers();
   static double DefaultHeightFirstLayer();
   static double DefaultBoundaryLayersProgression();
+  static double DefaultCoreSize();
   static double DefaultMultinormalsAngle();
     
   static THYBRIDEnforcedVertex DefaultHYBRIDEnforcedVertex() {return THYBRIDEnforcedVertex();}
@@ -442,6 +449,7 @@ private:
   bool             mySmoothNormals;
   double           myHeightFirstLayer;
   double           myBoundaryLayersProgression;
+  double           myCoreSize;
   double           myMultinormalsAngle;
   short            myNbOfBoundaryLayers;
    
index 0d769f5395f72ab7ce4e8b47483f7423ff074ad0..3aa6efa4d39a181a4e4c8f224c7b43c700873cdb 100644 (file)
@@ -556,7 +556,7 @@ void HYBRIDPlugin_Hypothesis_i::SetElementGeneration(CORBA::Short level)
   ::HYBRIDPlugin_Hypothesis::ElementGeneration l =
       (::HYBRIDPlugin_Hypothesis::ElementGeneration) level;
   if ( l < ::HYBRIDPlugin_Hypothesis::Generation_Tetra_Dominant ||
-       l > ::HYBRIDPlugin_Hypothesis::Generation_Hexa_Dominant )
+       l > ::HYBRIDPlugin_Hypothesis::Generation_Cartesian_Core )
     THROW_SALOME_CORBA_EXCEPTION( "Invalid ElementGeneration mode",SALOME::BAD_PARAM );
     
   ASSERT(myBaseImpl);
@@ -649,6 +649,25 @@ CORBA::Double HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersProgression()
   return this->GetImpl()->GetBoundaryLayersProgression();
 }
 
+//=======================================================================
+//function : SetCoreSize
+//=======================================================================
+void HYBRIDPlugin_Hypothesis_i::SetCoreSize(CORBA::Double toCoreSize)
+{
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetCoreSize(toCoreSize);
+  SMESH::TPythonDump() << _this() << ".SetCoreSize( " << toCoreSize << " )";
+}
+
+//=======================================================================
+//function : GetCoreSize
+//=======================================================================
+CORBA::Double HYBRIDPlugin_Hypothesis_i::GetCoreSize()
+{
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetCoreSize();
+}
+
 //=======================================================================
 //function : SetMultinormalsAngle
 //=======================================================================
index 4733318cffb36eb63d1906a5298debd63d9299d4..858436ac9711865659a8683a90b86cbae06e70fb 100644 (file)
@@ -180,6 +180,9 @@ class HYBRIDPLUGIN_EXPORT HYBRIDPlugin_Hypothesis_i:
   void SetBoundaryLayersProgression(CORBA::Double toBoundaryLayersProgression);
   CORBA::Double GetBoundaryLayersProgression();
   
+  void SetCoreSize(CORBA::Double toCoreSize);
+  CORBA::Double GetCoreSize();
+
   void SetMultinormalsAngle(CORBA::Double toMultinormalsAngle);
   CORBA::Double GetMultinormalsAngle();