From: mpa Date: Wed, 24 Jun 2015 09:53:50 +0000 (+0300) Subject: 0023102: [CEA 1486 ] Add the parameters for defining the boundary layers X-Git-Tag: V7_7_0a1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ccb1d1f10115e57bafa8bf3505439a0859abe0a2;p=plugins%2Fhexoticplugin.git 0023102: [CEA 1486 ] Add the parameters for defining the boundary layers --- diff --git a/doc/salome/examples/hexoticdemo_vl.py b/doc/salome/examples/hexoticdemo_vl.py new file mode 100644 index 0000000..bc2b4a2 --- /dev/null +++ b/doc/salome/examples/hexoticdemo_vl.py @@ -0,0 +1,54 @@ +# Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE +# +# 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 +# + +import salome +salome.salome_init() +theStudy = salome.myStudy + +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + +# Create geometry +Box_1 = geompy.MakeBoxDXDYDZ(50, 50, 50) +geompy.addToStudy( Box_1, 'Box_1' ) + +# Create mesh +Mesh_mghexa_vl = smesh.Mesh(Box_1, "Mesh_mghexa_vl") + +Regular_1D = Mesh_mghexa_vl.Segment() +Local_Length_1 = Regular_1D.LocalLength(8.66025,None,1e-07) + +MEFISTO_2D = Mesh_mghexa_vl.Triangle(algo=smeshBuilder.MEFISTO) + +MG_Hexa = Mesh_mghexa_vl.Hexahedron(algo=smeshBuilder.MG_Hexa) +MG_Hexa_Parameters = MG_Hexa.Parameters() +MG_Hexa.SetViscousLayers(5,5,3,"Inward",[13,23]) +MG_Hexa_Parameters.SetMinSize( 2 ) +MG_Hexa_Parameters.SetMaxSize( 4 ) +MG_Hexa_Parameters.SetHexesMinLevel( 2 ) +MG_Hexa_Parameters.SetHexesMaxLevel( 4 ) + +# Compute +Mesh_mghexa_vl.Compute() + +# End of script diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_local_size_parameters.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_local_size_parameters.png index 15091c8..5cf1043 100644 Binary files a/doc/salome/gui/HexoticPLUGIN/images/hexotic_local_size_parameters.png and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_local_size_parameters.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png index b425dc6..def5da7 100644 Binary files a/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_vl_example.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_vl_example.png new file mode 100644 index 0000000..0be4f23 Binary files /dev/null and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_vl_example.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_vl_parameters.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_vl_parameters.png new file mode 100644 index 0000000..16099a8 Binary files /dev/null and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_vl_parameters.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc b/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc index df292c3..60d9624 100644 --- a/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc +++ b/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc @@ -74,4 +74,22 @@ The area where the mesh has to be refined is given as a geometrical shape. \note The local size will only influence the density towards a locally denser mesh. If the required density is coarser than the one determined automatically by the global size parameters (min size, max size, min level, max level), it will be ignored and the default density will be used. + +\section hexotic_viscous_layers_parameters Viscous layers + +The viscous layers allows you to set up parameters of Viscous Layers supported by MG_Hexa mesher. + +\image html hexotic_vl_parameters.png + + + */ diff --git a/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_interface.doc b/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_interface.doc index 96cb32e..abad64f 100644 --- a/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_interface.doc +++ b/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_interface.doc @@ -35,6 +35,11 @@ Below you can see examples of usage of this class for hexahedral mesh generation \image html hexotic_basic_subdivisions_4_8.png Left: MG-Hexa mesh without hypothesis, right: MG-Hexa mesh with an hypothesis defined by minl=4 and maxl=8 +

Example of mesh generation with MG-Hexa algorithm and viscous layers parameters:

+\tui_script{hexoticdemo_vl.py} + +\image html hexotic_vl_example.png Left: MG-Hexa mesh without viscous layers parameters, right: MG-Hexa mesh with viscous layers parameters + \subsection tui_local_size Local size \image html hexotic_local_size_example.png Example of use of a local size on the skin of a sphere diff --git a/idl/HexoticPlugin_Algorithm.idl b/idl/HexoticPlugin_Algorithm.idl index e1d09e9..8c3cd0a 100644 --- a/idl/HexoticPlugin_Algorithm.idl +++ b/idl/HexoticPlugin_Algorithm.idl @@ -26,6 +26,7 @@ #define _SMESH_HexoticALGORITHM_IDL_ #include "SMESH_Hypothesis.idl" +#include "SMESH_Mesh.idl" #include "GEOM_Gen.idl" /*! @@ -100,6 +101,24 @@ module HexoticPlugin void UnsetSizeMap(in GEOM::GEOM_Object GeomObj); HexoticPluginSizeMapsList GetSizeMaps(); + + void SetNbLayers(in long theVal); + long GetNbLayers(); + + void SetFirstLayerSize(in double theVal); + double GetFirstLayerSize(); + + void SetDirection(in boolean theVal); + boolean GetDirection(); + + void SetGrowth(in double theVal); + double GetGrowth(); + + void SetFacesWithLayers(in SMESH::long_array theVal); + SMESH::long_array GetFacesWithLayers(); + + void SetImprintedFaces(in SMESH::long_array theVal); + SMESH::long_array GetImprintedFaces(); }; }; diff --git a/src/GUI/CMakeLists.txt b/src/GUI/CMakeLists.txt index 6abe917..e7dae2d 100644 --- a/src/GUI/CMakeLists.txt +++ b/src/GUI/CMakeLists.txt @@ -85,6 +85,7 @@ SET(_other_SOURCES HexoticPluginGUI.cxx HexoticPluginGUI_StdWidget.cxx HexoticPluginGUI_SizeMapsWidget.cxx + HexoticPluginGUI_ViscousLayersWidget.cxx HexoticPluginGUI_HypothesisCreator.cxx ) @@ -102,6 +103,7 @@ SET(_ts_RESOURCES SET(_uic_files HexoticPluginGUI_StdWidget_QTD.ui HexoticPluginGUI_SizeMapsWidget_QTD.ui + HexoticPluginGUI_ViscousLayersWidget_QTD.ui ) # header files / uic wrappings diff --git a/src/GUI/HexoticPLUGIN_msg_en.ts b/src/GUI/HexoticPLUGIN_msg_en.ts index a0eeb3c..716ca89 100644 --- a/src/GUI/HexoticPLUGIN_msg_en.ts +++ b/src/GUI/HexoticPLUGIN_msg_en.ts @@ -11,6 +11,10 @@ Hexotic_3D_TITLE Hypothesis Construction + + Hexotic_VISCOUS_LAYERS + Viscous layers + Hexotic_INPUT_SIZE Sizes @@ -115,5 +119,29 @@ Hexotic_NULL_LOCAL_SIZE 0 is not allowed as "Local size" + + Hexotic_NB_LAYERS + Number of layers + + + Hexotic_FIRST_LAYER_SIZE + Size of the first layer + + + Hexotic_DIRECTION + Direction of the layers + + + Hexotic_GROWTH + Growth + + + Hexotic_FACES_WITH_LAYERS + Faces with layers + + + Hexotic_IMPRINTED_FACES + Imprinted faces + diff --git a/src/GUI/HexoticPLUGIN_msg_fr.ts b/src/GUI/HexoticPLUGIN_msg_fr.ts index b5fb72c..1d445fe 100755 --- a/src/GUI/HexoticPLUGIN_msg_fr.ts +++ b/src/GUI/HexoticPLUGIN_msg_fr.ts @@ -15,6 +15,10 @@ Hexotic_3D_TITLE Construction de l'hypothèse + + Hexotic_VISCOUS_LAYERS + Couches limites + Hexotic_INPUT_SIZE Tailles @@ -115,5 +119,29 @@ Hexotic_SEL_SHAPE Sélectionnez un objet géométrique + + Hexotic_NB_LAYERS + Nombre de couches + + + Hexotic_FIRST_LAYER_SIZE + Taille de la première couche + + + Hexotic_DIRECTION + Direction des couches + + + Hexotic_GROWTH + Accroissement + + + Hexotic_FACES_WITH_LAYERS + Faces avec couche limite + + + Hexotic_IMPRINTED_FACES + Imprinted faces + diff --git a/src/GUI/HexoticPLUGIN_msg_ja.ts b/src/GUI/HexoticPLUGIN_msg_ja.ts index a31833b..0717ae7 100644 --- a/src/GUI/HexoticPLUGIN_msg_ja.ts +++ b/src/GUI/HexoticPLUGIN_msg_ja.ts @@ -11,6 +11,10 @@ Hexotic_3D_TITLE 仮定の構成 + + Hexotic_VISCOUS_LAYERS + 境界層設定 + Hexotic_INPUT_SIZE サイズ @@ -115,5 +119,29 @@ Hexotic_NULL_LOCAL_SIZE 局所サイズとしてゼロは許されていない + + Hexotic_NB_LAYERS + 層数 + + + Hexotic_FIRST_LAYER_SIZE + Size of the first layer + + + Hexotic_DIRECTION + Direction of the layers + + + Hexotic_GROWTH + Growth + + + Hexotic_FACES_WITH_LAYERS + 面層 + + + Hexotic_IMPRINTED_FACES + Imprinted faces + diff --git a/src/GUI/HexoticPluginGUI_Dlg.h b/src/GUI/HexoticPluginGUI_Dlg.h index 73b2c0c..9ffe39f 100644 --- a/src/GUI/HexoticPluginGUI_Dlg.h +++ b/src/GUI/HexoticPluginGUI_Dlg.h @@ -38,8 +38,11 @@ enum { #include "ui_HexoticPluginGUI_StdWidget_QTD.h" #include "ui_HexoticPluginGUI_SizeMapsWidget_QTD.h" +#include "ui_HexoticPluginGUI_ViscousLayersWidget_QTD.h" #include "HexoticPluginGUI.h" +#include + class HEXOTICPLUGIN_GUI_EXPORT HexoticPluginGUI_StdWidget : public QWidget, public Ui::HexoticPluginGUI_StdWidget_QTD { @@ -67,5 +70,21 @@ public: ~HexoticPluginGUI_SizeMapsWidget(); }; +class HEXOTICPLUGIN_GUI_EXPORT HexoticPluginGUI_ViscousLayersWidget : public QWidget, + public Ui::HexoticPluginGUI_ViscousLayersWidget_QTD +{ + Q_OBJECT + +public: + HexoticPluginGUI_ViscousLayersWidget( QWidget* = 0, Qt::WindowFlags = 0 ); + ~HexoticPluginGUI_ViscousLayersWidget(); + +public slots: + void onSelectionChanged(); + +public: + StdMeshersGUI_SubShapeSelectorWdg* myFacesWithLayers; + StdMeshersGUI_SubShapeSelectorWdg* myImprintedFaces; +}; #endif diff --git a/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx b/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx index 3c212e2..99e1e32 100644 --- a/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx @@ -58,7 +58,8 @@ // Main widget tabs identification enum { STD_TAB = 0, - SMP_TAB + SMP_TAB, + VL_TAB }; // Size maps tab, table columns order @@ -245,19 +246,48 @@ QFrame* HexoticPluginGUI_HypothesisCreator::buildFrame() aSmpLayout->setMargin( 0 ); aSmpLayout->addWidget( mySmpWidget); - + // Viscous Layers tab + QWidget* aVLGroup = new QWidget(); + lay->addWidget( aVLGroup ); + + // Viscous layers widget creation and initialisation + myVLWidget = new HexoticPluginGUI_ViscousLayersWidget(aVLGroup); + + QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); + QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); + + if ( !aMainEntry.isEmpty() ) + { + myVLWidget->myFacesWithLayers->SetGeomShapeEntry( aSubEntry, aMainEntry ); + myVLWidget->myImprintedFaces->SetGeomShapeEntry( aSubEntry, aMainEntry ); + } + else + { + myVLWidget->labelFacesWithLayers->setVisible(false); + myVLWidget->myFacesWithLayers->setVisible(false); + myVLWidget->labelImprintedFaces->setVisible(false); + myVLWidget->myImprintedFaces->setVisible(false); + } + + // Add the viscous layers widget to a layout + QHBoxLayout* aVLLayout = new QHBoxLayout( aVLGroup ); + aVLLayout->setSpacing( 6 ); + aVLLayout->setMargin( 11 ); + aVLLayout->addWidget( myVLWidget ); + // resizeEvent(); aTabWidget->insertTab( STD_TAB, aStdGroup, tr( "SMESH_ARGUMENTS" ) ); aTabWidget->insertTab( SMP_TAB, aSmpGroup, tr( "LOCAL_SIZE" ) ); + aTabWidget->insertTab( VL_TAB, aVLGroup, tr( "Hexotic_VISCOUS_LAYERS") ); myIs3D = true; // Size Maps mySizeMapsToRemove.clear(); - connect( mySmpWidget->pushButton_1, SIGNAL( clicked() ), this, SLOT( onAddLocalSize() ) ); - connect( mySmpWidget->pushButton_2, SIGNAL( clicked() ), this, SLOT( onRemoveLocalSize() ) ); - + connect( mySmpWidget->pushButton_1, SIGNAL( clicked() ), this, SLOT( onAddLocalSize() ) ); + connect( mySmpWidget->pushButton_2, SIGNAL( clicked() ), this, SLOT( onRemoveLocalSize() ) ); + connect( aTabWidget, SIGNAL( currentChanged(int)), this, SLOT( onTabChanged( int ) ) ); return fr; } @@ -434,6 +464,39 @@ void HexoticPluginGUI_HypothesisCreator::retrieveParams() const insertLocalSizeInWidget( entry, shapeName, size , row ); } + myVLWidget->myNbLayers->setCleared(data.myNbLayers == 0); + if (data.myNbLayers == 0) + myVLWidget->myNbLayers->setText(""); + else + myVLWidget->myNbLayers->setValue( data.myNbLayers ); + + myVLWidget->myFirstLayerSize->setCleared(data.myFirstLayerSize == 0); + if (data.myFirstLayerSize == 0) + myVLWidget->myFirstLayerSize->setText(""); + else + myVLWidget->myFirstLayerSize->setValue( data.myFirstLayerSize ); + + myVLWidget->myDirection->setCurrentIndex( data.myDirection ? 0 : 1 ); + myVLWidget->myGrowth->setCleared(data.myGrowth == 0); + if (data.myGrowth == 0) + myVLWidget->myGrowth->setText(""); + else + myVLWidget->myGrowth->setValue( data.myGrowth ); + + std::vector vector = data.myFacesWithLayers; + SMESH::long_array_var aVec = new SMESH::long_array; + aVec->length(vector.size()); + for (int i = 0; i < vector.size(); i++) + aVec[i]=vector.at(i); + myVLWidget->myFacesWithLayers->SetListOfIDs(aVec); + vector = data.myImprintedFaces; + aVec = new SMESH::long_array; + aVec->length(vector.size()); + for (int i = 0; i < vector.size(); i++) + aVec[i]=vector.at(i); + myVLWidget->myImprintedFaces->SetListOfIDs(aVec); + + std::cout << "myStdWidget->myMinSize->value(): " << myStdWidget->myMinSize->value() << std::endl; std::cout << "myStdWidget->myMaxSize->value(): " << myStdWidget->myMaxSize->value() << std::endl; std::cout << "myStdWidget->myHexesMinLevel->value(): " << myStdWidget->myHexesMinLevel->value() << std::endl; @@ -481,6 +544,11 @@ QString HexoticPluginGUI_HypothesisCreator::storeParams() const valStr += tr("Hexotic_MAX_MEMORY") + " = " + QString::number( data.myHexoticMaxMemory ) + "; "; valStr += tr("Hexotic_SD_MODE") + " = " + QString::number( data.myHexoticSdMode) + "; "; + valStr += tr("Hexotic_NB_LAYERS") + " = " + QString::number(data.myNbLayers) + ";"; + valStr += tr("Hexotic_FIRST_LAYER_SIZE") + " = " + QString::number(data.myFirstLayerSize) + ";"; + valStr += tr("Hexotic_DIRECTION") + " = " + QString::number(data.myDirection) + ";"; + valStr += tr("Hexotic_GROWTH") + " = " + QString::number(data.myGrowth) + ";"; + // std::cout << "Data: " << valStr.toStdString() << std::endl; return valStr; @@ -517,6 +585,18 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromHypo( HexoticHypothesisDa MESSAGE("READING Size map : entry "<GetNbLayers(); + h_data.myFirstLayerSize = h->GetFirstLayerSize(); + h_data.myDirection = h->GetDirection(); + h_data.myGrowth = h->GetGrowth(); + SMESH::long_array_var vector = h->GetFacesWithLayers(); + for (int i = 0; i < vector->length(); i++) + h_data.myFacesWithLayers.push_back(vector[i]); + vector = h->GetImprintedFaces(); + for (int i = 0; i < vector->length(); i++) + h_data.myImprintedFaces.push_back(vector[i]); + return true; } @@ -557,6 +637,26 @@ bool HexoticPluginGUI_HypothesisCreator::storeParamsToHypo( const HexoticHypothe { h->UnsetSizeMapEntry(entry_it->c_str()); } + + // Viscous layers + h->SetNbLayers( h_data.myNbLayers ); + h->SetFirstLayerSize( h_data.myFirstLayerSize ); + h->SetDirection( h_data.myDirection ); + h->SetGrowth( h_data.myGrowth ); + + std::vector vector = h_data.myFacesWithLayers; + SMESH::long_array_var aVec = new SMESH::long_array; + aVec->length(vector.size()); + for (int i = 0; i < vector.size(); i++) + aVec[i]=vector.at(i); + h->SetFacesWithLayers( aVec ); + + vector = h_data.myImprintedFaces; + aVec = new SMESH::long_array; + aVec->length(vector.size()); + for (int i = 0; i < vector.size(); i++) + aVec[i]=vector.at(i); + h->SetImprintedFaces( aVec ); } catch(const SALOME::SALOME_Exception& ex) { @@ -591,6 +691,17 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromWidgets( HexoticHypothesi if ( !ok ) return false; + h_data.myNbLayers = myVLWidget->myNbLayers->text().isEmpty() ? 0.0 : myVLWidget->myNbLayers->value(); + h_data.myFirstLayerSize = myVLWidget->myFirstLayerSize->text().isEmpty() ? 0.0 : myVLWidget->myFirstLayerSize->value(); + h_data.myDirection = myVLWidget->myDirection->currentIndex() == 0 ? true : false; + h_data.myGrowth = myVLWidget->myGrowth->text().isEmpty() ? 0.0 : myVLWidget->myGrowth->value(); + SMESH::long_array_var ids = myVLWidget->myFacesWithLayers->GetListOfIDs(); + for (int i = 0; i < ids->length(); i++) + h_data.myFacesWithLayers.push_back( ids[i] ); + ids = myVLWidget->myImprintedFaces->GetListOfIDs(); + for (int i = 0; i < ids->length(); i++) + h_data.myImprintedFaces.push_back( ids[i] ); + printData(h_data); return true; @@ -651,3 +762,9 @@ QString HexoticPluginGUI_HypothesisCreator::helpPage() const { return "hexotic_hypo_page.html"; } + +void HexoticPluginGUI_HypothesisCreator::onTabChanged(int i) +{ + myVLWidget->myFacesWithLayers->ShowPreview( i == VL_TAB ); + myVLWidget->myImprintedFaces->ShowPreview( false ); +} diff --git a/src/GUI/HexoticPluginGUI_HypothesisCreator.h b/src/GUI/HexoticPluginGUI_HypothesisCreator.h index 6e7cfd1..01b3810 100644 --- a/src/GUI/HexoticPluginGUI_HypothesisCreator.h +++ b/src/GUI/HexoticPluginGUI_HypothesisCreator.h @@ -40,6 +40,7 @@ class QTableWidgetItem; class HexoticPluginGUI_StdWidget; class HexoticPluginGUI_SizeMapsWidget; +class HexoticPluginGUI_ViscousLayersWidget; typedef struct { @@ -55,6 +56,12 @@ typedef struct int myHexoticMaxMemory; int myHexoticSdMode; HexoticPlugin_Hypothesis::THexoticSizeMaps mySizeMaps; + int myNbLayers; + double myFirstLayerSize; + bool myDirection; + double myGrowth; + std::vector myFacesWithLayers; + std::vector myImprintedFaces; } HexoticHypothesisData; /*! @@ -97,6 +104,7 @@ private: QLineEdit* myName; HexoticPluginGUI_StdWidget* myStdWidget; HexoticPluginGUI_SizeMapsWidget* mySmpWidget; + HexoticPluginGUI_ViscousLayersWidget* myVLWidget; StdMeshersGUI_ObjectReferenceParamWdg* myGeomSelWdg; bool myIs3D; @@ -106,6 +114,7 @@ private: protected slots: void onAddLocalSize(); void onRemoveLocalSize(); + void onTabChanged(int); }; diff --git a/src/GUI/HexoticPluginGUI_ViscousLayersWidget.cxx b/src/GUI/HexoticPluginGUI_ViscousLayersWidget.cxx new file mode 100644 index 0000000..2edaf43 --- /dev/null +++ b/src/GUI/HexoticPluginGUI_ViscousLayersWidget.cxx @@ -0,0 +1,84 @@ +// Copyright (C) 2015 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 +// + +// --- +// File : HexoticPluginGUI_ViscousLayersWidget.cxx +// + +#include "HexoticPluginGUI_Dlg.h" + +#include +#include + +#include + +////////////////////////////////////////// +// HexoticPluginGUI_ViscousLayersWidget +////////////////////////////////////////// + +HexoticPluginGUI_ViscousLayersWidget::HexoticPluginGUI_ViscousLayersWidget( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); + + // Obtain precision from preferences + int precision = SUIT_Session::session()->resourceMgr()->integerValue( "SMESH", "length_precision", -3 ); + + myNbLayers->setMinimum(0); + myNbLayers->setSingleStep( 1 ); + + myFirstLayerSize->setMinimum(0); + myFirstLayerSize->setPrecision(precision); + myFirstLayerSize->setSingleStep(0.1); + + myGrowth->setMinimum(0); + myFirstLayerSize->setPrecision(precision); + myGrowth->setSingleStep( 0.1 ); + + myFacesWithLayers = new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_FACE); + QHBoxLayout* layoutFacesWithLayers = new QHBoxLayout(myContainerFacesWithLayers); + layoutFacesWithLayers->setMargin(0); + layoutFacesWithLayers->addWidget(myFacesWithLayers); + + myImprintedFaces = new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_FACE); + QHBoxLayout* layoutImprintedFaces = new QHBoxLayout(myContainerImprintedFaces); + layoutImprintedFaces->setMargin(0); + layoutImprintedFaces->addWidget(myImprintedFaces); + + connect( myFacesWithLayers, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); + connect( myImprintedFaces, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); +} + +HexoticPluginGUI_ViscousLayersWidget::~HexoticPluginGUI_ViscousLayersWidget() +{ +} + +void HexoticPluginGUI_ViscousLayersWidget::onSelectionChanged() +{ + StdMeshersGUI_SubShapeSelectorWdg* send = (StdMeshersGUI_SubShapeSelectorWdg*)sender(); + + bool isDefault = (send == myFacesWithLayers); + myFacesWithLayers->ShowPreview(isDefault); + myImprintedFaces->ShowPreview(!isDefault); + if (isDefault) + myImprintedFaces->ClearSelected(); + else + myFacesWithLayers->ClearSelected(); + +} diff --git a/src/GUI/HexoticPluginGUI_ViscousLayersWidget_QTD.ui b/src/GUI/HexoticPluginGUI_ViscousLayersWidget_QTD.ui new file mode 100644 index 0000000..e66ed8a --- /dev/null +++ b/src/GUI/HexoticPluginGUI_ViscousLayersWidget_QTD.ui @@ -0,0 +1,137 @@ + + + HexoticPluginGUI_ViscousLayersWidget_QTD + + + + 0 + 0 + 403 + 496 + + + + + 6 + + + + + Hexotic_FIRST_LAYER_SIZE + + + + + + + + + + Hexotic_DIRECTION + + + + + + + Hexotic_FACES_WITH_LAYERS + + + + + + + Hexotic_GROWTH + + + + + + + + + + + Inward + + + + + Outward + + + + + + + + + + + Hexotic_IMPRINTED_FACES + + + + + + + Hexotic_NB_LAYERS + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 300 + + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + + + + + SalomeApp_DoubleSpinBox + QLineEdit +
SalomeApp_DoubleSpinBox.h
+
+ + SalomeApp_IntSpinBox + QLineEdit +
SalomeApp_IntSpinBox.h
+
+
+ + myFirstLayerSize + + + +
diff --git a/src/HexoticPlugin/HexoticPLUGINBuilder.py b/src/HexoticPlugin/HexoticPLUGINBuilder.py index 4a306ea..d8e034a 100644 --- a/src/HexoticPlugin/HexoticPLUGINBuilder.py +++ b/src/HexoticPlugin/HexoticPLUGINBuilder.py @@ -115,6 +115,33 @@ class Hexotic_Algorithm(Mesh_Algorithm): def MinMaxQuad(self, min=3, max=8, quad=True): print "WARNING: Function MinMaxQuad is deprecated, use SetMinMaxHexes instead" return self.SetMinMaxHexes(min, max) + + ## Defines "ViscousLayers" hypothesis to give MG-Hexa parameters + # @param numberOfLayers number of boundary layers + # @param firstLayerSize height of the first layer + # @param growth geometric progression for the boundary layer growth + # @param direction describes whether the layers grow inwards or outwards. + # if direction is: + # \c Inward : means the layers grow inwards, + # \c Outward : means the layers grow outwards + # @param facesWithLayers list of surface references from which the boundary + # layers should be grown + # @param imprintedFaces list of surface references that can be imprinted by + # boundary layers + # @return hypothesis object + def SetViscousLayers(self, numberOfLayers, firstLayerSize, growth, + direction="Inward", facesWithLayers=[], imprintedFaces=[]): + self.Parameters().SetNbLayers(numberOfLayers) + self.Parameters().SetFirstLayerSize(firstLayerSize) + self.Parameters().SetGrowth(growth) + if direction == "Inward": + self.Parameters().SetDirection(True) + elif direction == "Outward": + self.Parameters().SetDirection(False) + self.Parameters().SetFacesWithLayers(facesWithLayers) + self.Parameters().SetImprintedFaces(imprintedFaces) + + return self.Parameters() ## Defines hypothesis having several parameters # @return hypothesis object diff --git a/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx b/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx index 77ea848..a2047d1 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx @@ -856,6 +856,12 @@ void HexoticPlugin_Hexotic::SetParameters(const HexoticPlugin_Hypothesis* hyp) { _hexoticMaxMemory = hyp->GetHexoticMaxMemory(); _hexoticSdMode = hyp->GetHexoticSdMode(); _sizeMaps = hyp->GetSizeMaps(); + _nbLayers = hyp->GetNbLayers(); + _firstLayerSize = hyp->GetFirstLayerSize(); + _direction = hyp->GetDirection(); + _growth = hyp->GetGrowth(); + _facesWithLayers = hyp->GetFacesWithLayers(); + _imprintedFaces = hyp->GetImprintedFaces(); } else { cout << std::endl; @@ -874,6 +880,12 @@ void HexoticPlugin_Hexotic::SetParameters(const HexoticPlugin_Hypothesis* hyp) { _hexoticMaxMemory = hyp->GetDefaultHexoticMaxMemory(); _hexoticSdMode = hyp->GetDefaultHexoticSdMode(); _sizeMaps = hyp->GetDefaultHexoticSizeMaps(); + _nbLayers = hyp->GetDefaultNbLayers(); + _firstLayerSize = hyp->GetDefaultFirstLayerSize(); + _direction = hyp->GetDefaultDirection(); + _growth = hyp->GetDefaultGrowth(); + _facesWithLayers = hyp->GetDefaultFacesWithLayers(); + _imprintedFaces = hyp->GetDefaultImprintedFaces(); } } @@ -964,6 +976,30 @@ std::string HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiStri cout << " " << _name << " Number of threads = " << _hexoticNbProc << std::endl; cout << " " << _name << " Working directory = \"" << _hexoticWorkingDirectory << "\"" << std::endl; cout << " " << _name << " Sub. Dom mode = " << _hexoticSdMode << std::endl; + cout << " " << _name << " Number of layers = " << _nbLayers << std::endl; + cout << " " << _name << " Size of the first layer = " << _firstLayerSize << std::endl; + cout << " " << _name << " Direction of the layers = " << ( _direction ? "Inward" : "Outward" ) << std::endl; + cout << " " << _name << " Growth = " << _growth << std::endl; + if (!_facesWithLayers.empty()) { + cout << " " << _name << " Faces with layers = "; + for (int i = 0; i < _facesWithLayers.size(); i++) + { + cout << _facesWithLayers.at(i); + if ((i + 1) != _facesWithLayers.size()) + cout << ", "; + } + cout << std::endl; + } + if (!_imprintedFaces.empty()) { + cout << " " << _name << " Imprinted faces = "; + for (int i = 0; i < _imprintedFaces.size(); i++) + { + cout << _imprintedFaces.at(i); + if ((i + 1) != _imprintedFaces.size()) + cout << ", "; + } + cout << std::endl; + } TCollection_AsciiString run_Hexotic( "mg-hexa.exe" ); @@ -979,7 +1015,15 @@ std::string HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiStri TCollection_AsciiString verb = " --verbose "; TCollection_AsciiString maxmem = " --max_memory "; - TCollection_AsciiString minLevel, maxLevel, minSize, maxSize, sharpAngle, mode, nbproc, verbosity, maxMemory; + TCollection_AsciiString comNbLayers = " --number_of_boundary_layers "; + TCollection_AsciiString comFirstLayerSize = " --height_of_the_first_layer "; + TCollection_AsciiString comDirection = " --boundary_layers_subdomain_direction "; + TCollection_AsciiString comGrowth = " --boundary_layers_geometric_progression "; + TCollection_AsciiString comFacesWithLayers = " --boundary_layers_surface_ids "; + TCollection_AsciiString comImptintedFaces = " --imprinted_surface_ids "; + + TCollection_AsciiString minLevel, maxLevel, minSize, maxSize, sharpAngle, mode, nbproc, verbosity, maxMemory, + nbLayers, firstLayerSize, direction, growth, facesWithLayers, imprintedFaces; minLevel = _hexesMinLevel; maxLevel = _hexesMaxLevel; minSize = _hexesMinSize; @@ -1004,6 +1048,22 @@ std::string HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiStri nbproc = _hexoticNbProc; verbosity = _hexoticVerbosity; maxMemory = _hexoticMaxMemory; + nbLayers = _nbLayers; + firstLayerSize = _firstLayerSize; + direction = _direction ? "1" : "-1"; + growth = _growth; + for (int i = 0; i < _facesWithLayers.size(); i++) + { + facesWithLayers += _facesWithLayers[i]; + if ((i + 1) != _facesWithLayers.size()) + facesWithLayers += ","; + } + for (int i = 0; i < _imprintedFaces.size(); i++) + { + imprintedFaces += _imprintedFaces[i]; + if ((i + 1) != _imprintedFaces.size()) + imprintedFaces += ","; + } if (_hexoticIgnoreRidges) run_Hexotic += ignoreRidges; @@ -1029,6 +1089,23 @@ std::string HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiStri if (_sizeMaps.begin() != _sizeMaps.end()) run_Hexotic += sizeMap + Hexotic_SizeMap_Prefix; + if (_nbLayers > 0) + run_Hexotic += comNbLayers + nbLayers; + + if (_firstLayerSize > 0) + run_Hexotic += comFirstLayerSize + firstLayerSize; + + run_Hexotic += comDirection + direction; + + if (_growth > 0) + run_Hexotic += comGrowth + growth; + + if (!_facesWithLayers.empty()) + run_Hexotic += comFacesWithLayers + facesWithLayers; + + if (!_imprintedFaces.empty()) + run_Hexotic += comImptintedFaces + imprintedFaces; + run_Hexotic += in + Hexotic_In + out + Hexotic_Out; run_Hexotic += subdom + mode; #ifndef WIN32 diff --git a/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx b/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx index da6adc0..da6a840 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx +++ b/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx @@ -136,6 +136,12 @@ private: int _hexoticMaxMemory; int _hexoticSdMode; HexoticPlugin_Hypothesis::THexoticSizeMaps _sizeMaps; + int _nbLayers; + double _firstLayerSize; + bool _direction; + double _growth; + std::vector _facesWithLayers; + std::vector _imprintedFaces; SMDS_MeshNode** _tabNode; #ifdef WITH_BLSURFPLUGIN diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx index 02e084d..b2432b4 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx @@ -47,7 +47,13 @@ HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis (int hypId, int studyId, _hexoticSdMode(GetDefaultHexoticSdMode()), _hexoticVerbosity(GetDefaultHexoticVerbosity()), _hexoticMaxMemory(GetDefaultHexoticMaxMemory()), - _sizeMaps(GetDefaultHexoticSizeMaps()) + _sizeMaps(GetDefaultHexoticSizeMaps()), + _nbLayers(GetDefaultNbLayers()), + _firstLayerSize(GetDefaultFirstLayerSize()), + _direction(GetDefaultDirection()), + _growth(GetDefaultGrowth()), + _facesWithLayers(GetDefaultFacesWithLayers()), + _imprintedFaces(GetDefaultImprintedFaces()) { MESSAGE("HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis"); _name = GetHypType(); @@ -195,6 +201,52 @@ bool HexoticPlugin_Hypothesis::UnsetSizeMap(std::string theEntry) { return false; } +void HexoticPlugin_Hypothesis::SetNbLayers(int theVal) { + if (theVal != _nbLayers) { + _nbLayers = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +void HexoticPlugin_Hypothesis::SetFirstLayerSize(double theVal) { + if (theVal != _firstLayerSize) { + _firstLayerSize = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +void HexoticPlugin_Hypothesis::SetDirection(bool theVal) { + if (theVal != _direction) { + _direction = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +void HexoticPlugin_Hypothesis::SetGrowth(double theVal) { + if (theVal != _growth) { + _growth = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +bool HexoticPlugin_Hypothesis::SetFacesWithLayers(const std::vector& theVal) { + if ( _facesWithLayers != theVal ) { + _facesWithLayers = theVal; + NotifySubMeshesHypothesisModification(); + return true; + } + return false; +} + +bool HexoticPlugin_Hypothesis::SetImprintedFaces(const std::vector& theVal) { + if ( _imprintedFaces != theVal ) { + _imprintedFaces = theVal; + NotifySubMeshesHypothesisModification(); + return true; + } + return false; +} + //============================================================================= /*! * @@ -227,6 +279,28 @@ std::ostream& HexoticPlugin_Hypothesis::SaveTo(std::ostream& save) } save<<";"; } + save<<"nbLayers="<<_nbLayers<<";"; + save<<"firstLayerSize="<<_firstLayerSize<<";"; + save<<"direction="<<_direction<<";"; + save<<"growth="<<_growth<<";"; + if ( !_facesWithLayers.empty() ) + { + save<<"facesWithLayers="; + for ( int i = 0; i < _facesWithLayers.size(); i++ ) + { + save<< _facesWithLayers.at(i) << "#" ; + } + save<<";"; + } + if ( !_imprintedFaces.empty() ) + { + save<<"imprintedFaces="; + for ( int i = 0; i < _imprintedFaces.size(); i++ ) + { + save<< _imprintedFaces.at(i) << "#" ; + } + save<<";"; + } return save; } @@ -287,6 +361,34 @@ std::istream& HexoticPlugin_Hypothesis::LoadFrom(std::istream& load) sm_pos = sm_found + 1; } } + if (str3 == "nbLayers") _nbLayers = atoi(str4.c_str()); + if (str3 == "firstLayerSize") _firstLayerSize = atof(str4.c_str()); + if (str3 == "direction") _direction = atoi(str4.c_str()); + if (str3 == "growth") _growth = atof(str4.c_str()); + if (str3 == "facesWithLayers") + { + std::string id; + int pos = 0; + while ( pos < str4.length() ) + { + int found = str4.find('#',pos); + id = str4.substr(pos, found-pos); + _facesWithLayers.push_back(atoi(id.c_str())); + pos = found + 1; + } + } + if (str3 == "imprintedFaces") + { + std::string id; + int pos = 0; + while ( pos < str4.length() ) + { + int found = str4.find('#',pos); + id = str4.substr(pos, found-pos); + _imprintedFaces.push_back(atoi(id.c_str())); + pos = found + 1; + } + } } return load; } @@ -429,4 +531,32 @@ HexoticPlugin_Hypothesis::THexoticSizeMaps HexoticPlugin_Hypothesis::GetDefaultH return THexoticSizeMaps(); } +int HexoticPlugin_Hypothesis::GetDefaultNbLayers() +{ + return 0; +} + +double HexoticPlugin_Hypothesis::GetDefaultFirstLayerSize() +{ + return 0.0; +} + +bool HexoticPlugin_Hypothesis::GetDefaultDirection() +{ + return true; +} + +double HexoticPlugin_Hypothesis::GetDefaultGrowth() +{ + return 0.0; +} + +std::vector HexoticPlugin_Hypothesis::GetDefaultFacesWithLayers() +{ + return std::vector(); +} +std::vector HexoticPlugin_Hypothesis::GetDefaultImprintedFaces() +{ + return std::vector(); +} diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis.hxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis.hxx index 6f66b74..788b8d7 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis.hxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis.hxx @@ -31,6 +31,7 @@ #include "Utils_SALOME_Exception.hxx" #include +#include // class HexoticSizeMap // { @@ -100,6 +101,24 @@ public: bool AddSizeMap(std::string theEntry, double theSize); bool UnsetSizeMap(std::string theEntry); + void SetNbLayers(int theVal); + int GetNbLayers() const { return _nbLayers; } + + void SetFirstLayerSize(double theVal); + double GetFirstLayerSize() const { return _firstLayerSize; } + + void SetDirection(bool theVal); + bool GetDirection() const { return _direction; } + + void SetGrowth(double theVal); + double GetGrowth() const { return _growth; } + + bool SetFacesWithLayers(const std::vector& theVal); + std::vector GetFacesWithLayers() const { return _facesWithLayers; } + + bool SetImprintedFaces(const std::vector& theVal); + std::vector GetImprintedFaces() const { return _imprintedFaces; } + // the parameters default values static int GetDefaultHexesMinLevel(); static int GetDefaultHexesMaxLevel(); @@ -114,6 +133,12 @@ public: static int GetDefaultHexoticVerbosity(); static int GetDefaultHexoticMaxMemory(); static THexoticSizeMaps GetDefaultHexoticSizeMaps(); + static int GetDefaultNbLayers(); + static double GetDefaultFirstLayerSize(); + static bool GetDefaultDirection(); + static double GetDefaultGrowth(); + static std::vector GetDefaultFacesWithLayers(); + static std::vector GetDefaultImprintedFaces(); // Persistence virtual std::ostream& SaveTo(std::ostream& save); @@ -149,6 +174,12 @@ private: int _hexoticMaxMemory; THexoticSizeMaps _sizeMaps; std::string _hexoticWorkingDirectory ; + int _nbLayers; + double _firstLayerSize; + bool _direction; + double _growth; + std::vector _facesWithLayers; + std::vector _imprintedFaces; }; #endif diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx index 3c261b2..ac0285f 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx @@ -76,6 +76,12 @@ HexoticPlugin_Hypothesis_i::~HexoticPlugin_Hypothesis_i() * HexoticPlugin_Hypothesis_i::SetHexoticSdMode * HexoticPlugin_Hypothesis_i::SetVerbosity * HexoticPlugin_Hypothesis_i::SetHexoticMaxMemory + * HexoticPlugin_Hypothesis_i::SetNbLayers + * HexoticPlugin_Hypothesis_i::SetFirstLayerSize + * HexoticPlugin_Hypothesis_i::SetDirection + * HexoticPlugin_Hypothesis_i::SetGrowth + * HexoticPlugin_Hypothesis_i::SetFacesWithLayers + * HexoticPlugin_Hypothesis_i::SetImprintedFaces */ //============================================================================= @@ -266,6 +272,70 @@ void HexoticPlugin_Hypothesis_i::UnsetSizeMap (const GEOM::GEOM_Object_ptr theGe UnsetSizeMapEntry( entry.c_str()); } +void HexoticPlugin_Hypothesis_i::SetNbLayers(CORBA::Long theVal) +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::SetNbLayers"); + ASSERT(myBaseImpl); + CORBA::Long oldValue = GetNbLayers(); + this->GetImpl()->SetNbLayers(theVal); + if (theVal != oldValue) + SMESH::TPythonDump() << _this() << ".SetNbLayers( " << theVal << " )"; +} + +void HexoticPlugin_Hypothesis_i::SetFirstLayerSize(CORBA::Double theVal) +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::SetFirstLayerSize"); + ASSERT(myBaseImpl); + CORBA::Double oldValue = GetFirstLayerSize(); + this->GetImpl()->SetFirstLayerSize(theVal); + if (theVal != oldValue) + SMESH::TPythonDump() << _this() << ".SetFirstLayerSize( " << theVal << " )"; +} + +void HexoticPlugin_Hypothesis_i::SetDirection(CORBA::Boolean theVal) +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::SetDirection"); + ASSERT(myBaseImpl); + CORBA::Boolean oldValue = GetDirection(); + this->GetImpl()->SetDirection(theVal); + if (theVal != oldValue) + SMESH::TPythonDump() << _this() << ".SetDirection( " << theVal << " )"; +} + +void HexoticPlugin_Hypothesis_i::SetGrowth(CORBA::Double theVal) +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::SetGrowth"); + ASSERT(myBaseImpl); + CORBA::Double oldValue = GetGrowth(); + this->GetImpl()->SetGrowth(theVal); + if (theVal != oldValue) + SMESH::TPythonDump() << _this() << ".SetGrowth( " << theVal << " )"; +} + +void HexoticPlugin_Hypothesis_i::SetFacesWithLayers(const ::SMESH::long_array& theVal) +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::SetFacesWithLayers"); + vector ids( theVal.length() ); + for ( unsigned i = 0; i < ids.size(); ++i ) + ids[i] = theVal[i]; + + bool valueChanged = this->GetImpl()->SetFacesWithLayers(ids); + if (valueChanged) + SMESH::TPythonDump() << _this() << ".SetFacesWithLayers( "<< theVal << " )"; +} + +void HexoticPlugin_Hypothesis_i::SetImprintedFaces(const ::SMESH::long_array& theVal) +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::SetImprintedFaces"); + vector ids( theVal.length() ); + for ( unsigned i = 0; i < ids.size(); ++i ) + ids[i] = theVal[i]; + + bool valueChanged = this->GetImpl()->SetImprintedFaces(ids); + if (valueChanged) + SMESH::TPythonDump() << _this() << ".SetImprintedFaces( "<< theVal << " )"; +} + //============================================================================= /*! * HexoticPlugin_Hypothesis_i::GetHexesMinLevel @@ -280,6 +350,12 @@ void HexoticPlugin_Hypothesis_i::UnsetSizeMap (const GEOM::GEOM_Object_ptr theGe * HexoticPlugin_Hypothesis_i::GetHexoticSdMode * HexoticPlugin_Hypothesis_i::GetVerbosity * HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory + * HexoticPlugin_Hypothesis_i::GetNbLayers + * HexoticPlugin_Hypothesis_i::GetFirstLayerSize + * HexoticPlugin_Hypothesis_i::GetDirection + * HexoticPlugin_Hypothesis_i::GetGrowth + * HexoticPlugin_Hypothesis_i::GetFacesWithLayers + * HexoticPlugin_Hypothesis_i::GetImprintedFaces */ //============================================================================= @@ -366,6 +442,59 @@ CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory() return this->GetImpl()->GetHexoticMaxMemory(); } +CORBA::Long HexoticPlugin_Hypothesis_i::GetNbLayers() +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetNbLayers"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetNbLayers(); +} + +CORBA::Double HexoticPlugin_Hypothesis_i::GetFirstLayerSize() +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetFirstLayerSize"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetFirstLayerSize(); +} + +CORBA::Boolean HexoticPlugin_Hypothesis_i::GetDirection() +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetDirection"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetDirection(); +} + +CORBA::Double HexoticPlugin_Hypothesis_i::GetGrowth() +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetGrowth"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetGrowth(); +} + +SMESH::long_array* HexoticPlugin_Hypothesis_i::GetFacesWithLayers() +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetFacesWithLayers"); + ASSERT(myBaseImpl); + std::vector idsVec = this->GetImpl()->GetFacesWithLayers(); + SMESH::long_array_var ids = new SMESH::long_array; + ids->length( idsVec.size() ); + std::vector::const_iterator anIt; + for ( unsigned i = 0; i < idsVec.size(); ++i ) + ids[i] = idsVec[i]; + return ids._retn(); +} + +SMESH::long_array* HexoticPlugin_Hypothesis_i::GetImprintedFaces() +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetImprintedFaces"); + ASSERT(myBaseImpl); + std::vector idsVec = this->GetImpl()->GetImprintedFaces(); + SMESH::long_array_var ids = new SMESH::long_array; + ids->length( idsVec.size() ); + std::vector::const_iterator anIt; + for ( unsigned i = 0; i < idsVec.size(); ++i ) + ids[i] = idsVec[i]; + return ids._retn(); +} //============================================================================= /*! * HexoticPlugin_Hypothesis_i::GetImpl diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx index 692a02d..154d777 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx @@ -91,6 +91,24 @@ class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hypothesis_i: void UnsetSizeMap(GEOM::GEOM_Object_ptr theGeomObj); HexoticPlugin::HexoticPluginSizeMapsList* GetSizeMaps (); + void SetNbLayers(CORBA::Long theVal); + CORBA::Long GetNbLayers(); + + void SetFirstLayerSize(CORBA::Double theVal); + CORBA::Double GetFirstLayerSize(); + + void SetDirection(CORBA::Boolean theVal); + CORBA::Boolean GetDirection(); + + void SetGrowth(CORBA::Double theVal); + CORBA::Double GetGrowth(); + + void SetFacesWithLayers(const SMESH::long_array& theVal); + SMESH::long_array* GetFacesWithLayers(); + + void SetImprintedFaces(const SMESH::long_array& theVal); + SMESH::long_array* GetImprintedFaces(); + // Get implementation ::HexoticPlugin_Hypothesis* GetImpl();