]> SALOME platform Git repositories - plugins/hybridplugin.git/commitdiff
Salome HOME
Merge multi-study removal branch. Before_python3_27062017
authorrnv <rnv@opencascade.com>
Thu, 8 Jun 2017 15:04:03 +0000 (18:04 +0300)
committerrnv <rnv@opencascade.com>
Thu, 8 Jun 2017 15:49:36 +0000 (18:49 +0300)
32 files changed:
CMakeLists.txt
bin/mg-hybrid.bash
doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_advanced.png
doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_arguments.png
doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_faces.png [new file with mode: 0644]
doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_layers.png
doc/salome/gui/HYBRIDPLUGIN/input/hybrid_hypo.doc
doc/salome/gui/HYBRIDPLUGIN/static/footer.html
idl/HYBRIDPlugin_Algorithm.idl
src/GUI/HYBRIDPluginGUI_Enums.h
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_HYBRID.cxx
src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.hxx
src/HYBRIDPlugin/HYBRIDPlugin_HYBRID_i.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.hxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx
src/HYBRIDPlugin/HYBRIDPlugin_i.cxx
src/HYBRIDPlugin/MG_HYBRID_API.cxx
src/HYBRIDPlugin/MG_HYBRID_API.hxx
tests/CMakeLists.txt [new file with mode: 0755]
tests/test_cartesian_core_size.py [new file with mode: 0644]
tests/test_enforced_mesh.py [new file with mode: 0644]
tests/test_layers_imprinting.py [new file with mode: 0644]
tests/test_layers_imprinting_hexa_core.py [new file with mode: 0644]
tests/test_mg_hybrid_pyramids.py [new file with mode: 0644]

index bc4f2bef934a90631c3939fe9a563c89a02065c9..ba5521726ce10a19b6655b5dfdae2726d3a77237 100755 (executable)
@@ -31,7 +31,7 @@ ENDIF(WIN32)
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
 
 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 1)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 3)
 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
 SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
@@ -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 5ade12618def133eaf96caddc4e49b96722f79fb..a511bdb37e29e13f9a2f40185e0de14ad2810aef 100755 (executable)
@@ -42,5 +42,5 @@ $MESHGEMS_ROOT_DIR/bin/run_mg-hybrid.sh $*
 #$MESHGEMS_ROOT_DIR/bin/Linux_64/mg-hybrid.exe $*
 
 #to EZ and direct debug visualization (with gui salome load script createGroupsOnEntitiesFromGMFFile.py)
-cp -f $resFindOutFile /tmp/tmp.mesh
+#cp -f $resFindOutFile /tmp/tmp.mesh
 
index 956ade5406a004c9be2fbf6ecd0d63f44e2b9172..0891faaa49efc415eef516242f7d2288d423f123 100644 (file)
Binary files a/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_advanced.png and b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_advanced.png differ
index a3a67c07d81b8c9292b11879226229d7e26588eb..d6c2c431b9a46333b4b08dfa58f342640588a2a3 100644 (file)
Binary files a/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_arguments.png and b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_arguments.png differ
diff --git a/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_faces.png b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_faces.png
new file mode 100644 (file)
index 0000000..7f0a84f
Binary files /dev/null and b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_faces.png differ
index aca9fdc15a53ebc84b68d6ead2e0008d3a15ac7b..736847ff71cd94f78e0d52dcd944b3fd06af9689 100644 (file)
Binary files a/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_layers.png and b/doc/salome/gui/HYBRIDPLUGIN/images/hybrid_hypothesis_layers.png differ
index 77e5b8ef6d94e0b6dac057fadf6b17abd2f84497..71ada995cbd0dd8d303b7c5c46b7234b09a8e64d 100644 (file)
@@ -198,8 +198,6 @@ MG-HYBRID USAGE
         EMail: <support@distene.com> )
 
 \endverbatim
-\n
-- <b>Limitations</b> - Some of the MG-Hybrid parameters can not be changed in SALOME and are set to their default values. The parameters concerned are the following : global_physical_size, boundary_layer_size_mode, boundary_layer_initial_height_on_surface_tags, boundary_layer_max_element_angle and optimisation.
 
 \ref hybrid_top "Back to top"
 
@@ -258,6 +256,20 @@ Pay attention: theses groups should be defined
 into the shell mesh from a previous group defined in the geometry.
 
 
+\ref hybrid_top "Back to top"
+
+\section hybrid_layers_faces Faces with layers
+
+\image html hybrid_hypothesis_faces.png
+
+In case of a mesh based on geometry, if <b>Mesh layers on all wrap</b>
+on <b>Layers meshes</b> tab is unchecked, you can specify geometrical
+faces on which boundary layers should be constructed. After clicking
+\a Selection button (arrow) you can select faces either in the
+Viewer or in the Object Browser. \b Add button adds IDs of the
+selected faces to the <b>Face IDs</b> list. \b Remove button removes
+selected IDs from the list.
+
 <br><b>See Also</b> a sample TUI Script of the \ref tui_hybrid "creation of a MG-Hybrid hypothesis".
 
 \ref hybrid_top "Back to top"
index de6db6a6c6d55ea90befc28cce87b52271f01395..b52879b324cd1a20463b652cf748696954337439 100755 (executable)
@@ -4,7 +4,7 @@
   <ul>
     $navpath
     <li class="footer">
-      Copyright &copy; 2007-2016  CEA/DEN, EDF R&amp;D<br>
+      Copyright &copy; 2007-2017  CEA/DEN, EDF R&amp;D<br>
     </li>
   </ul>
 </div>
index 7f6233a1c2cfdb293cff630c35d6f93462aed736..a226d813d464ecd51decf335d44d2c4dd590f285 100644 (file)
@@ -78,6 +78,16 @@ module HYBRIDPlugin
      */
     void SetLayersOnAllWrap(in boolean toMesh);
     boolean GetLayersOnAllWrap();
+    /*!
+     * To mesh layers on given faces.
+     */
+    void SetFacesWithLayers(in SMESH::long_array faceIDs);
+    SMESH::long_array GetFacesWithLayers();
+    /*!
+     * To imprint layers on given faces.
+     */
+    void SetFacesWithImprinting(in SMESH::long_array faceIDs);
+    SMESH::long_array GetFacesWithImprinting();
     /*!
      * To make groups of volumes of different domains when mesh is generated from skin.
      * Default is to make groups.
@@ -116,7 +126,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();
@@ -144,6 +154,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 8b2bf776b463b4e8effe016f617b6a1db97e78b2..629d4b14736f710799c49835eb12e01a959b126a 100644 (file)
@@ -29,7 +29,8 @@
 enum {
   STD_TAB = 0,
   ADV_TAB,
-  ENF_VER_TAB,
+  FACE_SEL_LAYERS_TAB,
+  FACE_SEL_IMPRINTING_TAB,
   ENF_MESH_TAB
 };
 
index 820bd432b5813b2d0ffa04c606b718c7ad5ffc63..20b21ce927476cef686a47ea22fdcddfd7c08afe 100644 (file)
 
 #include <GeometryGUI.h>
 
-#include <SMESHGUI_Utils.h>
-#include <SMESHGUI_SpinBox.h>
 #include <SMESHGUI_HypothesesUtils.h>
+#include <SMESHGUI_SpinBox.h>
+#include <SMESHGUI_Utils.h>
 #include <SMESH_NumberFilter.hxx>
 #include <SMESH_TypeFilter.hxx>
 #include <StdMeshersGUI_ObjectReferenceParamWdg.h>
+#include <StdMeshersGUI_SubShapeSelectorWdg.h>
 
 #include <LightApp_SelectionMgr.h>
 #include <SUIT_Session.h>
@@ -350,9 +351,8 @@ HYBRIDPluginGUI_HypothesisCreator::~HYBRIDPluginGUI_HypothesisCreator()
 GeomSelectionTools* HYBRIDPluginGUI_HypothesisCreator::getGeomSelectionTool()
 {
   HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_HypothesisCreator*)this;
-  _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-  if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) {
-    that->GeomToolSelected = new GeomSelectionTools(aStudy);
+  if (that->GeomToolSelected == NULL) {
+    that->GeomToolSelected = new GeomSelectionTools();
   }
   return that->GeomToolSelected;
 }
@@ -414,7 +414,7 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
   aStdLayout->addWidget( myBoundaryLayersGrowthCombo, row++, 1, 1, 1 );
   
   QStringList typesBoundaryLayersGrowth;
-  typesBoundaryLayersGrowth << tr( "HYBRID_LAYER_GROWTH_UPWARD" ) << tr( "HYBRID_LAYER_GROWTH_DOWNWARD" );
+  typesBoundaryLayersGrowth << tr( "HYBRID_LAYER_GROWTH_DOWNWARD" ) << tr( "HYBRID_LAYER_GROWTH_UPWARD" );
   myBoundaryLayersGrowthCombo->addItems( typesBoundaryLayersGrowth );
   
   aStdLayout->addWidget( new QLabel( tr( "HYBRID_HeightFirstLayer" ), myStdGroup ), row, 0, 1, 1 );
@@ -444,9 +444,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 );
   
@@ -601,7 +606,6 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
 
   // Enforced meshes parameters
   myEnfMeshGroup = new QWidget();
-  myLayersOnAllWrapCheck = new QCheckBox( tr( "HYBRID_LAYERS_ON_ALL_WRAP" ), myEnfMeshGroup );
   QGridLayout* anEnfMeshLayout = new QGridLayout(myEnfMeshGroup);
   
   myEnforcedMeshTableWidget = new QTableWidget(myEnfGroup);
@@ -665,8 +669,8 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
   // GroupBox2VLayout->addWidget( info2 );
   
   // anEnfMeshLayout->addWidget( GroupBox2,                ENF_MESH_WARNING, 0, 1, 2 );
-  anEnfMeshLayout->addWidget(myLayersOnAllWrapCheck, ENF_MESH_MESH, 0, 1 , 1);
-  anEnfMeshLayout->addWidget(myEnforcedMeshTableWidget, ENF_MESH_MESH+1, 0, ENF_MESH_NB_LINES , 1);
+  //anEnfMeshLayout->addWidget(myLayersOnAllWrapCheck, ENF_MESH_MESH, 0, 1 , 1);
+  anEnfMeshLayout->addWidget(myEnforcedMeshTableWidget, ENF_MESH_MESH, 0, ENF_MESH_NB_LINES , 1);
   
   QGridLayout* anEnfMeshLayout2 = new QGridLayout(myEnfMeshGroup);
   anEnfMeshLayout2->addWidget(myEnfMeshWdg,             ENF_MESH_MESH, 0, 1, 2);
@@ -679,19 +683,54 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
   anEnfMeshLayout2->addWidget(removeEnfMeshButton,      ENF_MESH_BTN, 1, 1, 1);
   anEnfMeshLayout2->setRowStretch(ENF_MESH_NB_LINES, 1);
   
-  anEnfMeshLayout->addLayout(anEnfMeshLayout2,          ENF_MESH_MESH+1, 1, ENF_MESH_NB_LINES, 1);
+  anEnfMeshLayout->addLayout(anEnfMeshLayout2,          ENF_MESH_MESH, 1, ENF_MESH_NB_LINES, 1);
   anEnfMeshLayout->setRowStretch(ENF_MESH_MESH, 10);
 
-  
+
+  // selection of faces for layers
+
+  QWidget* faceSelLayersGroup = new QWidget( dlg() );
+  myLayersOnAllWrapCheck = new QCheckBox( tr( "HYBRID_LAYERS_ON_ALL_WRAP" ), faceSelLayersGroup );
+  QGridLayout* faceSelLayersLayout = new QGridLayout( faceSelLayersGroup );
+  faceSelLayersLayout->addWidget(myLayersOnAllWrapCheck, 0, 0 );
+
+  myFacesLbl = new QLabel( tr("HYBRID_FACE_IDS"), faceSelLayersGroup );
+  faceSelLayersLayout->addWidget( myFacesLbl, 1, 0 );
+
+  myFaceSelectorLayers = new StdMeshersGUI_SubShapeSelectorWdg( faceSelLayersGroup, TopAbs_FACE, true, true );
+  QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+  QString aSubEntry  = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+  myFaceSelectorLayers->SetGeomShapeEntry( aSubEntry, aMainEntry );
+  faceSelLayersLayout->addWidget( myFaceSelectorLayers, 2, 0);
+  faceSelLayersLayout->setRowStretch( 2, 10);
+
+  // selection of faces for imprinting
+
+  QWidget* faceSelImprintingGroup = new QWidget( dlg() );
+  QGridLayout* faceSelImprintingLayout = new QGridLayout( faceSelImprintingGroup );
+
+  QLabel* facesLblImprinting = new QLabel( tr("HYBRID_FACE_IDS"), faceSelImprintingGroup );
+  faceSelImprintingLayout->addWidget( facesLblImprinting, 0, 0 );
+
+  myFaceSelectorImprinting = new StdMeshersGUI_SubShapeSelectorWdg( faceSelImprintingGroup, TopAbs_FACE, true, true );
+  myFaceSelectorImprinting->SetGeomShapeEntry( aSubEntry, aMainEntry );
+  faceSelImprintingLayout->addWidget( myFaceSelectorImprinting, 1, 0, 2, 2 );
+  faceSelImprintingLayout->setRowStretch( 1, 10);
+
   // add tabs
   tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
   tab->insertTab( ADV_TAB, myAdvGroup, tr( "HYBRID_ADV_ARGS" ) );
-  //TODO remove or er usmay be lateful to select layers...
-  //tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "HYBRID_ENFORCED_VERTICES" ) );
+  if ( aMainEntry.isEmpty() && aSubEntry.isEmpty() ) // mesh not based of geometry
+    faceSelLayersGroup->hide();
+  else {
+    tab->insertTab( FACE_SEL_LAYERS_TAB, faceSelLayersGroup, tr( "HYBRID_FACES_LAYERS_TAB" ));
+    tab->insertTab( FACE_SEL_IMPRINTING_TAB, faceSelImprintingGroup, tr( "HYBRID_FACES_IMPRINTING_TAB" ));
+  }
   tab->insertTab( ENF_MESH_TAB, myEnfMeshGroup, tr( "HYBRID_ENFORCED_MESHES" ) );
   tab->setCurrentIndex( STD_TAB );
 
   // connections
+  connect( tab,              SIGNAL( currentChanged ( int )),       this,         SLOT( onTabChanged( int ) ) );
   //connect( myLayersOnAllWrapCheck,      SIGNAL( toggled( bool ) ), this, SLOT( onLayersOnAllWrap(bool)));
   connect( myLayersOnAllWrapCheck,      SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
   //connect( myToMeshHolesCheck,      SIGNAL( toggled( bool ) ), this, SLOT( onToMeshHoles(bool)));
@@ -794,7 +833,6 @@ This method updates the tooltip of a modified item. The QLineEdit widgets conten
 is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
 */
 void HYBRIDPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetItem* item) {
-//   MESSAGE("HYBRIDPluginGUI_HypothesisCreator::updateEnforcedVertexValues");
   int row = myEnforcedTableWidget->row(item);
       
   QVariant vertexName = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole);
@@ -825,7 +863,6 @@ void HYBRIDPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetI
     if (!groupName.isEmpty())
       toolTip += QString(" [") + groupName + QString("]");
 
-//     MESSAGE("Tooltip: " << toolTip.toStdString());
     for (int col=0;col<ENF_VER_NB_COLUMNS;col++)
       myEnforcedTableWidget->item(row,col)->setToolTip(toolTip);
 
@@ -966,7 +1003,6 @@ This method adds in the tree widget an enforced mesh from mesh, submesh or group
 */
 void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName)
 {
-  MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", \"" << groupName << "\")");
   bool okToCreate = true;
   QString itemEntry = "";
   int itemElementType = 0;
@@ -974,23 +1010,19 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s
   bool allColumns = true;
   for (int row = 0;row<rowCount;row++) {
     for (int col = 0 ; col < ENF_MESH_NB_COLUMNS ; col++) {
-      MESSAGE("col: " << col);
       if (col == ENF_MESH_CONSTRAINT_COLUMN){
         if (qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col)) == 0) {
           allColumns = false;
-          MESSAGE("allColumns = false");
           break;
         }
       }
       else if (myEnforcedMeshTableWidget->item(row, col) == 0) {
         allColumns = false;
-        MESSAGE("allColumns = false");
         break;
       }
       if (col == ENF_MESH_CONSTRAINT_COLUMN) {
         QComboBox* itemComboBox = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col));
         itemElementType = itemComboBox->currentIndex();
-        MESSAGE("itemElementType: " << itemElementType);
       }
       else if (col == ENF_MESH_ENTRY_COLUMN)
         itemEntry = myEnforcedMeshTableWidget->item(row, col)->data(Qt::EditRole).toString();
@@ -1002,7 +1034,6 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s
     if (itemEntry == QString(entry.c_str()) && itemElementType == elementType) { 
 //       // update group name
 //       if (itemGroupName.toStdString() != groupName) {
-//         MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
 //         myEnforcedMeshTableWidget->item(row, ENF_MESH_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
 //       }
       okToCreate = false;
@@ -1014,13 +1045,11 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s
   if (!okToCreate)
     return;
   
-  MESSAGE("Creation of enforced mesh");
 
   myEnforcedMeshTableWidget->setRowCount(rowCount+1);
   myEnforcedMeshTableWidget->setSortingEnabled(false);
   
   for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
-    MESSAGE("Column: " << col);
     if (col == ENF_MESH_CONSTRAINT_COLUMN) {
       QComboBox* comboBox = new QComboBox();
       QPalette pal = comboBox->palette();
@@ -1029,7 +1058,6 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s
       comboBox->insertItems(0,myEnfMeshConstraintLabels);
       comboBox->setEditable(false);
       comboBox->setCurrentIndex(elementType);
-      MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
       myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
     }
     else {
@@ -1039,25 +1067,21 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s
         case ENF_MESH_NAME_COLUMN:
           item->setData( 0, name.c_str() );
           item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           myEnforcedMeshTableWidget->setItem(rowCount,col,item);
           break;
         case ENF_MESH_ENTRY_COLUMN:
           item->setData( 0, entry.c_str() );
           item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           myEnforcedMeshTableWidget->setItem(rowCount,col,item);
           break;
         case ENF_MESH_GROUP_COLUMN:
           item->setData( 0, groupName.c_str() );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           myEnforcedMeshTableWidget->setItem(rowCount,col,item);
           break;
         default:
           break;
       }
     }
-    MESSAGE("Done");
   }
 
 //   connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this,  SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
@@ -1073,7 +1097,6 @@ This method adds in the tree widget an enforced vertex with given size and coord
 */
 void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z, double size, std::string vertexName, std::string geomEntry, std::string groupName, bool isCompound)
 {
-  MESSAGE("addEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ", \"" << vertexName << ", \"" << geomEntry << "\", \"" << groupName << "\", " << isCompound << ")");
   myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
   bool okToCreate = true;
   double itemX,itemY,itemZ,itemSize = 0;
@@ -1127,12 +1150,10 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do
     if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) || /*( (itemEntry.toStdString() != "") && */ (itemEntry.toStdString() == geomEntry)/*)*/) {
       // update size
       if (itemSize != size) {
-        MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
         myEnforcedTableWidget->item(row, ENF_VER_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size));
       }
       // update group name
       if (itemGroupName.toStdString() != groupName) {
-        MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
         myEnforcedTableWidget->item(row, ENF_VER_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
       }
       okToCreate = false;
@@ -1141,19 +1162,15 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do
   } // for
   if (!okToCreate) {
     if (geomEntry.empty()) {
-      MESSAGE("Vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
     }
     else {
-      MESSAGE("Vertex with entry " << geomEntry << " already exist: dont create again");
     }
     return;
   }
     
   if (geomEntry.empty()) {
-    MESSAGE("Vertex with coords " << x << ", " << y << ", " << z<< " is created");
   }
   else {
-    MESSAGE("Vertex with geom entry " << geomEntry << " is created");
   }
 
   int vertexIndex=0;
@@ -1175,11 +1192,9 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do
     }
   }
   
-  MESSAGE("myVertexName is \"" << myVertexName.toStdString() << "\"");
   myEnforcedTableWidget->setRowCount(rowCount+1);
   myEnforcedTableWidget->setSortingEnabled(false);
   for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
-    MESSAGE("Column: " << col);
     QTableWidgetItem* item = new QTableWidgetItem();
     item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
     switch (col) {
@@ -1223,9 +1238,7 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do
         break;
     }
     
-    MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
     myEnforcedTableWidget->setItem(rowCount,col,item);
-    MESSAGE("Done");
   }
 
   connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this,  SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
@@ -1240,7 +1253,6 @@ This method is called when a item is added into the enforced meshes tree widget
 */
 void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh()
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh()");
 
   HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_HypothesisCreator*)this;
   
@@ -1265,18 +1277,16 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh()
   int elementType = myEnfMeshConstraint->currentIndex();
   
   
-  _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+  _PTR(Study) aStudy = SMESH::getStudy();
   _PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil;
   QString meshEntry = myEnfMeshWdg->GetValue();
-  MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString());
   
   if (selEnfMeshes == 1)
   {
-    MESSAGE("1 SMESH object selected");
 //     myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >();
 //     std::string entry = myEnfMeshWdg->GetValue();
     aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str());
-    CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
+    CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj);
     if (!CORBA::is_nil(anObj)) {
 //       SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
       addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
@@ -1284,12 +1294,11 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh()
   }
   else
   {
-    MESSAGE(selEnfMeshes << " SMESH objects selected");
     QStringList meshEntries = meshEntry.split(" ", QString::SkipEmptyParts);
     QStringListIterator meshEntriesIt (meshEntries);
     while (meshEntriesIt.hasNext()) {
       aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str());
-      CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
+      CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj);
       if (!CORBA::is_nil(anObj)) {
 //         SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
         addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
@@ -1309,7 +1318,6 @@ This method is called when a item is added into the enforced vertices tree widge
 */
 void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex()
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex()");
 
   HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_HypothesisCreator*)this;
   
@@ -1336,7 +1344,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex()
   
   if (selEnfVertex <= 1)
   {
-    MESSAGE("0 or 1 GEOM object selected");
     double x = 0, y = 0, z=0;
     if (myXCoord->GetString() != "") {
       x = myXCoord->GetValue();
@@ -1344,7 +1351,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex()
       z = myZCoord->GetValue();
     }
     if (selEnfVertex == 1) {
-      MESSAGE("1 GEOM object selected");
       myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
       std::string entry = "";
       if (myEnfVertex != GEOM::GEOM_Object::_nil())
@@ -1352,8 +1358,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex()
       addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),entry, groupName, myEnfVertex->GetShapeType() == GEOM::COMPOUND);
     }
     else {
-      MESSAGE("0 GEOM object selected");
-      MESSAGE("Coords: ("<<x<<","<<y<<","<<z<<")");
       addEnforcedVertex(x, y, z, size, "", "", groupName);
     }
   }
@@ -1408,7 +1412,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
   it.toBack();
   while ( it.hasPrevious() ) {
       row = it.previous();
-      MESSAGE("delete row #"<< row);
       myEnforcedMeshTableWidget->removeRow(row );
   }
 
@@ -1435,7 +1438,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
   it.toBack();
   while ( it.hasPrevious() ) {
       row = it.previous();
-      MESSAGE("delete row #"<< row);
       myEnforcedTableWidget->removeRow(row );
   }
 
@@ -1463,6 +1465,16 @@ void HYBRIDPluginGUI_HypothesisCreator::onDirBtnClicked()
     myAdvWidget->workingDirectoryLineEdit->setText( dir );
 }
 
+void HYBRIDPluginGUI_HypothesisCreator::onTabChanged( int )
+{
+  myEnfVertexWdg->deactivateSelection();
+  myEnfMeshWdg->deactivateSelection();
+  myFaceSelectorLayers->ActivateSelection( false );
+  myFaceSelectorLayers->ShowPreview( false );
+  myFaceSelectorImprinting->ActivateSelection( false );
+  myFaceSelectorImprinting->ShowPreview( false );
+}
+
 void HYBRIDPluginGUI_HypothesisCreator::updateWidgets()
 {
   //customs automatic set
@@ -1481,16 +1493,15 @@ void HYBRIDPluginGUI_HypothesisCreator::updateWidgets()
     myAdvWidget->removeLogOnSuccessCheck->setEnabled( logFileRemovable );
   }
   bool enabled = !myLayersOnAllWrapCheck->isChecked();
-  myEnforcedMeshTableWidget->setEnabled(enabled);
-  addEnfMeshButton->setEnabled(enabled);
-  removeEnfMeshButton->setEnabled(enabled);
-  myEnfMeshWdg->setEnabled(enabled);
-  //xxx->setEnabled(enabled);
+  myFacesLbl->setEnabled(enabled);
+  myFaceSelectorLayers->setEnabled(enabled);
+  if ( QTabWidget* tab = qobject_cast<QTabWidget*>( myStdGroup->parentWidget()->parentWidget() )) {
+    tab->setTabEnabled( FACE_SEL_IMPRINTING_TAB, enabled );
+  }
 }
 
 bool HYBRIDPluginGUI_HypothesisCreator::checkParams(QString& msg) const
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::checkParams");
 
   if ( !QFileInfo( myAdvWidget->workingDirectoryLineEdit->text().trimmed() ).isWritable() ) {
     SUIT_MessageBox::warning( dlg(),
@@ -1504,7 +1515,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::checkParams(QString& msg) const
 
 void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::retrieveParams");
   HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_HypothesisCreator*)this;
   HYBRIDHypothesisData data;
   readParamsFromHypo( data );
@@ -1522,15 +1532,21 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
   myAdvWidget->initialMemorySpin              ->setValue      ( qMax( data.myInitialMemory,
                                                                       myAdvWidget->initialMemorySpin->minimum() ));
 
-  myCollisionModeCombo ->setCurrentIndex( data.myCollisionMode );
-  myBoundaryLayersGrowthCombo ->setCurrentIndex( data.myBoundaryLayersGrowth );
-  myElementGenerationCombo ->setCurrentIndex( data.myElementGeneration );
-  myAddMultinormalsCheck -> setChecked ( data.myAddMultinormals );
-  mySmoothNormalsCheck -> setChecked ( data.mySmoothNormals );
-  myHeightFirstLayerSpin -> setValue( data.myHeightFirstLayer );
-  myNbOfBoundaryLayersSpin -> setValue( data.myNbOfBoundaryLayers );
+  myCollisionModeCombo            ->setCurrentIndex( data.myCollisionMode );
+  myBoundaryLayersGrowthCombo     ->setCurrentIndex( data.myBoundaryLayersGrowth );
+  myElementGenerationCombo        ->setCurrentIndex( data.myElementGeneration );
+  myAddMultinormalsCheck          -> setChecked ( data.myAddMultinormals );
+  mySmoothNormalsCheck            -> setChecked ( data.mySmoothNormals );
+  myHeightFirstLayerSpin          -> setValue( data.myHeightFirstLayer );
+  myNbOfBoundaryLayersSpin        -> setValue( data.myNbOfBoundaryLayers );
   myBoundaryLayersProgressionSpin -> setValue( data.myBoundaryLayersProgression );
-  myMultinormalsAngleSpin -> setValue( data.myMultinormalsAngle );
+  if (data.myCoreSize <= 0)
+    myCoreSizeSpin->setText("");
+  else
+    myCoreSizeSpin                -> setValue( data.myCoreSize );
+  myMultinormalsAngleSpin         -> setValue( data.myMultinormalsAngle );
+  myFaceSelectorLayers            ->SetListOfIDs( data.myFaceWLIds );
+  myFaceSelectorImprinting        ->SetListOfIDs( data.myFaceWIIds );
 
   myAdvWidget->workingDirectoryLineEdit       ->setText   ( data.myWorkingDir );
   myAdvWidget->keepWorkingFilesCheck          ->setChecked( data.myKeepFiles );
@@ -1540,7 +1556,7 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
   myAdvWidget->boundaryRecoveryCheck          ->setChecked( data.myBoundaryRecovery );
   myAdvWidget->FEMCorrectionCheck             ->setChecked( data.myFEMCorrection );
   myAdvWidget->gradationSpinBox               ->setValue  ( data.myGradation );
-  myAdvWidget->myAdvOptionsTable        ->SetCustomOptions( data.myTextOption );
+  myAdvWidget->myAdvOptionsTable              ->SetCustomOptions( data.myTextOption );
   myAdvWidget->logInFileCheck                 ->setChecked( !data.myLogInStandardOutput );
   myAdvWidget->removeLogOnSuccessCheck        ->setChecked( data.myRemoveLogOnSuccess );
 
@@ -1555,8 +1571,6 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
     myEnforcedTableWidget->setRowCount(rowCount+1);
 
     for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
-      MESSAGE("Column: " << col);
-//       MESSAGE("enfVertex->isCompound: " << enfVertex->isCompound);
       QTableWidgetItem* item = new QTableWidgetItem();
       item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
       switch (col) {
@@ -1568,50 +1582,41 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
             else
               item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
             
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           }
           break;
         case ENF_VER_X_COLUMN:
           if (!enfVertex->isCompound) {
             item->setData( 0, enfVertex->coords.at(0) );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           }
           break;
         case ENF_VER_Y_COLUMN:
           if (!enfVertex->isCompound) {
             item->setData( 0, enfVertex->coords.at(1) );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           }
           break;
         case ENF_VER_Z_COLUMN:
           if (!enfVertex->isCompound) {
             item->setData( 0, enfVertex->coords.at(2) );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           }
           break;
         case ENF_VER_SIZE_COLUMN:
           item->setData( 0, enfVertex->size );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           break;
         case ENF_VER_ENTRY_COLUMN:
           item->setData( 0, enfVertex->geomEntry.c_str() );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           break;
         case ENF_VER_COMPOUND_COLUMN:
           item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
           item->setData( Qt::CheckStateRole, enfVertex->isCompound );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << enfVertex->isCompound);
           break;
         case ENF_VER_GROUP_COLUMN:
           item->setData( 0, enfVertex->groupName.c_str() );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           break;
         default:
           break;
       }
       
       myEnforcedTableWidget->setItem(rowCount,col,item);
-      MESSAGE("Done");
     }
     that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
     rowCount++;
@@ -1635,7 +1640,6 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
     myEnforcedMeshTableWidget->setRowCount(rowCount+1);
 
     for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
-      MESSAGE("Column: " << col);
       if (col == ENF_MESH_CONSTRAINT_COLUMN) {
         QComboBox* comboBox = new QComboBox();
         QPalette pal = comboBox->palette();
@@ -1644,7 +1648,6 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
         comboBox->insertItems(0,myEnfMeshConstraintLabels);
         comboBox->setEditable(false);
         comboBox->setCurrentIndex(enfMesh->elementType);
-        MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
         myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
       }
       else {
@@ -1654,18 +1657,15 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
           case ENF_MESH_NAME_COLUMN:
             item->setData( 0, enfMesh->name.c_str() );
             item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
             myEnforcedMeshTableWidget->setItem(rowCount,col,item);
             break;
           case ENF_MESH_ENTRY_COLUMN:
             item->setData( 0, enfMesh->entry.c_str() );
             item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
             myEnforcedMeshTableWidget->setItem(rowCount,col,item);
             break;
           case ENF_MESH_GROUP_COLUMN:
             item->setData( 0, enfMesh->groupName.c_str() );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
             myEnforcedMeshTableWidget->setItem(rowCount,col,item);
             break;
           default:
@@ -1674,7 +1674,6 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
       }
       
 //       myEnforcedMeshTableWidget->setItem(rowCount,col,item);
-      MESSAGE("Done");
     }
 //     that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
     rowCount++;
@@ -1692,84 +1691,94 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
 
 QString HYBRIDPluginGUI_HypothesisCreator::storeParams() const
 {
-    MESSAGE("HYBRIDPluginGUI_HypothesisCreator::storeParams");
-    HYBRIDHypothesisData data;
-    readParamsFromWidgets( data );
-    storeParamsToHypo( data );
-    
-    QString valStr = "";
-    
-    if ( !data.myBoundaryRecovery )
-        valStr = "-c " + QString::number( !data.myToMeshHoles );
-    
-    if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
-        const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
-        valStr += " -o ";
-        valStr += level[ data.myOptimizationLevel ];
-    }
-    if ( data.myMaximumMemory > 0 ) {
-        valStr += " -m ";
-        valStr += QString::number( data.myMaximumMemory );
-    }
-    if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
-        valStr += " -M ";
-        valStr += QString::number( data.myInitialMemory );
-    }
-    valStr += " -v ";
-    valStr += QString::number( data.myVerboseLevel );
-    
-    if ( !data.myToCreateNewNodes )
-        valStr += " -p0";
-    
-    if ( data.myRemoveInitialCentralPoint )
-        valStr += " -no_initial_central_point";
-    
-    if ( data.myBoundaryRecovery )
-        valStr += " -C";
-    
-    if ( data.myFEMCorrection )
-        valStr += " -FEM";
-    
-    if ( data.myGradation != 1.05 ) {
-      valStr += " -Dcpropa=";
-      valStr += QString::number( data.myGradation );
-    }
-    
-    valStr += " ";
-    valStr += data.myTextOption;
-    
-//     valStr += " #BEGIN ENFORCED VERTICES#";
-//     // Add size map parameters storage
-//     for (int i=0 ; i<mySmpModel->rowCount() ; i++) {
-//         valStr += " (";
-//         double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble();
-//         double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble();
-//         double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble();
-//         double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble();
-//         valStr += QString::number( x );
-//         valStr += ",";
-//         valStr += QString::number( y );
-//         valStr += ",";
-//         valStr += QString::number( z );
-//         valStr += ")=";
-//         valStr += QString::number( size );
-//         if (i!=mySmpModel->rowCount()-1)
-//             valStr += ";";
-//     }
-//     valStr += " #END ENFORCED VERTICES#";
-//     MESSAGE(valStr.toStdString());
+  HYBRIDHypothesisData data;
+  readParamsFromWidgets( data );
+  storeParamsToHypo( data );
+
+  QString valStr = "";
+
+  if ( !data.myBoundaryRecovery )
+    valStr = "-c " + QString::number( !data.myToMeshHoles );
+
+  if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
+    const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
+    valStr += " -o ";
+    valStr += level[ data.myOptimizationLevel ];
+  }
+  if ( data.myMaximumMemory > 0 ) {
+    valStr += " -m ";
+    valStr += QString::number( data.myMaximumMemory );
+  }
+  if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
+    valStr += " -M ";
+    valStr += QString::number( data.myInitialMemory );
+  }
+  valStr += " -v ";
+  valStr += QString::number( data.myVerboseLevel );
+
+  if ( !data.myToCreateNewNodes )
+    valStr += " -p0";
+
+  if ( data.myRemoveInitialCentralPoint )
+    valStr += " -no_initial_central_point";
+
+  if ( data.myBoundaryRecovery )
+    valStr += " -C";
+
+  if ( data.myFEMCorrection )
+    valStr += " -FEM";
+
+  if ( data.myGradation != 1.05 ) {
+    valStr += " -Dcpropa=";
+    valStr += QString::number( data.myGradation );
+  }
+
+  valStr += " ";
+  valStr += data.myTextOption;
+
+  //     valStr += " #BEGIN ENFORCED VERTICES#";
+  //     // Add size map parameters storage
+  //     for (int i=0 ; i<mySmpModel->rowCount() ; i++) {
+  //         valStr += " (";
+  //         double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble();
+  //         double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble();
+  //         double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble();
+  //         double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble();
+  //         valStr += QString::number( x );
+  //         valStr += ",";
+  //         valStr += QString::number( y );
+  //         valStr += ",";
+  //         valStr += QString::number( z );
+  //         valStr += ")=";
+  //         valStr += QString::number( size );
+  //         if (i!=mySmpModel->rowCount()-1)
+  //             valStr += ";";
+  //     }
+  //     valStr += " #END ENFORCED VERTICES#";
   return valStr;
 }
 
 bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData& h_data ) const
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo");
   HYBRIDPlugin::HYBRIDPlugin_Hypothesis_var h =
     HYBRIDPlugin::HYBRIDPlugin_Hypothesis::_narrow( initParamsHypothesis() );
 
   HypothesisData* data = SMESH::GetHypothesisData( hypType() );
   h_data.myName = isCreation() && data ? hypName() : "";
 
+  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();
+  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();
+  h_data.myFaceWIIds                  = h->GetFacesWithImprinting();
+
   h_data.myLayersOnAllWrap            = h->GetLayersOnAllWrap();
   h_data.myToMeshHoles                = h->GetToMeshHoles();
   h_data.myToMakeGroupsOfDomains      = /*h->GetToMeshHoles() &&*/ h->GetToMakeGroupsOfDomains();
@@ -1778,16 +1787,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData
   h_data.myInitialMemory              = h->GetInitialMemory();
   h_data.myOptimizationLevel          = h->GetOptimizationLevel();
   
-  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();
-  h_data.myBoundaryLayersProgression = h->GetBoundaryLayersProgression();
-  h_data.myMultinormalsAngle = h->GetMultinormalsAngle();
-  h_data.myNbOfBoundaryLayers = h->GetNbOfBoundaryLayers();
-  
   h_data.myKeepFiles                  = h->GetKeepFiles();
   h_data.myWorkingDir                 = h->GetWorkingDirectory();
   h_data.myVerboseLevel               = h->GetVerboseLevel();
@@ -1801,7 +1800,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData
   h_data.myRemoveLogOnSuccess         = h->GetRemoveLogOnSuccess();
   
   HYBRIDPlugin::HYBRIDEnforcedVertexList_var vertices = h->GetEnforcedVertices();
-  MESSAGE("vertices->length(): " << vertices->length());
   h_data.myEnforcedVertices.clear();
   for (CORBA::ULong i=0 ; i<vertices->length() ; i++) {
     TEnfVertex* myVertex = new TEnfVertex();
@@ -1813,13 +1811,11 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData
     if (vertices[i].coords.length()) {
       for (CORBA::ULong c = 0; c < vertices[i].coords.length() ; c++)
         myVertex->coords.push_back(vertices[i].coords[c]);
-      MESSAGE("Add enforced vertex ("<< myVertex->coords.at(0) << ","<< myVertex->coords.at(1) << ","<< myVertex->coords.at(2) << ") ="<< myVertex->size);
     }
     h_data.myEnforcedVertices.insert(myVertex);
   }
   
   HYBRIDPlugin::HYBRIDEnforcedMeshList_var enfMeshes = h->GetEnforcedMeshes();
-  MESSAGE("enfMeshes->length(): " << enfMeshes->length());
   h_data.myEnforcedMeshes.clear();
   for (CORBA::ULong i=0 ; i<enfMeshes->length() ; i++) {
     TEnfMesh* myEnfMesh = new TEnfMesh();
@@ -1847,7 +1843,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData
 
 bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesisData& h_data ) const
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo");
   HYBRIDPlugin::HYBRIDPlugin_Hypothesis_var h =
     HYBRIDPlugin::HYBRIDPlugin_Hypothesis::_narrow( hypothesis() );
 
@@ -1871,7 +1866,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
       h->SetInitialMemory    ( h_data.myInitialMemory );
     if ( h->GetOptimizationLevel() != h_data.myOptimizationLevel )
       h->SetOptimizationLevel( h_data.myOptimizationLevel );
-    
+
     if ( h->GetCollisionMode() != h_data.myCollisionMode )
       h->SetCollisionMode(        h_data.myCollisionMode );
     if ( h->GetBoundaryLayersGrowth() != h_data.myBoundaryLayersGrowth )
@@ -1887,11 +1882,15 @@ 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 )
       h->SetNbOfBoundaryLayers       ( h_data.myNbOfBoundaryLayers );
-    
+    h->SetFacesWithLayers( h_data.myFaceWLIds );
+    h->SetFacesWithImprinting( h_data.myFaceWIIds );
+
     if ( h->GetKeepFiles() != h_data.myKeepFiles)
       h->SetKeepFiles       ( h_data.myKeepFiles);
     if ( h->GetWorkingDirectory() != h_data.myWorkingDir )
@@ -1912,16 +1911,14 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
       h->SetAdvancedOption    ( h_data.myTextOption.toLatin1().constData() );
     if ( h->GetStandardOutputLog() != h_data.myLogInStandardOutput )
       h->SetStandardOutputLog       ( h_data.myLogInStandardOutput );
-     if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess )
+    if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess )
       h->SetRemoveLogOnSuccess        ( h_data.myRemoveLogOnSuccess );
     
     // Enforced vertices
-    int nbVertex = (int) h_data.myEnforcedVertices.size();
+    //int nbVertex = (int) h_data.myEnforcedVertices.size();
     HYBRIDPlugin::HYBRIDEnforcedVertexList_var vertexHyp = h->GetEnforcedVertices();
     int nbVertexHyp = vertexHyp->length();
     
-    MESSAGE("Store params for size maps: " << nbVertex << " enforced vertices");
-    MESSAGE("h->GetEnforcedVertices()->length(): " << nbVertexHyp);
     
     // 1. Clear all enforced vertices in hypothesis
     // 2. Add new enforced vertex according to h_data
@@ -1942,12 +1939,10 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
     } // for
     
     // Enforced Meshes
-    int nbEnfMeshes = (int) h_data.myEnforcedMeshes.size();
+    //int nbEnfMeshes = (int) h_data.myEnforcedMeshes.size();
     HYBRIDPlugin::HYBRIDEnforcedMeshList_var enfMeshListHyp = h->GetEnforcedMeshes();
     int nbEnfMeshListHyp = enfMeshListHyp->length();
     
-    MESSAGE("Store params for size maps: " << nbEnfMeshes << " enforced meshes");
-    MESSAGE("h->GetEnforcedMeshes()->length(): " << nbEnfMeshListHyp);
     
     // 1. Clear all enforced vertices in hypothesis
     // 2. Add new enforced vertex according to h_data
@@ -1956,7 +1951,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
     
     TEnfMeshList::const_iterator itEnfMesh;
 
-    _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+    _PTR(Study) aStudy = SMESH::getStudy();
 
     for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
       TEnfMesh* enfMesh = (*itEnfMesh);
@@ -1964,7 +1959,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
       _PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str());
       SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
 
-      MESSAGE("enfMesh->elementType: " << enfMesh->elementType);
       SMESH::ElementType elementType;
       switch(enfMesh->elementType) {
         case 0:
@@ -1998,7 +1992,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
 
 bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisData& h_data ) const
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets");
   h_data.myName                       = myName ? myName->text() : "";
   h_data.myLayersOnAllWrap            = myLayersOnAllWrapCheck->isChecked();
   h_data.myToMeshHoles                = myToMeshHolesCheck->isChecked();
@@ -2006,18 +1999,21 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD
   h_data.myMaximumMemory              = myAdvWidget->maxMemoryCheck->isChecked() ? myAdvWidget->maxMemorySpin->value() : -1;
   h_data.myInitialMemory              = myAdvWidget->initialMemoryCheck->isChecked() ? myAdvWidget->initialMemorySpin->value() : -1;
   h_data.myOptimizationLevel          = myOptimizationLevelCombo->currentIndex();
-  
-  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();
-  
-  h_data.myHeightFirstLayer = myHeightFirstLayerSpin -> value();
-  h_data.myNbOfBoundaryLayers = myNbOfBoundaryLayersSpin -> value();
-  h_data.myBoundaryLayersProgression = myBoundaryLayersProgressionSpin -> value();
-  h_data.myMultinormalsAngle = myMultinormalsAngleSpin -> value();
-  
+
+  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();
+
+  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                  = myFaceSelectorLayers->GetListOfIDs();
+  h_data.myFaceWIIds                  = myFaceSelectorImprinting->GetListOfIDs();
+
   h_data.myKeepFiles                  = myAdvWidget->keepWorkingFilesCheck->isChecked();
   h_data.myWorkingDir                 = myAdvWidget->workingDirectoryLineEdit->text().trimmed();
   h_data.myVerboseLevel               = myAdvWidget->verboseLevelSpin->value();
@@ -2029,7 +2025,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD
   h_data.myTextOption                 = myAdvWidget->myAdvOptionsTable->GetCustomOptions();
   h_data.myLogInStandardOutput        = !myAdvWidget->logInFileCheck->isChecked();
   h_data.myRemoveLogOnSuccess         = myAdvWidget->removeLogOnSuccessCheck->isChecked();
-  
+
   // Enforced vertices
   h_data.myEnforcedVertices.clear();
   QVariant valueX, valueY, valueZ;
@@ -2037,13 +2033,10 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD
     
     TEnfVertex *myVertex = new TEnfVertex();
     myVertex->name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    MESSAGE("Add new enforced vertex \"" << myVertex->name << "\"" );
     myVertex->geomEntry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
     if (myVertex->geomEntry.size())
-      MESSAGE("Geom entry is \"" << myVertex->geomEntry << "\"" );
     myVertex->groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
     if (myVertex->groupName.size())
-      MESSAGE("Group name is \"" << myVertex->groupName << "\"" );
     valueX = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data(Qt::EditRole);
     valueY = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data(Qt::EditRole);
     valueZ = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data(Qt::EditRole);
@@ -2051,14 +2044,9 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD
       myVertex->coords.push_back(valueX.toDouble());
       myVertex->coords.push_back(valueY.toDouble());
       myVertex->coords.push_back(valueZ.toDouble());
-      MESSAGE("Coords are (" << myVertex->coords.at(0) << ", "
-                             << myVertex->coords.at(1) << ", "
-                             << myVertex->coords.at(2) << ")");
     }
     myVertex->size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data(Qt::EditRole).toDouble();
-    MESSAGE("Size is " << myVertex->size);
     myVertex->isCompound = myEnforcedTableWidget->item(row,ENF_VER_COMPOUND_COLUMN)->data(Qt::CheckStateRole).toBool();
-    MESSAGE("Is compound ? " << myVertex->isCompound);
     h_data.myEnforcedVertices.insert(myVertex);
   }
   
@@ -2069,14 +2057,10 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD
     
     TEnfMesh *myEnfMesh = new TEnfMesh();
     myEnfMesh->name = myEnforcedMeshTableWidget->item(row,ENF_MESH_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    MESSAGE("Add new enforced mesh \"" << myEnfMesh->name << "\"" );
     myEnfMesh->entry = myEnforcedMeshTableWidget->item(row,ENF_MESH_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    MESSAGE("Entry is \"" << myEnfMesh->entry << "\"" );
     myEnfMesh->groupName = myEnforcedMeshTableWidget->item(row,ENF_MESH_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    MESSAGE("Group name is \"" << myEnfMesh->groupName << "\"" );
     QComboBox* combo = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row,ENF_MESH_CONSTRAINT_COLUMN));
     myEnfMesh->elementType = combo->currentIndex();
-    MESSAGE("Element type: " << myEnfMesh->elementType);
     h_data.myEnforcedMeshes.insert(myEnfMesh);
     std::cout << "h_data.myEnforcedMeshes.size(): " << h_data.myEnforcedMeshes.size() << std::endl;
   }
index c4458ee1deb31ae41724f3127db4c94b42d94e3b..2d3b70e9f2032b9e1093f613e87ac87f29dff34e 100644 (file)
 #include CORBA_SERVER_HEADER(SMESH_Gen)
 #include CORBA_SERVER_HEADER(SMESH_Mesh)
 
-class QWidget;
-class QComboBox;
 class QCheckBox;
+class QComboBox;
+class QHeaderView;
 class QLineEdit;
 class QSpinBox;
 class QTableWidget;
 class QTableWidgetItem;
-class QHeaderView;
+class QWidget;
 
-class SMESHGUI_SpinBox;
-class StdMeshersGUI_ObjectReferenceParamWdg;
+class HYBRIDPluginGUI_AdvWidget;
 class LightApp_SelectionMgr;
+class SMESHGUI_SpinBox;
 class SUIT_SelectionFilter;
-class HYBRIDPluginGUI_AdvWidget;
+class StdMeshersGUI_ObjectReferenceParamWdg;
+class StdMeshersGUI_SubShapeSelectorWdg;
 
 class QTEnfVertex
 {
@@ -160,8 +161,14 @@ typedef struct
           mySmoothNormals;
   double  myHeightFirstLayer,
           myBoundaryLayersProgression,
+          myCoreSize,
           myMultinormalsAngle;
   short   myNbOfBoundaryLayers;
+  // IDs of faces with layers
+  SMESH::long_array_var myFaceWLIds;
+  // IDs of faces with imprinting
+  SMESH::long_array_var myFaceWIIds;
+
 } HYBRIDHypothesisData;
 
 /*!
@@ -210,6 +217,7 @@ protected slots:
   void                onRemoveEnforcedMesh();
   //void                synchronizeEnforcedMesh();
   void                checkEnfMeshIsDefined();
+  void                onTabChanged( int );
   
 signals:
   void                vertexDefined(bool);
@@ -268,9 +276,13 @@ private:
   SMESHGUI_SpinBox*   myHeightFirstLayerSpin;
   QSpinBox*           myNbOfBoundaryLayersSpin;
   SMESHGUI_SpinBox*   myBoundaryLayersProgressionSpin;
+  SMESHGUI_SpinBox*   myCoreSizeSpin;
   SMESHGUI_SpinBox*   myMultinormalsAngleSpin;
   QCheckBox*          mySmoothNormalsCheck;
 
+  QLabel* myFacesLbl;
+  StdMeshersGUI_SubShapeSelectorWdg* myFaceSelectorLayers;
+  StdMeshersGUI_SubShapeSelectorWdg* myFaceSelectorImprinting;
 };
 
 class EnforcedVertexTableWidgetDelegate : public QItemDelegate
index 61daaaca73e1c49ff57c3c7da8c261a96ba77fc6..5da01eb43c9d8512fb00fdb035c701b5325a1e7e 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>
@@ -212,7 +220,7 @@ downward means inward and upward means outward ...
     </message>
     <message>
         <source>HYBRID_ENFORCED_MESHES</source>
-        <translation>Layers meshes</translation>
+        <translation>Enforced meshes</translation>
     </message>
     <message>
         <source>HYBRID_ENF_NAME_COLUMN</source>
@@ -310,5 +318,17 @@ downward means inward and upward means outward ...
         <source>HYBRID_ENF_MESH_INFO</source>
         <translation>&lt;b&gt;Warning&lt;/b&gt;: Enforced meshes are currently only taken into account for meshes w/o associated geometry.</translation>
     </message>
+    <message>
+        <source>HYBRID_FACES_LAYERS_TAB</source>
+        <translation>Faces with layers</translation>
+    </message>
+    <message>
+        <source>HYBRID_FACES_IMPRINTING_TAB</source>
+        <translation>Faces with imprinting</translation>
+    </message>
+    <message>
+        <source>HYBRID_FACE_IDS</source>
+        <translation>Face IDs</translation>
+    </message>
 </context>
 </TS>
index 0cf50104a788dc5e34d833341b76d676d148f061..a189df015f06d79b9b075b6a47ddb0b26eb7dd81 100755 (executable)
@@ -60,12 +60,20 @@ en conséquence au dessous signifie à l&apos;intérieur et au dessus signifie 
     </message>
     <message>
         <source>HYBRID_GENERATION_TETRA_DOMINANT</source>
-        <translation>Dominance de tétrahedres</translation>
+        <translation>Dominance de tétraèdres</translation>
     </message>
     <message>
         <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>
@@ -311,5 +319,17 @@ en conséquence au dessous signifie à l&apos;intérieur et au dessus signifie 
         <source>HYBRID_ENF_MESH_INFO</source>
         <translation>&lt;b&gt;Attention&lt;/b&gt;: Les éléments de contraintes ne sont pris en compte que pour des maillage sans géométrie associée.</translation>
     </message>
+    <message>
+        <source>HYBRID_FACES_LAYERS_TAB</source>
+        <translation>Faces avec couche prismatique</translation>
+    </message>
+    <message>
+        <source>HYBRID_FACES_IMPRINTING_TAB</source>
+        <translation>Faces avec empreinte</translation>
+    </message>
+    <message>
+        <source>HYBRID_FACE_IDS</source>
+        <translation>Numéros des faces</translation>
+    </message>
 </context>
 </TS>
index 4f3d84ae54787f773ced5701de9007399b0f26ee..2e7a329a1e98c9db4571dde061bf6a663a805e00 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>
@@ -311,5 +319,17 @@ downward means inward and upward means outward ...
       <source>HYBRID_ENF_MESH_INFO</source>
       <translation>&lt;b&gt;警告&lt;/b&gt;: 強制メッシュは現在 w/o がジオメトリに関連付けたメッシュの説明を考慮のみしています。</translation>
     </message>
+    <message>
+        <source>HYBRID_FACES_LAYERS_TAB</source>
+        <translation type="unfinished">Faces with layers</translation>
+    </message>
+    <message>
+        <source>HYBRID_FACES_IMPRINTING_TAB</source>
+        <translation type="unfinished">Faces with imprinting</translation>
+    </message>
+    <message>
+        <source>HYBRID_FACE_IDS</source>
+        <translation type="unfinished">Face IDs</translation>
+    </message>
   </context>
 </TS>
index 7a66586f954447ee2a519391daef8eb8c5c81505..c2ea69c23054b8428a194ef37444b6cb833449d0 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
@@ -97,6 +97,52 @@ class HYBRID_Algorithm(Mesh_Algorithm):
         self.Parameters().SetLayersOnAllWrap(toMesh)
         pass
 
+    ## To mesh layers on given faces.
+    #  @param faceIDs faces or face IDs to construct boundary layers on
+    def SetFacesWithLayers(self, faceIDs):
+        import GEOM
+        ids = []
+        if not isinstance( faceIDs, list ) and not isinstance( faceIDs, tuple ):
+            faceIDs = [ faceIDs ]
+        for fid in faceIDs:
+            if isinstance( fid, int ):
+                ids.append( fid )
+            elif isinstance( fid, GEOM._objref_GEOM_Object):
+                faces = self.mesh.geompyD.SubShapeAll( fid, self.mesh.geompyD.ShapeType["FACE"])
+                for f in faces:
+                    ids.append( self.mesh.geompyD.GetSubShapeID( self.mesh.geom, f ))
+            else:
+                raise TypeError, \
+                    "Face should be either ID or GEOM_Object, not %s" % type(fid)
+            pass
+        self.Parameters().SetFacesWithLayers(ids)
+        if ids:
+            self.SetLayersOnAllWrap( False )
+        pass
+
+    ## To imprint the layers on given faces.
+    #  @param faceIDs faces or face IDs to imprint the boundary layers on
+    def SetFacesWithImprinting(self, faceIDs):
+        import GEOM
+        ids = []
+        if not isinstance( faceIDs, list ) and not isinstance( faceIDs, tuple ):
+            faceIDs = [ faceIDs ]
+        for fid in faceIDs:
+            if isinstance( fid, int ):
+                ids.append( fid )
+            elif isinstance( fid, GEOM._objref_GEOM_Object):
+                faces = self.mesh.geompyD.SubShapeAll( fid, self.mesh.geompyD.ShapeType["FACE"])
+                for f in faces:
+                    ids.append( self.mesh.geompyD.GetSubShapeID( self.mesh.geom, f ))
+            else:
+                raise TypeError, \
+                    "Face should be either ID or GEOM_Object, not %s" % type(fid)
+            pass
+        self.Parameters().SetFacesWithImprinting(ids)
+        if ids:
+            self.SetLayersOnAllWrap( False )
+        pass
+
     """
     obsolete
     ## To mesh "holes" in a solid or not. Default is to mesh.
@@ -164,6 +210,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):
@@ -198,6 +245,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 2fffeed12e5a2457186998cfac0052f1cad02f69..de082694474e861b95e125c4d37274a34b476840 100644 (file)
@@ -41,8 +41,6 @@
 #include <SMESH_MesherHelper.hxx>
 #include <SMESH_ProxyMesh.hxx>
 #include <SMESH_subMeshEventListener.hxx>
-// #include <StdMeshers_QuadToTriaAdaptor.hxx>
-// #include <StdMeshers_ViscousLayers.hxx>
 
 #include <BRepAdaptor_Surface.hxx>
 #include <BRepBndLib.hxx>
@@ -87,13 +85,13 @@ typedef const std::list<const SMDS_MeshFace*> TTriaList;
 
 static const char theDomainGroupNamePrefix[] = "Domain_";
 
-static void removeFile( const TCollection_AsciiString& fileName )
+static void removeFile( const std::string& fileName )
 {
   try {
-    SMESH_File( fileName.ToCString() ).remove();
+    SMESH_File( fileName ).remove();
   }
   catch ( ... ) {
-    MESSAGE("Can't remove file: " << fileName.ToCString() << " ; file does not exist or permission denied");
+    MESSAGE("Can't remove file: " << fileName << " ; file does not exist or permission denied");
   }
 }
 
@@ -106,23 +104,13 @@ static void removeFile( const TCollection_AsciiString& fileName )
 HYBRIDPlugin_HYBRID::HYBRIDPlugin_HYBRID(int hypId, SMESH_Gen* gen)
   : SMESH_3D_Algo(hypId, gen)
 {
-  MESSAGE("HYBRIDPlugin_HYBRID::HYBRIDPlugin_HYBRID");
   _name = Name();
   _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type
   _onlyUnaryInput = true; // Compute() will be called on each solid
   _iShape=0;
   _nbShape=0;
   _compatibleHypothesis.push_back( HYBRIDPlugin_Hypothesis::GetHypType());
-  //_compatibleHypothesis.push_back( StdMeshers_ViscousLayers::GetHypType() );
   _requireShape = false; // can work without shape
-
-  smeshGen_i = SMESH_Gen_i::GetSMESHGen();
-  CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/Study");
-
-  myStudy = SALOMEDS::Study::_narrow(anObject);
-  if (!myStudy->_is_nil())
-    MESSAGE("Study not empty");
-  
   _computeCanceled = false;
 }
 
@@ -134,7 +122,6 @@ HYBRIDPlugin_HYBRID::HYBRIDPlugin_HYBRID(int hypId, SMESH_Gen* gen)
 
 HYBRIDPlugin_HYBRID::~HYBRIDPlugin_HYBRID()
 {
-  MESSAGE("HYBRIDPlugin_HYBRID::~HYBRIDPlugin_HYBRID");
 }
 
 //=============================================================================
@@ -150,7 +137,6 @@ bool HYBRIDPlugin_HYBRID::CheckHypothesis ( SMESH_Mesh&         aMesh,
   aStatus = SMESH_Hypothesis::HYP_OK;
 
   _hyp = 0;
-  //_viscousLayersHyp = 0;
   _keepFiles = false;
   _removeLogOnSuccess = true;
   _logInStandardOutput = false;
@@ -162,8 +148,6 @@ bool HYBRIDPlugin_HYBRID::CheckHypothesis ( SMESH_Mesh&         aMesh,
   {
     if ( !_hyp )
       _hyp = dynamic_cast< const HYBRIDPlugin_Hypothesis*> ( *h );
-    // if ( !_viscousLayersHyp )
-    //   _viscousLayersHyp = dynamic_cast< const StdMeshers_ViscousLayers*> ( *h );
   }
   if ( _hyp )
   {
@@ -183,276 +167,21 @@ bool HYBRIDPlugin_HYBRID::CheckHypothesis ( SMESH_Mesh&         aMesh,
 
 TopoDS_Shape HYBRIDPlugin_HYBRID::entryToShape(std::string entry)
 {
-  MESSAGE("HYBRIDPlugin_HYBRID::entryToShape "<<entry );
-  if ( myStudy->_is_nil() )
+  if ( SMESH_Gen_i::getStudyServant()->_is_nil() )
     throw SALOME_Exception("MG-HYBRID plugin can't work w/o publishing in the study");
   GEOM::GEOM_Object_var aGeomObj;
   TopoDS_Shape S = TopoDS_Shape();
-  SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() );
+  SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.c_str() );
   if (!aSObj->_is_nil() ) {
     CORBA::Object_var obj = aSObj->GetObject();
     aGeomObj = GEOM::GEOM_Object::_narrow(obj);
     aSObj->UnRegister();
   }
   if ( !aGeomObj->_is_nil() )
-    S = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
+    S = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( aGeomObj.in() );
   return S;
 }
 
-//=======================================================================
-//function : findShape
-//purpose  : 
-//=======================================================================
-
-// static TopoDS_Shape findShape(const SMDS_MeshNode *aNode[],
-//                               TopoDS_Shape        aShape,
-//                               const TopoDS_Shape  shape[],
-//                               double**            box,
-//                               const int           nShape,
-//                               TopAbs_State *      state = 0)
-// {
-//   gp_XYZ aPnt(0,0,0);
-//   int j, iShape, nbNode = 4;
-
-//   for ( j=0; j<nbNode; j++ ) {
-//     gp_XYZ p ( aNode[j]->X(), aNode[j]->Y(), aNode[j]->Z() );
-//     if ( aNode[j]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_3DSPACE ) {
-//       aPnt = p;
-//       break;
-//     }
-//     aPnt += p / nbNode;
-//   }
-
-//   BRepClass3d_SolidClassifier SC (aShape, aPnt, Precision::Confusion());
-//   if (state) *state = SC.State();
-//   if ( SC.State() != TopAbs_IN || aShape.IsNull() || aShape.ShapeType() != TopAbs_SOLID) {
-//     for (iShape = 0; iShape < nShape; iShape++) {
-//       aShape = shape[iShape];
-//       if ( !( aPnt.X() < box[iShape][0] || box[iShape][1] < aPnt.X() ||
-//               aPnt.Y() < box[iShape][2] || box[iShape][3] < aPnt.Y() ||
-//               aPnt.Z() < box[iShape][4] || box[iShape][5] < aPnt.Z()) ) {
-//         BRepClass3d_SolidClassifier SC (aShape, aPnt, Precision::Confusion());
-//         if (state) *state = SC.State();
-//         if (SC.State() == TopAbs_IN)
-//           break;
-//       }
-//     }
-//   }
-//   return aShape;
-// }
-
-//=======================================================================
-//function : readMapIntLine
-//purpose  : 
-//=======================================================================
-
-// static char* readMapIntLine(char* ptr, int tab[]) {
-//   long int intVal;
-//   std::cout << std::endl;
-
-//   for ( int i=0; i<17; i++ ) {
-//     intVal = strtol(ptr, &ptr, 10);
-//     if ( i < 3 )
-//       tab[i] = intVal;
-//   }
-//   return ptr;
-// }
-
-//================================================================================
-/*!
- * \brief returns true if a triangle defined by the nodes is a temporary face on a
- * side facet of pyramid and defines sub-domain inside the pyramid
- */
-//================================================================================
-
-// static bool isTmpFace(const SMDS_MeshNode* node1,
-//                       const SMDS_MeshNode* node2,
-//                       const SMDS_MeshNode* node3)
-// {
-//   // find a pyramid sharing the 3 nodes
-//   //const SMDS_MeshElement* pyram = 0;
-//   SMDS_ElemIteratorPtr vIt1 = node1->GetInverseElementIterator(SMDSAbs_Volume);
-//   while ( vIt1->more() )
-//   {
-//     const SMDS_MeshElement* pyram = vIt1->next();
-//     if ( pyram->NbCornerNodes() != 5 ) continue;
-//     int i2, i3;
-//     if ( (i2 = pyram->GetNodeIndex( node2 )) >= 0 &&
-//          (i3 = pyram->GetNodeIndex( node3 )) >= 0 )
-//     {
-//       // Triangle defines sub-domian inside the pyramid if it's
-//       // normal points out of the pyram
-
-//       // make i2 and i3 hold indices of base nodes of the pyram while
-//       // keeping the nodes order in the triangle
-//       const int iApex = 4;
-//       if ( i2 == iApex )
-//         i2 = i3, i3 = pyram->GetNodeIndex( node1 );
-//       else if ( i3 == iApex )
-//         i3 = i2, i2 = pyram->GetNodeIndex( node1 );
-
-//       int i3base = (i2+1) % 4; // next index after i2 within the pyramid base
-//       return ( i3base != i3 );
-//     }
-//   }
-//   return false;
-// }
-
-//=======================================================================
-//function : findShapeID
-//purpose  : find the solid corresponding to HYBRID sub-domain following
-//           the technique proposed in GHS3D manual (available within
-//           ghs3d installation) in chapter "B.4 Subdomain (sub-region) assignment".
-//           In brief: normal of the triangle defined by the given nodes
-//           points out of the domain it is associated to
-//=======================================================================
-
-// static int findShapeID(SMESH_Mesh&          mesh,
-//                        const SMDS_MeshNode* node1,
-//                        const SMDS_MeshNode* node2,
-//                        const SMDS_MeshNode* node3,
-//                        const bool           toMeshHoles)
-// {
-//   const int invalidID = 0;
-//   SMESHDS_Mesh* meshDS = mesh.GetMeshDS();
-
-//   // face the nodes belong to
-//   std::vector<const SMDS_MeshNode *> nodes(3);
-//   nodes[0] = node1;
-//   nodes[1] = node2;
-//   nodes[2] = node3;
-//   const SMDS_MeshElement * face = meshDS->FindElement( nodes, SMDSAbs_Face, /*noMedium=*/true);
-//   if ( !face )
-//     return isTmpFace(node1, node2, node3) ? HOLE_ID : invalidID;
-// #ifdef _DEBUG_
-//   std::cout << "bnd face " << face->GetID() << " - ";
-// #endif
-//   // geom face the face assigned to
-//   SMESH_MeshEditor editor(&mesh);
-//   int geomFaceID = editor.FindShape( face );
-//   if ( !geomFaceID )
-//     return isTmpFace(node1, node2, node3) ? HOLE_ID : invalidID;
-//   TopoDS_Shape shape = meshDS->IndexToShape( geomFaceID );
-//   if ( shape.IsNull() || shape.ShapeType() != TopAbs_FACE )
-//     return invalidID;
-//   TopoDS_Face geomFace = TopoDS::Face( shape );
-
-//   // solids bounded by geom face
-//   TopTools_IndexedMapOfShape solids, shells;
-//   TopTools_ListIteratorOfListOfShape ansIt = mesh.GetAncestors(geomFace);
-//   for ( ; ansIt.More(); ansIt.Next() ) {
-//     switch ( ansIt.Value().ShapeType() ) {
-//     case TopAbs_SOLID:
-//       solids.Add( ansIt.Value() ); break;
-//     case TopAbs_SHELL:
-//       shells.Add( ansIt.Value() ); break;
-//     default:;
-//     }
-//   }
-//   // analyse found solids
-//   if ( solids.Extent() == 0 || shells.Extent() == 0)
-//     return invalidID;
-
-//   const TopoDS_Solid& solid1 = TopoDS::Solid( solids(1) );
-//   if ( solids.Extent() == 1 )
-//   {
-//     if ( toMeshHoles )
-//       return meshDS->ShapeToIndex( solid1 );
-
-//     // - Are we at a hole boundary face?
-//     if ( shells(1).IsSame( BRepClass3d::OuterShell( solid1 )) )
-//     { // - No, but maybe a hole is bound by two shapes? Does shells(1) touches another shell?
-//       bool touch = false;
-//       TopExp_Explorer eExp( shells(1), TopAbs_EDGE );
-//       // check if any edge of shells(1) belongs to another shell
-//       for ( ; eExp.More() && !touch; eExp.Next() ) {
-//         ansIt = mesh.GetAncestors( eExp.Current() );
-//         for ( ; ansIt.More() && !touch; ansIt.Next() ) {
-//           if ( ansIt.Value().ShapeType() == TopAbs_SHELL )
-//             touch = ( !ansIt.Value().IsSame( shells(1) ));
-//         }
-//       }
-//       if (!touch)
-//         return meshDS->ShapeToIndex( solid1 );
-//     }
-//   }
-//   // find orientation of geom face within the first solid
-//   TopExp_Explorer fExp( solid1, TopAbs_FACE );
-//   for ( ; fExp.More(); fExp.Next() )
-//     if ( geomFace.IsSame( fExp.Current() )) {
-//       geomFace = TopoDS::Face( fExp.Current() );
-//       break;
-//     }
-//   if ( !fExp.More() )
-//     return invalidID; // face not found
-
-//   // normale to triangle
-//   gp_Pnt node1Pnt ( node1->X(), node1->Y(), node1->Z() );
-//   gp_Pnt node2Pnt ( node2->X(), node2->Y(), node2->Z() );
-//   gp_Pnt node3Pnt ( node3->X(), node3->Y(), node3->Z() );
-//   gp_Vec vec12( node1Pnt, node2Pnt );
-//   gp_Vec vec13( node1Pnt, node3Pnt );
-//   gp_Vec meshNormal = vec12 ^ vec13;
-//   if ( meshNormal.SquareMagnitude() < DBL_MIN )
-//     return invalidID;
-
-//   // get normale to geomFace at any node
-//   bool geomNormalOK = false;
-//   gp_Vec geomNormal;
-//   SMESH_MesherHelper helper( mesh ); helper.SetSubShape( geomFace );
-//   for ( int i = 0; !geomNormalOK && i < 3; ++i )
-//   {
-//     // find UV of i-th node on geomFace
-//     const SMDS_MeshNode* nNotOnSeamEdge = 0;
-//     if ( helper.IsSeamShape( nodes[i]->getshapeId() )) {
-//       if ( helper.IsSeamShape( nodes[(i+1)%3]->getshapeId() ))
-//         nNotOnSeamEdge = nodes[(i+2)%3];
-//       else
-//         nNotOnSeamEdge = nodes[(i+1)%3];
-//     }
-//     bool uvOK;
-//     gp_XY uv = helper.GetNodeUV( geomFace, nodes[i], nNotOnSeamEdge, &uvOK );
-//     // check that uv is correct
-//     if (uvOK) {
-//       double tol = 1e-6;
-//       TopoDS_Shape nodeShape = helper.GetSubShapeByNode( nodes[i], meshDS );
-//       if ( !nodeShape.IsNull() )
-//         switch ( nodeShape.ShapeType() )
-//         {
-//         case TopAbs_FACE:   tol = BRep_Tool::Tolerance( TopoDS::Face( nodeShape )); break;
-//         case TopAbs_EDGE:   tol = BRep_Tool::Tolerance( TopoDS::Edge( nodeShape )); break;
-//         case TopAbs_VERTEX: tol = BRep_Tool::Tolerance( TopoDS::Vertex( nodeShape )); break;
-//         default:;
-//         }
-//       gp_Pnt nodePnt ( nodes[i]->X(), nodes[i]->Y(), nodes[i]->Z() );
-//       BRepAdaptor_Surface surface( geomFace );
-//       uvOK = ( nodePnt.Distance( surface.Value( uv.X(), uv.Y() )) < 2 * tol );
-//       if ( uvOK ) {
-//         // normale to geomFace at UV
-//         gp_Vec du, dv;
-//         surface.D1( uv.X(), uv.Y(), nodePnt, du, dv );
-//         geomNormal = du ^ dv;
-//         if ( geomFace.Orientation() == TopAbs_REVERSED )
-//           geomNormal.Reverse();
-//         geomNormalOK = ( geomNormal.SquareMagnitude() > DBL_MIN * 1e3 );
-//       }
-//     }
-//   }
-//   if ( !geomNormalOK)
-//     return invalidID;
-
-//   // compare normals
-//   bool isReverse = ( meshNormal * geomNormal ) < 0;
-//   if ( !isReverse )
-//     return meshDS->ShapeToIndex( solid1 );
-
-//   if ( solids.Extent() == 1 )
-//     return HOLE_ID; // we are inside a hole
-
-//   return meshDS->ShapeToIndex( solids(2) );
-// }
-
-
 //=======================================================================
 //function : addElemInMeshGroup
 //purpose  : Update or create groups in mesh
@@ -476,7 +205,6 @@ static void addElemInMeshGroup(SMESH_Mesh*             theMesh,
       SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( groupDS );
       aGroupDS->SMDSGroup().Add(anElem);
       groupDone = true;
-//       MESSAGE("Successfully added enforced element to existing group " << groupName);
       break;
     }
   }
@@ -488,7 +216,6 @@ static void addElemInMeshGroup(SMESH_Mesh*             theMesh,
     aGroup->SetName( groupName.c_str() );
     SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( aGroup->GetGroupDS() );
     aGroupDS->SMDSGroup().Add(anElem);
-//     MESSAGE("Successfully created enforced vertex group " << groupName);
     groupDone = true;
   }
   if (!groupDone)
@@ -512,7 +239,6 @@ static void updateMeshGroups(SMESH_Mesh* theMesh, std::set<std::string> groupsTo
     std::string currentGroupName = (std::string)group->GetName();
     if (groupDS->IsEmpty() && groupsToRemove.find(currentGroupName) != groupsToRemove.end()) {
       // Previous group created by enforced elements
-      MESSAGE("Delete previous group created by removed enforced elements: " << group->GetName())
       theMesh->RemoveGroup(groupDS->GetID());
     }
   }
@@ -559,11 +285,6 @@ static void removeEmptyGroupsOfDomains(SMESH_Mesh* mesh,
 static void makeDomainGroups( std::vector< std::vector< const SMDS_MeshElement* > >& elemsOfDomain,
                               SMESH_MesherHelper*                                    theHelper)
 {
-  // int nbDomains = 0;
-  // for ( size_t i = 0; i < elemsOfDomain.size(); ++i )
-  //   nbDomains += ( elemsOfDomain[i].size() > 0 );
-
-  // if ( nbDomains > 1 )
   for ( size_t iDomain = 0; iDomain < elemsOfDomain.size(); ++iDomain )
   {
     std::vector< const SMDS_MeshElement* > & elems = elemsOfDomain[ iDomain ];
@@ -604,27 +325,46 @@ static void makeDomainGroups( std::vector< std::vector< const SMDS_MeshElement*
 //purpose  : read GMF file w/o geometry associated to mesh
 //=======================================================================
 
-static bool readGMFFile(MG_HYBRID_API*                  MGOutput,
-                        const char*                     theFile,
-                        HYBRIDPlugin_HYBRID*            theAlgo,
-                        SMESH_MesherHelper*             theHelper,
+static bool readGMFFile(MG_HYBRID_API*                          MGOutput,
+                        const char*                             theFile,
+                        HYBRIDPlugin_HYBRID*                    theAlgo,
+                        SMESH_MesherHelper*                     theHelper,
                         std::vector <const SMDS_MeshNode*> &    theNodeByHybridId,
                         std::vector <const SMDS_MeshElement*> & theFaceByHybridId,
-                        std::map<const SMDS_MeshNode*,int> & theNodeToHybridIdMap,
-                        std::vector<std::string> &      aNodeGroupByHybridId,
-                        std::vector<std::string> &      anEdgeGroupByHybridId,
-                        std::vector<std::string> &      aFaceGroupByHybridId,
-                        std::set<std::string> &         groupsToRemove,
-                        bool                            toMakeGroupsOfDomains=false,
-                        bool                            toMeshHoles=true)
+                        std::map<const SMDS_MeshNode*,int> &    theNodeToHybridIdMap,
+                        std::vector<std::string> &              aNodeGroupByHybridId,
+                        std::vector<std::string> &              anEdgeGroupByHybridId,
+                        std::vector<std::string> &              aFaceGroupByHybridId,
+                        std::set<std::string> &                 groupsToRemove,
+                        bool                                    toMakeGroupsOfDomains=false,
+                        bool                                    toMeshHoles=true)
 {
   std::string tmpStr;
   SMESHDS_Mesh* theMeshDS = theHelper->GetMeshDS();
   const bool hasGeom = ( theHelper->GetMesh()->HasShapeToMesh() );
 
-  int nbInitialNodes = theNodeByHybridId.size();
+  // if imprinting, the original mesh faces are modified
+  // => we clear all the faces to retrieve them from Hybrid output mesh.
+  std::vector<int> facesWithImprinting = theAlgo->getHyp()->GetFacesWithImprinting();
+
+  if ( ! facesWithImprinting.empty() ) {
+#ifdef _DEBUG_
+      std::cout << "Imprinting => Clear original mesh" << std::endl;
+#endif
+      SMDS_ElemIteratorPtr eIt = theMeshDS->elementsIterator();
+      while( eIt->more() )
+        theMeshDS->RemoveFreeElement( eIt->next(), /*sm=*/0 );
+      SMDS_NodeIteratorPtr nIt = theMeshDS->nodesIterator();
+      while ( nIt->more() )
+        theMeshDS->RemoveFreeNode( nIt->next(), /*sm=*/0 );
+
+      theNodeByHybridId.clear();
+      theFaceByHybridId.clear();
+  }
+
   int nbMeshNodes = theMeshDS->NbNodes();
-  
+  int nbInitialNodes = theNodeByHybridId.size();
+
   const bool isQuadMesh = 
     theHelper->GetMesh()->NbEdges( ORDER_QUADRATIC ) ||
     theHelper->GetMesh()->NbFaces( ORDER_QUADRATIC ) ||
@@ -657,15 +397,14 @@ static bool readGMFFile(MG_HYBRID_API*                  MGOutput,
   tabRef[GmfTriangles]      = 3; // for enforced faces
   tabRef[GmfQuadrilaterals] = 4;
   tabRef[GmfTetrahedra]     = 4; // for new tetras
+  tabRef[GmfPyramids]       = 5; // for new pyramids
   tabRef[GmfPrisms]         = 6; // for new prisms
   tabRef[GmfHexahedra]      = 8;
 
   int ver, dim;
-  MESSAGE("Read " << theFile << " file");
   int InpMsh = MGOutput->GmfOpenMesh(theFile, GmfRead, &ver, &dim);
   if (!InpMsh)
     return false;
-  MESSAGE("Done ");
 
   // Hybrid is not multi-domain => We can't (and don't need to) read ids of domains in ouput file like in GHS3DPlugin
   // We just need to get the id of the one and only solid
@@ -784,10 +523,15 @@ static bool readGMFFile(MG_HYBRID_API*                  MGOutput,
         MGOutput->GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3], &domainID[iElem]);
 #ifdef _DEBUG_
         subdomainId2tetraId[dummy].insert(iElem+1);
-//         MESSAGE("subdomainId2tetraId["<<dummy<<"].insert("<<iElem+1<<")");
 #endif
       }
     }
+    else if (token == GmfPyramids && nbElem > 0) {
+      (nbElem <= 1) ? tmpStr = " Pyramid" : tmpStr = " Pyramids";
+      for ( int iElem = 0; iElem < nbElem; iElem++ )
+        MGOutput->GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3],
+                  &id[iElem*tabRef[token]+4], &domainID[iElem]);
+    }
     else if (token == GmfPrisms && nbElem > 0) {
       (nbElem <= 1) ? tmpStr = " Prism" : tmpStr = " Prisms";
       for ( int iElem = 0; iElem < nbElem; iElem++ )
@@ -810,6 +554,7 @@ static bool readGMFFile(MG_HYBRID_API*                  MGOutput,
     case GmfTriangles:
     case GmfQuadrilaterals:
     case GmfTetrahedra:
+    case GmfPyramids:
     case GmfPrisms:
     case GmfHexahedra:
     {
@@ -848,20 +593,32 @@ static bool readGMFFile(MG_HYBRID_API*                  MGOutput,
         case GmfEdges:
           if (fullyCreatedElement) {
             aCreatedElem = theHelper->AddEdge( node[0], node[1], noID, force3d );
-            if (anEdgeGroupByHybridId.size() && !anEdgeGroupByHybridId[iElem].empty())
+            if ( !anEdgeGroupByHybridId.empty() && !anEdgeGroupByHybridId[iElem].empty())
               addElemInMeshGroup(theHelper->GetMesh(), aCreatedElem, anEdgeGroupByHybridId[iElem], groupsToRemove);
           }
           break;
         case GmfTriangles:
           if (fullyCreatedElement) {
             aCreatedElem = theHelper->AddFace( node[0], node[1], node[2], noID, force3d );
-            if (aFaceGroupByHybridId.size() && !aFaceGroupByHybridId[iElem].empty())
+            // add iElem < aFaceGroupByHybridId.size() to avoid crash if imprinting with hexa core with MeshGems <= 2.4-5
+            if ( !aFaceGroupByHybridId.empty() && iElem < aFaceGroupByHybridId.size() && !aFaceGroupByHybridId[iElem].empty() ) {
               addElemInMeshGroup(theHelper->GetMesh(), aCreatedElem, aFaceGroupByHybridId[iElem], groupsToRemove);
+            }
+            // add element in shape for groups on geom to work
+            theMeshDS->SetMeshElementOnShape( aCreatedElem, domainID[iElem] );
+            for ( int iN = 0; iN < 3; ++iN )
+              if ( node[iN]->getshapeId() < 1 )
+                theMeshDS->SetNodeOnFace( node[iN], domainID[iElem] );
           }
           break;
         case GmfQuadrilaterals:
           if (fullyCreatedElement) {
             aCreatedElem = theHelper->AddFace( node[0], node[1], node[2], node[3], noID, force3d );
+            // add element in shape for groups on geom to work
+            theMeshDS->SetMeshElementOnShape( aCreatedElem, domainID[iElem] );
+            for ( int iN = 0; iN < 3; ++iN )
+              if ( node[iN]->getshapeId() < 1 )
+                theMeshDS->SetNodeOnFace( node[iN], domainID[iElem] );
           }
           break;
         case GmfTetrahedra:
@@ -895,6 +652,40 @@ static bool readGMFFile(MG_HYBRID_API*                  MGOutput,
                                                  noID, force3d );
           }
           break;
+        case GmfPyramids:
+          if ( hasGeom )
+          {
+            if ( solidID != HOLE_ID )
+            {
+              aCreatedElem = theHelper->AddVolume( node[3], node[2], node[1],
+                                                   node[0], node[4],
+                                                   noID, force3d );
+              theMeshDS->SetMeshElementOnShape( aCreatedElem, solidID );
+              for ( int iN = 0; iN < 5; ++iN )
+                if ( node[iN]->getshapeId() < 1 )
+                  theMeshDS->SetNodeInVolume( node[iN], solidID );
+            }
+          }
+          else
+          {
+            if ( elemSearcher ) {
+              // Issue 0020682. Avoid creating nodes and tetras at place where
+              // volumic elements already exist
+              if ( !node[1] || !node[0] || !node[2] || !node[3] || !node[4] || !node[5] )
+                continue;
+              if ( elemSearcher->FindElementsByPoint((SMESH_TNodeXYZ(node[0]) +
+                                                      SMESH_TNodeXYZ(node[1]) +
+                                                      SMESH_TNodeXYZ(node[2]) +
+                                                      SMESH_TNodeXYZ(node[3]) +
+                                                      SMESH_TNodeXYZ(node[4])) / 5.,
+                                                     SMDSAbs_Volume, foundVolumes ))
+                break;
+            }
+            aCreatedElem = theHelper->AddVolume( node[3], node[2], node[1],
+                                                   node[0], node[4],
+                                                   noID, force3d );
+          }
+          break;
         case GmfPrisms:
           if ( hasGeom )
           {
@@ -999,17 +790,15 @@ static bool readGMFFile(MG_HYBRID_API*                  MGOutput,
     makeDomainGroups( elemsOfDomain, theHelper );
 
 #ifdef _DEBUG_
-  MESSAGE("Nb subdomains " << subdomainId2tetraId.size());
   std::map<int, std::set<int> >::const_iterator subdomainIt = subdomainId2tetraId.begin();
-  TCollection_AsciiString aSubdomainFileName = theFile;
+  std::string aSubdomainFileName = theFile;
   aSubdomainFileName = aSubdomainFileName + ".subdomain";
-  ofstream aSubdomainFile  ( aSubdomainFileName.ToCString()  , ios::out);
+  ofstream aSubdomainFile  ( aSubdomainFileName  , ios::out);
 
   aSubdomainFile << "Nb subdomains " << subdomainId2tetraId.size() << std::endl;
   for(;subdomainIt != subdomainId2tetraId.end() ; ++subdomainIt) {
     int subdomainId = subdomainIt->first;
     std::set<int> tetraIds = subdomainIt->second;
-    MESSAGE("Subdomain #"<<subdomainId<<": "<<tetraIds.size()<<" tetrahedrons");
     std::set<int>::const_iterator tetraIdsIt = tetraIds.begin();
     aSubdomainFile << subdomainId << std::endl;
     for(;tetraIdsIt != tetraIds.end() ; ++tetraIdsIt) {
@@ -1042,8 +831,6 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
                          std::map<std::vector<double>, std::string> &    enfVerticesWithGroup,
                          HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues & theEnforcedVertices)
 {
-  //MESSAGE("writeGMFFile w/o geometry");
-  std::cout << "!!!!!!!!!!!writeGMFFile w/o geometry for HYBRIDPLUGIN..." << std::endl;
   std::string tmpStr;
   int idx, idxRequired = 0, idxSol = 0;
   //tabg each dummyint
@@ -1052,12 +839,12 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
   const int dummyint2 = 2;
   const int dummyint3 = 3;
   const int dummyint4 = 4;
-  const int dummyint5 = 5;
-  const int dummyint6 = 6; //are interesting for layers
+  const int enforcedTag = HYBRIDPlugin_Hypothesis::EnforcedTag();
+  //const int dummyint6 = 6; //are interesting for layers
   HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues::const_iterator vertexIt;
   std::vector<double> enfVertexSizes;
   const SMDS_MeshElement* elem;
-  TIDSortedElemSet anElemSet, theKeptEnforcedEdges, theKeptEnforcedTriangles;
+  TIDSortedElemSet anElemSetTri, anElemSetQuad, theKeptEnforcedEdges, theKeptEnforcedTriangles;
   SMDS_ElemIteratorPtr nodeIt;
   std::vector <const SMDS_MeshNode*> theEnforcedNodeByHybridId;
   std::map<const SMDS_MeshNode*,int> anEnforcedNodeToHybridIdMap, anExistingEnforcedNodeToHybridIdMap;
@@ -1097,9 +884,17 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
   while ( eIt->more() )
   {
     elem = eIt->next();
-    anElemSet.insert(elem);
     nodeIt = elem->nodesIterator();
     nbNodes = elem->NbCornerNodes();
+    if (nbNodes == 3)
+      anElemSetTri.insert(elem);
+    else if (nbNodes == 4)
+      anElemSetQuad.insert(elem);
+    else
+    {
+      std::cout << "Unexpected number of nodes: " << nbNodes << std::endl;
+      throw ("Unexpected number of nodes" );
+    }
     while ( nodeIt->more() && nbNodes--)
     {
       // find HYBRID ID
@@ -1295,22 +1090,6 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
       continue;
     }
     
-//     gp_Pnt myPoint(node->X(),node->Y(),node->Z());
-//     nbFoundElems = pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems);
-//     if (nbFoundElems ==0) {
-//       std::cout << " not found" << std::endl;
-//       if ((*aNodeToTopAbs_StateMap.find(node)).second == TopAbs_IN) {
-//         nodesCoords.insert(coords);
-//         theOrderedNodes.push_back(node);
-//       }
-//     }
-//     else {
-//       std::cout << " found in initial mesh" << std::endl;
-//       const SMDS_MeshNode* existingNode = (SMDS_MeshNode*) foundElems.at(0);
-//       nodesCoords.insert(coords);
-//       theOrderedNodes.push_back(existingNode);
-//     }
-    
 #ifdef _DEBUG_
     std::cout << " not found" << std::endl;
 #endif
@@ -1361,29 +1140,6 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
       continue;
     }
     
-//     nbFoundElems = pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems);
-//     if (nbFoundElems ==0) {
-//       std::cout << " not found" << std::endl;
-//       if (result == TopAbs_IN) {
-//         nodesCoords.insert(coords);
-//         theRequiredNodes.push_back(node);
-//       }
-//     }
-//     else {
-//       std::cout << " found in initial mesh" << std::endl;
-//       const SMDS_MeshNode* existingNode = (SMDS_MeshNode*) foundElems.at(0);
-// //       nodesCoords.insert(coords);
-//       theRequiredNodes.push_back(existingNode);
-//     }
-//     
-//     
-//     
-//     if (pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems) == 0)
-//       continue;
-
-//     if ( result != TopAbs_IN )
-//       continue;
-    
 #ifdef _DEBUG_
     std::cout << " not found" << std::endl;
 #endif
@@ -1396,7 +1152,6 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
   int solSize = 0;
   std::vector<std::vector<double> > ReqVerTab;
   if (nbEnforcedVertices) {
-//    ReqVerTab.clear();
     (nbEnforcedVertices <= 1) ? tmpStr = " node" : " nodes";
     std::cout << nbEnforcedVertices << tmpStr << " from enforced vertices ..." << std::endl;
     // Iterate over the enforced vertices
@@ -1409,11 +1164,6 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
       TopAbs_State result = pntCls->GetPointState( myPoint );
       if ( result == TopAbs_OUT )
         continue;
-      //if (pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems) == 0)
-      //continue;
-
-//       if ( result != TopAbs_IN )
-//         continue;
       std::vector<double> coords;
       coords.push_back(x);
       coords.push_back(y);
@@ -1428,7 +1178,7 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
   // GmfVertices
   std::cout << "Begin writing required nodes in GmfVertices" << std::endl;
   std::cout << "Nb vertices: " << theOrderedNodes.size() << std::endl;
-  MGInput->GmfSetKwd(idx, GmfVertices, theOrderedNodes.size()); //theOrderedNodes.size()+solSize)
+  MGInput->GmfSetKwd(idx, GmfVertices, theOrderedNodes.size());
   for (hybridNodeIt = theOrderedNodes.begin();hybridNodeIt != theOrderedNodes.end();++hybridNodeIt) {
     MGInput->GmfSetLin(idx, GmfVertices, (*hybridNodeIt)->X(), (*hybridNodeIt)->Y(), (*hybridNodeIt)->Z(), dummyint1);
   }
@@ -1454,8 +1204,6 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
     double ValTab[] = {0.0};
     MGInput->GmfSetKwd(idxRequired, GmfVertices, requiredNodes + solSize);
     MGInput->GmfSetKwd(idxSol, GmfSolAtVertices, requiredNodes + solSize, 1, TypTab);
-//     int usedEnforcedNodes = 0;
-//     std::string gn = "";
     for (hybridNodeIt = theRequiredNodes.begin();hybridNodeIt != theRequiredNodes.end();++hybridNodeIt) {
       MGInput->GmfSetLin(idxRequired, GmfVertices, (*hybridNodeIt)->X(), (*hybridNodeIt)->Y(), (*hybridNodeIt)->Z(), dummyint2);
       MGInput->GmfSetLin(idxSol, GmfSolAtVertices, ValTab);
@@ -1482,17 +1230,13 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
     std::cout << "End writing in req and sol file" << std::endl;
   }
 
-  int nedge[2], ntri[3];
+  int nedge[2], ntri[3], nquad[4];
     
   // GmfEdges
   int usedEnforcedEdges = 0;
   if (theKeptEnforcedEdges.size()) {
     anEdgeGroupByHybridId.resize( theKeptEnforcedEdges.size() );
-//    idxRequired = MGInput->GmfOpenMesh(theRequiredFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
-//    if (!idxRequired)
-//      return false;
     MGInput->GmfSetKwd(idx, GmfEdges, theKeptEnforcedEdges.size());
-//    MGInput->GmfSetKwd(idxRequired, GmfEdges, theKeptEnforcedEdges.size());
     for(elemSetIt = theKeptEnforcedEdges.begin() ; elemSetIt != theKeptEnforcedEdges.end() ; ++elemSetIt) {
       elem = (*elemSetIt);
       nodeIt = elem->nodesIterator();
@@ -1511,10 +1255,8 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
       }
       MGInput->GmfSetLin(idx, GmfEdges, nedge[0], nedge[1], dummyint4);
       anEdgeGroupByHybridId[usedEnforcedEdges] = theEnforcedEdges.find(elem)->second;
-//      MGInput->GmfSetLin(idxRequired, GmfEdges, nedge[0], nedge[1], dummyint);
       usedEnforcedEdges++;
     }
-//    MGInput->GmfCloseMesh(idxRequired);
   }
 
 
@@ -1527,16 +1269,19 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
 
   // GmfTriangles
   int usedEnforcedTriangles = 0;
-  if (anElemSet.size()+theKeptEnforcedTriangles.size()) {
-    aFaceGroupByHybridId.resize( anElemSet.size()+theKeptEnforcedTriangles.size() );
-    MGInput->GmfSetKwd(idx, GmfTriangles, anElemSet.size()+theKeptEnforcedTriangles.size());
+  if (anElemSetTri.size()+theKeptEnforcedTriangles.size())
+  {
+    aFaceGroupByHybridId.resize( anElemSetTri.size()+theKeptEnforcedTriangles.size() );
+    MGInput->GmfSetKwd(idx, GmfTriangles, anElemSetTri.size()+theKeptEnforcedTriangles.size());
     int k=0;
-    for(elemSetIt = anElemSet.begin() ; elemSetIt != anElemSet.end() ; ++elemSetIt,++k) {
+    for(elemSetIt = anElemSetTri.begin() ; elemSetIt != anElemSetTri.end() ; ++elemSetIt,++k)
+    {
       elem = (*elemSetIt);
       theFaceByHybridId.push_back( elem );
       nodeIt = elem->nodesIterator();
       int index=0;
-      for ( int j = 0; j < 3; ++j ) {
+      for ( int j = 0; j < 3; ++j )
+      {
         // find HYBRID ID
         const SMDS_MeshNode* node = castToNode( nodeIt->next() );
         std::map< const SMDS_MeshNode*,int >::iterator it = aNodeToHybridIdMap.find(node);
@@ -1545,22 +1290,26 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
         ntri[index] = it->second;
         index++;
       }
-      MGInput->GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], dummyint5);
+      MGInput->GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], /*tag=*/elem->getshapeId() );
       aFaceGroupByHybridId[k] = "";
     }
     
     if ( !theHelper.GetMesh()->HasShapeToMesh() ) SMESHUtils::FreeVector( theFaceByHybridId ); 
     std::cout << "Enforced triangles size " << theKeptEnforcedTriangles.size() << std::endl;
-    if (theKeptEnforcedTriangles.size()) {
-      for(elemSetIt = theKeptEnforcedTriangles.begin() ; elemSetIt != theKeptEnforcedTriangles.end() ; ++elemSetIt,++k) {
+    if (theKeptEnforcedTriangles.size())
+    {
+      for(elemSetIt = theKeptEnforcedTriangles.begin() ; elemSetIt != theKeptEnforcedTriangles.end() ; ++elemSetIt,++k)
+      {
         elem = (*elemSetIt);
         nodeIt = elem->nodesIterator();
         int index=0;
-        for ( int j = 0; j < 3; ++j ) {
+        for ( int j = 0; j < 3; ++j )
+        {
           // find HYBRID ID
           const SMDS_MeshNode* node = castToNode( nodeIt->next() );
           std::map< const SMDS_MeshNode*,int >::iterator it = anEnforcedNodeToHybridIdMap.find(node);
-          if (it == anEnforcedNodeToHybridIdMap.end()) {
+          if (it == anEnforcedNodeToHybridIdMap.end())
+          {
             it = anExistingEnforcedNodeToHybridIdMap.find(node);
             if (it == anEnforcedNodeToHybridIdMap.end())
               throw "Node not found";
@@ -1568,7 +1317,7 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
           ntri[index] = it->second;
           index++;
         }
-        MGInput->GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], dummyint6);
+        MGInput->GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], enforcedTag);
         aFaceGroupByHybridId[k] = theEnforcedTriangles.find(elem)->second;
         usedEnforcedTriangles++;
       }
@@ -1576,10 +1325,38 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
   }
 
   
-  if (usedEnforcedTriangles) {
+  if (usedEnforcedTriangles)
+  {
     MGInput->GmfSetKwd(idx, GmfRequiredTriangles, usedEnforcedTriangles);
     for (int enfID=1;enfID<=usedEnforcedTriangles;enfID++)
-      MGInput->GmfSetLin(idx, GmfRequiredTriangles, anElemSet.size()+enfID);
+      MGInput->GmfSetLin(idx, GmfRequiredTriangles, anElemSetTri.size()+enfID);
+  }
+  
+  if (anElemSetQuad.size())
+  {
+    MGInput->GmfSetKwd(idx, GmfQuadrilaterals, anElemSetQuad.size());
+    int k=0;
+    for(elemSetIt = anElemSetQuad.begin() ; elemSetIt != anElemSetQuad.end() ; ++elemSetIt,++k)
+    {
+      elem = (*elemSetIt);
+      theFaceByHybridId.push_back( elem );
+      nodeIt = elem->nodesIterator();
+      int index=0;
+      for ( int j = 0; j < 4; ++j )
+      {
+        // find HYBRID ID
+        const SMDS_MeshNode* node = castToNode( nodeIt->next() );
+        std::map< const SMDS_MeshNode*,int >::iterator it = aNodeToHybridIdMap.find(node);
+        if (it == aNodeToHybridIdMap.end())
+          throw "Node not found";
+        nquad[index] = it->second;
+        index++;
+      }
+      MGInput->GmfSetLin(idx, GmfQuadrilaterals, nquad[0], nquad[1], nquad[2], nquad[3],
+                         /*tag=*/elem->getshapeId() );
+      // _CEA_cbo what is it for???
+      //aFaceGroupByHybridId[k] = "";
+    }
   }
 
   MGInput->GmfCloseMesh(idx);
@@ -1592,1217 +1369,6 @@ static bool writeGMFFile(MG_HYBRID_API*                                  MGInput
   
 }
 
-// static bool writeGMFFile(const char*                                    theMeshFileName,
-//                         const char*                                     theRequiredFileName,
-//                         const char*                                     theSolFileName,
-//                         SMESH_MesherHelper&                             theHelper,
-//                         const SMESH_ProxyMesh&                          theProxyMesh,
-//                         std::map <int,int> &                            theNodeId2NodeIndexMap,
-//                         std::map <int,int> &                            theSmdsToHybridIdMap,
-//                         std::map <int,const SMDS_MeshNode*> &           theHybridIdToNodeMap,
-//                         TIDSortedNodeSet &                              theEnforcedNodes,
-//                         TIDSortedElemSet &                              theEnforcedEdges,
-//                         TIDSortedElemSet &                              theEnforcedTriangles,
-// //                         TIDSortedElemSet &                              theEnforcedQuadrangles,
-//                         HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues & theEnforcedVertices)
-// {
-//   MESSAGE("writeGMFFile with geometry");
-//   int idx, idxRequired, idxSol;
-//   int nbv, nbev, nben, aHybridID = 0;
-//   const int dummyint = 0;
-//   HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues::const_iterator vertexIt;
-//   std::vector<double> enfVertexSizes;
-//   TIDSortedNodeSet::const_iterator enfNodeIt;
-//   const SMDS_MeshNode* node;
-//   SMDS_NodeIteratorPtr nodeIt;
-// 
-//   idx = GmfOpenMesh(theMeshFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
-//   if (!idx)
-//     return false;
-//   
-//   SMESHDS_Mesh * theMeshDS = theHelper.GetMeshDS();
-//   
-//   /* ========================== NODES ========================== */
-//   // NB_NODES
-//   nbv = theMeshDS->NbNodes();
-//   if ( nbv == 0 )
-//     return false;
-//   nbev = theEnforcedVertices.size();
-//   nben = theEnforcedNodes.size();
-//   
-//   // Issue 020674: EDF 870 SMESH: Mesh generated by Netgen not usable by HYBRID
-//   // The problem is in nodes on degenerated edges, we need to skip nodes which are free
-//   // and replace not-free nodes on edges by the node on vertex
-//   TNodeNodeMap n2nDegen; // map a node on degenerated edge to a node on vertex
-//   TNodeNodeMap::iterator n2nDegenIt;
-//   if ( theHelper.HasDegeneratedEdges() )
-//   {
-//     set<int> checkedSM;
-//     for (TopExp_Explorer e(theMeshDS->ShapeToMesh(), TopAbs_EDGE ); e.More(); e.Next())
-//     {
-//       SMESH_subMesh* sm = theHelper.GetMesh()->GetSubMesh( e.Current() );
-//       if ( checkedSM.insert( sm->GetId() ).second && theHelper.IsDegenShape(sm->GetId() ))
-//       {
-//         if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() )
-//         {
-//           TopoDS_Shape vertex = TopoDS_Iterator( e.Current() ).Value();
-//           const SMDS_MeshNode* vNode = SMESH_Algo::VertexNode( TopoDS::Vertex( vertex ), theMeshDS);
-//           {
-//             SMDS_NodeIteratorPtr nIt = smDS->GetNodes();
-//             while ( nIt->more() )
-//               n2nDegen.insert( std::make_pair( nIt->next(), vNode ));
-//           }
-//         }
-//       }
-//     }
-//   }
-//   
-//   const bool isQuadMesh = 
-//     theHelper.GetMesh()->NbEdges( ORDER_QUADRATIC ) ||
-//     theHelper.GetMesh()->NbFaces( ORDER_QUADRATIC ) ||
-//     theHelper.GetMesh()->NbVolumes( ORDER_QUADRATIC );
-// 
-//   std::vector<std::vector<double> > VerTab;
-//   std::set<std::vector<double> > VerMap;
-//   VerTab.clear();
-//   std::vector<double> aVerTab;
-//   // Loop from 1 to NB_NODES
-// 
-//   nodeIt = theMeshDS->nodesIterator();
-//   
-//   while ( nodeIt->more() )
-//   {
-//     node = nodeIt->next();
-//     if ( isQuadMesh && theHelper.IsMedium( node )) // Issue 0021238
-//       continue;
-//     if ( n2nDegen.count( node ) ) // Issue 0020674
-//       continue;
-// 
-//     std::vector<double> coords;
-//     coords.push_back(node->X());
-//     coords.push_back(node->Y());
-//     coords.push_back(node->Z());
-//     if (VerMap.find(coords) != VerMap.end()) {
-//       aHybridID = theSmdsToHybridIdMap[node->GetID()];
-//       theHybridIdToNodeMap[theSmdsToHybridIdMap[node->GetID()]] = node;
-//       continue;
-//     }
-//     VerTab.push_back(coords);
-//     VerMap.insert(coords);
-//     aHybridID++;
-//     theSmdsToHybridIdMap.insert( std::make_pair( node->GetID(), aHybridID ));
-//     theHybridIdToNodeMap.insert( std::make_pair( aHybridID, node ));
-//   }
-//   
-//   
-//   /* ENFORCED NODES ========================== */
-//   if (nben) {
-//     std::cout << "Add " << nben << " enforced nodes to input .mesh file" << std::endl;
-//     for(enfNodeIt = theEnforcedNodes.begin() ; enfNodeIt != theEnforcedNodes.end() ; ++enfNodeIt) {
-//       double x = (*enfNodeIt)->X();
-//       double y = (*enfNodeIt)->Y();
-//       double z = (*enfNodeIt)->Z();
-//       // Test if point is inside shape to mesh
-//       gp_Pnt myPoint(x,y,z);
-//       BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh());
-//       scl.Perform(myPoint, 1e-7);
-//       TopAbs_State result = scl.State();
-//       if ( result != TopAbs_IN )
-//         continue;
-//       std::vector<double> coords;
-//       coords.push_back(x);
-//       coords.push_back(y);
-//       coords.push_back(z);
-//       if (theEnforcedVertices.find(coords) != theEnforcedVertices.end())
-//         continue;
-//       if (VerMap.find(coords) != VerMap.end())
-//         continue;
-//       VerTab.push_back(coords);
-//       VerMap.insert(coords);
-//       aHybridID++;
-//       theNodeId2NodeIndexMap.insert( std::make_pair( (*enfNodeIt)->GetID(), aHybridID ));
-//     }
-//   }
-//     
-//   
-//   /* ENFORCED VERTICES ========================== */
-//   int solSize = 0;
-//   std::vector<std::vector<double> > ReqVerTab;
-//   ReqVerTab.clear();
-//   if (nbev) {
-//     std::cout << "Add " << nbev << " enforced vertices to input .mesh file" << std::endl;
-//     for(vertexIt = theEnforcedVertices.begin() ; vertexIt != theEnforcedVertices.end() ; ++vertexIt) {
-//       double x = vertexIt->first[0];
-//       double y = vertexIt->first[1];
-//       double z = vertexIt->first[2];
-//       // Test if point is inside shape to mesh
-//       gp_Pnt myPoint(x,y,z);
-//       BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh());
-//       scl.Perform(myPoint, 1e-7);
-//       TopAbs_State result = scl.State();
-//       if ( result != TopAbs_IN )
-//         continue;
-//       enfVertexSizes.push_back(vertexIt->second);
-//       std::vector<double> coords;
-//       coords.push_back(x);
-//       coords.push_back(y);
-//       coords.push_back(z);
-//       if (VerMap.find(coords) != VerMap.end())
-//         continue;
-//       ReqVerTab.push_back(coords);
-//       VerMap.insert(coords);
-//       solSize++;
-//     }
-//   }
-// 
-//   
-//   /* ========================== FACES ========================== */
-//   
-//   int nbTriangles = 0/*, nbQuadrangles = 0*/, aSmdsID;
-//   TopTools_IndexedMapOfShape facesMap, trianglesMap/*, quadranglesMap*/;
-//   TIDSortedElemSet::const_iterator elemIt;
-//   const SMESHDS_SubMesh* theSubMesh;
-//   TopoDS_Shape aShape;
-//   SMDS_ElemIteratorPtr itOnSubMesh, itOnSubFace;
-//   const SMDS_MeshElement* aFace;
-//   map<int,int>::const_iterator itOnMap;
-//   std::vector<std::vector<int> > tt, qt,et;
-//   tt.clear();
-//   qt.clear();
-//   et.clear();
-//   std::vector<int> att, aqt, aet;
-//   
-//   TopExp::MapShapes( theMeshDS->ShapeToMesh(), TopAbs_FACE, facesMap );
-// 
-//   for ( int i = 1; i <= facesMap.Extent(); ++i )
-//     if (( theSubMesh  = theProxyMesh.GetSubMesh( facesMap(i))))
-//     {
-//       SMDS_ElemIteratorPtr it = theSubMesh->GetElements();
-//       while (it->more())
-//       {
-//         const SMDS_MeshElement *elem = it->next();
-//         int nbCornerNodes = elem->NbCornerNodes();
-//         if (nbCornerNodes == 3)
-//         {
-//           trianglesMap.Add(facesMap(i));
-//           nbTriangles ++;
-//         }
-// //         else if (nbCornerNodes == 4)
-// //         {
-// //           quadranglesMap.Add(facesMap(i));
-// //           nbQuadrangles ++;
-// //         }
-//       }
-//     }
-//     
-//   /* TRIANGLES ========================== */
-//   if (nbTriangles) {
-//     for ( int i = 1; i <= trianglesMap.Extent(); i++ )
-//     {
-//       aShape = trianglesMap(i);
-//       theSubMesh = theProxyMesh.GetSubMesh(aShape);
-//       if ( !theSubMesh ) continue;
-//       itOnSubMesh = theSubMesh->GetElements();
-//       while ( itOnSubMesh->more() )
-//       {
-//         aFace = itOnSubMesh->next();
-//         itOnSubFace = aFace->nodesIterator();
-//         att.clear();
-//         for ( int j = 0; j < 3; ++j ) {
-//           // find HYBRID ID
-//           node = castToNode( itOnSubFace->next() );
-//           if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() )
-//             node = n2nDegenIt->second;
-//           aSmdsID = node->GetID();
-//           itOnMap = theSmdsToHybridIdMap.find( aSmdsID );
-//           ASSERT( itOnMap != theSmdsToHybridIdMap.end() );
-//           att.push_back((*itOnMap).second);
-//         }
-//         tt.push_back(att);
-//       }
-//     }
-//   }
-// 
-//   if (theEnforcedTriangles.size()) {
-//     std::cout << "Add " << theEnforcedTriangles.size() << " enforced triangles to input .mesh file" << std::endl;
-//     // Iterate over the enforced triangles
-//     for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) {
-//       aFace = (*elemIt);
-//       itOnSubFace = aFace->nodesIterator();
-//       bool isOK = true;
-//       att.clear();
-//       
-//       for ( int j = 0; j < 3; ++j ) {
-//         node = castToNode( itOnSubFace->next() );
-//         if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() )
-//           node = n2nDegenIt->second;
-// //         std::cout << node;
-//         double x = node->X();
-//         double y = node->Y();
-//         double z = node->Z();
-//         // Test if point is inside shape to mesh
-//         gp_Pnt myPoint(x,y,z);
-//         BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh());
-//         scl.Perform(myPoint, 1e-7);
-//         TopAbs_State result = scl.State();
-//         if ( result != TopAbs_IN ) {
-//           isOK = false;
-//           theEnforcedTriangles.erase(elemIt);
-//           continue;
-//         }
-//         std::vector<double> coords;
-//         coords.push_back(x);
-//         coords.push_back(y);
-//         coords.push_back(z);
-//         if (VerMap.find(coords) != VerMap.end()) {
-//           att.push_back(theNodeId2NodeIndexMap[node->GetID()]);
-//           continue;
-//         }
-//         VerTab.push_back(coords);
-//         VerMap.insert(coords);
-//         aHybridID++;
-//         theNodeId2NodeIndexMap.insert( std::make_pair( node->GetID(), aHybridID ));
-//         att.push_back(aHybridID);
-//       }
-//       if (isOK)
-//         tt.push_back(att);
-//     }
-//   }
-// 
-// 
-//   /* ========================== EDGES ========================== */
-// 
-//   if (theEnforcedEdges.size()) {
-//     // Iterate over the enforced edges
-//     std::cout << "Add " << theEnforcedEdges.size() << " enforced edges to input .mesh file" << std::endl;
-//     for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) {
-//       aFace = (*elemIt);
-//       bool isOK = true;
-//       itOnSubFace = aFace->nodesIterator();
-//       aet.clear();
-//       for ( int j = 0; j < 2; ++j ) {
-//         node = castToNode( itOnSubFace->next() );
-//         if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() )
-//           node = n2nDegenIt->second;
-//         double x = node->X();
-//         double y = node->Y();
-//         double z = node->Z();
-//         // Test if point is inside shape to mesh
-//         gp_Pnt myPoint(x,y,z);
-//         BRepClass3d_SolidClassifier scl(theMeshDS->ShapeToMesh());
-//         scl.Perform(myPoint, 1e-7);
-//         TopAbs_State result = scl.State();
-//         if ( result != TopAbs_IN ) {
-//           isOK = false;
-//           theEnforcedEdges.erase(elemIt);
-//           continue;
-//         }
-//         std::vector<double> coords;
-//         coords.push_back(x);
-//         coords.push_back(y);
-//         coords.push_back(z);
-//         if (VerMap.find(coords) != VerMap.end()) {
-//           aet.push_back(theNodeId2NodeIndexMap[node->GetID()]);
-//           continue;
-//         }
-//         VerTab.push_back(coords);
-//         VerMap.insert(coords);
-//         
-//         aHybridID++;
-//         theNodeId2NodeIndexMap.insert( std::make_pair( node->GetID(), aHybridID ));
-//         aet.push_back(aHybridID);
-//       }
-//       if (isOK)
-//         et.push_back(aet);
-//     }
-//   }
-// 
-// 
-//   /* Write vertices number */
-//   MESSAGE("Number of vertices: "<<aHybridID);
-//   MESSAGE("Size of vector: "<<VerTab.size());
-//   GmfSetKwd(idx, GmfVertices, aHybridID/*+solSize*/);
-//   for (int i=0;i<aHybridID;i++)
-//     GmfSetLin(idx, GmfVertices, VerTab[i][0], VerTab[i][1], VerTab[i][2], dummyint);
-// //   for (int i=0;i<solSize;i++) {
-// //     std::cout << ReqVerTab[i][0] <<" "<< ReqVerTab[i][1] << " "<< ReqVerTab[i][2] << std::endl;
-// //     GmfSetLin(idx, GmfVertices, ReqVerTab[i][0], ReqVerTab[i][1], ReqVerTab[i][2], dummyint);
-// //   }
-// 
-//   if (solSize) {
-//     idxRequired = GmfOpenMesh(theRequiredFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
-//     if (!idxRequired) {
-//       GmfCloseMesh(idx);
-//       return false;
-//     }
-//     idxSol = GmfOpenMesh(theSolFileName, GmfWrite, GMFVERSION, GMFDIMENSION);
-//     if (!idxSol){
-//       GmfCloseMesh(idx);
-//       if (idxRequired)
-//         GmfCloseMesh(idxRequired);
-//       return false;
-//     }
-//     
-//     int TypTab[] = {GmfSca};
-//     GmfSetKwd(idxRequired, GmfVertices, solSize);
-//     GmfSetKwd(idxSol, GmfSolAtVertices, solSize, 1, TypTab);
-//     
-//     for (int i=0;i<solSize;i++) {
-//       double solTab[] = {enfVertexSizes.at(i)};
-//       GmfSetLin(idxRequired, GmfVertices, ReqVerTab[i][0], ReqVerTab[i][1], ReqVerTab[i][2], dummyint);
-//       GmfSetLin(idxSol, GmfSolAtVertices, solTab);
-//     }
-//     GmfCloseMesh(idxRequired);
-//     GmfCloseMesh(idxSol);
-//   }
-//   
-//   /* Write triangles number */
-//   if (tt.size()) {
-//     GmfSetKwd(idx, GmfTriangles, tt.size());
-//     for (int i=0;i<tt.size();i++)
-//       GmfSetLin(idx, GmfTriangles, tt[i][0], tt[i][1], tt[i][2], dummyint);
-//   }  
-//   
-//   /* Write edges number */
-//   if (et.size()) {
-//     GmfSetKwd(idx, GmfEdges, et.size());
-//     for (int i=0;i<et.size();i++)
-//       GmfSetLin(idx, GmfEdges, et[i][0], et[i][1], dummyint);
-//   }
-// 
-//   /* QUADRANGLES ========================== */
-//   // TODO: add pyramids ?
-// //   if (nbQuadrangles) {
-// //     for ( int i = 1; i <= quadranglesMap.Extent(); i++ )
-// //     {
-// //       aShape = quadranglesMap(i);
-// //       theSubMesh = theProxyMesh.GetSubMesh(aShape);
-// //       if ( !theSubMesh ) continue;
-// //       itOnSubMesh = theSubMesh->GetElements();
-// //       for ( int j = 0; j < 4; ++j )
-// //       {
-// //         aFace = itOnSubMesh->next();
-// //         itOnSubFace = aFace->nodesIterator();
-// //         aqt.clear();
-// //         while ( itOnSubFace->more() ) {
-// //           // find HYBRID ID
-// //           aSmdsID = itOnSubFace->next()->GetID();
-// //           itOnMap = theSmdsToHybridIdMap.find( aSmdsID );
-// //           ASSERT( itOnMap != theSmdsToHybridIdMap.end() );
-// //           aqt.push_back((*itOnMap).second);
-// //         }
-// //         qt.push_back(aqt);
-// //       }
-// //     }
-// //   }
-// // 
-// //   if (theEnforcedQuadrangles.size()) {
-// //     // Iterate over the enforced triangles
-// //     for(elemIt = theEnforcedQuadrangles.begin() ; elemIt != theEnforcedQuadrangles.end() ; ++elemIt) {
-// //       aFace = (*elemIt);
-// //       bool isOK = true;
-// //       itOnSubFace = aFace->nodesIterator();
-// //       aqt.clear();
-// //       for ( int j = 0; j < 4; ++j ) {
-// //         int aNodeID = itOnSubFace->next()->GetID();
-// //         itOnMap = theNodeId2NodeIndexMap.find(aNodeID);
-// //         if (itOnMap != theNodeId2NodeIndexMap.end())
-// //           aqt.push_back((*itOnMap).second);
-// //         else {
-// //           isOK = false;
-// //           theEnforcedQuadrangles.erase(elemIt);
-// //           break;
-// //         }
-// //       }
-// //       if (isOK)
-// //         qt.push_back(aqt);
-// //     }
-// //   }
-// //  
-//   
-// //   /* Write quadrilaterals number */
-// //   if (qt.size()) {
-// //     GmfSetKwd(idx, GmfQuadrilaterals, qt.size());
-// //     for (int i=0;i<qt.size();i++)
-// //       GmfSetLin(idx, GmfQuadrilaterals, qt[i][0], qt[i][1], qt[i][2], qt[i][3], dummyint);
-// //   }
-// 
-//   GmfCloseMesh(idx);
-//   return true;
-// }
-
-
-//=======================================================================
-//function : writeFaces
-//purpose  : 
-//=======================================================================
-
-// static bool writeFaces (ofstream &              theFile,
-//                         const SMESH_ProxyMesh&  theMesh,
-//                         const TopoDS_Shape&     theShape,
-//                         const std::map <int,int> &   theSmdsToHybridIdMap,
-//                         const std::map <int,int> &   theEnforcedNodeIdToHybridIdMap,
-//                         HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges,
-//                         HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles)
-// {
-//   // record structure:
-//   //
-//   // NB_ELEMS DUMMY_INT
-//   // Loop from 1 to NB_ELEMS
-//   // NB_NODES NODE_NB_1 NODE_NB_2 ... (NB_NODES + 1) times: DUMMY_INT
-
-//   TopoDS_Shape aShape;
-//   const SMESHDS_SubMesh* theSubMesh;
-//   const SMDS_MeshElement* aFace;
-//   const char* space    = "  ";
-//   const int   dummyint = 0;
-//   std::map<int,int>::const_iterator itOnMap;
-//   SMDS_ElemIteratorPtr itOnSubMesh, itOnSubFace;
-//   int nbNodes, aSmdsID;
-
-//   TIDSortedElemSet::const_iterator elemIt;
-//   int nbEnforcedEdges       = theEnforcedEdges.size();
-//   int nbEnforcedTriangles   = theEnforcedTriangles.size();
-
-//   // count triangles bound to geometry
-//   int nbTriangles = 0;
-
-//   TopTools_IndexedMapOfShape facesMap, trianglesMap;
-//   TopExp::MapShapes( theShape, TopAbs_FACE, facesMap );
-  
-//   int nbFaces = facesMap.Extent();
-
-//   for ( int i = 1; i <= nbFaces; ++i )
-//     if (( theSubMesh  = theMesh.GetSubMesh( facesMap(i))))
-//       nbTriangles += theSubMesh->NbElements();
-//   std::string tmpStr;
-//   (nbFaces == 0 || nbFaces == 1) ? tmpStr = " shape " : tmpStr = " shapes " ;
-//   std::cout << "    " << nbFaces << tmpStr << "of 2D dimension";
-//   int nbEnforcedElements = nbEnforcedEdges+nbEnforcedTriangles;
-//   if (nbEnforcedElements > 0) {
-//     (nbEnforcedElements == 1) ? tmpStr = "shape:" : tmpStr = "shapes:";
-//     std::cout << " and" << std::endl;
-//     std::cout << "    " << nbEnforcedElements 
-//                         << " enforced " << tmpStr << std::endl;
-//   }
-//   else
-//     std::cout << std::endl;
-//   if (nbEnforcedEdges) {
-//     (nbEnforcedEdges == 1) ? tmpStr = "edge" : tmpStr = "edges";
-//     std::cout << "      " << nbEnforcedEdges << " enforced " << tmpStr << std::endl;
-//   }
-//   if (nbEnforcedTriangles) {
-//     (nbEnforcedTriangles == 1) ? tmpStr = "triangle" : tmpStr = "triangles";
-//     std::cout << "      " << nbEnforcedTriangles << " enforced " << tmpStr << std::endl;
-//   }
-//   std::cout << std::endl;
-
-// //   theFile << space << nbTriangles << space << dummyint << std::endl;
-//   std::ostringstream globalStream, localStream, aStream;
-
-//   for ( int i = 1; i <= facesMap.Extent(); i++ )
-//   {
-//     aShape = facesMap(i);
-//     theSubMesh = theMesh.GetSubMesh(aShape);
-//     if ( !theSubMesh ) continue;
-//     itOnSubMesh = theSubMesh->GetElements();
-//     while ( itOnSubMesh->more() )
-//     {
-//       aFace = itOnSubMesh->next();
-//       nbNodes = aFace->NbCornerNodes();
-
-//       localStream << nbNodes << space;
-
-//       itOnSubFace = aFace->nodesIterator();
-//       for ( int j = 0; j < 3; ++j ) {
-//         // find HYBRID ID
-//         aSmdsID = itOnSubFace->next()->GetID();
-//         itOnMap = theSmdsToHybridIdMap.find( aSmdsID );
-//         // if ( itOnMap == theSmdsToHybridIdMap.end() ) {
-//         //   cout << "not found node: " << aSmdsID << endl;
-//         //   return false;
-//         // }
-//         ASSERT( itOnMap != theSmdsToHybridIdMap.end() );
-
-//         localStream << (*itOnMap).second << space ;
-//       }
-
-//       // (NB_NODES + 1) times: DUMMY_INT
-//       for ( int j=0; j<=nbNodes; j++)
-//         localStream << dummyint << space ;
-
-//       localStream << std::endl;
-//     }
-//   }
-  
-//   globalStream << localStream.str();
-//   localStream.str("");
-
-//   //
-//   //        FACES : END
-//   //
-
-// //   //
-// //   //        ENFORCED EDGES : BEGIN
-// //   //
-// //   
-// //   // Iterate over the enforced edges
-// //   int usedEnforcedEdges = 0;
-// //   bool isOK;
-// //   for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) {
-// //     aFace = (*elemIt);
-// //     isOK = true;
-// //     itOnSubFace = aFace->nodesIterator();
-// //     aStream.str("");
-// //     aStream << "2" << space ;
-// //     for ( int j = 0; j < 2; ++j ) {
-// //       aSmdsID = itOnSubFace->next()->GetID();
-// //       itOnMap = theEnforcedNodeIdToHybridIdMap.find(aSmdsID);
-// //       if (itOnMap != theEnforcedNodeIdToHybridIdMap.end())
-// //         aStream << (*itOnMap).second << space;
-// //       else {
-// //         isOK = false;
-// //         break;
-// //       }
-// //     }
-// //     if (isOK) {
-// //       for ( int j=0; j<=2; j++)
-// //         aStream << dummyint << space ;
-// // //       aStream << dummyint << space << dummyint;
-// //       localStream << aStream.str() << std::endl;
-// //       usedEnforcedEdges++;
-// //     }
-// //   }
-// //   
-// //   if (usedEnforcedEdges) {
-// //     globalStream << localStream.str();
-// //     localStream.str("");
-// //   }
-// // 
-// //   //
-// //   //        ENFORCED EDGES : END
-// //   //
-// //   //
-// // 
-// //   //
-// //   //        ENFORCED TRIANGLES : BEGIN
-// //   //
-// //     // Iterate over the enforced triangles
-// //   int usedEnforcedTriangles = 0;
-// //   for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) {
-// //     aFace = (*elemIt);
-// //     nbNodes = aFace->NbCornerNodes();
-// //     isOK = true;
-// //     itOnSubFace = aFace->nodesIterator();
-// //     aStream.str("");
-// //     aStream << nbNodes << space ;
-// //     for ( int j = 0; j < 3; ++j ) {
-// //       aSmdsID = itOnSubFace->next()->GetID();
-// //       itOnMap = theEnforcedNodeIdToHybridIdMap.find(aSmdsID);
-// //       if (itOnMap != theEnforcedNodeIdToHybridIdMap.end())
-// //         aStream << (*itOnMap).second << space;
-// //       else {
-// //         isOK = false;
-// //         break;
-// //       }
-// //     }
-// //     if (isOK) {
-// //       for ( int j=0; j<=3; j++)
-// //         aStream << dummyint << space ;
-// //       localStream << aStream.str() << std::endl;
-// //       usedEnforcedTriangles++;
-// //     }
-// //   }
-// //   
-// //   if (usedEnforcedTriangles) {
-// //     globalStream << localStream.str();
-// //     localStream.str("");
-// //   }
-// // 
-// //   //
-// //   //        ENFORCED TRIANGLES : END
-// //   //
-  
-//   theFile
-//   << nbTriangles/*+usedEnforcedTriangles+usedEnforcedEdges*/
-//   << " 0" << std::endl
-//   << globalStream.str();
-
-//   return true;
-// }
-
-//=======================================================================
-//function : writePoints
-//purpose  : 
-//=======================================================================
-
-// static bool writePoints (ofstream &                       theFile,
-//                          SMESH_MesherHelper&              theHelper,
-//                          std::map <int,int> &                  theSmdsToHybridIdMap,
-//                          std::map <int,int> &                  theEnforcedNodeIdToHybridIdMap,
-//                          std::map <int,const SMDS_MeshNode*> & theHybridIdToNodeMap,
-//                          HYBRIDPlugin_Hypothesis::TID2SizeMap & theNodeIDToSizeMap,
-//                          HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues & theEnforcedVertices,
-//                          HYBRIDPlugin_Hypothesis::TIDSortedNodeGroupMap & theEnforcedNodes,
-//                          HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges,
-//                          HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles)
-// {
-//   // record structure:
-//   //
-//   // NB_NODES
-//   // Loop from 1 to NB_NODES
-//   //   X Y Z DUMMY_INT
-
-//   SMESHDS_Mesh * theMeshDS = theHelper.GetMeshDS();
-//   int nbNodes = theMeshDS->NbNodes();
-//   if ( nbNodes == 0 )
-//     return false;
-  
-//   int nbEnforcedVertices = theEnforcedVertices.size();
-//   int nbEnforcedNodes    = theEnforcedNodes.size();
-  
-//   const TopoDS_Shape shapeToMesh = theMeshDS->ShapeToMesh();
-  
-//   int aHybridID = 1;
-//   SMDS_NodeIteratorPtr nodeIt = theMeshDS->nodesIterator();
-//   const SMDS_MeshNode* node;
-
-//   // Issue 020674: EDF 870 SMESH: Mesh generated by Netgen not usable by HYBRID
-//   // The problem is in nodes on degenerated edges, we need to skip nodes which are free
-//   // and replace not-free nodes on degenerated edges by the node on vertex
-//   TNodeNodeMap n2nDegen; // map a node on degenerated edge to a node on vertex
-//   TNodeNodeMap::iterator n2nDegenIt;
-//   if ( theHelper.HasDegeneratedEdges() )
-//   {
-//     std::set<int> checkedSM;
-//     for (TopExp_Explorer e(theMeshDS->ShapeToMesh(), TopAbs_EDGE ); e.More(); e.Next())
-//     {
-//       SMESH_subMesh* sm = theHelper.GetMesh()->GetSubMesh( e.Current() );
-//       if ( checkedSM.insert( sm->GetId() ).second && theHelper.IsDegenShape(sm->GetId() ))
-//       {
-//         if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() )
-//         {
-//           TopoDS_Shape vertex = TopoDS_Iterator( e.Current() ).Value();
-//           const SMDS_MeshNode* vNode = SMESH_Algo::VertexNode( TopoDS::Vertex( vertex ), theMeshDS);
-//           {
-//             SMDS_NodeIteratorPtr nIt = smDS->GetNodes();
-//             while ( nIt->more() )
-//               n2nDegen.insert( std::make_pair( nIt->next(), vNode ));
-//           }
-//         }
-//       }
-//     }
-//     nbNodes -= n2nDegen.size();
-//   }
-
-//   const bool isQuadMesh = 
-//     theHelper.GetMesh()->NbEdges( ORDER_QUADRATIC ) ||
-//     theHelper.GetMesh()->NbFaces( ORDER_QUADRATIC ) ||
-//     theHelper.GetMesh()->NbVolumes( ORDER_QUADRATIC );
-//   if ( isQuadMesh )
-//   {
-//     // descrease nbNodes by nb of medium nodes
-//     while ( nodeIt->more() )
-//     {
-//       node = nodeIt->next();
-//       if ( !theHelper.IsDegenShape( node->getshapeId() ))
-//         nbNodes -= int( theHelper.IsMedium( node ));
-//     }
-//     nodeIt = theMeshDS->nodesIterator();
-//   }
-
-//   const char* space    = "  ";
-//   const int   dummyint = 0;
-
-//   std::string tmpStr;
-//   (nbNodes == 0 || nbNodes == 1) ? tmpStr = " node" : tmpStr = " nodes";
-//   // NB_NODES
-//   std::cout << std::endl;
-//   std::cout << "The initial 2D mesh contains :" << std::endl;
-//   std::cout << "    " << nbNodes << tmpStr << std::endl;
-//   if (nbEnforcedVertices > 0) {
-//     (nbEnforcedVertices == 1) ? tmpStr = "vertex" : tmpStr = "vertices";
-//     std::cout << "    " << nbEnforcedVertices << " enforced " << tmpStr << std::endl;
-//   }
-//   if (nbEnforcedNodes > 0) {
-//     (nbEnforcedNodes == 1) ? tmpStr = "node" : tmpStr = "nodes";
-//     std::cout << "    " << nbEnforcedNodes << " enforced " << tmpStr << std::endl;
-//   }
-//   std::cout << std::endl;
-//   std::cout << "Start writing in 'points' file ..." << std::endl;
-
-//   theFile << nbNodes << std::endl;
-
-//   // Loop from 1 to NB_NODES
-
-//   while ( nodeIt->more() )
-//   {
-//     node = nodeIt->next();
-//     if ( isQuadMesh && theHelper.IsMedium( node )) // Issue 0021238
-//       continue;
-//     if ( n2nDegen.count( node ) ) // Issue 0020674
-//       continue;
-
-//     theSmdsToHybridIdMap.insert( std::make_pair( node->GetID(), aHybridID ));
-//     theHybridIdToNodeMap.insert( std::make_pair( aHybridID, node ));
-//     aHybridID++;
-
-//     // X Y Z DUMMY_INT
-//     theFile
-//     << node->X() << space 
-//     << node->Y() << space 
-//     << node->Z() << space 
-//     << dummyint;
-
-//     theFile << std::endl;
-
-//   }
-  
-//   // Iterate over the enforced nodes
-//   std::map<int,double> enfVertexIndexSizeMap;
-//   if (nbEnforcedNodes) {
-//     HYBRIDPlugin_Hypothesis::TIDSortedNodeGroupMap::const_iterator nodeIt = theEnforcedNodes.begin();
-//     for( ; nodeIt != theEnforcedNodes.end() ; ++nodeIt) {
-//       double x = nodeIt->first->X();
-//       double y = nodeIt->first->Y();
-//       double z = nodeIt->first->Z();
-//       // Test if point is inside shape to mesh
-//       gp_Pnt myPoint(x,y,z);
-//       BRepClass3d_SolidClassifier scl(shapeToMesh);
-//       scl.Perform(myPoint, 1e-7);
-//       TopAbs_State result = scl.State();
-//       if ( result != TopAbs_IN )
-//         continue;
-//       std::vector<double> coords;
-//       coords.push_back(x);
-//       coords.push_back(y);
-//       coords.push_back(z);
-//       if (theEnforcedVertices.find(coords) != theEnforcedVertices.end())
-//         continue;
-        
-// //      double size = theNodeIDToSizeMap.find(nodeIt->first->GetID())->second;
-//   //       theHybridIdToNodeMap.insert( std::make_pair( nbNodes + i, (*nodeIt) ));
-//   //       MESSAGE("Adding enforced node (" << x << "," << y <<"," << z << ")");
-//       // X Y Z PHY_SIZE DUMMY_INT
-//       theFile
-//       << x << space 
-//       << y << space 
-//       << z << space
-//       << -1 << space
-//       << dummyint << space;
-//       theFile << std::endl;
-//       theEnforcedNodeIdToHybridIdMap.insert( std::make_pair( nodeIt->first->GetID(), aHybridID ));
-//       enfVertexIndexSizeMap[aHybridID] = -1;
-//       aHybridID++;
-//   //     else
-//   //         MESSAGE("Enforced vertex (" << x << "," << y <<"," << z << ") is not inside the geometry: it was not added ");
-//     }
-//   }
-  
-//   if (nbEnforcedVertices) {
-//     // Iterate over the enforced vertices
-//     HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues::const_iterator vertexIt = theEnforcedVertices.begin();
-//     for( ; vertexIt != theEnforcedVertices.end() ; ++vertexIt) {
-//       double x = vertexIt->first[0];
-//       double y = vertexIt->first[1];
-//       double z = vertexIt->first[2];
-//       // Test if point is inside shape to mesh
-//       gp_Pnt myPoint(x,y,z);
-//       BRepClass3d_SolidClassifier scl(shapeToMesh);
-//       scl.Perform(myPoint, 1e-7);
-//       TopAbs_State result = scl.State();
-//       if ( result != TopAbs_IN )
-//         continue;
-//       MESSAGE("Adding enforced vertex (" << x << "," << y <<"," << z << ") = " << vertexIt->second);
-//       // X Y Z PHY_SIZE DUMMY_INT
-//       theFile
-//       << x << space 
-//       << y << space 
-//       << z << space
-//       << vertexIt->second << space 
-//       << dummyint << space;
-//       theFile << std::endl;
-//       enfVertexIndexSizeMap[aHybridID] = vertexIt->second;
-//       aHybridID++;
-//     }
-//   }
-  
-  
-//   std::cout << std::endl;
-//   std::cout << "End writing in 'points' file." << std::endl;
-
-//   return true;
-// }
-
-//=======================================================================
-//function : readResultFile
-//purpose  : readResultFile with geometry
-//=======================================================================
-
-// static bool readResultFile(const int                       fileOpen,
-// #ifdef WIN32
-//                            const char*                     fileName,
-// #endif
-//                            HYBRIDPlugin_HYBRID*            theAlgo,
-//                            SMESH_MesherHelper&             theHelper,
-//                            TopoDS_Shape                    tabShape[],
-//                            double**                        tabBox,
-//                            const int                       nbShape,
-//                            std::map <int,const SMDS_MeshNode*>& theHybridIdToNodeMap,
-//                            std::map <int,int> &            theNodeId2NodeIndexMap,
-//                            bool                            toMeshHoles,
-//                            int                             nbEnforcedVertices,
-//                            int                             nbEnforcedNodes,
-//                            HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges,
-//                            HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles,
-//                            bool                            toMakeGroupsOfDomains)
-// {
-//   MESSAGE("HYBRIDPlugin_HYBRID::readResultFile()");
-//   Kernel_Utils::Localizer loc;
-//   struct stat status;
-//   size_t      length;
-  
-//   std::string tmpStr;
-
-//   char *ptr, *mapPtr;
-//   char *tetraPtr;
-//   char *shapePtr;
-
-//   SMESHDS_Mesh* theMeshDS = theHelper.GetMeshDS();
-
-//   int nbElems, nbNodes, nbInputNodes;
-//   int nbTriangle;
-//   int ID, shapeID, hybridShapeID;
-//   int IdShapeRef = 1;
-//   int compoundID =
-//     nbShape ? theMeshDS->ShapeToIndex( tabShape[0] ) : theMeshDS->ShapeToIndex( theMeshDS->ShapeToMesh() );
-
-//   int *tab, *tabID, *nodeID, *nodeAssigne;
-//   double *coord;
-//   const SMDS_MeshNode **node;
-
-//   tab    = new int[3];
-//   nodeID = new int[4];
-//   coord  = new double[3];
-//   node   = new const SMDS_MeshNode*[4];
-
-//   TopoDS_Shape aSolid;
-//   SMDS_MeshNode * aNewNode;
-//   std::map <int,const SMDS_MeshNode*>::iterator itOnNode;
-//   SMDS_MeshElement* aTet;
-// #ifdef _DEBUG_
-//   std::set<int> shapeIDs;
-// #endif
-
-//   // Read the file state
-//   fstat(fileOpen, &status);
-//   length   = status.st_size;
-
-//   // Mapping the result file into memory
-// #ifdef WIN32
-//   HANDLE fd = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ,
-//                          NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-//   HANDLE hMapObject = CreateFileMapping(fd, NULL, PAGE_READONLY,
-//                                         0, (DWORD)length, NULL);
-//   ptr = ( char* ) MapViewOfFile(hMapObject, FILE_MAP_READ, 0, 0, 0 );
-// #else
-//   ptr = (char *) mmap(0,length,PROT_READ,MAP_PRIVATE,fileOpen,0);
-// #endif
-//   mapPtr = ptr;
-
-//   ptr      = readMapIntLine(ptr, tab);
-//   tetraPtr = ptr;
-
-//   nbElems      = tab[0];
-//   nbNodes      = tab[1];
-//   nbInputNodes = tab[2];
-
-//   nodeAssigne = new int[ nbNodes+1 ];
-
-//   if (nbShape > 0)
-//     aSolid = tabShape[0];
-
-//   // Reading the nodeId
-//   for (int i=0; i < 4*nbElems; i++)
-//     strtol(ptr, &ptr, 10);
-
-//   MESSAGE("nbInputNodes: "<<nbInputNodes);
-//   MESSAGE("nbEnforcedVertices: "<<nbEnforcedVertices);
-//   MESSAGE("nbEnforcedNodes: "<<nbEnforcedNodes);
-//   // Reading the nodeCoor and update the nodeMap
-//   for (int iNode=1; iNode <= nbNodes; iNode++) {
-//     if(theAlgo->computeCanceled())
-//       return false;
-//     for (int iCoor=0; iCoor < 3; iCoor++)
-//       coord[ iCoor ] = strtod(ptr, &ptr);
-//     nodeAssigne[ iNode ] = 1;
-//     if ( iNode > (nbInputNodes-(nbEnforcedVertices+nbEnforcedNodes)) ) {
-//       // Creating SMESH nodes
-//       // - for enforced vertices
-//       // - for vertices of forced edges
-//       // - for hybrid nodes
-//       nodeAssigne[ iNode ] = 0;
-//       aNewNode = theMeshDS->AddNode( coord[0],coord[1],coord[2] );
-//       theHybridIdToNodeMap.insert(theHybridIdToNodeMap.end(), std::make_pair( iNode, aNewNode ));
-//     }
-//   }
-
-//   // Reading the number of triangles which corresponds to the number of sub-domains
-//   nbTriangle = strtol(ptr, &ptr, 10);
-
-//   tabID = new int[nbTriangle];
-//   for (int i=0; i < nbTriangle; i++) {
-//     if(theAlgo->computeCanceled())
-//       return false;
-//     tabID[i] = 0;
-//     // find the solid corresponding to HYBRID sub-domain following
-//     // the technique proposed in HYBRID manual in chapter
-//     // "B.4 Subdomain (sub-region) assignment"
-//     int nodeId1 = strtol(ptr, &ptr, 10);
-//     int nodeId2 = strtol(ptr, &ptr, 10);
-//     int nodeId3 = strtol(ptr, &ptr, 10);
-//     if ( nbTriangle > 1 ) {
-//       const SMDS_MeshNode* n1 = theHybridIdToNodeMap[ nodeId1 ];
-//       const SMDS_MeshNode* n2 = theHybridIdToNodeMap[ nodeId2 ];
-//       const SMDS_MeshNode* n3 = theHybridIdToNodeMap[ nodeId3 ];
-//       if (!n1 || !n2 || !n3) {
-//         tabID[i] = HOLE_ID;
-//         continue;
-//       }
-//       try {
-//         OCC_CATCH_SIGNALS;
-// //         tabID[i] = findShapeID( theHelper, n1, n2, n3, toMeshHoles );
-//         tabID[i] = findShapeID( *theHelper.GetMesh(), n1, n2, n3, toMeshHoles );
-//         // -- 0020330: Pb with hybrid as a submesh
-//         // check that found shape is to be meshed
-//         if ( tabID[i] > 0 ) {
-//           const TopoDS_Shape& foundShape = theMeshDS->IndexToShape( tabID[i] );
-//           bool isToBeMeshed = false;
-//           for ( int iS = 0; !isToBeMeshed && iS < nbShape; ++iS )
-//             isToBeMeshed = foundShape.IsSame( tabShape[ iS ]);
-//           if ( !isToBeMeshed )
-//             tabID[i] = HOLE_ID;
-//         }
-//         // END -- 0020330: Pb with hybrid as a submesh
-// #ifdef _DEBUG_
-//         std::cout << i+1 << " subdomain: findShapeID() returns " << tabID[i] << std::endl;
-// #endif
-//       }
-//       catch ( Standard_Failure & ex)
-//       {
-// #ifdef _DEBUG_
-//         std::cout << i+1 << " subdomain: Exception caugt: " << ex.GetMessageString() << std::endl;
-// #endif
-//       }
-//       catch (...) {
-// #ifdef _DEBUG_
-//         std::cout << i+1 << " subdomain: unknown exception caught " << std::endl;
-// #endif
-//       }
-//     }
-//   }
-
-//   shapePtr = ptr;
-
-//   if ( nbTriangle <= nbShape ) // no holes
-//     toMeshHoles = true; // not avoid creating tetras in holes
-
-//   // IMP 0022172: [CEA 790] create the groups corresponding to domains
-//   std::vector< std::vector< const SMDS_MeshElement* > > elemsOfDomain( Max( nbTriangle, nbShape ));
-
-//   // Associating the tetrahedrons to the shapes
-//   shapeID = compoundID;
-//   for (int iElem = 0; iElem < nbElems; iElem++) {
-//     if(theAlgo->computeCanceled())
-//       return false;
-//     for (int iNode = 0; iNode < 4; iNode++) {
-//       ID = strtol(tetraPtr, &tetraPtr, 10);
-//       itOnNode = theHybridIdToNodeMap.find(ID);
-//       node[ iNode ] = itOnNode->second;
-//       nodeID[ iNode ] = ID;
-//     }
-//     // We always run HYBRID with "to mesh holes"==TRUE but we must not create
-//     // tetras within holes depending on hypo option,
-//     // so we first check if aTet is inside a hole and then create it 
-//     //aTet = theMeshDS->AddVolume( node[1], node[0], node[2], node[3] );
-//     hybridShapeID = 0; // domain ID
-//     if ( nbTriangle > 1 ) {
-//       shapeID = HOLE_ID; // negative shapeID means not to create tetras if !toMeshHoles
-//       hybridShapeID = strtol(shapePtr, &shapePtr, 10) - IdShapeRef;
-//       if ( tabID[ hybridShapeID ] == 0 ) {
-//         TopAbs_State state;
-//         aSolid = findShape(node, aSolid, tabShape, tabBox, nbShape, &state);
-//         if ( toMeshHoles || state == TopAbs_IN )
-//           shapeID = theMeshDS->ShapeToIndex( aSolid );
-//         tabID[ hybridShapeID ] = shapeID;
-//       }
-//       else
-//         shapeID = tabID[ hybridShapeID ];
-//     }
-//     else if ( nbShape > 1 ) {
-//       // Case where nbTriangle == 1 while nbShape == 2 encountered
-//       // with compound of 2 boxes and "To mesh holes"==False,
-//       // so there are no subdomains specified for each tetrahedron.
-//       // Try to guess a solid by a node already bound to shape
-//       shapeID = 0;
-//       for ( int i=0; i<4 && shapeID==0; i++ ) {
-//         if ( nodeAssigne[ nodeID[i] ] == 1 &&
-//              node[i]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_3DSPACE &&
-//              node[i]->getshapeId() > 1 )
-//         {
-//           shapeID = node[i]->getshapeId();
-//         }
-//       }
-//       if ( shapeID==0 ) {
-//         aSolid = findShape(node, aSolid, tabShape, tabBox, nbShape);
-//         shapeID = theMeshDS->ShapeToIndex( aSolid );
-//       }
-//     }
-//     // set new nodes and tetrahedron onto the shape
-//     for ( int i=0; i<4; i++ ) {
-//       if ( nodeAssigne[ nodeID[i] ] == 0 ) {
-//         if ( shapeID != HOLE_ID )
-//           theMeshDS->SetNodeInVolume( node[i], shapeID );
-//         nodeAssigne[ nodeID[i] ] = shapeID;
-//       }
-//     }
-//     if ( toMeshHoles || shapeID != HOLE_ID ) {
-//       aTet = theHelper.AddVolume( node[1], node[0], node[2], node[3],
-//                                   /*id=*/0, /*force3d=*/false);
-//       theMeshDS->SetMeshElementOnShape( aTet, shapeID );
-//       if ( toMakeGroupsOfDomains )
-//       {
-//         if ( int( elemsOfDomain.size() ) < hybridShapeID+1 )
-//           elemsOfDomain.resize( hybridShapeID+1 );
-//         elemsOfDomain[ hybridShapeID ].push_back( aTet );
-//       }
-//     }
-// #ifdef _DEBUG_
-//     shapeIDs.insert( shapeID );
-// #endif
-//   }
-//   if ( toMakeGroupsOfDomains )
-//     makeDomainGroups( elemsOfDomain, &theHelper );
-  
-//   // Add enforced elements
-//   HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap::const_iterator elemIt;
-//   const SMDS_MeshElement* anElem;
-//   SMDS_ElemIteratorPtr itOnEnfElem;
-//   std::map<int,int>::const_iterator itOnMap;
-//   shapeID = compoundID;
-//   // Enforced edges
-//   if (theEnforcedEdges.size()) {
-//     (theEnforcedEdges.size() <= 1) ? tmpStr = " enforced edge" : " enforced edges";
-//     std::cout << "Add " << theEnforcedEdges.size() << tmpStr << std::endl;
-//     std::vector< const SMDS_MeshNode* > node( 2 );
-//     // Iterate over the enforced edges
-//     for(elemIt = theEnforcedEdges.begin() ; elemIt != theEnforcedEdges.end() ; ++elemIt) {
-//       anElem = elemIt->first;
-//       bool addElem = true;
-//       itOnEnfElem = anElem->nodesIterator();
-//       for ( int j = 0; j < 2; ++j ) {
-//         int aNodeID = itOnEnfElem->next()->GetID();
-//         itOnMap = theNodeId2NodeIndexMap.find(aNodeID);
-//         if (itOnMap != theNodeId2NodeIndexMap.end()) {
-//           itOnNode = theHybridIdToNodeMap.find((*itOnMap).second);
-//           if (itOnNode != theHybridIdToNodeMap.end()) {
-//             node.push_back((*itOnNode).second);
-// //             shapeID =(*itOnNode).second->getshapeId();
-//           }
-//           else
-//             addElem = false;
-//         }
-//         else
-//           addElem = false;
-//       }
-//       if (addElem) {
-//         aTet = theHelper.AddEdge( node[0], node[1], 0,  false);
-//         theMeshDS->SetMeshElementOnShape( aTet, shapeID );
-//       }
-//     }
-//   }
-//   // Enforced faces
-//   if (theEnforcedTriangles.size()) {
-//     (theEnforcedTriangles.size() <= 1) ? tmpStr = " enforced triangle" : " enforced triangles";
-//     std::cout << "Add " << theEnforcedTriangles.size() << " enforced triangles" << std::endl;
-//     std::vector< const SMDS_MeshNode* > node( 3 );
-//     // Iterate over the enforced triangles
-//     for(elemIt = theEnforcedTriangles.begin() ; elemIt != theEnforcedTriangles.end() ; ++elemIt) {
-//       anElem = elemIt->first;
-//       bool addElem = true;
-//       itOnEnfElem = anElem->nodesIterator();
-//       for ( int j = 0; j < 3; ++j ) {
-//         int aNodeID = itOnEnfElem->next()->GetID();
-//         itOnMap = theNodeId2NodeIndexMap.find(aNodeID);
-//         if (itOnMap != theNodeId2NodeIndexMap.end()) {
-//           itOnNode = theHybridIdToNodeMap.find((*itOnMap).second);
-//           if (itOnNode != theHybridIdToNodeMap.end()) {
-//             node.push_back((*itOnNode).second);
-// //             shapeID =(*itOnNode).second->getshapeId();
-//           }
-//           else
-//             addElem = false;
-//         }
-//         else
-//           addElem = false;
-//       }
-//       if (addElem) {
-//         aTet = theHelper.AddFace( node[0], node[1], node[2], 0,  false);
-//         theMeshDS->SetMeshElementOnShape( aTet, shapeID );
-//       }
-//     }
-//   }
-
-//   // Remove nodes of tetras inside holes if !toMeshHoles
-//   if ( !toMeshHoles ) {
-//     itOnNode = theHybridIdToNodeMap.find( nbInputNodes );
-//     for ( ; itOnNode != theHybridIdToNodeMap.end(); ++itOnNode) {
-//       ID = itOnNode->first;
-//       if ( nodeAssigne[ ID ] == HOLE_ID )
-//         theMeshDS->RemoveFreeNode( itOnNode->second, 0 );
-//     }
-//   }
-
-  
-//   if ( nbElems ) {
-//     (nbElems <= 1) ? tmpStr = " tetrahedra" : " tetrahedrons";
-//     cout << nbElems << tmpStr << " have been associated to " << nbShape;
-//     (nbShape <= 1) ? tmpStr = " shape" : " shapes";
-//     cout << tmpStr << endl;
-//   }
-// #ifdef WIN32
-//   UnmapViewOfFile(mapPtr);
-//   CloseHandle(hMapObject);
-//   CloseHandle(fd);
-// #else
-//   munmap(mapPtr, length);
-// #endif
-//   close(fileOpen);
-
-//   delete [] tab;
-//   delete [] tabID;
-//   delete [] nodeID;
-//   delete [] coord;
-//   delete [] node;
-//   delete [] nodeAssigne;
-
-// #ifdef _DEBUG_
-//   shapeIDs.erase(-1);
-//   if ((int) shapeIDs.size() != nbShape ) {
-//     (shapeIDs.size() <= 1) ? tmpStr = " solid" : " solids";
-//     std::cout << "Only " << shapeIDs.size() << tmpStr << " of " << nbShape << " found" << std::endl;
-//     for (int i=0; i<nbShape; i++) {
-//       shapeID = theMeshDS->ShapeToIndex( tabShape[i] );
-//       if ( shapeIDs.find( shapeID ) == shapeIDs.end() )
-//         std::cout << "  Solid #" << shapeID << " not found" << std::endl;
-//     }
-//   }
-// #endif
-
-//   return true;
-// }
-
-
 //=============================================================================
 /*!
  *Here we are going to use the HYBRID mesher with geometry
@@ -2817,35 +1383,26 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   // a unique working file name
   // to avoid access to the same files by eg different users
   _genericName = HYBRIDPlugin_Hypothesis::GetFileName(_hyp);
-  TCollection_AsciiString aGenericName((char*) _genericName.c_str() );
-  TCollection_AsciiString aGenericNameRequired = aGenericName + "_required";
+  std::string aGenericName         = _genericName;
+  std::string aGenericNameRequired = aGenericName + "_required";
 
-  TCollection_AsciiString aLogFileName    = aGenericName + ".log";    // log
-  TCollection_AsciiString aResultFileName;
+  std::string aLogFileName    = aGenericName + ".log";    // log
+  std::string aResultFileName;
 
-  TCollection_AsciiString aGMFFileName, aRequiredVerticesFileName, aSolFileName, aResSolFileName;
-//#ifdef _DEBUG_
+  std::string aGMFFileName, aRequiredVerticesFileName, aSolFileName, aResSolFileName;
   aGMFFileName              = aGenericName + ".mesh"; // GMF mesh file
   aResultFileName           = aGenericName + "Vol.mesh"; // GMF mesh file
   aResSolFileName           = aGenericName + "Vol.sol"; // GMF mesh file
   aRequiredVerticesFileName = aGenericNameRequired + ".mesh"; // GMF required vertices mesh file
   aSolFileName              = aGenericNameRequired + ".sol"; // GMF solution file
-//#else
-//  aGMFFileName    = aGenericName + ".meshb"; // GMF mesh file
-//  aResultFileName = aGenericName + "Vol.meshb"; // GMF mesh file
-//  aRequiredVerticesFileName    = aGenericNameRequired + ".meshb"; // GMF required vertices mesh file
-//  aSolFileName    = aGenericNameRequired + ".solb"; // GMF solution file
-//#endif
   
   std::map <int,int> aNodeId2NodeIndexMap, aSmdsToHybridIdMap, anEnforcedNodeIdToHybridIdMap;
-  //std::map <int,const SMDS_MeshNode*> aHybridIdToNodeMap;
   std::map <int, int> nodeID2nodeIndexMap;
   std::map<std::vector<double>, std::string> enfVerticesWithGroup;
   HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues coordsSizeMap = HYBRIDPlugin_Hypothesis::GetEnforcedVerticesCoordsSize(_hyp);
   HYBRIDPlugin_Hypothesis::TIDSortedNodeGroupMap enforcedNodes = HYBRIDPlugin_Hypothesis::GetEnforcedNodes(_hyp);
   HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap enforcedEdges = HYBRIDPlugin_Hypothesis::GetEnforcedEdges(_hyp);
   HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap enforcedTriangles = HYBRIDPlugin_Hypothesis::GetEnforcedTriangles(_hyp);
-//   TIDSortedElemSet enforcedQuadrangles = HYBRIDPlugin_Hypothesis::GetEnforcedQuadrangles(_hyp);
   HYBRIDPlugin_Hypothesis::TID2SizeMap nodeIDToSizeMap = HYBRIDPlugin_Hypothesis::GetNodeIDToSizeMap(_hyp);
 
   HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList enfVertices = HYBRIDPlugin_Hypothesis::GetEnforcedVertices(_hyp);
@@ -2855,53 +1412,30 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   for ( ; enfVerIt != enfVertices.end() ; ++enfVerIt)
   {
     HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* enfVertex = (*enfVerIt);
-//     if (enfVertex->geomEntry.empty() && enfVertex->coords.size()) {
     if (enfVertex->coords.size()) {
       coordsSizeMap.insert(std::make_pair(enfVertex->coords,enfVertex->size));
       enfVerticesWithGroup.insert(std::make_pair(enfVertex->coords,enfVertex->groupName));
-//       MESSAGE("enfVerticesWithGroup.insert(std::make_pair(("<<enfVertex->coords[0]<<","<<enfVertex->coords[1]<<","<<enfVertex->coords[2]<<"),\""<<enfVertex->groupName<<"\"))");
     }
     else {
-//     if (!enfVertex->geomEntry.empty()) {
       TopoDS_Shape GeomShape = entryToShape(enfVertex->geomEntry);
-//       GeomType = GeomShape.ShapeType();
-
-//       if (!enfVertex->isCompound) {
-// //       if (GeomType == TopAbs_VERTEX) {
-//         coords.clear();
-//         aPnt = BRep_Tool::Pnt(TopoDS::Vertex(GeomShape));
-//         coords.push_back(aPnt.X());
-//         coords.push_back(aPnt.Y());
-//         coords.push_back(aPnt.Z());
-//         if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
-//           coordsSizeMap.insert(std::make_pair(coords,enfVertex->size));
-//           enfVerticesWithGroup.insert(std::make_pair(coords,enfVertex->groupName));
-//         }
-//       }
-//
-//       // Group Management
-//       else {
-//       if (GeomType == TopAbs_COMPOUND){
-        for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
-          coords.clear();
-          if (it.Value().ShapeType() == TopAbs_VERTEX){
-            gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value()));
-            coords.push_back(aPnt.X());
-            coords.push_back(aPnt.Y());
-            coords.push_back(aPnt.Z());
-            if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
-              coordsSizeMap.insert(std::make_pair(coords,enfVertex->size));
-              enfVerticesWithGroup.insert(std::make_pair(coords,enfVertex->groupName));
-//               MESSAGE("enfVerticesWithGroup.insert(std::make_pair(("<<coords[0]<<","<<coords[1]<<","<<coords[2]<<"),\""<<enfVertex->groupName<<"\"))");
-            }
+      for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
+        coords.clear();
+        if (it.Value().ShapeType() == TopAbs_VERTEX){
+          gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value()));
+          coords.push_back(aPnt.X());
+          coords.push_back(aPnt.Y());
+          coords.push_back(aPnt.Z());
+          if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
+            coordsSizeMap.insert(std::make_pair(coords,enfVertex->size));
+            enfVerticesWithGroup.insert(std::make_pair(coords,enfVertex->groupName));
           }
         }
-//       }
+      }
     }
   }
   int nbEnforcedVertices = coordsSizeMap.size();
   int nbEnforcedNodes = enforcedNodes.size();
-  
+
   std::string tmpStr;
   (nbEnforcedNodes <= 1) ? tmpStr = "node" : "nodes";
   std::cout << nbEnforcedNodes << " enforced " << tmpStr << " from hypo" << std::endl;
@@ -2921,9 +1455,9 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   MG_HYBRID_API mgHybrid( _computeCanceled, _progress );
 
   Ok = writeGMFFile(&mgHybrid,
-                    aGMFFileName.ToCString(),
-                    aRequiredVerticesFileName.ToCString(),
-                    aSolFileName.ToCString(),
+                    aGMFFileName.c_str(),
+                    aRequiredVerticesFileName.c_str(),
+                    aSolFileName.c_str(),
                     *proxyMesh, helper,
                     aNodeByHybridId, aFaceByHybridId, aNodeToHybridIdMap,
                     aNodeGroupByHybridId, anEdgeGroupByHybridId, aFaceGroupByHybridId,
@@ -2931,9 +1465,9 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
                     enfVerticesWithGroup, coordsSizeMap);
 
   // Write aSmdsToHybridIdMap to temp file
-  TCollection_AsciiString aSmdsToHybridIdMapFileName;
+  std::string aSmdsToHybridIdMapFileName;
   aSmdsToHybridIdMapFileName = aGenericName + ".ids";  // ids relation
-  ofstream aIdsFile  ( aSmdsToHybridIdMapFileName.ToCString()  , ios::out);
+  ofstream aIdsFile  ( aSmdsToHybridIdMapFileName  , ios::out);
   Ok = aIdsFile.rdbuf()->is_open();
   if (!Ok) {
     INFOS( "Can't write into " << aSmdsToHybridIdMapFileName);
@@ -2963,23 +1497,21 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   // run hybrid mesher
   // -----------------
 
-  TCollection_AsciiString cmd( (char*)HYBRIDPlugin_Hypothesis::CommandToRun( _hyp ).c_str() );
+  std::string cmd = HYBRIDPlugin_Hypothesis::CommandToRun( _hyp, theMesh );
 
   if ( mgHybrid.IsExecutable() )
   {
-    cmd += TCollection_AsciiString(" --in ") + aGMFFileName;
-    //if ( nbEnforcedVertices + nbEnforcedNodes)
-    //  cmd += TCollection_AsciiString(" --required_vertices ") + aGenericNameRequired;
-    cmd += TCollection_AsciiString(" --out ") + aResultFileName;
+    cmd += " --in "  + aGMFFileName;
+    cmd += " --out " + aResultFileName;
   }
   std::cout << std::endl;
   std::cout << "Hybrid execution with geometry..." << std::endl;
   std::cout << cmd;
   if ( !_logInStandardOutput )
   {
-    mgHybrid.SetLogFile( aLogFileName.ToCString() );
+    mgHybrid.SetLogFile( aLogFileName );
     if ( mgHybrid.IsExecutable() )
-      cmd += TCollection_AsciiString(" 1>" ) + aLogFileName;  // dump into file
+      cmd += " 1>" + aLogFileName;  // dump into file
     std::cout << " 1> " << aLogFileName;
   }
   std::cout << std::endl;
@@ -2987,7 +1519,7 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   _computeCanceled = false;
 
   std::string errStr;
-  Ok = mgHybrid.Compute( cmd.ToCString(), errStr ); // run
+  Ok = mgHybrid.Compute( cmd, errStr ); // run
 
   if ( _logInStandardOutput && mgHybrid.IsLibrary() )
     std::cout << std::endl << mgHybrid.GetLog() << std::endl;
@@ -3000,22 +1532,21 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
 
   // Mapping the result file
 
-    HYBRIDPlugin_Hypothesis::TSetStrings groupsToRemove = HYBRIDPlugin_Hypothesis::GetGroupsToRemove(_hyp);
-    bool toMeshHoles =
-      _hyp ? _hyp->GetToMeshHoles(true) : HYBRIDPlugin_Hypothesis::DefaultMeshHoles();
-    const bool toMakeGroupsOfDomains = HYBRIDPlugin_Hypothesis::GetToMakeGroupsOfDomains( _hyp );
+  HYBRIDPlugin_Hypothesis::TSetStrings groupsToRemove = HYBRIDPlugin_Hypothesis::GetGroupsToRemove(_hyp);
+  bool toMeshHoles =
+    _hyp ? _hyp->GetToMeshHoles(true) : HYBRIDPlugin_Hypothesis::DefaultMeshHoles();
+  const bool toMakeGroupsOfDomains = HYBRIDPlugin_Hypothesis::GetToMakeGroupsOfDomains( _hyp );
 
-    helper.IsQuadraticSubMesh( theShape );
-    helper.SetElementsOnShape( false );
-                        
-    Ok = readGMFFile(&mgHybrid, aResultFileName.ToCString(),
-                     this,
-                     &helper, aNodeByHybridId, aFaceByHybridId, aNodeToHybridIdMap,
-                     aNodeGroupByHybridId, anEdgeGroupByHybridId, aFaceGroupByHybridId,
-                     groupsToRemove, toMakeGroupsOfDomains, toMeshHoles);
+  helper.IsQuadraticSubMesh( theShape );
+  helper.SetElementsOnShape( false );
 
-    removeEmptyGroupsOfDomains( helper.GetMesh(), !toMakeGroupsOfDomains );
+  Ok = readGMFFile(&mgHybrid, aResultFileName.c_str(),
+                   this,
+                   &helper, aNodeByHybridId, aFaceByHybridId, aNodeToHybridIdMap,
+                   aNodeGroupByHybridId, anEdgeGroupByHybridId, aFaceGroupByHybridId,
+                   groupsToRemove, toMakeGroupsOfDomains, toMeshHoles);
 
+  removeEmptyGroupsOfDomains( helper.GetMesh(), !toMakeGroupsOfDomains );
 
 
 
@@ -3027,15 +1558,12 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   {
     if ( _removeLogOnSuccess )
       removeFile( aLogFileName );
-
-    // if ( _hyp && _hyp->GetToMakeGroupsOfDomains() )
-    //   error( COMPERR_WARNING, "'toMakeGroupsOfDomains' is ignored since the mesh is on shape" );
   }
   else if ( mgHybrid.HasLog() )
   {
     // get problem description from the log file
     _Ghs2smdsConvertor conv( aNodeByHybridId );
-    storeErrorDescription( _logInStandardOutput ? 0 : aLogFileName.ToCString(),
+    storeErrorDescription( _logInStandardOutput ? 0 : aLogFileName.c_str(),
                            mgHybrid.GetLog(), conv );
   }
   else if ( !errStr.empty() )
@@ -3058,7 +1586,7 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   }
   if ( mgHybrid.IsExecutable() )
   {
-    std::cout << "<" << aResultFileName.ToCString() << "> HYBRID output file ";
+    std::cout << "<" << aResultFileName << "> HYBRID output file ";
     if ( !Ok )
       std::cout << "not ";
     std::cout << "treated !" << std::endl;
@@ -3080,39 +1608,29 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
 bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
                                   SMESH_MesherHelper* theHelper)
 {
-  MESSAGE("HYBRIDPlugin_HYBRID::Compute()");
-
   theHelper->IsQuadraticSubMesh( theHelper->GetSubShape() );
 
   // a unique working file name
   // to avoid access to the same files by eg different users
   _genericName = HYBRIDPlugin_Hypothesis::GetFileName(_hyp);
-  TCollection_AsciiString aGenericName((char*) _genericName.c_str() );
-  TCollection_AsciiString aGenericNameRequired = aGenericName + "_required";
+  std::string aGenericName((char*) _genericName.c_str() );
+  std::string aGenericNameRequired = aGenericName + "_required";
 
-  TCollection_AsciiString aLogFileName    = aGenericName + ".log";    // log
-  TCollection_AsciiString aResultFileName;
+  std::string aLogFileName    = aGenericName + ".log";    // log
+  std::string aResultFileName;
   bool Ok;
 
-  TCollection_AsciiString aGMFFileName, aRequiredVerticesFileName, aSolFileName, aResSolFileName;
-//#ifdef _DEBUG_
+  std::string aGMFFileName, aRequiredVerticesFileName, aSolFileName, aResSolFileName;
   aGMFFileName              = aGenericName + ".mesh"; // GMF mesh file
   aResultFileName           = aGenericName + "Vol.mesh"; // GMF mesh file
   aResSolFileName           = aGenericName + "Vol.sol"; // GMF mesh file
   aRequiredVerticesFileName = aGenericNameRequired + ".mesh"; // GMF required vertices mesh file
   aSolFileName              = aGenericNameRequired + ".sol"; // GMF solution file
-//#else
-//  aGMFFileName    = aGenericName + ".meshb"; // GMF mesh file
-//  aResultFileName = aGenericName + "Vol.meshb"; // GMF mesh file
-//  aRequiredVerticesFileName    = aGenericNameRequired + ".meshb"; // GMF required vertices mesh file
-//  aSolFileName    = aGenericNameRequired + ".solb"; // GMF solution file
-//#endif
 
   std::map <int, int> nodeID2nodeIndexMap;
   std::map<std::vector<double>, std::string> enfVerticesWithGroup;
   HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues coordsSizeMap;
   TopoDS_Shape GeomShape;
-//   TopAbs_ShapeEnum GeomType;
   std::vector<double> coords;
   gp_Pnt aPnt;
   HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* enfVertex;
@@ -3123,69 +1641,31 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   for ( ; enfVerIt != enfVertices.end() ; ++enfVerIt)
   {
     enfVertex = (*enfVerIt);
-//     if (enfVertex->geomEntry.empty() && enfVertex->coords.size()) {
     if (enfVertex->coords.size()) {
       coordsSizeMap.insert(std::make_pair(enfVertex->coords,enfVertex->size));
       enfVerticesWithGroup.insert(std::make_pair(enfVertex->coords,enfVertex->groupName));
-//       MESSAGE("enfVerticesWithGroup.insert(std::make_pair(("<<enfVertex->coords[0]<<","<<enfVertex->coords[1]<<","<<enfVertex->coords[2]<<"),\""<<enfVertex->groupName<<"\"))");
     }
     else {
-//     if (!enfVertex->geomEntry.empty()) {
       GeomShape = entryToShape(enfVertex->geomEntry);
-//       GeomType = GeomShape.ShapeType();
-
-//       if (!enfVertex->isCompound) {
-// //       if (GeomType == TopAbs_VERTEX) {
-//         coords.clear();
-//         aPnt = BRep_Tool::Pnt(TopoDS::Vertex(GeomShape));
-//         coords.push_back(aPnt.X());
-//         coords.push_back(aPnt.Y());
-//         coords.push_back(aPnt.Z());
-//         if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
-//           coordsSizeMap.insert(std::make_pair(coords,enfVertex->size));
-//           enfVerticesWithGroup.insert(std::make_pair(coords,enfVertex->groupName));
-//         }
-//       }
-//
-//       // Group Management
-//       else {
-//       if (GeomType == TopAbs_COMPOUND){
-        for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
-          coords.clear();
-          if (it.Value().ShapeType() == TopAbs_VERTEX){
-            aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value()));
-            coords.push_back(aPnt.X());
-            coords.push_back(aPnt.Y());
-            coords.push_back(aPnt.Z());
-            if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
-              coordsSizeMap.insert(std::make_pair(coords,enfVertex->size));
-              enfVerticesWithGroup.insert(std::make_pair(coords,enfVertex->groupName));
-//               MESSAGE("enfVerticesWithGroup.insert(std::make_pair(("<<coords[0]<<","<<coords[1]<<","<<coords[2]<<"),\""<<enfVertex->groupName<<"\"))");
-            }
+      for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
+        coords.clear();
+        if (it.Value().ShapeType() == TopAbs_VERTEX){
+          aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value()));
+          coords.push_back(aPnt.X());
+          coords.push_back(aPnt.Y());
+          coords.push_back(aPnt.Z());
+          if (coordsSizeMap.find(coords) == coordsSizeMap.end()) {
+            coordsSizeMap.insert(std::make_pair(coords,enfVertex->size));
+            enfVerticesWithGroup.insert(std::make_pair(coords,enfVertex->groupName));
           }
         }
-//       }
+      }
     }
   }
 
-//   const SMDS_MeshNode* enfNode;
   HYBRIDPlugin_Hypothesis::TIDSortedNodeGroupMap enforcedNodes = HYBRIDPlugin_Hypothesis::GetEnforcedNodes(_hyp);
-//   HYBRIDPlugin_Hypothesis::TIDSortedNodeGroupMap::const_iterator enfNodeIt = enforcedNodes.begin();
-//   for ( ; enfNodeIt != enforcedNodes.end() ; ++enfNodeIt)
-//   {
-//     enfNode = enfNodeIt->first;
-//     coords.clear();
-//     coords.push_back(enfNode->X());
-//     coords.push_back(enfNode->Y());
-//     coords.push_back(enfNode->Z());
-//     if (enfVerticesWithGro
-//       enfVerticesWithGroup.insert(std::make_pair(coords,enfNodeIt->second));
-//   }
-
-
   HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap enforcedEdges = HYBRIDPlugin_Hypothesis::GetEnforcedEdges(_hyp);
   HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap enforcedTriangles = HYBRIDPlugin_Hypothesis::GetEnforcedTriangles(_hyp);
-//   TIDSortedElemSet enforcedQuadrangles = HYBRIDPlugin_Hypothesis::GetEnforcedQuadrangles(_hyp);
   HYBRIDPlugin_Hypothesis::TID2SizeMap nodeIDToSizeMap = HYBRIDPlugin_Hypothesis::GetNodeIDToSizeMap(_hyp);
 
   std::string tmpStr;
@@ -3207,8 +1687,8 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   MG_HYBRID_API mgHybrid( _computeCanceled, _progress );
 
   Ok = writeGMFFile(&mgHybrid,
-                    aGMFFileName.ToCString(),
-                    aRequiredVerticesFileName.ToCString(), aSolFileName.ToCString(),
+                    aGMFFileName.c_str(),
+                    aRequiredVerticesFileName.c_str(), aSolFileName.c_str(),
                     *proxyMesh, *theHelper,
                     aNodeByHybridId, aFaceByHybridId, aNodeToHybridIdMap,
                     aNodeGroupByHybridId, anEdgeGroupByHybridId, aFaceGroupByHybridId,
@@ -3219,19 +1699,17 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   // run hybrid mesher
   // -----------------
 
-  TCollection_AsciiString cmd = HYBRIDPlugin_Hypothesis::CommandToRun( _hyp, false ).c_str();
+  std::string cmd = HYBRIDPlugin_Hypothesis::CommandToRun( _hyp, theMesh );
 
   if ( mgHybrid.IsExecutable() )
   {
-    cmd += TCollection_AsciiString(" --in ") + aGMFFileName;
-    //if ( nbEnforcedVertices + nbEnforcedNodes)
-    //  cmd += TCollection_AsciiString(" --required_vertices ") + aGenericNameRequired;
-    cmd += TCollection_AsciiString(" --out ") + aResultFileName;
+    cmd += " --in "  + aGMFFileName;
+    cmd += " --out " + aResultFileName;
   }
   if ( !_logInStandardOutput )
   {
-    cmd += TCollection_AsciiString(" 1> " ) + aLogFileName;  // dump into file
-    mgHybrid.SetLogFile( aLogFileName.ToCString() );
+    cmd += " 1> " + aLogFileName;  // dump into file
+    mgHybrid.SetLogFile( aLogFileName );
   }
   std::cout << std::endl;
   std::cout << "Hybrid execution w/o geometry..." << std::endl;
@@ -3240,7 +1718,7 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   _computeCanceled = false;
 
   std::string errStr;
-  Ok = mgHybrid.Compute( cmd.ToCString(), errStr ); // run
+  Ok = mgHybrid.Compute( cmd, errStr ); // run
 
   if ( _logInStandardOutput && mgHybrid.IsLibrary() )
     std::cout << std::endl << mgHybrid.GetLog() << std::endl;
@@ -3254,14 +1732,13 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   const bool toMakeGroupsOfDomains = HYBRIDPlugin_Hypothesis::GetToMakeGroupsOfDomains( _hyp );
 
   Ok = Ok && readGMFFile(&mgHybrid,
-                         aResultFileName.ToCString(),
+                         aResultFileName.c_str(),
                          this,
                          theHelper, aNodeByHybridId, aFaceByHybridId, aNodeToHybridIdMap,
                          aNodeGroupByHybridId, anEdgeGroupByHybridId, aFaceGroupByHybridId,
                          groupsToRemove, toMakeGroupsOfDomains);
 
   updateMeshGroups(theHelper->GetMesh(), groupsToRemove);
-  //removeEmptyGroupsOfDomains( theHelper->GetMesh(), notEmptyAsWell );
   removeEmptyGroupsOfDomains( theHelper->GetMesh(), !toMakeGroupsOfDomains );
 
   if ( Ok ) {
@@ -3277,21 +1754,18 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
   {
     if ( _removeLogOnSuccess )
       removeFile( aLogFileName );
-
-    //if ( !toMakeGroupsOfDomains && _hyp && _hyp->GetToMakeGroupsOfDomains() )
-    //error( COMPERR_WARNING, "'toMakeGroupsOfDomains' is ignored since 'toMeshHoles' is OFF." );
   }
   else if ( mgHybrid.HasLog() )
   {
     // get problem description from the log file
     _Ghs2smdsConvertor conv( aNodeByHybridId );
-    storeErrorDescription( _logInStandardOutput ? 0 : aLogFileName.ToCString(),
+    storeErrorDescription( _logInStandardOutput ? 0 : aLogFileName.c_str(),
                            mgHybrid.GetLog(), conv );
   }
   else {
     // the log file is empty
     removeFile( aLogFileName );
-    INFOS( "HYBRID Error, command '" << cmd.ToCString() << "' failed" );
+    INFOS( "HYBRID Error, command '" << cmd << "' failed" );
     error(COMPERR_ALGO_FAILED, "hybrid: command not found" );
   }
 
@@ -3311,8 +1785,7 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh&         theMesh,
 void HYBRIDPlugin_HYBRID::CancelCompute()
 {
   _computeCanceled = true;
-#ifdef WIN32
-#else
+#if !defined(WIN32) && !defined(__APPLE__)
   std::string cmd = "ps xo pid,args | grep " + _genericName;
   //cmd += " | grep -e \"^ *[0-9]\\+ \\+" + HYBRIDPlugin_Hypothesis::GetExeName() + "\"";
   cmd += " | awk '{print $1}' | xargs kill -9 > /dev/null 2>&1";
index 17ea214558e0e33a44cef3b988bb6a7b1a965efb..3e10264d6b5138b44ec2eece9e6320a9d051905c 100644 (file)
@@ -70,6 +70,8 @@ public:
 
   static const char* Name() { return "HYBRID_3D"; }
 
+  const HYBRIDPlugin_Hypothesis* getHyp() {return _hyp ;}
+
 protected:
   const HYBRIDPlugin_Hypothesis*   _hyp;
   //const StdMeshers_ViscousLayers* _viscousLayersHyp;
@@ -87,8 +89,6 @@ private:
   bool _keepFiles;
   bool _removeLogOnSuccess;
   bool _logInStandardOutput;
-  SALOMEDS::Study_var myStudy;
-  SMESH_Gen_i* smeshGen_i;
 };
 
 /*!
index 9cdd92ddbaee09326d98271832ba61c27b5ae5f3..3a745e1ae46ae767532e32f7db57454aacc980db 100644 (file)
@@ -47,7 +47,6 @@ HYBRIDPlugin_HYBRID_i::HYBRIDPlugin_HYBRID_i (PortableServer::POA_ptr thePOA,
        SMESH_Algo_i( thePOA ),
        SMESH_3D_Algo_i( thePOA )
 {
-  MESSAGE( "HYBRIDPlugin_HYBRID_i::HYBRIDPlugin_HYBRID_i" );
   myBaseImpl = new ::HYBRIDPlugin_HYBRID (theGenImpl->GetANewId(),
                                           theGenImpl );
 }
@@ -62,7 +61,6 @@ HYBRIDPlugin_HYBRID_i::HYBRIDPlugin_HYBRID_i (PortableServer::POA_ptr thePOA,
 
 HYBRIDPlugin_HYBRID_i::~HYBRIDPlugin_HYBRID_i()
 {
-  MESSAGE( "HYBRIDPlugin_HYBRID_i::~HYBRIDPlugin_HYBRID_i" );
 }
 
 //=============================================================================
@@ -75,7 +73,6 @@ HYBRIDPlugin_HYBRID_i::~HYBRIDPlugin_HYBRID_i()
 
 ::HYBRIDPlugin_HYBRID* HYBRIDPlugin_HYBRID_i::GetImpl()
 {
-  MESSAGE( "HYBRIDPlugin_HYBRID_i::GetImpl" );
   return ( ::HYBRIDPlugin_HYBRID* )myBaseImpl;
 }
 
@@ -89,7 +86,6 @@ HYBRIDPlugin_HYBRID_i::~HYBRIDPlugin_HYBRID_i()
 
 SMESH::SMESH_Mesh_ptr HYBRIDPlugin_HYBRID_i::importGMFMesh(const char* theGMFFileName)
 {
-  MESSAGE( "HYBRIDPlugin_HYBRID_i::importGMFMesh" );
   SMESH_Gen_i* smeshGen = SMESH_Gen_i::GetSMESHGen();
   SMESH::SMESH_Mesh_ptr theMesh = smeshGen->CreateEmptyMesh();
   smeshGen->RemoveLastFromPythonScript();
index 673d63597e564b4e744cd6560c1ac40d110a753f..daff0cdd2ad15470b866d2549a860d46ed41fab2 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <SMESHDS_Mesh.hxx>
 
-#include <TCollection_AsciiString.hxx>
+#include <TopExp_Explorer.hxx>
 
 #ifdef WIN32
 #include <process.h>
@@ -62,6 +62,7 @@ HYBRIDPlugin_Hypothesis::HYBRIDPlugin_Hypothesis(int hypId, SMESH_Gen * gen)
   mySmoothNormals(DefaultSmoothNormals()),
   myHeightFirstLayer(DefaultHeightFirstLayer()),
   myBoundaryLayersProgression(DefaultBoundaryLayersProgression()),
+  myCoreSize(DefaultCoreSize()),
   myMultinormalsAngle(DefaultMultinormalsAngle()),
   myNbOfBoundaryLayers(DefaultNbOfBoundaryLayers()),
   _enfVertexList(DefaultHYBRIDEnforcedVertexList()),
@@ -102,6 +103,58 @@ bool HYBRIDPlugin_Hypothesis::GetLayersOnAllWrap(bool checkFreeOption) const
   return myLayersOnAllWrap;
 }
 
+//=======================================================================
+//function : SetFacesWithLayers
+//purpose  : Set IDs of faces to grow the layers on
+//=======================================================================
+
+bool HYBRIDPlugin_Hypothesis::SetFacesWithLayers(const std::vector<int>& theVal)
+{
+  if ( myFacesWithLayers != theVal )
+  {
+    myFacesWithLayers = theVal;
+    NotifySubMeshesHypothesisModification();
+    return true;
+  }
+  return false;
+}
+
+//=======================================================================
+//function : GetFacesWithLayers
+//purpose  : Return IDs of faces to grow the layers on
+//=======================================================================
+
+const std::vector<int>& HYBRIDPlugin_Hypothesis::GetFacesWithLayers() const
+{
+  return myFacesWithLayers;
+}
+
+//=======================================================================
+//function : SetFacesWithImprinting
+//purpose  : Set IDs of faces to grow the layers on
+//=======================================================================
+
+bool HYBRIDPlugin_Hypothesis::SetFacesWithImprinting(const std::vector<int>& theVal)
+{
+  if ( myFacesWithImprinting != theVal )
+  {
+    myFacesWithImprinting = theVal;
+    NotifySubMeshesHypothesisModification();
+    return true;
+  }
+  return false;
+}
+
+//=======================================================================
+//function : GetFacesWithImprinting
+//purpose  : Return IDs of faces to grow the layers on
+//=======================================================================
+
+const std::vector<int>& HYBRIDPlugin_Hypothesis::GetFacesWithImprinting() const
+{
+  return myFacesWithImprinting;
+}
+
 //=======================================================================
 //function : SetToMeshHoles
 //=======================================================================
@@ -365,6 +418,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
 //=======================================================================
@@ -399,7 +473,7 @@ void HYBRIDPlugin_Hypothesis::SetNbOfBoundaryLayers(short toNbOfBoundaryLayers)
 }
 
 //=======================================================================
-//function : GetMultinormalsAngle
+//function : GetCoreSize
 //=======================================================================
 
 short HYBRIDPlugin_Hypothesis::GetNbOfBoundaryLayers() const
@@ -649,9 +723,6 @@ bool HYBRIDPlugin_Hypothesis::GetRemoveLogOnSuccess() const
 bool HYBRIDPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string theEntry, std::string theGroupName,
                                                double size, double x, double y, double z, bool isCompound)
 {
-  MESSAGE("HYBRIDPlugin_Hypothesis::SetEnforcedVertex(\""<< theName << "\", \""<< theEntry << "\", \"" << theGroupName << "\", "
-                                                      << size << ", " << x << ", " << y << ", " << z  << ", "<< isCompound << ")");
-
   bool toNotify = false;
   bool toCreate = true;
 
@@ -675,19 +746,15 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string
   if (it != _enfVertexList.end()) {
     toCreate = false;
     oldEnVertex = (*it);
-    MESSAGE("Enforced Vertex was found => Update");
     if (oldEnVertex->name != theName) {
-      MESSAGE("Update name from \"" << oldEnVertex->name << "\" to \"" << theName << "\"");
       oldEnVertex->name = theName;
       toNotify = true;
     }
     if (oldEnVertex->groupName != theGroupName) {
-      MESSAGE("Update group name from \"" << oldEnVertex->groupName << "\" to \"" << theGroupName << "\"");
       oldEnVertex->groupName = theGroupName;
       toNotify = true;
     }
     if (oldEnVertex->size != size) {
-      MESSAGE("Update size from \"" << oldEnVertex->size << "\" to \"" << size << "\"");
       oldEnVertex->size = size;
       toNotify = true;
     }
@@ -709,7 +776,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string
 //   //////// CREATE ////////////
   if (toCreate) {
     toNotify = true;
-    MESSAGE("Creating new enforced vertex");
     _enfVertexList.insert(newEnfVertex);
     if (theEntry == "") {
       _coordsEnfVertexMap[newEnfVertex->coords] = newEnfVertex;
@@ -724,7 +790,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string
   if (toNotify)
     NotifySubMeshesHypothesisModification();
 
-  MESSAGE("HYBRIDPlugin_Hypothesis::SetEnforcedVertex END");
   return toNotify;
 }
 
@@ -738,7 +803,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::Elemen
   SMDS_ElemIteratorPtr eIt = theMesh.GetMeshDS()->elementsIterator(SMDSAbs_ElementType(elementType));
   while ( eIt->more() )
     theElemSet.insert( eIt->next() );
-  MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source mesh");
   bool added = SetEnforcedElements( theElemSet, elementType, groupName);
   if (added) {
     THYBRIDEnforcedMesh* newEnfMesh = new THYBRIDEnforcedMesh();
@@ -765,7 +829,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::Elemen
 //=======================================================================
 bool HYBRIDPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
 {
-  MESSAGE("HYBRIDPlugin_Hypothesis::SetEnforcedGroup");
   TIDSortedElemSet theElemSet;
     if ( theIDs->length() == 0 ){MESSAGE("The source group is empty");}
     for ( CORBA::ULong i = 0; i < theIDs->length(); i++) {
@@ -788,7 +851,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SM
 //   while ( it->more() ) 
 //     theElemSet.insert( it->next() );
 
-  MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source group ");
   bool added = SetEnforcedElements( theElemSet, elementType, groupName);
   if (added) {
     THYBRIDEnforcedMesh* newEnfMesh = new THYBRIDEnforcedMesh();
@@ -811,7 +873,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SM
 //=======================================================================
 bool HYBRIDPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName)
 {
-  MESSAGE("HYBRIDPlugin_Hypothesis::SetEnforcedElements");
   TIDSortedElemSet::const_iterator it = theElemSet.begin();
   const SMDS_MeshElement* elem;
   const SMDS_MeshNode* node;
@@ -829,7 +890,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, S
           nodeRet = _enfNodes.insert(make_pair(node,groupName));
           added = added && nodeRet.second;
           std::string msg = added ? "yes":"no";
-          MESSAGE( "Node (" <<node->X()<<","<<node->Y()<<","<<node->Z()<< ") with ID " << node->GetID() <<" added ? " << msg);
         }
         else {
           SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
@@ -932,28 +992,23 @@ bool HYBRIDPlugin_Hypothesis::RemoveEnforcedVertex(double x, double y, double z,
   TGeomEntryHYBRIDEnforcedVertexMap::iterator it_enfVertexEntry = _geomEntryEnfVertexMap.find(theEntry);
   if (it_enfVertexEntry != _geomEntryEnfVertexMap.end()) {
     // Success
-    MESSAGE("Found enforced vertex with geom entry " << theEntry);
     oldEnfVertex = it_enfVertexEntry->second;
     _geomEntryEnfVertexMap.erase(it_enfVertexEntry);
   } else {
     // Fail
-    MESSAGE("Enforced vertex with geom entry " << theEntry << " not found");
     // check that enf vertex with given coords exists
     TCoordsHYBRIDEnforcedVertexMap::iterator it_coords_enf = _coordsEnfVertexMap.find(coords);
     if (it_coords_enf != _coordsEnfVertexMap.end()) {
       // Success
-      MESSAGE("Found enforced vertex with coords " << x << ", " << y << ", " << z);
       oldEnfVertex = it_coords_enf->second;
       _coordsEnfVertexMap.erase(it_coords_enf);
       _enfVertexCoordsSizeList.erase(_enfVertexCoordsSizeList.find(coords));
     } else {
       // Fail
-      MESSAGE("Enforced vertex with coords " << x << ", " << y << ", " << z << " not found");
       throw std::invalid_argument(msg.str());
     }
   }
 
-  MESSAGE("Remove enf vertex from _enfVertexList");
 
   // update _enfVertexList
   THYBRIDEnforcedVertexList::iterator it = _enfVertexList.find(oldEnfVertex);
@@ -962,7 +1017,6 @@ bool HYBRIDPlugin_Hypothesis::RemoveEnforcedVertex(double x, double y, double z,
       _groupsToRemove.insert((*it)->groupName);
     _enfVertexList.erase(it);
     toNotify = true;
-    MESSAGE("Done");
   }
 
   if (toNotify)
@@ -1070,22 +1124,15 @@ bool HYBRIDPlugin_Hypothesis::DefaultToMakeGroupsOfDomains()
 //function : DefaultMaximumMemory
 //=======================================================================
 
-#ifndef WIN32
-#include <sys/sysinfo.h>
-#else
+#if defined(WIN32)
 #include <windows.h>
+#elif !defined(__APPLE__)
+#include <sys/sysinfo.h>
 #endif
 
 double  HYBRIDPlugin_Hypothesis::DefaultMaximumMemory()
 {
-#ifndef WIN32
-  struct sysinfo si;
-  int err = sysinfo( &si );
-  if ( err == 0 ) {
-    int ramMB = si.totalram * si.mem_unit / 1024 / 1024;
-    return ( 0.7 * ramMB );
-  }
-#else
+#if defined(WIN32)
   // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
   MEMORYSTATUSEX statex;
   statex.dwLength = sizeof (statex);
@@ -1097,6 +1144,13 @@ double  HYBRIDPlugin_Hypothesis::DefaultMaximumMemory()
       statex.ullTotalVirtual / 1024 / 1024;
     return ( 0.7 * totMB );
   }
+#elif !defined(__APPLE__)
+  struct sysinfo si;
+  int err = sysinfo( &si );
+  if ( err == 0 ) {
+    int ramMB = si.totalram * si.mem_unit / 1024 / 1024;
+    return ( 0.7 * ramMB );
+  }
 #endif
   return 1024;
 }
@@ -1148,7 +1202,7 @@ short  HYBRIDPlugin_Hypothesis::DefaultOptimizationLevel()
 
 std::string HYBRIDPlugin_Hypothesis::DefaultWorkingDirectory()
 {
-  TCollection_AsciiString aTmpDir;
+  std::string aTmpDir;
 
   char *Tmp_dir = getenv("SALOME_TMP_DIR");
   if(Tmp_dir != NULL) {
@@ -1156,12 +1210,12 @@ std::string HYBRIDPlugin_Hypothesis::DefaultWorkingDirectory()
   }
   else {
 #ifdef WIN32
-    aTmpDir = TCollection_AsciiString("C:\\");
+    aTmpDir = "C:\\";
 #else
-    aTmpDir = TCollection_AsciiString("/tmp/");
+    aTmpDir = "/tmp/";
 #endif
   }
-  return aTmpDir.ToCString();
+  return aTmpDir;
 }
 
 //=======================================================================
@@ -1287,6 +1341,14 @@ double HYBRIDPlugin_Hypothesis::DefaultBoundaryLayersProgression()
   return 1.0;
 }
 
+//=======================================================================
+//function : DefaultCoreSize
+//=======================================================================
+double HYBRIDPlugin_Hypothesis::DefaultCoreSize()
+{
+  return 0.0;
+}
+
 //=======================================================================
 //function : DefaultMultinormalsAngle
 //=======================================================================
@@ -1323,12 +1385,14 @@ 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 << " ";
     save << "__OPTIONS_END__ ";
   }
-  
+
 
   THYBRIDEnforcedVertexList::iterator it  = _enfVertexList.begin();
   if (it != _enfVertexList.end()) {
@@ -1397,6 +1461,15 @@ std::ostream & HYBRIDPlugin_Hypothesis::SaveTo(std::ostream & save)
     }
     save << " "  << "__ENFORCED_MESHES_END__ ";
   }
+
+  save << " " << myFacesWithLayers.size();
+  for ( size_t i = 0; i < myFacesWithLayers.size(); ++i )
+    save << " " << myFacesWithLayers[i];
+
+  save << " " << myFacesWithImprinting.size();
+  for ( size_t i = 0; i < myFacesWithImprinting.size(); ++i )
+    save << " " << myFacesWithImprinting[i];
+
   return save;
 }
 
@@ -1490,6 +1563,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;
@@ -1584,7 +1662,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
               name += txt;
             }
           }
-          MESSAGE("name: " <<name);
         }
 
         if (txt == "__BEGIN_ENTRY__") {  // __BEGIN_ENTRY__
@@ -1593,7 +1670,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
           isOK = static_cast<bool>(load >> txt); // __END_ENTRY__
           if (txt != "__END_ENTRY__")
             throw std::exception();
-          MESSAGE("entry: " << entry);
         }
 
         if (txt == "__BEGIN_GROUP__") {  // __BEGIN_GROUP__
@@ -1605,7 +1681,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
               groupName += txt;
             }
           }
-          MESSAGE("groupName: " << groupName);
         }
 
         if (txt == "__BEGIN_COORDS__") {  // __BEGIN_COORDS__
@@ -1614,7 +1689,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
           isOK = static_cast<bool>(load >> txt); // __END_COORDS__
           if (txt != "__END_COORDS__")
             throw std::exception();
-          MESSAGE("coords: " << coords[0] <<","<< coords[1] <<","<< coords[2]);
         }
 
         if (txt == "__BEGIN_SIZE__") {  // __BEGIN_ENTRY__
@@ -1623,7 +1697,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
           if (txt != "__END_SIZE__") {
             throw std::exception();
           }
-          MESSAGE("size: " << size);
         }
       }
       isOK = static_cast<bool>(load >> txt);  // __BEGIN_VERTEX__
@@ -1675,7 +1748,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
               name += txt;
             }
           }
-          MESSAGE("name: " <<name);
         }
 
         if (txt == "__BEGIN_ENTRY__") {  // __BEGIN_ENTRY__
@@ -1683,7 +1755,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
           isOK = static_cast<bool>(load >> txt); // __END_ENTRY__
           if (txt != "__END_ENTRY__")
             throw std::exception();
-          MESSAGE("entry: " << entry);
         }
 
         if (txt == "__BEGIN_ELEM_TYPE__") {  // __BEGIN_ELEM_TYPE__
@@ -1691,7 +1762,6 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
           isOK = static_cast<bool>(load >> txt); // __END_ELEM_TYPE__
           if (txt != "__END_ELEM_TYPE__")
             throw std::exception();
-          MESSAGE("elementType: " << elementType);
         }
 
         if (txt == "__BEGIN_GROUP__") {  // __BEGIN_GROUP__
@@ -1703,12 +1773,10 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
               groupName += txt;
             }
           } // while
-          MESSAGE("groupName: " << groupName);
         } // if
 
         if (txt == "__PERSIST_ID__") {
           isOK = static_cast<bool>(load >> persistID);
-          MESSAGE("persistID: " << persistID);
         }
         std::cout << "isOK: " << isOK << std::endl;
       } // while
@@ -1717,6 +1785,35 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
     } // while
   } // if
 
+  if ( hasEnforcedMeshes )
+    isOK = static_cast<bool>(load >> separator);
+
+  if ( isOK )
+  {
+    i = atoi( separator.c_str() );
+    isOK = ( i >= 0 );
+    if ( isOK )
+    {
+      myFacesWithLayers.reserve( i );
+      while (( myFacesWithLayers.size() < myFacesWithLayers.capacity() ) &&
+             ( isOK = static_cast<bool>(load >> i)) )
+        myFacesWithLayers.push_back( i );
+    }
+  }
+
+  if ( isOK )
+  {
+    i = atoi( separator.c_str() );
+    isOK = ( i >= 0 );
+    if ( isOK )
+    {
+      myFacesWithImprinting.reserve( i );
+      while (( myFacesWithImprinting.size() < myFacesWithImprinting.capacity() ) &&
+             ( isOK = static_cast<bool>(load >> i)) )
+        myFacesWithImprinting.push_back( i );
+    }
+  }
+
   return load;
 }
 
@@ -1750,31 +1847,29 @@ bool HYBRIDPlugin_Hypothesis::SetParametersByDefaults(const TDefaults&  dflts,
 //================================================================================
 
 std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* hyp,
-                                                  const bool         hasShapeToMesh)
+                                                  SMESH_Mesh&                    mesh)
 {
-  TCollection_AsciiString cmd = GetExeName().c_str();
+  SMESH_Comment cmd = GetExeName();
   // check if any option is overridden by hyp->myTextOption
-  bool p_h     = ( hyp && hyp->myTextOption.find("-h")  != std::string::npos );
-  bool p_v     = ( hyp && hyp->myTextOption.find("-v ")  != std::string::npos );
-  bool p_i     = ( hyp && hyp->myTextOption.find("-i")  != std::string::npos );
-  bool p_o     = ( hyp && hyp->myTextOption.find("-o")  != std::string::npos );
-  bool p_mnot  = ( hyp && hyp->myTextOption.find("--max_number_of_threads ")  != std::string::npos );
-  bool p_blsi  = ( hyp && hyp->myTextOption.find("--boundary_layer_surface_tags ")  != std::string::npos );
-  bool p_blii  = ( hyp && hyp->myTextOption.find("--boundary_layer_imprint_tags ")  != std::string::npos );
-  bool p_blsd  = ( hyp && hyp->myTextOption.find("--normal_direction ")  != std::string::npos );
-  bool p_hotfl = ( hyp && hyp->myTextOption.find("--boundary_layer_global_initial_height ")  != std::string::npos );
-  bool p_nobl  = ( hyp && hyp->myTextOption.find("--number_of_boundary_layers ")  != std::string::npos );
-  bool p_blgp  = ( hyp && hyp->myTextOption.find("--boundary_layer_geometric_progression ")  != std::string::npos );
-  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_mat   = ( hyp && hyp->myTextOption.find("--multinormal_angle_threshold ")  != std::string::npos );
-  bool p_sn    = ( hyp && hyp->myTextOption.find("--smooth_normals ")  != std::string::npos );
+  bool p_h     = ( hyp && hyp->myTextOption.find("-h") != std::string::npos );
+  bool p_v     = ( hyp && hyp->myTextOption.find("-v") != std::string::npos );
+  bool p_i     = ( hyp && hyp->myTextOption.find("-i") != std::string::npos );
+  bool p_o     = ( hyp && hyp->myTextOption.find("-o") != std::string::npos );
+  bool p_mnot  = ( hyp && hyp->myTextOption.find("--max_number_of_threads ") != std::string::npos );
+  bool p_blsi  = ( hyp && hyp->myTextOption.find("--boundary_layer_surface_tags ") != std::string::npos );
+  bool p_blii  = ( hyp && hyp->myTextOption.find("--boundary_layer_imprint_tags ") != std::string::npos );
+  bool p_blsd  = ( hyp && hyp->myTextOption.find("--normal_direction ") != std::string::npos );
+  bool p_hotfl = ( hyp && hyp->myTextOption.find("--boundary_layer_global_initial_height ") != std::string::npos );
+  bool p_nobl  = ( hyp && hyp->myTextOption.find("--number_of_boundary_layers ") != std::string::npos );
+  bool p_blgp  = ( hyp && hyp->myTextOption.find("--boundary_layer_geometric_progression ") != std::string::npos );
+  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;
@@ -1782,34 +1877,20 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis*
 
   //help mode
   if ( p_h ) {
-    cmd += " --help ";
+    cmd << " --help ";
 #ifdef WIN32
-    cmd += " < NUL";
+    cmd << " < NUL";
 #endif
-    std::cout << "!!!!! CommandToRun help only !!!! " << cmd.ToCString() << std::endl;
-    return cmd.ToCString();
+    std::cout << "!!!!! CommandToRun help only !!!! " << cmd << std::endl;
+    return cmd;
   }
 
-  if ( !p_v && hyp ) {
-    cmd += " --verbose ";
-    cmd += hyp->myVerboseLevel;
-  }
+  if ( !p_v && hyp )
+    cmd << " --verbose " << hyp->myVerboseLevel;
+
+  if ( !p_mnot && hyp )
+    cmd << " --max_number_of_threads " << 8; //TODO getenv NB CPU
 
-  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;
-  //}
-  
   //no layers?
   if ( !p_nobl && hyp ) {
     if ( hyp->myNbOfBoundaryLayers < 1 ) nolayers = true;
@@ -1820,81 +1901,91 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis*
     
   if ( !p_blsd && hyp ) {
     if ( hyp->myBoundaryLayersGrowth >= 0 && hyp->myBoundaryLayersGrowth <= 1 ) {
-      const char* value[] = { "1" , "-1" };
-      cmd += " --normal_direction ";
-      cmd += value[ hyp->myBoundaryLayersGrowth ];
+      const char* value[] = { "-1" , "1" }; // -1 == inside
+      cmd << " --normal_direction " << value[ hyp->myBoundaryLayersGrowth ];
     }
   }
   
   if ( !p_hotfl && hyp ) {
-    cmd += " --boundary_layer_global_initial_height ";
-    cmd += hyp->myHeightFirstLayer;
+    cmd << " --boundary_layer_global_initial_height " << hyp->myHeightFirstLayer;
   }
   
   if ( !p_nobl && hyp ) {
-    cmd += " --number_of_boundary_layers ";
-    if ( nolayers )
-      cmd += 0;
-    else
-      cmd += hyp->myNbOfBoundaryLayers;
+    cmd << " --number_of_boundary_layers " << ( nolayers ? 0 :  hyp->myNbOfBoundaryLayers );
   }
-  
+
   if ( !p_blgp && hyp ) {
-    cmd += " --boundary_layer_geometric_progression ";
-    cmd += hyp->myBoundaryLayersProgression;
+    cmd << " --boundary_layer_geometric_progression " << hyp->myBoundaryLayersProgression;
   }
 
-  //--boundary_layers_surface_ids 5 #for all wrap shell
-  //--boundary_layers_surface_ids 6 #for all enfMeshList
-  //TODO? if ( !nolayers ) cmd += " --boundary_layers_surface_ids 5,6 "; //as all wrap shell and triangles of enforced mesh
-  if ( !nolayers ) {
-    if (layersOnAllWrap)
-      cmd += " --boundary_layer_surface_tags 5 "; //as triangles of all wrap
-    else
-      cmd += " --boundary_layer_surface_tags 6 "; //as triangles of enforced mesh
+  if ( !nolayers && hyp )
+  {
+    cmd << " --boundary_layer_size_mode " << ( layersOnAllWrap ? "global" : "local" );
+    
+    if ( !layersOnAllWrap )
+    {
+      // faces with layers
+      const std::vector<int>& faceLayersIDs = hyp->GetFacesWithLayers();
+      if ( !faceLayersIDs.empty() )
+        cmd << " --boundary_layer_surface_tags ";
+      for ( size_t i = 0; i < faceLayersIDs.size(); ++i )
+        cmd << faceLayersIDs[i] << ",";
+      if ( !faceLayersIDs.empty() )
+        cmd << " --boundary_layer_initial_height_on_surface_tags ";
+      for ( size_t i = 0; i < faceLayersIDs.size(); ++i )
+        cmd << hyp->myHeightFirstLayer << ",";
+
+      // faces with imprinting
+      const std::vector<int>& faceImprintingIDs = hyp->GetFacesWithImprinting();
+      if ( !faceImprintingIDs.empty() )
+        cmd << " --boundary_layer_imprinting yes --boundary_layer_imprinting_tags ";
+      for ( size_t i = 0; i < faceImprintingIDs.size(); ++i )
+        cmd << faceImprintingIDs[i] << ",";
+    }
   }
 
   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 ( 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" };
-      cmd += " --collision_mode ";
-      cmd += value[ hyp->myCollisionMode ];
+      cmd << " --collision_mode " << value[ hyp->myCollisionMode ];
     }
   }
   
   if ( !p_am && hyp ) {
     int res = hyp->myAddMultinormals ? 0 : 1 ;
     const char* value[] = { "yes" , "no" };
-    cmd += " --add_multinormals ";
-    cmd += value[ res ];
+    cmd << " --add_multinormals " << value[ res ];
   }
   
   if ( !p_mat && hyp ) {
-    cmd += " --multinormal_angle_threshold ";
-    cmd += hyp->myMultinormalsAngle;
+    cmd << " --multinormal_angle_threshold " << hyp->myMultinormalsAngle;
   }
   
   if ( !p_sn && hyp ) {
     int res = hyp->mySmoothNormals ? 0 : 1 ;
     const char* value[] = { "yes" , "no" };
-    cmd += " --smooth_normals ";
-    cmd += value[ res ];
+    cmd << " --smooth_normals " << value[ res ];
   }
   
 #ifdef WIN32
-  cmd += " < NUL";
+  cmd << " < NUL";
 #endif
-  //std::cout << "!!!!!CommandToRun end " << cmd.ToCString() << std::endl;
+  //std::cout << "!!!!!CommandToRun end " << cmd << std::endl;
     
-  return cmd.ToCString();
+  return cmd;
 }
 
 //================================================================================
@@ -1908,18 +1999,18 @@ std::string HYBRIDPlugin_Hypothesis::GetFileName(const HYBRIDPlugin_Hypothesis*
   std::string aTmpDir = hyp ? hyp->GetWorkingDirectory() : DefaultWorkingDirectory();
   const char lastChar = *aTmpDir.rbegin();
 #ifdef WIN32
-    if(lastChar != '\\') aTmpDir+='\\';
+  if(lastChar != '\\') aTmpDir+='\\';
 #else
-    if(lastChar != '/') aTmpDir+='/';
+  if(lastChar != '/') aTmpDir+='/';
 #endif
 
-  TCollection_AsciiString aGenericName = (char*)aTmpDir.c_str();
-  aGenericName += "HYBRID_";
-  aGenericName += getpid();
-  aGenericName += "_";
-  aGenericName += Abs((Standard_Integer)(long) aGenericName.ToCString());
+  SMESH_Comment aGenericName = aTmpDir;
+  aGenericName << "HYBRID_";
+  aGenericName << getpid();
+  aGenericName << "_";
+  aGenericName << Abs((Standard_Integer)(long) aGenericName.c_str());
 
-  return aGenericName.ToCString();
+  return aGenericName;
 }
 
 //================================================================================
index baeca583eae5bc0f1c35b6c6f98612ed672f9e89..ddf1b3dfd2066ad67bc471644765fc69358b567e 100644 (file)
@@ -129,6 +129,16 @@ public:
    */
   void SetLayersOnAllWrap(bool toMesh);
   bool GetLayersOnAllWrap(bool checkFreeOption = false) const;
+  /*!
+   * IDs of faces to grow the layers on
+   */
+  bool SetFacesWithLayers(const std::vector<int>& theVal);
+  const std::vector<int>& GetFacesWithLayers() const;
+  /*!
+   * IDs of faces to imprint the layers on
+   */
+  bool SetFacesWithImprinting(const std::vector<int>& theVal);
+  const std::vector<int>& GetFacesWithImprinting() const;
   /*!
    * To make groups of volumes of different domains when mesh is generated from skin.
    * Default is to make groups.
@@ -167,9 +177,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;
     /*!
@@ -195,6 +205,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
@@ -288,8 +304,7 @@ public:
   /*!
    * \brief Return command to run hybrid mesher excluding file prefix (-f)
    */
-  static std::string CommandToRun(const HYBRIDPlugin_Hypothesis* hyp,
-                                  const bool                    hasShapeToMesh=true);
+  static std::string CommandToRun(const HYBRIDPlugin_Hypothesis* hyp, SMESH_Mesh& mesh);
   /*!
    * \brief Return a unique file name
    */
@@ -298,6 +313,10 @@ public:
    * \brief Return the name of executable
    */
   static std::string GetExeName();
+  /*!
+   * \brief Return a tag of enforced triangles
+   */
+  static int EnforcedTag() { return -5; }
 
   /*!
    * To set an enforced vertex
@@ -372,6 +391,7 @@ public:
   static short  DefaultNbOfBoundaryLayers();
   static double DefaultHeightFirstLayer();
   static double DefaultBoundaryLayersProgression();
+  static double DefaultCoreSize();
   static double DefaultMultinormalsAngle();
     
   static THYBRIDEnforcedVertex DefaultHYBRIDEnforcedVertex() {return THYBRIDEnforcedVertex();}
@@ -408,33 +428,36 @@ public:
 
 private:
 
-  bool   myToMeshHoles;
-  bool   myLayersOnAllWrap;
-  bool   myToMakeGroupsOfDomains;
-  double myMaximumMemory;
-  double myInitialMemory;
-  short  myOptimizationLevel;
-  short  myCollisionMode;
-  short  myBoundaryLayersGrowth;
-  short  myElementGeneration;
-  bool   myKeepFiles;
-  std::string myWorkingDirectory;
-  short  myVerboseLevel;
-  bool   myToCreateNewNodes;
-  bool   myToUseBoundaryRecoveryVersion;
-  bool   myToUseFemCorrection;
-  bool   myToRemoveCentralPoint;
-  bool   myLogInStandardOutput;
-  bool   myRemoveLogOnSuccess;
-  std::string myTextOption;
-  double myGradation;
+  bool             myToMeshHoles;
+  bool             myLayersOnAllWrap;
+  std::vector<int> myFacesWithLayers;
+  std::vector<int> myFacesWithImprinting;
+  bool             myToMakeGroupsOfDomains;
+  double           myMaximumMemory;
+  double           myInitialMemory;
+  short            myOptimizationLevel;
+  short            myCollisionMode;
+  short            myBoundaryLayersGrowth;
+  short            myElementGeneration;
+  bool             myKeepFiles;
+  std::string      myWorkingDirectory;
+  short            myVerboseLevel;
+  bool             myToCreateNewNodes;
+  bool             myToUseBoundaryRecoveryVersion;
+  bool             myToUseFemCorrection;
+  bool             myToRemoveCentralPoint;
+  bool             myLogInStandardOutput;
+  bool             myRemoveLogOnSuccess;
+  std::string      myTextOption;
+  double           myGradation;
 
-  bool    myAddMultinormals;
-  bool    mySmoothNormals;
-  double  myHeightFirstLayer;
-  double  myBoundaryLayersProgression;
-  double  myMultinormalsAngle;
-  short   myNbOfBoundaryLayers;
+  bool             myAddMultinormals;
+  bool             mySmoothNormals;
+  double           myHeightFirstLayer;
+  double           myBoundaryLayersProgression;
+  double           myCoreSize;
+  double           myMultinormalsAngle;
+  short            myNbOfBoundaryLayers;
    
   THYBRIDEnforcedVertexList _enfVertexList;
   THYBRIDEnforcedVertexCoordsValues _enfVertexCoordsSizeList;
index 2c8c30f5c3d8b2bcd4c57c987ecfc8b203973883..d4348f519259770e23888a401a0a65509c37a368 100644 (file)
@@ -53,7 +53,6 @@ HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i (PortableServer::POA_ptr th
   : SALOME::GenericObj_i( thePOA ), 
     SMESH_Hypothesis_i( thePOA )
 {
-  MESSAGE( "HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i" );
   myBaseImpl = new ::HYBRIDPlugin_Hypothesis (theGenImpl->GetANewId(),
                                               theGenImpl);
 }
@@ -63,7 +62,6 @@ HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i (PortableServer::POA_ptr th
 //=======================================================================
 HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i()
 {
-  MESSAGE( "HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i" );
 }
 
 //=======================================================================
@@ -87,6 +85,64 @@ CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetLayersOnAllWrap()
   return this->GetImpl()->GetLayersOnAllWrap();
 }
 
+//=======================================================================
+//function : SetFacesWithLayers
+//=======================================================================
+
+void HYBRIDPlugin_Hypothesis_i::SetFacesWithLayers(const ::SMESH::long_array& theVal)
+{
+  std::vector<int> ids( theVal.length() );
+  for ( size_t i = 0; i < ids.size(); ++i )
+   ids[i] = theVal[i];
+
+  bool valueChanged = this->GetImpl()->SetFacesWithLayers(ids);
+  if (valueChanged)
+    SMESH::TPythonDump() << _this() << ".SetFacesWithLayers( "<< theVal << " )";
+}
+
+//=======================================================================
+//function : GetFacesWithLayers
+//=======================================================================
+
+SMESH::long_array* HYBRIDPlugin_Hypothesis_i::GetFacesWithLayers()
+{
+  const std::vector<int>& idsVec = this->GetImpl()->GetFacesWithLayers();
+  SMESH::long_array_var ids = new SMESH::long_array;
+  ids->length( idsVec.size() );
+  for ( size_t i = 0; i < idsVec.size(); ++i )
+    ids[i] = idsVec[i];
+  return ids._retn();
+}
+
+//=======================================================================
+//function : SetFacesWithImprinting
+//=======================================================================
+
+void HYBRIDPlugin_Hypothesis_i::SetFacesWithImprinting(const ::SMESH::long_array& theVal)
+{
+  std::vector<int> ids( theVal.length() );
+  for ( size_t i = 0; i < ids.size(); ++i )
+   ids[i] = theVal[i];
+
+  bool valueChanged = this->GetImpl()->SetFacesWithImprinting(ids);
+  if (valueChanged)
+    SMESH::TPythonDump() << _this() << ".SetFacesWithImprinting( "<< theVal << " )";
+}
+
+//=======================================================================
+//function : GetFacesWithImprinting
+//=======================================================================
+
+SMESH::long_array* HYBRIDPlugin_Hypothesis_i::GetFacesWithImprinting()
+{
+  const std::vector<int>& idsVec = this->GetImpl()->GetFacesWithImprinting();
+  SMESH::long_array_var ids = new SMESH::long_array;
+  ids->length( idsVec.size() );
+  for ( size_t i = 0; i < idsVec.size(); ++i )
+    ids[i] = idsVec[i];
+  return ids._retn();
+}
+
 //=======================================================================
 //function : SetToMeshHoles
 //=======================================================================
@@ -527,7 +583,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);
@@ -620,6 +676,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
 //=======================================================================
@@ -665,28 +740,24 @@ CORBA::Short HYBRIDPlugin_Hypothesis_i::GetNbOfBoundaryLayers()
 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : SetEnforcedVertex( "<< x << ", " << y << ", " << z << ", " << size << ")");
   return p_SetEnforcedVertex(size, x, y, z);
 }
 
 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : SetEnforcedVertexNamed( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ")");
   return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
 }
 
 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theGroupName << ")");
   return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
 }
 
 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ", " << theGroupName << ")");
   return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
 }
 
@@ -695,7 +766,6 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theV
   ASSERT(myBaseImpl);
   
   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
-    MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
   }
   
@@ -726,11 +796,9 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theV
       return false;
     
     measureOp->PointCoordinates (theVertex, x, y, z);
-    MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
   }
 
   std::string theVertexName = theVertex->GetName();
-  MESSAGE("IDL : SetEnforcedVertexGeom( "<< theVertexEntry << ", " << size<< ")");
   
   return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
 }
@@ -771,11 +839,9 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object
       return false;
     
     measureOp->PointCoordinates (theVertex, x, y, z);
-    MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
   }
     
   std::string theVertexName = theVertex->GetName();
-  MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theVertexEntry << ", " << size<< ", " << theGroupName << ")");
   
   return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
 }
@@ -785,7 +851,6 @@ bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::
                                                    CORBA::Boolean isCompound)
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
-  MESSAGE("IDL : p_SetEnforcedVertex(" << size << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\", " << isCompound<< ")");
   bool newValue = false;
 
   ::HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap coordsList;
@@ -797,19 +862,15 @@ bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::
     coords.push_back(y);
     coords.push_back(z);
     if (coordsList.find(coords) == coordsList.end()) {
-      MESSAGE("Coords not found: add it in coordsList");
       newValue = true;
     }
     else {
-      MESSAGE("Coords already found, compare names");
       ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
       if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
-        MESSAGE("The names or size are different: update");
 //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
         newValue = true;
       }
       else {
-        MESSAGE("The names and size are identical");
       }
     }
 
@@ -833,19 +894,15 @@ bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::
     enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
 //     ::BLSURFPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
     if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
-      MESSAGE("Geom entry not found: add it in enfVertexEntryList");
       newValue = true;
     }
     else {
-      MESSAGE("Geom entry already found, compare names");
       ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
       if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
-        MESSAGE("The names or size are different: update");
 //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
         newValue = true;
       }
       else {
-        MESSAGE("The names and size are identical");
       }
     }
 
@@ -860,7 +917,6 @@ bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::
   if (newValue)
     this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
 
-  MESSAGE("IDL : SetEnforcedVertexEntry END");
   return newValue;
 }
 
@@ -1132,7 +1188,6 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_p
 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
   throw (SALOME::SALOME_Exception)
 {
-//   MESSAGE("HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh");
 // #if HYBRID_VERSION >= 42
   return p_SetEnforcedMesh(theSource, theType);
 // #else
@@ -1184,7 +1239,6 @@ bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr th
 bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
   throw (SALOME::SALOME_Exception)
 {
-  MESSAGE("HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh");
   ASSERT(myBaseImpl);
   
   if (CORBA::is_nil( theSource ))
@@ -1199,25 +1253,17 @@ bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theS
   
   switch (theType) {
     case SMESH::NODE:
-      MESSAGE("Required type is NODE");
       break;
     case SMESH::EDGE:
-      MESSAGE("Required type is EDGE");
       break;
     case SMESH::FACE:
-      MESSAGE("Required type is FACE");
       break;
     default:
-        MESSAGE("Incompatible required type: " << theType);
-        return false;
+      return false;
   }
-//   MESSAGE("Required type is "<<theType);
   SMESH::array_of_ElementType_var types = theSource->GetTypes();
-  MESSAGE("Available types:");
-  for (CORBA::ULong i=0;i<types->length();i++){MESSAGE(types[i]);}
   if ( types->length() >= 1 && types[types->length()-1] <  theType)
   {
-    MESSAGE("Required type not available");
     return false;
 //     SALOME::ExceptionStruct ExDescription;
 //     ExDescription.text = "The source mesh has bad type";
@@ -1268,7 +1314,6 @@ bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theS
   }
   else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
   {
-    MESSAGE("The source is a group")
     try {
         bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
         if (theGroupName && theGroupName[0]) {
@@ -1295,7 +1340,6 @@ bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theS
   }
   else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
   {
-    MESSAGE("The source is a group on geom")
       try {
         bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
         if (theGroupName && theGroupName[0]) {
index 1f1836f2a0b04bb68b20a1c9885ee4a0de38cf91..965a7a858ff4d3f9a965028cd1d4bbf25128dccd 100644 (file)
@@ -54,6 +54,16 @@ class HYBRIDPLUGIN_EXPORT HYBRIDPlugin_Hypothesis_i:
    */
   void SetToMeshHoles(CORBA::Boolean toMesh);
   CORBA::Boolean GetToMeshHoles();
+   /*!
+   * IDs of faces to grow the layers on
+   */
+  void SetFacesWithLayers(const SMESH::long_array& faceIDs);
+  SMESH::long_array* GetFacesWithLayers();
+  /*!
+   * IDs of faces to imprint the layers on
+   */
+  void SetFacesWithImprinting(const SMESH::long_array& faceIDs);
+  SMESH::long_array* GetFacesWithImprinting();
   /*!
    * To mesh "layers on all wrap". Default is to mesh.
    */
@@ -174,6 +184,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();
   
index 1495564a586438439be917524e7bc74b24275cab..5fdea9cedf1bb5e380b3a2ab4f649fe9ea0959e0 100644 (file)
@@ -48,8 +48,6 @@ extern "C"
   HYBRIDPLUGIN_EXPORT
   GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName)
   {
-    MESSAGE("GetHypothesisCreator " << aHypName);
-
     GenericHypothesisCreator_i* aCreator = 0;
 
     // Hypotheses
index 4f7c925043c7be8a904ef3fb5ff8e623bcbc2a53..767d5ce5d9b7020b054a69f003599b3f693fc885 100644 (file)
@@ -1054,6 +1054,25 @@ void MG_HYBRID_API::GmfGetLin(int iMesh, GmfKwdCod what,
   ::GmfGetLin(iMesh, what, node1, node2, node3, node4, node5, node6, node7, node8, domain );
 }
 
+//================================================================================
+/*!
+ * \brief Return node indices of a next pyramid
+ */
+//================================================================================
+
+void MG_HYBRID_API::GmfGetLin(int iMesh, GmfKwdCod what,
+                              int* node1, int* node2, int* node3, int* node4,
+                              int* node5, int* domain )
+{
+  if ( _useLib ) {
+#ifdef USE_MG_LIBS
+    _libData->ReadPyramidNodes( node1, node2, node3, node4, node5, domain );
+    return;
+#endif
+  }
+  ::GmfGetLin(iMesh, what, node1, node2, node3, node4, node5, domain );
+}
+
 //================================================================================
 /*!
  * \brief Return node indices of a next prism
@@ -1237,7 +1256,7 @@ void MG_HYBRID_API::GmfSetLin(int iMesh, GmfKwdCod what, int node1, int node2, i
     return;
 #endif
   }
-  ::GmfSetLin(iMesh, what, node1, node2, node3, domain );
+  ::GmfSetLin(iMesh, what, node1, node2, node3, node4, domain );
 }
 
 //================================================================================
index 461dfb5c06cf17dfd61126b5cc21567693b301b9..64cfe6a2bad730c78ba973ffbd4a0a48c8232a42 100644 (file)
@@ -66,6 +66,7 @@ public:
   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* domain );
   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* domain );
   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* node4, int* domain );
+  void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* node4, int* node5, int* domain ); //pyramids
   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* node4, int* node5, int* node6, int* domain );
   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* node4, int* node5, int* node6, int* node7, int* node8, int* domain );
   void GmfCloseMesh( int iMesh );
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..3237615
--- /dev/null
@@ -0,0 +1,28 @@
+# Copyright (C) 2013-2016  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(HYBRIDPLUGIN_TEST_FILES
+  test_cartesian_core_size.py
+  test_enforced_mesh.py
+  test_layers_imprinting.py
+  test_layers_imprinting_hexa_core.py
+  test_mg_hybrid_pyramids.py
+)
+
+INSTALL(FILES ${HYBRIDPLUGIN_TEST_FILES} DESTINATION ${SALOME_HYBRIDPLUGIN_INSTALL_TESTS})
diff --git a/tests/test_cartesian_core_size.py b/tests/test_cartesian_core_size.py
new file mode 100644 (file)
index 0000000..c767dd7
--- /dev/null
@@ -0,0 +1,107 @@
+# -*- coding: utf-8 -*-
+
+
+import sys
+import salome
+
+salome.salome_init()
+theStudy = salome.myStudy
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New(theStudy)
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Cylinder_1 = geompy.MakeCylinderRH(100, 300)
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
+
+###
+### SMESH component
+###
+
+import  SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+from salome.HYBRIDPlugin import HYBRIDPluginBuilder
+
+smesh = smeshBuilder.New(theStudy)
+
+# Hybrid mesh with hexa dominant core
+# ===================================
+
+Mesh_1 = smesh.Mesh(Cylinder_1)
+
+MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+
+MG_Hybrid = Mesh_1.Tetrahedron(algo=smeshBuilder.HYBRID)
+MG_Hybrid_Parameters_1 = MG_Hybrid.Parameters()
+MG_Hybrid_Parameters_1.SetElementGeneration( HYBRIDPluginBuilder.Generation_Hexa_Dominant )
+MG_Hybrid_Parameters_1.SetHeightFirstLayer( 1 )
+MG_Hybrid_Parameters_1.SetNbOfBoundaryLayers( 3 )
+
+isDone = Mesh_1.Compute()
+
+nb_hexas_1 = Mesh_1.NbHexas()
+
+# check that hexaedra have been genereted
+assert nb_hexas_1 > 0
+
+# Hybrid mesh with cartesian core
+# ===============================
+
+Mesh_2 = smesh.Mesh(Cylinder_1)
+
+MG_CADSurf_1 = Mesh_2.Triangle(algo=smeshBuilder.MG_CADSurf)
+
+MG_Hybrid_1 = Mesh_2.Tetrahedron(algo=smeshBuilder.HYBRID)
+MG_Hybrid_Parameters_2 = MG_Hybrid_1.Parameters()
+MG_Hybrid_Parameters_2.SetElementGeneration( HYBRIDPluginBuilder.Generation_Cartesian_Core )
+MG_Hybrid_Parameters_2.SetHeightFirstLayer( 1 )
+MG_Hybrid_Parameters_2.SetNbOfBoundaryLayers( 3 )
+
+isDone = Mesh_2.Compute()
+
+nb_hexas_2 = Mesh_2.NbHexas()
+
+# check that hexaedra have been genereted
+assert nb_hexas_2 > 0
+
+
+# Hybrid mesh with cartesian core with fine core elements size
+# ============================================================
+
+Mesh_3 = smesh.Mesh(Cylinder_1)
+
+MG_CADSurf_1 = Mesh_3.Triangle(algo=smeshBuilder.MG_CADSurf)
+
+MG_Hybrid_1 = Mesh_3.Tetrahedron(algo=smeshBuilder.HYBRID)
+MG_Hybrid_Parameters_3 = MG_Hybrid_1.Parameters()
+MG_Hybrid_Parameters_3.SetElementGeneration( HYBRIDPluginBuilder.Generation_Cartesian_Core )
+MG_Hybrid_Parameters_3.SetHeightFirstLayer( 1 )
+MG_Hybrid_Parameters_3.SetNbOfBoundaryLayers( 3 )
+MG_Hybrid_Parameters_3.SetCoreSize( 10 )
+
+isDone = Mesh_3.Compute()
+
+nb_hexas_3 = Mesh_3.NbHexas()
+
+# check that more hexaedra have been genereted
+assert nb_hexas_3 > nb_hexas_2
+
+if salome.sg.hasDesktop():
+  salome.sg.updateObjBrowser(True)
diff --git a/tests/test_enforced_mesh.py b/tests/test_enforced_mesh.py
new file mode 100644 (file)
index 0000000..d2675f2
--- /dev/null
@@ -0,0 +1,168 @@
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+theStudy = salome.myStudy
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New(theStudy)
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Cylinder_1 = geompy.MakeCylinderRH(0.5, 5)
+Cylinder_2 = geompy.MakeCylinderRH(0.3, 3)
+Rotation_1 = geompy.MakeRotation(Cylinder_2, OY, -90*math.pi/180.0)
+Translation_1 = geompy.MakeTranslation(Rotation_1, 0, 0, 1.5)
+piquage = geompy.MakeFuseList([Cylinder_1, Translation_1], True, True)
+[Outlet] = geompy.SubShapes(piquage, [15])
+[Inlet_z,Inlet_x] = geompy.SubShapes(piquage, [3, 22])
+[corner] = geompy.SubShapes(piquage, [14])
+geomObj_1 = geompy.MakeVertex(0, 0, 0)
+geomObj_2 = geompy.MakeVectorDXDYDZ(1, 0, 0)
+geomObj_3 = geompy.MakeVectorDXDYDZ(0, 1, 0)
+geomObj_4 = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Wall = geompy.CreateGroup(piquage, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Wall, [7, 17])
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
+geompy.addToStudy( Cylinder_2, 'Cylinder_2' )
+geompy.addToStudy( Rotation_1, 'Rotation_1' )
+geompy.addToStudy( Translation_1, 'Translation_1' )
+geompy.addToStudy( piquage, 'piquage' )
+geompy.addToStudyInFather( piquage, Inlet_x, 'Inlet_x' )
+geompy.addToStudyInFather( piquage, Outlet, 'Outlet' )
+geompy.addToStudyInFather( piquage, Wall, 'Wall' )
+geompy.addToStudyInFather( piquage, Inlet_z, 'Inlet_z' )
+geompy.addToStudyInFather( piquage, corner, 'corner' )
+
+p1 = geompy.MakeVertex(0, -0.25, 1)
+p2 = geompy.MakeVertex(0, 0.25, 1)
+p3 = geompy.MakeVertex(0, 0.25, 3)
+p4 = geompy.MakeVertex(0, -0.25, 3)
+
+wire = geompy.MakePolyline([p1, p2, p3, p4, p1])
+face = geompy.MakeFace(wire, 1, theName="face")
+
+###
+### SMESH component
+###
+
+import  SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+from salome.StdMeshers import StdMeshersBuilder
+
+smesh = smeshBuilder.New(theStudy)
+
+Mesh_faces = smesh.Mesh(face)
+Mesh_faces.Triangle(algo=smeshBuilder.MG_CADSurf)
+Mesh_faces.Compute()
+
+
+# Viscous layers with Netgen additional hypothesis
+# ================================================
+
+Mesh_1 = smesh.Mesh(piquage)
+NETGEN_2D = Mesh_1.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+NETGEN_2D_Parameters = NETGEN_2D.Parameters()
+
+NETGEN_2D_Parameters.SetMinSize( 0.01 )
+NETGEN_2D_Parameters.SetLocalSizeOnShape(corner, 0.01)
+NETGEN_2D_Parameters.SetFineness( 5 )
+NETGEN_2D_Parameters.SetGrowthRate( 0.1 )
+NETGEN_2D_Parameters.SetNbSegPerEdge( 2 )
+NETGEN_2D_Parameters.SetNbSegPerRadius( 3 )
+
+NETGEN_3D = Mesh_1.Tetrahedron()
+Viscous_Layers_1 = NETGEN_3D.ViscousLayers(0.05,3,1.1,[],1,StdMeshersBuilder.SURF_OFFSET_SMOOTH)
+Viscous_Layers_1.SetTotalThickness( 0.05 )
+Viscous_Layers_1.SetNumberLayers( 3 )
+Viscous_Layers_1.SetStretchFactor( 1.1 )
+Viscous_Layers_1.SetMethod( StdMeshersBuilder.SURF_OFFSET_SMOOTH )
+Viscous_Layers_1.SetFaces( [ 7, 17 ], 0 )
+
+
+#isDone = Mesh_1.Compute()
+#Mesh_1.SplitVolumesIntoTetra( Mesh_1, 1 )
+
+Outlet_1 = Mesh_1.GroupOnGeom(Outlet,'Outlet',SMESH.FACE)
+Wall_1 = Mesh_1.GroupOnGeom(Wall,'Wall',SMESH.FACE)
+Inlet_z_1 = Mesh_1.GroupOnGeom(Inlet_z,'Inlet_z',SMESH.FACE)
+Inlet_x_1 = Mesh_1.GroupOnGeom(Inlet_x,'Inlet_x',SMESH.FACE)
+
+# Enforced mesh without layer
+# ===========================
+
+Mesh_2 = smesh.Mesh(piquage, "Mesh_without_layer")
+
+NETGEN_2D_1_1 = Mesh_2.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+status = Mesh_2.AddHypothesis(NETGEN_2D_Parameters)
+
+MG_Hybrid_2 = Mesh_2.Tetrahedron(algo=smeshBuilder.HYBRID)
+MG_Hybrid_Parameters_2 = MG_Hybrid_2.Parameters()
+MG_Hybrid_Parameters_2.SetLayersOnAllWrap( 0 )
+MG_Hybrid_Parameters_2.SetElementGeneration( 0 )
+#MG_Hybrid_Parameters_2.SetHeightFirstLayer( 0.01 )
+#MG_Hybrid_Parameters_2.SetBoundaryLayersProgression( 1.1 )
+#MG_Hybrid_Parameters_2.SetNbOfBoundaryLayers( 3 )
+MG_Hybrid_Parameters_2.SetEnforcedMeshWithGroup( Mesh_faces.GetMesh(), SMESH.FACE, "LayersGroup" )
+MG_Hybrid_Parameters_2.SetKeepFiles(1)
+
+isDone = Mesh_2.Compute()
+
+if not isDone:
+  raise Exception("Error when computing Mesh_without_layer")
+
+# Check that a group has been created with the enforced mesh
+assert len(Mesh_2.GetGroups()) == 1
+assert Mesh_2.GetGroups()[0].GetName() == 'LayersGroup'
+assert Mesh_2.GetGroups()[0].Size() > 0
+
+# Enforced mesh with layers
+# =========================
+
+Mesh_3 = smesh.Mesh(piquage, "Mesh_with_layer")
+
+NETGEN_2D_1_1 = Mesh_3.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+status = Mesh_3.AddHypothesis(NETGEN_2D_Parameters)
+
+MG_Hybrid_3 = Mesh_3.Tetrahedron(algo=smeshBuilder.HYBRID)
+MG_Hybrid_Parameters_3 = MG_Hybrid_3.Parameters()
+MG_Hybrid_Parameters_3.SetLayersOnAllWrap( 0 )
+MG_Hybrid_Parameters_3.SetElementGeneration( 0 )
+MG_Hybrid_Parameters_3.SetHeightFirstLayer( 0.01 )
+MG_Hybrid_Parameters_3.SetBoundaryLayersProgression( 1.1 )
+MG_Hybrid_Parameters_3.SetNbOfBoundaryLayers( 3 )
+MG_Hybrid_Parameters_3.SetEnforcedMeshWithGroup( Mesh_faces.GetMesh(), SMESH.FACE, "LayersGroup" )
+MG_Hybrid_Parameters_3.SetKeepFiles(1)
+MG_Hybrid_3.SetFacesWithLayers( Wall )
+
+
+isDone = Mesh_3.Compute()
+
+if not isDone:
+  raise Exception("Error when computing Mesh_with_layer")
+
+# Check that a group has been created with the enforced mesh
+assert len(Mesh_3.GetGroups()) == 1
+assert Mesh_3.GetGroups()[0].GetName() == 'LayersGroup'
+assert Mesh_3.GetGroups()[0].Size() > 0
+
+if salome.sg.hasDesktop():
+  salome.sg.updateObjBrowser(1)
diff --git a/tests/test_layers_imprinting.py b/tests/test_layers_imprinting.py
new file mode 100644 (file)
index 0000000..d95d23f
--- /dev/null
@@ -0,0 +1,222 @@
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+theStudy = salome.myStudy
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New(theStudy)
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Cylinder_1 = geompy.MakeCylinderRH(0.5, 5)
+Cylinder_2 = geompy.MakeCylinderRH(0.3, 3)
+Rotation_1 = geompy.MakeRotation(Cylinder_2, OY, -90*math.pi/180.0)
+Translation_1 = geompy.MakeTranslation(Rotation_1, 0, 0, 1.5)
+piquage = geompy.MakeFuseList([Cylinder_1, Translation_1], True, True)
+[Outlet] = geompy.SubShapes(piquage, [15])
+[Inlet_z,Inlet_x] = geompy.SubShapes(piquage, [3, 22])
+[corner] = geompy.SubShapes(piquage, [14])
+geomObj_1 = geompy.MakeVertex(0, 0, 0)
+geomObj_2 = geompy.MakeVectorDXDYDZ(1, 0, 0)
+geomObj_3 = geompy.MakeVectorDXDYDZ(0, 1, 0)
+geomObj_4 = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Wall = geompy.CreateGroup(piquage, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Wall, [7, 17])
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
+geompy.addToStudy( Cylinder_2, 'Cylinder_2' )
+geompy.addToStudy( Rotation_1, 'Rotation_1' )
+geompy.addToStudy( Translation_1, 'Translation_1' )
+geompy.addToStudy( piquage, 'piquage' )
+geompy.addToStudyInFather( piquage, Inlet_x, 'Inlet_x' )
+geompy.addToStudyInFather( piquage, Outlet, 'Outlet' )
+geompy.addToStudyInFather( piquage, Wall, 'Wall' )
+geompy.addToStudyInFather( piquage, Inlet_z, 'Inlet_z' )
+geompy.addToStudyInFather( piquage, corner, 'corner' )
+
+geom_groups = [Inlet_x, Inlet_z, Outlet, Wall]
+d_geom_groups = {}
+
+###
+### SMESH component
+###
+
+import  SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+from salome.StdMeshers import StdMeshersBuilder
+from salome.HYBRIDPlugin import HYBRIDPluginBuilder
+
+smesh = smeshBuilder.New(theStudy)
+
+
+# Viscous layers without imprinting
+# =================================
+
+Mesh_1 = smesh.Mesh(piquage, "Mesh_without_imprinting")
+NETGEN_2D = Mesh_1.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+NETGEN_2D_Parameters = NETGEN_2D.Parameters()
+
+NETGEN_2D_Parameters.SetMinSize( 0.01 )
+NETGEN_2D_Parameters.SetLocalSizeOnShape(corner, 0.01)
+NETGEN_2D_Parameters.SetFineness( 5 )
+NETGEN_2D_Parameters.SetGrowthRate( 0.1 )
+NETGEN_2D_Parameters.SetNbSegPerEdge( 2 )
+NETGEN_2D_Parameters.SetNbSegPerRadius( 3 )
+
+MG_Hybrid = Mesh_1.Tetrahedron(algo=smeshBuilder.HYBRID)
+MG_Hybrid_Parameters_1 = MG_Hybrid.Parameters()
+MG_Hybrid_Parameters_1.SetLayersOnAllWrap( 0 )
+MG_Hybrid_Parameters_1.SetElementGeneration( HYBRIDPluginBuilder.Generation_Tetra_Dominant )
+MG_Hybrid_Parameters_1.SetHeightFirstLayer( 0.01 )
+MG_Hybrid_Parameters_1.SetBoundaryLayersProgression( 1.1 )
+MG_Hybrid_Parameters_1.SetNbOfBoundaryLayers( 3 )
+MG_Hybrid_Parameters_1.SetFacesWithLayers( [ 7, 17 ] )
+
+
+isDone = Mesh_1.Compute()
+
+if not isDone:
+  raise Exception("Error when computing Mesh_without_imprinting")
+
+d_groups_1 = {}
+
+for geom_group in geom_groups:
+  name = geom_group.GetName()
+  gr = Mesh_1.Group(geom_group)
+  d_groups_1[name] = gr
+  d_geom_groups[name] = geom_group
+
+assert Mesh_1.NbQuadrangles() == 0
+
+shape_volume = geompy.BasicProperties(piquage)[2]
+
+# Compare whole mesh volume
+volume_error_1 = abs(shape_volume-Mesh_1.GetVolume())/shape_volume
+
+assert volume_error_1 < 0.015
+
+# Viscous layers with imprinting
+# ==============================
+
+Mesh_2 = smesh.Mesh(piquage, "Mesh_with_imprinting")
+
+NETGEN_2D_1_1 = Mesh_2.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+status = Mesh_2.AddHypothesis(NETGEN_2D_Parameters)
+
+MG_Hybrid_2 = Mesh_2.Tetrahedron(algo=smeshBuilder.HYBRID)
+MG_Hybrid_Parameters_2 = MG_Hybrid_2.Parameters()
+MG_Hybrid_Parameters_2.SetLayersOnAllWrap( 0 )
+MG_Hybrid_Parameters_2.SetElementGeneration( HYBRIDPluginBuilder.Generation_Tetra_Dominant )
+MG_Hybrid_Parameters_2.SetHeightFirstLayer( 0.01 )
+MG_Hybrid_Parameters_2.SetBoundaryLayersProgression( 1.1 )
+MG_Hybrid_Parameters_2.SetNbOfBoundaryLayers( 3 )
+MG_Hybrid_Parameters_2.SetFacesWithLayers( [ 7, 17 ] )
+MG_Hybrid_Parameters_2.SetFacesWithImprinting( [ 22, 15, 3 ] )
+
+isDone = Mesh_2.Compute()
+
+if not isDone:
+  raise Exception("Error when computing Mesh_with_imprinting")
+
+assert Mesh_2.NbQuadrangles() > 0
+
+d_groups_2 = {}
+
+for geom_group in geom_groups:
+  name = geom_group.GetName()
+  gr = Mesh_2.Group(geom_group)
+  d_groups_2[name] = gr
+
+faces_imprinted = ["Inlet_x", "Inlet_z", "Outlet"]
+
+# Check viscous layers with imprinting
+for name in faces_imprinted:
+  geom_area = geompy.BasicProperties(d_geom_groups[name])[1]
+  gr_1 = d_groups_1[name]
+  gr_2 = d_groups_2[name]
+  #assert gr_1.Size() > 0
+  assert gr_2.Size() > 0
+  # Nb of quadrangles is in 7th index of mesh info
+  assert gr_2.GetMeshInfo()[7] > 0
+
+  # Compare mesh group and geom group
+  area_error_1 = abs(geom_area-smesh.GetArea(gr_2))/geom_area
+  assert area_error_1 < 0.025
+  # Compare mesh group with imprinting and mesh group without imprinting
+  area_error_2 = abs(smesh.GetArea(gr_1)-smesh.GetArea(gr_2))/smesh.GetArea(gr_1)
+  assert area_error_2 < 1e-10
+
+# Compare whole mesh volume
+mesh_2_volume = Mesh_2.GetVolume()
+volume_error_2 = abs(shape_volume-mesh_2_volume)/shape_volume
+
+assert volume_error_2 < 0.015
+
+# Viscous layers with imprinting set by groups
+# ============================================
+
+Mesh_3 = smesh.Mesh(piquage, "Mesh_with_imprinting_set_by_groups")
+
+NETGEN_2D_1_1 = Mesh_3.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+status = Mesh_3.AddHypothesis(NETGEN_2D_Parameters)
+
+MG_Hybrid_3 = Mesh_3.Tetrahedron(algo=smeshBuilder.HYBRID)
+MG_Hybrid_Parameters_3 = MG_Hybrid_3.Parameters()
+MG_Hybrid_Parameters_3.SetLayersOnAllWrap( 0 )
+MG_Hybrid_Parameters_3.SetElementGeneration( HYBRIDPluginBuilder.Generation_Tetra_Dominant )
+MG_Hybrid_Parameters_3.SetHeightFirstLayer( 0.01 )
+MG_Hybrid_Parameters_3.SetBoundaryLayersProgression( 1.1 )
+MG_Hybrid_Parameters_3.SetNbOfBoundaryLayers( 3 )
+MG_Hybrid_3.SetFacesWithLayers( Wall )
+MG_Hybrid_3.SetFacesWithImprinting( [ Inlet_x, Inlet_z, Outlet ] )
+
+isDone = Mesh_3.Compute()
+
+if not isDone:
+  raise Exception("Error when computing Mesh_with_imprinting_set_by_groups")
+
+d_groups_3 = {}
+
+for geom_group in geom_groups:
+  name = geom_group.GetName()
+  gr = Mesh_3.Group(geom_group)
+  d_groups_3[name] = gr
+
+# Compare whole mesh volume
+mesh_3_volume = Mesh_3.GetVolume()
+volume_error_3 = abs(mesh_2_volume-mesh_3_volume)/mesh_2_volume
+
+assert abs(mesh_3_volume-mesh_2_volume)/mesh_2_volume < 1e-10
+
+# Check viscous layers with imprinting
+for name in faces_imprinted:
+  gr_2 = d_groups_2[name]
+  gr_3 = d_groups_3[name]
+  assert gr_3.Size() > 0
+  # Nb of quadrangles is in 7th index of mesh info
+  assert gr_2.GetMeshInfo()[7] == gr_3.GetMeshInfo()[7]
+
+  # Compare mesh group with imprinting set by ids and mesh group with imprinting set by geom group
+  area_error_3 = abs(smesh.GetArea(gr_2)-smesh.GetArea(gr_3))/smesh.GetArea(gr_2)
+  assert area_error_3 < 1e-10
+
+if salome.sg.hasDesktop():
+  salome.sg.updateObjBrowser(1)
diff --git a/tests/test_layers_imprinting_hexa_core.py b/tests/test_layers_imprinting_hexa_core.py
new file mode 100644 (file)
index 0000000..e494785
--- /dev/null
@@ -0,0 +1,136 @@
+# -*- coding: utf-8 -*-
+
+# This test is a known failure for MeshGems <= 2.4-5 (but must not crash Salome)
+
+import sys
+import salome
+
+salome.salome_init()
+theStudy = salome.myStudy
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New(theStudy)
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Cylinder_1 = geompy.MakeCylinderRH(0.5, 5)
+Cylinder_2 = geompy.MakeCylinderRH(0.3, 3)
+Rotation_1 = geompy.MakeRotation(Cylinder_2, OY, -90*math.pi/180.0)
+Translation_1 = geompy.MakeTranslation(Rotation_1, 0, 0, 1.5)
+piquage = geompy.MakeFuseList([Cylinder_1, Translation_1], True, True)
+[Outlet] = geompy.SubShapes(piquage, [15])
+[Inlet_z,Inlet_x] = geompy.SubShapes(piquage, [3, 22])
+[corner] = geompy.SubShapes(piquage, [14])
+geomObj_1 = geompy.MakeVertex(0, 0, 0)
+geomObj_2 = geompy.MakeVectorDXDYDZ(1, 0, 0)
+geomObj_3 = geompy.MakeVectorDXDYDZ(0, 1, 0)
+geomObj_4 = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Wall = geompy.CreateGroup(piquage, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Wall, [7, 17])
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
+geompy.addToStudy( Cylinder_2, 'Cylinder_2' )
+geompy.addToStudy( Rotation_1, 'Rotation_1' )
+geompy.addToStudy( Translation_1, 'Translation_1' )
+geompy.addToStudy( piquage, 'piquage' )
+geompy.addToStudyInFather( piquage, Inlet_x, 'Inlet_x' )
+geompy.addToStudyInFather( piquage, Outlet, 'Outlet' )
+geompy.addToStudyInFather( piquage, Wall, 'Wall' )
+geompy.addToStudyInFather( piquage, Inlet_z, 'Inlet_z' )
+geompy.addToStudyInFather( piquage, corner, 'corner' )
+
+geom_groups = [Inlet_x, Inlet_z, Outlet, Wall]
+d_geom_groups = {}
+
+###
+### SMESH component
+###
+
+import  SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+from salome.StdMeshers import StdMeshersBuilder
+from salome.HYBRIDPlugin import HYBRIDPluginBuilder
+
+smesh = smeshBuilder.New(theStudy)
+
+# Viscous layers with imprinting (hexa core)
+# ==========================================
+
+Mesh_4 = smesh.Mesh(piquage, "Mesh_with_imprinting_hexa_core")
+
+NETGEN_2D_1_1 = Mesh_4.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+NETGEN_2D_Parameters = NETGEN_2D_1_1.Parameters()
+
+NETGEN_2D_Parameters.SetMinSize( 0.01 )
+NETGEN_2D_Parameters.SetLocalSizeOnShape(corner, 0.01)
+NETGEN_2D_Parameters.SetFineness( 5 )
+NETGEN_2D_Parameters.SetGrowthRate( 0.1 )
+NETGEN_2D_Parameters.SetNbSegPerEdge( 2 )
+NETGEN_2D_Parameters.SetNbSegPerRadius( 3 )
+
+MG_Hybrid_4 = Mesh_4.Tetrahedron(algo=smeshBuilder.HYBRID)
+MG_Hybrid_Parameters_4 = MG_Hybrid_4.Parameters()
+MG_Hybrid_Parameters_4.SetLayersOnAllWrap( 0 )
+MG_Hybrid_Parameters_4.SetElementGeneration( HYBRIDPluginBuilder.Generation_Hexa_Dominant )
+MG_Hybrid_Parameters_4.SetHeightFirstLayer( 0.01 )
+MG_Hybrid_Parameters_4.SetBoundaryLayersProgression( 1.1 )
+MG_Hybrid_Parameters_4.SetNbOfBoundaryLayers( 3 )
+MG_Hybrid_Parameters_4.SetFacesWithLayers( [ 7, 17 ] )
+MG_Hybrid_Parameters_4.SetFacesWithImprinting( [ 22, 15, 3 ] )
+
+isDone = Mesh_4.Compute()
+
+if not isDone:
+  raise Exception("Error when computing Mesh_with_imprinting_hexa_core")
+
+assert Mesh_4.NbQuadrangles() > 0
+
+d_groups_4 = {}
+d_geom_groups = {}
+
+for geom_group in geom_groups:
+  name = geom_group.GetName()
+  gr = Mesh_4.Group(geom_group)
+  d_groups_4[name] = gr
+  d_geom_groups[name] = geom_group
+
+# Compare whole mesh volume
+mesh_4_volume = Mesh_4.GetVolume()
+shape_volume = geompy.BasicProperties(piquage)[2]
+volume_error_4 = abs(shape_volume-mesh_4_volume)/shape_volume
+
+assert volume_error_4 < 0.015
+
+# Check viscous layers with imprinting
+faces_imprinted = ["Inlet_x", "Inlet_z", "Outlet"]
+
+for name in faces_imprinted:
+  gr_4 = d_groups_4[name]
+  #assert gr_1.Size() > 0
+  assert gr_4.Size() > 0
+  # Nb of quadrangles is in 7th index of mesh info
+  assert gr_4.GetMeshInfo()[7] > 0
+
+  # Compare mesh group and geom group
+  geom_area = geompy.BasicProperties(d_geom_groups[name])[1]
+  area_error_1 = abs(geom_area-smesh.GetArea(gr_4))/geom_area
+  assert area_error_1 < 0.025
+
+
+if salome.sg.hasDesktop():
+  salome.sg.updateObjBrowser(1)
diff --git a/tests/test_mg_hybrid_pyramids.py b/tests/test_mg_hybrid_pyramids.py
new file mode 100644 (file)
index 0000000..f546b5b
--- /dev/null
@@ -0,0 +1,92 @@
+# -*- coding: utf-8 -*-
+
+
+import sys
+import salome
+
+salome.salome_init()
+theStudy = salome.myStudy
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New(theStudy)
+
+box_side = 200
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Box_1 = geompy.MakeBoxDXDYDZ(box_side, box_side, box_side)
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( Box_1, 'Box_1' )
+
+###
+### SMESH component
+###
+
+import  SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New(theStudy)
+Mesh_1 = smesh.Mesh(Box_1)
+MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
+MG_CADSurf_Parameters_1.SetPhySize( 10 )
+MG_CADSurf_Parameters_1.SetMinSize( 0.34641 )
+MG_CADSurf_Parameters_1.SetMaxSize( 69.282 )
+
+isDone = Mesh_1.Compute()
+
+# Copy the skin mesh
+Mesh_2 = smesh.CopyMesh( Mesh_1, 'Mesh_2', 0, 0)
+
+# Add hybrid
+HYBRID_3D = Mesh_1.Tetrahedron(algo=smeshBuilder.HYBRID)
+MG_Hybrid_Parameters_1 = HYBRID_3D.Parameters()
+MG_Hybrid_Parameters_1.SetElementGeneration( 1 )
+MG_Hybrid_Parameters_1.SetHeightFirstLayer( 1 )
+MG_Hybrid_Parameters_1.SetNbOfBoundaryLayers( 3 )
+
+# Compute mesh on CAD
+# ===================
+isDone = Mesh_1.Compute()
+
+# Check volume
+vol_mesh_1 = smesh.GetVolume(Mesh_1)
+vol_box = box_side**3
+assert abs(vol_mesh_1-vol_box)/vol_box < 1e-4
+
+# Check number of pyramids
+assert Mesh_1.NbPyramids() > 1000
+
+# Add hybrid to skin mesh
+HYBRID_3D_1 = Mesh_2.Tetrahedron(algo=smeshBuilder.HYBRID,geom=None)
+status = Mesh_2.AddHypothesis(MG_Hybrid_Parameters_1,None)
+
+# Compute mesh without CAD
+# ========================
+isDone = Mesh_2.Compute()
+
+# Check volume
+vol_mesh_2 = smesh.GetVolume(Mesh_2)
+vol_box = box_side**3
+assert abs(vol_mesh_2-vol_box)/vol_box < 1e-4
+
+# Check number of pyramids
+assert Mesh_2.NbPyramids() > 1000
+
+
+if salome.sg.hasDesktop():
+  salome.sg.updateObjBrowser(True)