]> SALOME platform Git repositories - plugins/hybridplugin.git/commitdiff
Salome HOME
new combo for element generation etc...
authorChristian Van Wambeke <christian.van-wambeke@cea.fr>
Fri, 27 Jun 2014 14:36:16 +0000 (16:36 +0200)
committerChristian Van Wambeke <christian.van-wambeke@cea.fr>
Fri, 27 Jun 2014 14:36:16 +0000 (16:36 +0200)
idl/HYBRIDPlugin_Algorithm.idl
resources/HYBRIDPlugin.xml
src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx
src/GUI/HYBRIDPluginGUI_HypothesisCreator.h
src/GUI/HYBRIDPlugin_msg_en.ts
src/HYBRIDPlugin/HYBRIDPluginBuilder.py
src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.hxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx

index 35f57b2344d86db8cf3f59ad220a96882d282ee0..f54103d409ba92219f6b84d33fa38aeaf6d3b341 100644 (file)
@@ -99,17 +99,21 @@ module HYBRIDPlugin
 
 
     /*!
-     * To mesh Boundary Layers growing inward or outward.
-     * Default is inward.
+     * Collision mode: 0-decrease, 1-stop. Default is decrease
      */
-    void SetBoundaryLayersInward(in boolean toBoundaryLayersInward);
-    boolean GetBoundaryLayersInward();
+    void SetCollisionMode(in short level) raises (SALOME::SALOME_Exception);
+    short GetCollisionMode();
     /*!
-     * To mesh with element type Tetra Dominant or hexa Dominant in the boundary layers. 
-     * Default is Tetra Dominant.
+     * BoundaryLayersGrowth: 0-Layer_Growth_Inward, 1-Layer_Growth_Outward. Default is Layer_Growth_Inward
      */
-    void SetElemGenTetraDominant(in boolean toElemGenTetraDominant);
-    boolean GetElemGenTetraDominant();
+    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
+     */
+    void SetElementGeneration(in short level) raises (SALOME::SALOME_Exception);
+    short GetElementGeneration();
+    
     /*!
      * To mesh adding extra normals at opening ridges and corners.
      * Default is no.
index e72e347930bf420d325a52ec6f880d3c60407fa7..562bb00037e9460f89f6c2ddd3ca2a478bc7154e 100644 (file)
@@ -55,7 +55,7 @@
 
   <algorithms>
     <algorithm type="HYBRID_3D"
-               label-id="Tetrahedron and hexahedron (HYBRID)"
+               label-id="Tetrahedron etc... (HYBRID)"
                icon-id="mesh_tree_hypo_hybrid.png"
                input="TRIA,QUAD"
               need-geom="false"
index ec7641cd9d5310cccc116d0a2e581b21347818ea..36643b82fab53b9ca387d22e314ec272568e6ce0 100644 (file)
@@ -364,7 +364,6 @@ GEOM::GEOM_Gen_var HYBRIDPluginGUI_HypothesisCreator::getGeomEngine()
 
 QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
 {
-  std::cout << std::endl << "!!!!!!!!!!!!!!!!!!!!buildFrame TOVERIFY" << std::endl;
   QFrame* fr = new QFrame( 0 );
   QVBoxLayout* lay = new QVBoxLayout( fr );
   lay->setMargin( 5 );
@@ -406,9 +405,13 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
   types << tr( "LEVEL_NONE" ) << tr( "LEVEL_LIGHT" ) << tr( "LEVEL_MEDIUM" ) << tr( "LEVEL_STANDARDPLUS" ) << tr( "LEVEL_STRONG" );
   myOptimizationLevelCombo->addItems( types );
 
-  myBoundaryLayersInwardCheck = new QCheckBox( tr( "HYBRID_LAYERS_INWARD" ), myStdGroup );
-  aStdLayout->addWidget( myBoundaryLayersInwardCheck, row++, 0, 1, 1 );
-  myBoundaryLayersInwardCheck->setToolTip(tr( "HYBRID_LAYERS_Outward" ) ); //"Outward growth if deselected");
+  aStdLayout->addWidget( new QLabel( tr( "HYBRID_BOUNDARY_LAYERS_GROWTH" ), myStdGroup ), row, 0, 1, 1 );
+  myBoundaryLayersGrowthCombo = new QComboBox( myStdGroup );
+  aStdLayout->addWidget( myBoundaryLayersGrowthCombo, row++, 1, 1, 1 );
+  
+  QStringList typesBoundaryLayersGrowth;
+  typesBoundaryLayersGrowth << tr( "HYBRID_LAYER_GROWTH_INWARD" ) << tr( "HYBRID_LAYER_GROWTH_OUTWARD" );
+  myBoundaryLayersGrowthCombo->addItems( typesBoundaryLayersGrowth );
   
   aStdLayout->addWidget( new QLabel( tr( "HYBRID_HeightFirstLayer" ), myStdGroup ), row, 0, 1, 1 );
   myHeightFirstLayerSpin = new SMESHGUI_SpinBox( myStdGroup );
@@ -424,9 +427,22 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
   myBoundaryLayersProgressionSpin->RangeStepAndValidator(0., 10., .1, "BoundaryLayersProgression");
   aStdLayout->addWidget( myBoundaryLayersProgressionSpin, row++, 1, 1, 1 );
 
-  myElemGenTetraDominantCheck = new QCheckBox( tr( "HYBRID_TETRA_DOMINANT" ), myStdGroup );
-  aStdLayout->addWidget( myElemGenTetraDominantCheck, row++, 0, 1, 1 );
+  aStdLayout->addWidget( new QLabel( tr( "COLLISION_MODE" ), myStdGroup ), row, 0, 1, 1 );
+  myCollisionModeCombo = new QComboBox( myStdGroup );
+  aStdLayout->addWidget( myCollisionModeCombo, row++, 1, 1, 1 );
+  
+  QStringList typescoll;
+  typescoll << tr( "COLLISION_DECREASE" ) << tr( "COLLISION_STOP" );
+  myCollisionModeCombo->addItems( typescoll );
 
+  aStdLayout->addWidget( new QLabel( tr( "HYBRID_GENERATION_ELEMENT" ), myStdGroup ), row, 0, 1, 1 );
+  myElementGenerationCombo = new QComboBox( myStdGroup );
+  aStdLayout->addWidget( myElementGenerationCombo, row++, 1, 1, 1 );
+  
+  QStringList typesElementGeneration;
+  typesElementGeneration << tr( "HYBRID_GENERATION_TETRA_DOMINANT" ) << tr( "HYBRID_GENERATION_HEXA_DOMINANT" );
+  myElementGenerationCombo->addItems( typesElementGeneration );
+  
   myAddMultinormalsCheck = new QCheckBox( tr( "HYBRID_ADD_MULTINORMALS" ), myStdGroup );
   aStdLayout->addWidget( myAddMultinormalsCheck, row++, 0, 1, 1 );
   
@@ -662,8 +678,8 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
   //connect( myAdvWidget->initialMemoryCheck,         SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
   //connect( myAdvWidget->boundaryRecoveryCheck,      SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
 
-  connect( myBoundaryLayersInwardCheck,  SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
-  connect( myElemGenTetraDominantCheck,  SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
+  //connect( myBoundaryLayersGrowthCombo,  SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
+  //connect( myElementGenerationCombo,     SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
   connect( myAddMultinormalsCheck,       SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
   connect( mySmoothNormalsCheck,         SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
   
@@ -694,7 +710,6 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
 //   connect( myEnfMeshConstraint,     SIGNAL( currentIndexChanged(int) ),      this,  SLOT( checkEnfMeshIsDefined() ) );
 //   connect( this,                    SIGNAL( enfMeshDefined(bool) ), addEnfMeshButton, SLOT( setEnabled(bool) ) );
   
-  std::cout << std::endl << "!!!!!!!!!!!!!!!!!!!!buildFrame TOVERIFY end" << std::endl;
   return fr;
 }
 
@@ -1474,8 +1489,9 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
   myAdvWidget->initialMemorySpin              ->setValue      ( qMax( data.myInitialMemory,
                                                                       myAdvWidget->initialMemorySpin->minimum() ));
 
-  myBoundaryLayersInwardCheck -> setChecked ( data.myBoundaryLayersInward );
-  myElemGenTetraDominantCheck -> setChecked ( data.myElemGenTetraDominant );
+  myCollisionModeCombo ->setCurrentIndex( data.myCollisionMode );
+  myBoundaryLayersGrowthCombo ->setCurrentIndex( data.myBoundaryLayersGrowth );
+  myElementGenerationCombo ->setCurrentIndex( data.myElementGeneration );
   myAddMultinormalsCheck -> setChecked ( data.myAddMultinormals );
   mySmoothNormalsCheck -> setChecked ( data.mySmoothNormals );
   myHeightFirstLayerSpin -> setValue( data.myHeightFirstLayer );
@@ -1728,8 +1744,9 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData
   h_data.myInitialMemory              = h->GetInitialMemory();
   h_data.myOptimizationLevel          = h->GetOptimizationLevel();
   
-  h_data.myBoundaryLayersInward = h->GetBoundaryLayersInward();
-  h_data.myElemGenTetraDominant = h->GetElemGenTetraDominant();
+  h_data.myCollisionMode = h->GetCollisionMode();
+  h_data.myBoundaryLayersGrowth = h->GetBoundaryLayersGrowth();
+  h_data.myElementGeneration = h->GetElementGeneration();
   h_data.myAddMultinormals = h->GetAddMultinormals();
   h_data.mySmoothNormals = h->GetSmoothNormals();
   h_data.myHeightFirstLayer = h->GetHeightFirstLayer();
@@ -1819,10 +1836,13 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
     if ( h->GetOptimizationLevel() != h_data.myOptimizationLevel )
       h->SetOptimizationLevel( h_data.myOptimizationLevel );
     
-    if ( h->GetBoundaryLayersInward() != h_data.myBoundaryLayersInward )
-      h->SetBoundaryLayersInward       ( h_data.myBoundaryLayersInward );
-    if ( h->GetElemGenTetraDominant() != h_data.myElemGenTetraDominant )
-      h->SetElemGenTetraDominant       ( h_data.myElemGenTetraDominant );
+    if ( h->GetCollisionMode() != h_data.myCollisionMode )
+      h->SetCollisionMode(        h_data.myCollisionMode );
+    if ( h->GetBoundaryLayersGrowth() != h_data.myBoundaryLayersGrowth )
+      h->SetBoundaryLayersGrowth(        h_data.myBoundaryLayersGrowth );
+    if ( h->GetElementGeneration() != h_data.myElementGeneration )
+      h->SetElementGeneration(        h_data.myElementGeneration );
+
     if ( h->GetAddMultinormals() != h_data.myAddMultinormals )
       h->SetAddMultinormals       ( h_data.myAddMultinormals );
     if ( h->GetSmoothNormals() != h_data.mySmoothNormals )
@@ -1950,8 +1970,9 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD
   h_data.myInitialMemory              = myAdvWidget->initialMemoryCheck->isChecked() ? myAdvWidget->initialMemorySpin->value() : -1;
   h_data.myOptimizationLevel          = myOptimizationLevelCombo->currentIndex();
   
-  h_data.myBoundaryLayersInward = myBoundaryLayersInwardCheck->isChecked();
-  h_data.myElemGenTetraDominant = myElemGenTetraDominantCheck->isChecked();
+  h_data.myCollisionMode        = myCollisionModeCombo->currentIndex();
+  h_data.myBoundaryLayersGrowth = myBoundaryLayersGrowthCombo->currentIndex();
+  h_data.myElementGeneration = myElementGenerationCombo->currentIndex();
   h_data.myAddMultinormals = myAddMultinormalsCheck->isChecked();
   h_data.mySmoothNormals = mySmoothNormalsCheck->isChecked();
   
index 55e230ee2c08f33ec7b09ec3bb5870211faa885f..9014cbddd1d095d5e7848e263298123583c1ba48 100644 (file)
@@ -141,18 +141,22 @@ typedef std::set< TEnfMesh*, CompareEnfMeshes > TEnfMeshList;
 
 typedef struct
 {
-  bool    myToMeshHoles,myToMakeGroupsOfDomains,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery,myFEMCorrection,myRemoveInitialCentralPoint,
+  bool    myToMeshHoles, myToMakeGroupsOfDomains,
+          myKeepFiles, myToCreateNewNodes,
+          myBoundaryRecovery, myFEMCorrection,
+          myRemoveInitialCentralPoint,
           myLogInStandardOutput, myRemoveLogOnSuccess;
   double  myMaximumMemory,myInitialMemory;
   int     myOptimizationLevel;
+  int     myCollisionMode;
+  int     myBoundaryLayersGrowth;
+  int     myElementGeneration;
   QString myName,myWorkingDir,myTextOption;
   double  myGradation;
   short   myVerboseLevel;
   TEnfVertexList myEnforcedVertices;
   TEnfMeshList myEnforcedMeshes;
-  bool    myBoundaryLayersInward,
-          myElemGenTetraDominant,
-          myAddMultinormals,
+  bool    myAddMultinormals,
           mySmoothNormals;
   double  myHeightFirstLayer,
           myBoundaryLayersProgression,
@@ -223,8 +227,9 @@ private:
   QCheckBox*          myToMeshHolesCheck;
   QCheckBox*          myToMakeGroupsOfDomains;
   QComboBox*          myOptimizationLevelCombo;
-  QCheckBox*          myBoundaryLayersInwardCheck;
-  QCheckBox*          myElemGenTetraDominantCheck;
+  QComboBox*          myCollisionModeCombo;
+  QComboBox*          myBoundaryLayersGrowthCombo;
+  QComboBox*          myElementGenerationCombo;
   QCheckBox*          myAddMultinormalsCheck;
   QCheckBox*          mySmoothNormals;
   QWidget*            myAdvGroup;
index d9e22f301e1331e13f9b47a7da01dfc19261f23a..08d3254b48a552349bb7de62df0e8f1cca957340 100644 (file)
         <translation>Hypothesis Construction</translation>
     </message>
     <message>
-        <source>HYBRID_LAYERS_INWARD</source>
-        <translation>Inward growth of boundary layers</translation>
+        <source>HYBRID_BOUNDARY_LAYERS_GROWTH</source>
+        <translation>Growth of boundary layers</translation>
     </message>
     <message>
-        <source>HYBRID_LAYERS_Outward</source>
-        <translation>Outward growth growth of boundary layers if deselected</translation>
+        <source>HYBRID_LAYER_GROWTH_INWARD</source>
+        <translation>Inward growth</translation>
     </message>
     <message>
-        <source>HYBRID_TETRA_DOMINANT</source>
-        <translation>Mesh with tetrahedra in the remaining volume</translation>
+        <source>HYBRID_LAYER_GROWTH_OUTWARD</source>
+        <translation>Outward growth</translation>
+    </message>
+    <message>
+        <source>HYBRID_GENERATION_ELEMENT</source>
+        <translation>Element type for mesh in the remaining volume</translation>
+    </message>
+    <message>
+        <source>HYBRID_GENERATION_TETRA_DOMINANT</source>
+        <translation>Tetrahedra dominant</translation>
+    </message>
+    <message>
+        <source>HYBRID_GENERATION_HEXA_DOMINANT</source>
+        <translation>Hexahedra dominant</translation>
     </message>
     <message>
         <source>HYBRID_ADD_MULTINORMALS</source>
         <source>KEEP_WORKING_FILES</source>
         <translation>Keep all working files</translation>
     </message>
+    <message>
+        <source>COLLISION_MODE</source>
+        <translation>Behavior in case of collision between layers</translation>
+    </message>
+    <message>
+        <source>COLLISION_DECREASE</source>
+        <translation>Decrease height of layers</translation>
+    </message>
+    <message>
+        <source>COLLISION_STOP</source>
+        <translation>Reduce number of layers locally</translation>
+    </message>
     <message>
         <source>LEVEL_NONE</source>
         <translation>None</translation>
index b2890709a904219224c13a94edbc67bc1784fc85..4bf9d22cb9208ee8168b25a06e780fc7e187f613 100644 (file)
@@ -39,6 +39,15 @@ None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization
 # V4.1 (partialy redefines V3.1). Issue 0020574
 None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization, Strong_Optimization = 0,1,2,3,4
 
+# Collision Mode
+Decrease_Collision_Mode, Stop_Collision_Mode = 0,1
+
+# Boundary Layers growing inward or outward.
+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
+
 #----------------------------
 # Mesh algo type identifiers
 #----------------------------
@@ -124,18 +133,34 @@ class HYBRID_Algorithm(Mesh_Algorithm):
         pass
     """
 
+    ## Set Collision Mode:
+    #  @param mode Collision Mode, one of the following values
+    #  - Decrease_Collision_Mode
+    #  - Stop_Collision_Mode
+    #  .
+    #  Default is Decrease_Collision_Mode
+    def SetCollisionMode(self, mode):
+        self.Parameters().SetCollisionMode(mode)
+        pass
+
     ## To mesh Boundary Layers growing inward or outward.
-    # Default is inward.
-    # @param inward boolean value
-    def SetBoundaryLayersInward(self, inward):
-        self.Parameters().SetBoundaryLayersInward(inward)
+    #  @param mode, one of the following values
+    #  - Layer_Growth_Inward
+    #  - Layer_Growth_Outward
+    #  .
+    #  Default is Layer_Growth_Inward
+    def SetBoundaryLayersGrowth(self, mode):
+        self.Parameters().SetBoundaryLayersGrowth(mode)
         pass
 
-    ## To mesh with element type Tetra Dominant or hexa Dominant in the boundary layers. 
-    # Default is Tetra Dominant.
-    # @param tetraDominant boolean value
-    def SetElemGenTetraDominant(self, tetraDominant);
-        self.Parameters().SetElemGenTetraDominant(tetraDominant)
+    ## To mesh with element type Tetra Dominant or hexa Dominant in the remaining volume (outside layers).
+    #  @param mode, one of the following values
+    #  - Generation_Tetra_Dominant
+    #  - Generation_Hexa_Dominant
+    #  .
+    # Default is Generation_Tetra_Dominant
+    def SetElementGeneration(self, mode);
+        self.Parameters().SetElementGeneration(mode)
         pass
 
     ## To mesh adding extra normals at opening ridges and corners.
index 9153b2bf2280b299610b0f9aaebf96c4e3ec2371..da2e0ab342381bfb1c9edf07a93df6c23e388144 100644 (file)
@@ -3303,8 +3303,8 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   TCollection_AsciiString cmd = TCollection_AsciiString((char*)HYBRIDPlugin_Hypothesis::CommandToRun( _hyp, false ).c_str());
 
   cmd += TCollection_AsciiString(" --in ") + aGMFFileName;
-  if ( nbEnforcedVertices + nbEnforcedNodes)
-    cmd += TCollection_AsciiString(" --required_vertices ") + aGenericNameRequired;
+  //if ( nbEnforcedVertices + nbEnforcedNodes)
+  //  cmd += TCollection_AsciiString(" --required_vertices ") + aGenericNameRequired;
   cmd += TCollection_AsciiString(" --out ") + aResultFileName;
   if ( !_logInStandardOutput )
     cmd += TCollection_AsciiString(" 1>" ) + aLogFileName;  // dump into file
index 9fd8e6dc70f12d34518a306a1440e2dfb004f032..8fb9b6347b61ba33c7e7294af79bbbd7acb37109 100644 (file)
@@ -46,8 +46,9 @@ HYBRIDPlugin_Hypothesis::HYBRIDPlugin_Hypothesis(int hypId, int studyId, SMESH_G
   myMaximumMemory(-1),
   myInitialMemory(-1),
   myOptimizationLevel(DefaultOptimizationLevel()),
-  myBoundaryLayersInward(DefaultBoundaryLayersInward()),
-  myElemGenTetraDominant(DefaultElemGenTetraDominant()),
+  myCollisionMode(DefaultCollisionMode()),
+  myBoundaryLayersGrowth(DefaultBoundaryLayersGrowth()),
+  myElementGeneration(DefaultElementGeneration()),
   myAddMultinormals(DefaultAddMultinormals()),
   mySmoothNormals(DefaultSmoothNormals()),
   myHeightFirstLayer(DefaultHeightFirstLayer()),
@@ -198,59 +199,71 @@ void HYBRIDPlugin_Hypothesis::SetOptimizationLevel(OptimizationLevel level)
 //=======================================================================
 //function : GetOptimizationLevel
 //=======================================================================
-
 HYBRIDPlugin_Hypothesis::OptimizationLevel HYBRIDPlugin_Hypothesis::GetOptimizationLevel() const
 {
   return (OptimizationLevel) myOptimizationLevel;
 }
 
-
 //=======================================================================
-//function : SetBoundaryLayersInward
+//function : SetCollisionMode
 //=======================================================================
-
-void HYBRIDPlugin_Hypothesis::SetBoundaryLayersInward(bool toBoundaryLayersInward)
+void HYBRIDPlugin_Hypothesis::SetCollisionMode(CollisionMode mode)
 {
-  if ( myBoundaryLayersInward != toBoundaryLayersInward ) {
-    myBoundaryLayersInward = toBoundaryLayersInward;
+  if ( myCollisionMode != mode ) {
+    myCollisionMode = mode;
     NotifySubMeshesHypothesisModification();
   }
 }
 
 //=======================================================================
-//function : GetBoundaryLayersInward
+//function : GetCollisionMode
 //=======================================================================
+HYBRIDPlugin_Hypothesis::CollisionMode HYBRIDPlugin_Hypothesis::GetCollisionMode() const
+{
+  return (CollisionMode) myCollisionMode;
+}
 
-bool HYBRIDPlugin_Hypothesis::GetBoundaryLayersInward() const
+//=======================================================================
+//function : SetBoundaryLayersGrowth
+//=======================================================================
+void HYBRIDPlugin_Hypothesis::SetBoundaryLayersGrowth(BoundaryLayersGrowth mode)
 {
-  return myBoundaryLayersInward;
+  if ( myBoundaryLayersGrowth != mode ) {
+    myBoundaryLayersGrowth = mode;
+    NotifySubMeshesHypothesisModification();
+  }
 }
 
 //=======================================================================
-//function : SetElemGenTetraDominant
+//function : GetBoundaryLayersGrowth
 //=======================================================================
+HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth HYBRIDPlugin_Hypothesis::GetBoundaryLayersGrowth() const
+{
+  return (BoundaryLayersGrowth) myBoundaryLayersGrowth;
+}
 
-void HYBRIDPlugin_Hypothesis::SetElemGenTetraDominant(bool toElemGenTetraDominant)
+//=======================================================================
+//function : SetElementGeneration
+//=======================================================================
+void HYBRIDPlugin_Hypothesis::SetElementGeneration(ElementGeneration mode)
 {
-  if ( myElemGenTetraDominant != toElemGenTetraDominant ) {
-    myElemGenTetraDominant = toElemGenTetraDominant;
+  if ( myElementGeneration != mode ) {
+    myElementGeneration = mode;
     NotifySubMeshesHypothesisModification();
   }
 }
 
 //=======================================================================
-//function : GetElemGenTetraDominant
+//function : GetElementGeneration
 //=======================================================================
-
-bool HYBRIDPlugin_Hypothesis::GetElemGenTetraDominant() const
+HYBRIDPlugin_Hypothesis::ElementGeneration HYBRIDPlugin_Hypothesis::GetElementGeneration() const
 {
-  return myElemGenTetraDominant;
+  return (ElementGeneration) myElementGeneration;
 }
 
 //=======================================================================
 //function : SetAddMultinormals
 //=======================================================================
-
 void HYBRIDPlugin_Hypothesis::SetAddMultinormals(bool toAddMultinormals)
 {
   if ( myAddMultinormals != toAddMultinormals ) {
@@ -1068,9 +1081,32 @@ double  HYBRIDPlugin_Hypothesis::DefaultInitialMemory()
 }
 
 //=======================================================================
-//function : DefaultOptimizationLevel
+//function : DefaultCollisionMode
 //=======================================================================
+short  HYBRIDPlugin_Hypothesis::DefaultCollisionMode()
+{
+  return Decrease;
+}
 
+//=======================================================================
+//function : DefaultBoundaryLayersGrowth
+//=======================================================================
+short  HYBRIDPlugin_Hypothesis::DefaultBoundaryLayersGrowth()
+{
+  return Layer_Growth_Inward;
+}
+
+//=======================================================================
+//function : DefaultElementGeneration
+//=======================================================================
+short  HYBRIDPlugin_Hypothesis::DefaultElementGeneration()
+{
+  return Generation_Tetra_Dominant;
+}
+
+//=======================================================================
+//function : DefaultOptimizationLevel
+//=======================================================================
 short  HYBRIDPlugin_Hypothesis::DefaultOptimizationLevel()
 {
   return Medium;
@@ -1189,22 +1225,6 @@ bool HYBRIDPlugin_Hypothesis::DefaultStandardOutputLog()
 //   return HYBRIDPlugin_Hypothesis::TID2SizeMap();
 // }
 
-//=======================================================================
-//function : DefaultBoundaryLayersInward
-//=======================================================================
-bool HYBRIDPlugin_Hypothesis::DefaultBoundaryLayersInward()
-{
-  return true;
-}
-
-//=======================================================================
-//function : DefaultElemGenTetraDominant
-//=======================================================================
-bool HYBRIDPlugin_Hypothesis::DefaultElemGenTetraDominant()
-{
-  return true;
-}
-
 //=======================================================================
 //function : DefaultAddMultinormals
 //=======================================================================
@@ -1259,8 +1279,8 @@ short HYBRIDPlugin_Hypothesis::DefaultNbOfBoundaryLayers()
 
 std::ostream & HYBRIDPlugin_Hypothesis::SaveTo(std::ostream & save)
 {
-  save << (int) myBoundaryLayersInward << " ";
-  save << (int) myElemGenTetraDominant << " ";
+  save << (int) myBoundaryLayersGrowth << " ";
+  save << (int) myElementGeneration << " ";
   save << (int) myAddMultinormals << " ";
   save << (int) mySmoothNormals << " ";
 
@@ -1361,13 +1381,13 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
 
   isOK = (load >> i);
   if (isOK)
-    myBoundaryLayersInward = (bool) i;
+    myBoundaryLayersGrowth = (short) i;
   else
     load.clear(ios::badbit | load.rdstate());
 
   isOK = (load >> i);
   if (isOK)
-    myElemGenTetraDominant = (bool) i;
+    myElementGeneration = (short) i;
   else
     load.clear(ios::badbit | load.rdstate());
 
@@ -1701,39 +1721,120 @@ bool HYBRIDPlugin_Hypothesis::SetParametersByDefaults(const TDefaults&  dflts,
 //================================================================================
 
 std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* hyp,
-                                                 const bool         hasShapeToMesh)
+                                                  const bool         hasShapeToMesh)
 {
   TCollection_AsciiString cmd = GetExeName().c_str();
   // check if any option is overridden by hyp->myTextOption
-  bool p_v     = hyp ? ( hyp->myTextOption.find("-v")  == std::string::npos ) : true;
-  //bool p_i     = hyp ? ( hyp->myTextOption.find("-i")  == std::string::npos ) : true;
-  bool p_o     = hyp ? ( hyp->myTextOption.find("-o")  == std::string::npos ) : true;
-  bool p_blsi  = hyp ? ( hyp->myTextOption.find("-blsi")  == std::string::npos ) : true;
-  bool p_blsd  = hyp ? ( hyp->myTextOption.find("-blsd")  == std::string::npos ) : true;
-  bool p_hotfl = hyp ? ( hyp->myTextOption.find("-hotfl")  == std::string::npos ) : true;
-  bool p_nobl  = hyp ? ( hyp->myTextOption.find("-nobl")  == std::string::npos ) : true;
-  bool p_blgp  = hyp ? ( hyp->myTextOption.find("-blgp")  == std::string::npos ) : true;
-  bool p_eg    = hyp ? ( hyp->myTextOption.find("-eg")  == std::string::npos ) : true;
-  bool p_am    = hyp ? ( hyp->myTextOption.find("-am")  == std::string::npos ) : true;
-  bool p_mat   = hyp ? ( hyp->myTextOption.find("-mat")  == std::string::npos ) : true;
-  bool p_sn    = hyp ? ( hyp->myTextOption.find("-sn")  == std::string::npos ) : true;
-
-  // verbose mode
-  if ( p_v && hyp ) {
-    cmd += " -v ";
+  bool p_h     = ( hyp->myTextOption.find("-h")  != std::string::npos );
+  bool p_v     = ( hyp->myTextOption.find("-v ")  != std::string::npos );
+  //bool p_i     = ( hyp->myTextOption.find("-i")  != std::string::npos );
+  //bool p_o     = ( hyp->myTextOption.find("-o")  != std::string::npos );
+  bool p_mnot  = ( hyp->myTextOption.find("--max_number_of_threads ")  != std::string::npos );
+  bool p_blsi  = ( hyp->myTextOption.find("--boundary_layers_surface_ids ")  != std::string::npos );
+  bool p_blii  = ( hyp->myTextOption.find("--boundary_layers_imprint_ids ")  != std::string::npos );
+  bool p_blsd  = ( hyp->myTextOption.find("--boundary_layers_subdomain_direction ")  != std::string::npos );
+  bool p_hotfl = ( hyp->myTextOption.find("--height_of_the_first_layer ")  != std::string::npos );
+  bool p_nobl  = ( hyp->myTextOption.find("--number_of_boundary_layers ")  != std::string::npos );
+  bool p_blgp  = ( hyp->myTextOption.find("--boundary_layers_geometric_progression ")  != std::string::npos );
+  bool p_eg    = ( hyp->myTextOption.find("--element_generation ")  != std::string::npos );
+  bool p_cm    = ( hyp->myTextOption.find("--collision_mode ")  != std::string::npos );
+  bool p_am    = ( hyp->myTextOption.find("--add_multinormals ")  != std::string::npos );
+  bool p_mat   = ( hyp->myTextOption.find("--multinormals_angle_threshold ")  != std::string::npos );
+  bool p_sn    = ( hyp->myTextOption.find("--smooth_normals ")  != std::string::npos );
+
+  //help mode
+  if ( p_h ) {
+    cmd += " --help ";
+#ifdef WIN32
+    cmd += " < NUL";
+#endif
+    std::cout << "!!!!! CommandToRun help only !!!! " << cmd.ToCString() << std::endl;
+    return cmd.ToCString();
+  }
+  
+  if ( !p_v && hyp ) {
+    cmd += " --verbose ";
     cmd += hyp->myVerboseLevel;
   }
 
-  // options as text
-  if ( hyp && !hyp->myTextOption.empty() ) {
-    cmd += " ";
-    cmd += (char*) hyp->myTextOption.c_str();
+  if ( !p_mnot && hyp ) {
+    cmd += " --max_number_of_threads ";
+    cmd += 8; //TODO getenv NB CPU
   }
-
+  
+  //if ( !p_blsi && hyp ) {
+  //  cmd += " --boundary_layers_surface_ids ";
+  //  cmd += 0; //TODO hyp->my;
+  //}
+  
+  //if ( !p_blii && hyp ) {
+  //  cmd += " --boundary_layers_imprint_ids ";
+  //  cmd += 0; //TODO hyp->my;
+  //}
+  
+  if ( !p_blsd && hyp ) {
+    if ( hyp->myBoundaryLayersGrowth >= 0 && hyp->myBoundaryLayersGrowth <= 1 ) {
+      const char* value[] = { "1" , "-1" };
+      cmd += " --boundary_layers_subdomain_direction ";
+      cmd += value[ hyp->myBoundaryLayersGrowth ];
+    }
+  }
+  
+  if ( !p_hotfl && hyp ) {
+    cmd += " --height_of_the_first_layer ";
+    cmd += hyp->myHeightFirstLayer;
+  }
+  
+  if ( !p_nobl && hyp ) {
+    cmd += " --number_of_boundary_layers ";
+    cmd += hyp->myNbOfBoundaryLayers;
+  }
+  
+  if ( !p_blgp && hyp ) {
+    cmd += " --boundary_layers_geometric_progression ";
+    cmd += hyp->myBoundaryLayersProgression;
+  }
+  
+  if ( !p_eg && hyp ) {
+    if ( hyp->myElementGeneration >= 0 && hyp->myElementGeneration <= 1 ) {
+      const char* value[] = { "tetra-dominant" , "hexa-dominant" };
+      cmd += " --element_generation ";
+      cmd += value[ hyp->myElementGeneration ];
+    }
+  }
+  
+  if ( !p_cm && hyp ) {
+    if ( hyp->myCollisionMode >= 0 && hyp->myCollisionMode <= 1 ) {
+      const char* value[] = { "decrease" , "stop" };
+      cmd += " --collision_mode ";
+      cmd += value[ hyp->myCollisionMode ];
+    }
+  }
+  
+  if ( !p_am && hyp ) {
+    int res = hyp->myAddMultinormals ? 0 : 1 ;
+    const char* value[] = { "yes" , "no" };
+    cmd += " --add_multinormals ";
+    cmd += value[ res ];
+  }
+  
+  if ( !p_mat && hyp ) {
+    cmd += " --multinormals_angle_threshold ";
+    cmd += hyp->myMultinormalsAngle;
+  }
+  
+  if ( !p_sn && hyp ) {
+    int res = hyp->mySmoothNormals ? 0 : 1 ;
+    const char* value[] = { "yes" , "no" };
+    cmd += " --smooth_normals ";
+    cmd += value[ res ];
+  }
+  
 #ifdef WIN32
   cmd += " < NUL";
 #endif
-
+  //std::cout << "!!!!!CommandToRun end " << cmd.ToCString() << std::endl;
+    
   return cmd.ToCString();
 }
 
index 05800242062969b055e58757ecb669fca5338b88..7a6b5c1a2d52a1a09104b78c545731b4f552d80c 100644 (file)
@@ -149,18 +149,24 @@ public:
   void SetOptimizationLevel(OptimizationLevel level);
   OptimizationLevel GetOptimizationLevel() const;
 
-    /*!
-     * To mesh Boundary Layers growing inward or outward.
-     * Default is inward.
-     */
-    void SetBoundaryLayersInward(bool toBoundaryLayersInward);
-    bool GetBoundaryLayersInward() const;
-    /*!
-     * To mesh with element type Tetra Dominant or hexa Dominant in the boundary layers. 
-     * Default is Tetra Dominant.
-     */
-    void SetElemGenTetraDominant(bool toElemGenTetraDominant);
-    bool GetElemGenTetraDominant() const;
+  /*!
+   * Collision Mode: 0-decrease, 1-stop. Default is decrease
+   */
+  enum CollisionMode { Decrease = 0, Stop };
+  void SetCollisionMode(CollisionMode level);
+  CollisionMode GetCollisionMode() const;
+  /*!
+   * BoundaryLayersGrowth: 0-Layer_Growth_Inward, 1-Layer_Growth_Outward. Default is Layer_Growth_Inward
+   */
+  enum BoundaryLayersGrowth { Layer_Growth_Inward = 0, Layer_Growth_Outward };
+  void SetBoundaryLayersGrowth(BoundaryLayersGrowth level);
+  BoundaryLayersGrowth GetBoundaryLayersGrowth() const;
+  /*!
+   * ElementGeneration: 0-Generation_Tetra_Dominant, 1-Generation_Hexa_Dominant. Default is Generation_Tetra_Dominant
+   */
+  enum ElementGeneration { Generation_Tetra_Dominant = 0, Generation_Hexa_Dominant };
+  void SetElementGeneration(ElementGeneration level);
+  ElementGeneration GetElementGeneration() const;
     /*!
      * To mesh adding extra normals at opening ridges and corners.
      * Default is no.
@@ -342,6 +348,9 @@ public:
   static double DefaultMaximumMemory();
   static double DefaultInitialMemory();
   static short  DefaultOptimizationLevel();
+  static short  DefaultCollisionMode();
+  static short  DefaultBoundaryLayersGrowth();
+  static short  DefaultElementGeneration();
   static std::string DefaultWorkingDirectory();
   static bool   DefaultKeepFiles();
   static short  DefaultVerboseLevel();
@@ -352,8 +361,6 @@ public:
   static bool   DefaultStandardOutputLog();
   static bool   DefaultRemoveLogOnSuccess();
   static double DefaultGradation();
-  static bool   DefaultBoundaryLayersInward();
-  static bool   DefaultElemGenTetraDominant();
   static bool   DefaultAddMultinormals();
   static bool   DefaultSmoothNormals();
   static short  DefaultNbOfBoundaryLayers();
@@ -400,6 +407,9 @@ private:
   double myMaximumMemory;
   double myInitialMemory;
   short  myOptimizationLevel;
+  short  myCollisionMode;
+  short  myBoundaryLayersGrowth;
+  short  myElementGeneration;
   bool   myKeepFiles;
   std::string myWorkingDirectory;
   short  myVerboseLevel;
@@ -412,8 +422,6 @@ private:
   std::string myTextOption;
   double myGradation;
 
-  bool    myBoundaryLayersInward;
-  bool    myElemGenTetraDominant;
   bool    myAddMultinormals;
   bool    mySmoothNormals;
   double  myHeightFirstLayer;
index 0a8cb7abf5b35eacb159f4160dff795e659317e0..47838aa88665421bd496c98252ebef251865cc7b 100644 (file)
@@ -185,6 +185,33 @@ CORBA::Short HYBRIDPlugin_Hypothesis_i::GetOptimizationLevel()
   return this->GetImpl()->GetOptimizationLevel();
 }
 
+
+//=======================================================================
+//function : SetCollisionMode
+//=======================================================================
+void HYBRIDPlugin_Hypothesis_i::SetCollisionMode(CORBA::Short level)
+  throw ( SALOME::SALOME_Exception )
+{
+  ::HYBRIDPlugin_Hypothesis::CollisionMode l =
+      (::HYBRIDPlugin_Hypothesis::CollisionMode) level;
+  if ( l < ::HYBRIDPlugin_Hypothesis::Decrease ||
+       l > ::HYBRIDPlugin_Hypothesis::Stop )
+    THROW_SALOME_CORBA_EXCEPTION( "Invalid collision mode",SALOME::BAD_PARAM );
+    
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetCollisionMode(l);
+  SMESH::TPythonDump() << _this() << ".SetCollisionMode( " << level << " )";
+}
+
+//=======================================================================
+//function : GetCollisionMode
+//=======================================================================
+CORBA::Short HYBRIDPlugin_Hypothesis_i::GetCollisionMode()
+{
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetCollisionMode();
+}
+
 //=======================================================================
 //function : SetWorkingDirectory
 //=======================================================================
@@ -426,41 +453,55 @@ CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
 }
 
 //=======================================================================
-//function : SetBoundaryLayersInward
+//function : SetBoundaryLayersGrowth
 //=======================================================================
-void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersInward(CORBA::Boolean toBoundaryLayersInward)
+void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersGrowth(CORBA::Short level)
+  throw ( SALOME::SALOME_Exception )
 {
+  ::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth l =
+      (::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth) level;
+  if ( l < ::HYBRIDPlugin_Hypothesis::Layer_Growth_Inward ||
+       l > ::HYBRIDPlugin_Hypothesis::Layer_Growth_Outward )
+    THROW_SALOME_CORBA_EXCEPTION( "Invalid BoundaryLayersGrowth mode",SALOME::BAD_PARAM );
+    
   ASSERT(myBaseImpl);
-  this->GetImpl()->SetBoundaryLayersInward(toBoundaryLayersInward);
-  SMESH::TPythonDump() << _this() << ".SetBoundaryLayersInward( " << toBoundaryLayersInward << " )";
+  this->GetImpl()->SetBoundaryLayersGrowth(l);
+  SMESH::TPythonDump() << _this() << ".SetBoundaryLayersGrowth( " << level << " )";
 }
 
 //=======================================================================
-//function : GetBoundaryLayersInward
+//function : GetBoundaryLayersGrowth
 //=======================================================================
-CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersInward()
+CORBA::Short HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersGrowth()
 {
   ASSERT(myBaseImpl);
-  return this->GetImpl()->GetBoundaryLayersInward();
+  return this->GetImpl()->GetBoundaryLayersGrowth();
 }
 
 //=======================================================================
-//function : SetElemGenTetraDominant
+//function : SetElementGeneration
 //=======================================================================
-void HYBRIDPlugin_Hypothesis_i::SetElemGenTetraDominant(CORBA::Boolean toElemGenTetraDominant)
+void HYBRIDPlugin_Hypothesis_i::SetElementGeneration(CORBA::Short level)
+  throw ( SALOME::SALOME_Exception )
 {
+  ::HYBRIDPlugin_Hypothesis::ElementGeneration l =
+      (::HYBRIDPlugin_Hypothesis::ElementGeneration) level;
+  if ( l < ::HYBRIDPlugin_Hypothesis::Generation_Tetra_Dominant ||
+       l > ::HYBRIDPlugin_Hypothesis::Generation_Hexa_Dominant )
+    THROW_SALOME_CORBA_EXCEPTION( "Invalid ElementGeneration mode",SALOME::BAD_PARAM );
+    
   ASSERT(myBaseImpl);
-  this->GetImpl()->SetElemGenTetraDominant(toElemGenTetraDominant);
-  SMESH::TPythonDump() << _this() << ".SetElemGenTetraDominant( " << toElemGenTetraDominant << " )";
+  this->GetImpl()->SetElementGeneration(l);
+  SMESH::TPythonDump() << _this() << ".SetElementGeneration( " << level << " )";
 }
 
 //=======================================================================
-//function : GetElemGenTetraDominant
+//function : GetElementGeneration
 //=======================================================================
-CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetElemGenTetraDominant()
+CORBA::Short HYBRIDPlugin_Hypothesis_i::GetElementGeneration()
 {
   ASSERT(myBaseImpl);
-  return this->GetImpl()->GetElemGenTetraDominant();
+  return this->GetImpl()->GetElementGeneration();
 }
 
 //=======================================================================
index 9359d3b60fd0e386dcc1694dde89d67129cc00fd..b85f96696a46b9fd38c1790462799b4c2b46f1d2 100644 (file)
@@ -78,6 +78,11 @@ class HYBRIDPLUGIN_EXPORT HYBRIDPlugin_Hypothesis_i:
    */
   void SetOptimizationLevel(CORBA::Short level) throw ( SALOME::SALOME_Exception );
   CORBA::Short GetOptimizationLevel();
+  /*!
+   * Collision Mode: 0-decrease, 1-stop. Default is decrease
+   */
+  void SetCollisionMode(CORBA::Short mode) throw ( SALOME::SALOME_Exception );
+  CORBA::Short GetCollisionMode();
   /*!
    * Path to working directory
    */
@@ -145,11 +150,11 @@ class HYBRIDPLUGIN_EXPORT HYBRIDPlugin_Hypothesis_i:
   void SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess);
   CORBA::Boolean GetRemoveLogOnSuccess();
   
-  void SetBoundaryLayersInward(CORBA::Boolean toBoundaryLayersInward);
-  CORBA::Boolean GetBoundaryLayersInward();
+  void SetBoundaryLayersGrowth(CORBA::Short mode) throw ( SALOME::SALOME_Exception );
+  CORBA::Short GetBoundaryLayersGrowth();
 
-  void SetElemGenTetraDominant(CORBA::Boolean toElemGenTetraDominant);
-  CORBA::Boolean GetElemGenTetraDominant();
+  void SetElementGeneration(CORBA::Short mode) throw ( SALOME::SALOME_Exception );
+  CORBA::Short GetElementGeneration();
 
   void SetAddMultinormals(CORBA::Boolean toAddMultinormals);
   CORBA::Boolean GetAddMultinormals();