Salome HOME
23627: [IMACS] ASERIS: project point to the mesh and create a slot
authoreap <eap@opencascade.com>
Thu, 17 Jan 2019 13:03:36 +0000 (16:03 +0300)
committereap <eap@opencascade.com>
Thu, 17 Jan 2019 13:03:36 +0000 (16:03 +0300)
Expose all NETGEN parameters via the plugin

17 files changed:
idl/NETGENPlugin_Algorithm.idl
src/GUI/NETGENPluginGUI_HypothesisCreator.cxx
src/GUI/NETGENPluginGUI_HypothesisCreator.h
src/GUI/NETGENPlugin_msg_en.ts
src/NETGENPlugin/NETGENPlugin_Defs.hxx
src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx
src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx
src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.cxx
src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.hxx
src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.cxx
src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.hxx
src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx
src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx
src/NETGENPlugin/NETGENPlugin_Mesher.cxx
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx
src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx
src/NETGENPlugin/NETGENPlugin_Remesher_2D.cxx

index 37426206161e36dda6172a5800a9122da1df7eaf..4526b3625b6dba5269862d4871f05dfd61b3b231 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "SALOME_Exception.idl"
 #include "SMESH_Hypothesis.idl"
+#include "SMESH_Group.idl"
 #include "GEOM_Gen.idl"
 
 /*!
@@ -79,53 +80,74 @@ module NETGENPlugin
    */
   interface NETGENPlugin_Hypothesis : SMESH::SMESH_Hypothesis
   {
-    void SetMaxSize(in double value);
-    double GetMaxSize();
+    void    SetMaxSize(in double value);
+    double  GetMaxSize();
 
-    void SetMinSize(in double value);
-    double GetMinSize();
+    void    SetMinSize(in double value);
+    double  GetMinSize();
 
-    void SetSecondOrder(in boolean value);
+    void    SetSecondOrder(in boolean value);
     boolean GetSecondOrder();
 
-    void SetOptimize(in boolean value);
+    void    SetOptimize(in boolean value);
     boolean GetOptimize();
 
-    void SetFineness(in long value);
-    long GetFineness();
+    void    SetFineness(in long value);
+    long    GetFineness();
 
-    void SetGrowthRate(in double value);
-    double GetGrowthRate();
+    void    SetGrowthRate(in double value);
+    double  GetGrowthRate();
 
-    void SetNbSegPerEdge(in double value);
-    double GetNbSegPerEdge();
+    void    SetNbSegPerEdge(in double value);
+    double  GetNbSegPerEdge();
 
-    void SetChordalErrorEnabled(in boolean value);
+    void    SetChordalErrorEnabled(in boolean value);
     boolean GetChordalErrorEnabled();
-    void SetChordalError(in double value);
-    double GetChordalError();
+    void    SetChordalError(in double value);
+    double  GetChordalError();
 
-    void SetNbSegPerRadius(in double value);
-    double GetNbSegPerRadius();
+    void    SetNbSegPerRadius(in double value);
+    double  GetNbSegPerRadius();
 
-    void SetQuadAllowed(in boolean value);
+    void    SetQuadAllowed(in boolean value);
     boolean GetQuadAllowed();
     
-    void SetUseSurfaceCurvature(in boolean value);
+    void    SetUseSurfaceCurvature(in boolean value);
     boolean GetUseSurfaceCurvature();
     
-    void SetFuseEdges(in boolean value);
+    void    SetFuseEdges(in boolean value);
     boolean GetFuseEdges();
 
-    void SetLocalSizeOnShape(in GEOM::GEOM_Object GeomObj, in double localSize)
+    void    SetLocalSizeOnShape(in GEOM::GEOM_Object GeomObj, in double localSize)
       raises (SALOME::SALOME_Exception);
-    void SetLocalSizeOnEntry(in string entry, in double localSize);
-    double GetLocalSizeOnEntry(in string entry);
+    void    SetLocalSizeOnEntry(in string entry, in double localSize);
+    double  GetLocalSizeOnEntry(in string entry);
     string_array GetLocalSizeEntries();
-    void UnsetLocalSizeOnEntry(in string entry);
+    void    UnsetLocalSizeOnEntry(in string entry);
 
-    void SetMeshSizeFile(in string fileName);
-    string GetMeshSizeFile();
+    void    SetMeshSizeFile(in string fileName);
+    string  GetMeshSizeFile();
+
+    void    SetNbSurfOptSteps(in short nb );
+    short   GetNbSurfOptSteps();
+
+    void    SetNbVolOptSteps(in short nb );
+    short   GetNbVolOptSteps();
+
+    void    SetElemSizeWeight(in double size );
+    double  GetElemSizeWeight();
+
+    void    SetWorstElemMeasure(in short val );
+    short   GetWorstElemMeasure();
+
+    void    SetUseDelauney(in boolean toUse);
+    boolean GetUseDelauney();
+
+    void    SetCheckOverlapping(in boolean toCheck );
+    boolean GetCheckOverlapping();
+
+    void    SetCheckChartBoundary(in boolean toCheck );
+    boolean GetCheckChartBoundary();
   };
 
   /*!
@@ -157,8 +179,65 @@ module NETGENPlugin
     /*!
      * \brief Set/get ridge angle
      */
-    void SetRidgeAngle(in double angle );
-    double GetRidgeAngle();
+    void    SetRidgeAngle(in double angle );
+    double  GetRidgeAngle();
+
+    void    SetEdgeCornerAngle(in double angle );
+    double  GetEdgeCornerAngle();
+
+    void    SetChartAngle(in double angle );
+    double  GetChartAngle();
+
+    void    SetOuterChartAngle(in double angle );
+    double  GetOuterChartAngle();
+
+    void    SetRestHChartDistFactor(in double f );
+    double  GetRestHChartDistFactor();
+
+    void    SetRestHChartDistEnable(in boolean enable );
+    boolean GetRestHChartDistEnable();
+
+    void    SetRestHLineLengthFactor(in double f );
+    double  GetRestHLineLengthFactor();
+
+    void    SetRestHLineLengthEnable(in boolean enable );
+    boolean GetRestHLineLengthEnable();
+
+    void    SetRestHCloseEdgeFactor(in double f );
+    double  GetRestHCloseEdgeFactor();
+
+    void    SetRestHCloseEdgeEnable(in boolean enable );
+    boolean GetRestHCloseEdgeEnable();
+
+    void    SetRestHSurfCurvFactor(in double f );
+    double  GetRestHSurfCurvFactor();
+
+    void    SetRestHSurfCurvEnable(in boolean enable );
+    boolean GetRestHSurfCurvEnable();
+
+    void    SetRestHEdgeAngleFactor(in double f );
+    double  GetRestHEdgeAngleFactor();
+
+    void    SetRestHEdgeAngleEnable(in boolean enable );
+    boolean GetRestHEdgeAngleEnable();
+
+    void    SetRestHSurfMeshCurvFactor(in double f );
+    double  GetRestHSurfMeshCurvFactor();
+
+    void    SetRestHSurfMeshCurvEnable(in boolean enable );
+    boolean GetRestHSurfMeshCurvEnable();
+
+    void    SetKeepExistingEdges(in boolean toKeep );
+    boolean GetKeepExistingEdges();
+
+    void    SetMakeGroupsOfSurfaces(in boolean toMake );
+    boolean GetMakeGroupsOfSurfaces();
+
+    void    SetLoadMeshOnCancel(in boolean toLoad );
+    boolean GetLoadMeshOnCancel();
+
+    void SetFixedEdgeGroup( in SMESH::SMESH_GroupBase edgeGroup );
+    SMESH::SMESH_GroupBase GetFixedEdgeGroup( in SMESH::SMESH_Mesh mesh );
   };
 
   /*!
index 8f685b03834395f2a500336ec3880e44a8aa10e5..0847703617e7862e3bab40d264251444220a4f76 100644 (file)
 
 #include CORBA_SERVER_HEADER(NETGENPlugin_Algorithm)
 
+#include <LightApp_SelectionMgr.h>
+#include <SALOME_ListIO.hxx>
 #include <SUIT_FileDlg.h>
 #include <SUIT_ResourceMgr.h>
 #include <SUIT_Session.h>
-
+#include <SalomeApp_IntSpinBox.h>
 #include <SalomeApp_Tools.h>
-#include <LightApp_SelectionMgr.h>
-#include <SALOME_ListIO.hxx>
 
 #include <QComboBox>
 #include <QLabel>
 #include <QHeaderView>
 #include <QPushButton>
 
-enum Fineness
-  {
-    VeryCoarse,
-    Coarse,
-    Moderate,
-    Fine,
-    VeryFine,
-    UserDefined
-  };
+enum Fineness {
+  VeryCoarse,
+  Coarse,
+  Moderate,
+  Fine,
+  VeryFine,
+  UserDefined
+};
 
 enum {
   STD_TAB = 0,
-  LSZ_TAB
+  STL_TAB,
+  LSZ_TAB,
+  ADV_TAB
 };
 
 enum {
@@ -87,6 +88,18 @@ enum {
   LSZ_FILE_LE = 9
 };
 
+template<class SPINBOX, typename VALUETYPE>
+void setTextOrVar( SPINBOX* spin, VALUETYPE value, const QString& variable )
+{
+  if ( spin )
+  {
+    if ( variable.isEmpty() )
+      spin->setValue( value );
+    else
+      spin->setText( variable );
+  }
+}
+
 NETGENPluginGUI_HypothesisCreator::NETGENPluginGUI_HypothesisCreator( const QString& theHypType )
   : SMESHGUI_GenericHypothesisCreator( theHypType )
 {
@@ -109,17 +122,6 @@ bool NETGENPluginGUI_HypothesisCreator::checkParams(QString& msg) const
   readParamsFromHypo( data_old );
   readParamsFromWidgets( data_new );
   bool res = storeParamsToHypo( data_new );
-  //storeParamsToHypo( data_old ); -- issue 0021364: Dump of netgen parameters has duplicate lines
-  
-  res = myMaxSize->isValid(msg,true) && res;
-  res = myMinSize->isValid(msg,true) && res;
-  res = myGrowthRate->isValid(msg,true) && res; ;
-  if ( myNbSegPerEdge )
-    res = myNbSegPerEdge->isValid(msg,true) && res;
-  if ( myNbSegPerRadius )
-    res = myNbSegPerRadius->isValid(msg,true) && res;
-  if ( myRidgeAngle )
-    res = myRidgeAngle->isValid(msg,true) && res;
 
   if ( !res ) //  -- issue 0021364: Dump of netgen parameters has duplicate lines
     storeParamsToHypo( data_old );
@@ -141,135 +143,264 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
   tab->setTabShape( QTabWidget::Rounded );
   tab->setTabPosition( QTabWidget::North );
   lay->addWidget( tab );
+
+  // ==============
+  // Arguments TAB
+  // ==============
+
   QWidget* GroupC1 = new QWidget();
   tab->insertTab( STD_TAB, GroupC1, tr( "SMESH_ARGUMENTS" ) );
-  
+
   QGridLayout* aGroupLayout = new QGridLayout( GroupC1 );
-  aGroupLayout->setSpacing( 6 );
-  aGroupLayout->setMargin( 11 );
-  
-  int row = 0;
+  aGroupLayout->setMargin( 6 );
+  aGroupLayout->setSpacing( 11 );
+
+  int row0 = 0;
   myName = 0;
-  if( isCreation() )
+  if ( isCreation() )
   {
-    aGroupLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), GroupC1 ), row, 0 );
+    aGroupLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), GroupC1 ), row0, 0 );
     myName = new QLineEdit( GroupC1 );
     myName->setMinimumWidth(160);
-    aGroupLayout->addWidget( myName, row, 1 );
-    row++;
+    aGroupLayout->addWidget( myName, row0, 1 );
+    row0++;
   }
 
-  aGroupLayout->addWidget( new QLabel( tr( "NETGEN_MAX_SIZE" ), GroupC1 ), row, 0 );
-  myMaxSize = new SMESHGUI_SpinBox( GroupC1 );
-  myMaxSize->RangeStepAndValidator( 1e-07, 1e+06, 10., "length_precision" );
-  aGroupLayout->addWidget( myMaxSize, row, 1 );
-  row++;
+  // Mesh size group
+  // ----------------
+  {
+    QGroupBox* aSizeBox = new QGroupBox( tr("NETGEN_MESH_SIZE"), GroupC1 );
+    aGroupLayout->addWidget( aSizeBox, row0, 0, 1, 2 );
+    row0++;
+
+    QGridLayout* aSizeLayout = new QGridLayout( aSizeBox );
+    aSizeLayout->setSpacing( 6 );
+    aSizeLayout->setMargin( 11 );
+    int row = 0;
+
+    aSizeLayout->addWidget( new QLabel( tr( "NETGEN_MAX_SIZE" ), aSizeBox ), row, 0 );
+    myMaxSize = new SMESHGUI_SpinBox( aSizeBox );
+    myMaxSize->RangeStepAndValidator( 1e-07, 1e+06, 10., "length_precision" );
+    aSizeLayout->addWidget( myMaxSize, row, 1 );
+    row++;
+
+    aSizeLayout->addWidget( new QLabel( tr( "NETGEN_MIN_SIZE" ), aSizeBox ), row, 0 );
+    myMinSize = new SMESHGUI_SpinBox( aSizeBox );
+    myMinSize->RangeStepAndValidator( 0.0, 1e+06, 10., "length_precision" );
+    aSizeLayout->addWidget( myMinSize, row, 1 );
+    row++;
+
+    aSizeLayout->addWidget( new QLabel( tr( "NETGEN_FINENESS" ), aSizeBox ), row, 0 );
+    myFineness = new QComboBox( aSizeBox );
+    QStringList types;
+    types << tr( "NETGEN_VERYCOARSE" ) << tr( "NETGEN_COARSE" )   << tr( "NETGEN_MODERATE" ) <<
+      tr( "NETGEN_FINE" )       << tr( "NETGEN_VERYFINE" ) << tr( "NETGEN_CUSTOM" );
+    myFineness->addItems( types );
+    aSizeLayout->addWidget( myFineness, row, 1 );
+    connect( myFineness, SIGNAL( activated( int ) ), this, SLOT( onFinenessChanged() ) );
+    row++;
+
+    aSizeLayout->addWidget( new QLabel( tr( "NETGEN_GROWTH_RATE" ), aSizeBox ), row, 0 );
+    myGrowthRate = new SMESHGUI_SpinBox( aSizeBox );
+    myGrowthRate->RangeStepAndValidator( .0001, 10., .1, "parametric_precision" );
+    aSizeLayout->addWidget( myGrowthRate, row, 1 );
+    row++;
+
+    myNbSegPerEdge = 0;
+    myNbSegPerRadius = 0;
+    if ( !myIsONLY )
+    {
+      const double VALUE_MAX = 1.0e+6;
+
+      aSizeLayout->addWidget( new QLabel( tr( "NETGEN_SEG_PER_EDGE" ), aSizeBox ), row, 0 );
+      myNbSegPerEdge = new SMESHGUI_SpinBox( aSizeBox );
+      myNbSegPerEdge->RangeStepAndValidator( .2, VALUE_MAX, .1, "parametric_precision" );
+      aSizeLayout->addWidget( myNbSegPerEdge, row, 1 );
+      row++;
+
+      aSizeLayout->addWidget( new QLabel( tr( "NETGEN_SEG_PER_RADIUS" ), aSizeBox ), row, 0 );
+      myNbSegPerRadius = new SMESHGUI_SpinBox( aSizeBox );
+      myNbSegPerRadius->RangeStepAndValidator( .2, VALUE_MAX, .1, "parametric_precision" );
+      aSizeLayout->addWidget( myNbSegPerRadius, row, 1 );
+      row++;
+    }
+
+    myChordalErrorEnabled = 0;
+    myChordalError = 0;
+    if (( myIs2D && !isRemesher ) || !myIsONLY )
+    {
+      myChordalErrorEnabled = new QCheckBox( tr( "NETGEN_CHORDAL_ERROR" ), aSizeBox );
+      aSizeLayout->addWidget( myChordalErrorEnabled, row, 0 );
+      myChordalError = new SMESHGUI_SpinBox( aSizeBox );
+      myChordalError->RangeStepAndValidator( COORD_MIN, COORD_MAX, .1, "length_precision" );
+      aSizeLayout->addWidget( myChordalError, row, 1 );
+      connect( myChordalErrorEnabled, SIGNAL( stateChanged(int)), SLOT( onChordalErrorEnabled()));
+      row++;
+    }
 
-  aGroupLayout->addWidget( new QLabel( tr( "NETGEN_MIN_SIZE" ), GroupC1 ), row, 0 );
-  myMinSize = new SMESHGUI_SpinBox( GroupC1 );
-  myMinSize->RangeStepAndValidator( 0.0, 1e+06, 10., "length_precision" );
-  aGroupLayout->addWidget( myMinSize, row, 1 );
-  row++;
+    mySurfaceCurvature = 0;
+    if (( myIs2D && !isRemesher ) || !myIsONLY )
+    {
+      mySurfaceCurvature = new QCheckBox( tr( "NETGEN_SURFACE_CURVATURE" ), aSizeBox );
+      aSizeLayout->addWidget( mySurfaceCurvature, row, 0, 1, 2 );
+      connect( mySurfaceCurvature, SIGNAL( stateChanged( int ) ), this, SLOT( onSurfaceCurvatureChanged() ) );
+      row++;
+    }
+  } // end Mesh Size box
+
+  myAllowQuadrangles = 0;
+  if ( myIs2D || !myIsONLY ) // disable only for NETGEN 3D
+  {
+    myAllowQuadrangles = new QCheckBox( tr( "NETGEN_ALLOW_QUADRANGLES" ), GroupC1 );
+    aGroupLayout->addWidget( myAllowQuadrangles, row0, 0, 1, 2 );
+    row0++;
+  }
 
   mySecondOrder = 0;
   if ( !myIsONLY )
   {
     mySecondOrder = new QCheckBox( tr( "NETGEN_SECOND_ORDER" ), GroupC1 );
-    aGroupLayout->addWidget( mySecondOrder, row, 0, 1, 2 );
-    row++;
+    aGroupLayout->addWidget( mySecondOrder, row0, 0, 1, 2 );
+    row0++;
   }
 
-  aGroupLayout->addWidget( new QLabel( tr( "NETGEN_FINENESS" ), GroupC1 ), row, 0 );
-  myFineness = new QComboBox( GroupC1 );
-  QStringList types;
-  types << tr( "NETGEN_VERYCOARSE" ) << tr( "NETGEN_COARSE" )   << tr( "NETGEN_MODERATE" ) <<
-    tr( "NETGEN_FINE" )       << tr( "NETGEN_VERYFINE" ) << tr( "NETGEN_CUSTOM" );
-  myFineness->addItems( types );
-  aGroupLayout->addWidget( myFineness, row, 1 );
-  connect( myFineness, SIGNAL( activated( int ) ), this, SLOT( onFinenessChanged() ) );
-  row++;
-
-  aGroupLayout->addWidget( new QLabel( tr( "NETGEN_GROWTH_RATE" ), GroupC1 ), row, 0 );
-  myGrowthRate = new SMESHGUI_SpinBox( GroupC1 );
-  myGrowthRate->RangeStepAndValidator( .0001, 10., .1, "parametric_precision" );
-  aGroupLayout->addWidget( myGrowthRate, row, 1 );
-  row++;
-
-  myNbSegPerEdge = 0;
-  myNbSegPerRadius = 0;
-  if ( !myIsONLY )
+  myOptimize = 0;
+  // if ( !isRemesher ) ???
   {
-    const double VALUE_MAX = 1.0e+6;
-
-    aGroupLayout->addWidget( new QLabel( tr( "NETGEN_SEG_PER_EDGE" ), GroupC1 ), row, 0 );
-    myNbSegPerEdge = new SMESHGUI_SpinBox( GroupC1 );
-    myNbSegPerEdge->RangeStepAndValidator( .2, VALUE_MAX, .1, "parametric_precision" );
-    aGroupLayout->addWidget( myNbSegPerEdge, row, 1 );
-    row++;
-
-    aGroupLayout->addWidget( new QLabel( tr( "NETGEN_SEG_PER_RADIUS" ), GroupC1 ), row, 0 );
-    myNbSegPerRadius = new SMESHGUI_SpinBox( GroupC1 );
-    myNbSegPerRadius->RangeStepAndValidator( .2, VALUE_MAX, .1, "parametric_precision" );
-    aGroupLayout->addWidget( myNbSegPerRadius, row, 1 );
-    row++;
+    myOptimize = new QCheckBox( tr( "NETGEN_OPTIMIZE" ), GroupC1 );
+    aGroupLayout->addWidget( myOptimize, row0, 0, 1, 2 );
+    row0++;
   }
 
-  myChordalErrorEnabled = 0;
-  myChordalError = 0;
-  if (( myIs2D && !isRemesher ) || !myIsONLY )
+  myKeepExistingEdges = myMakeGroupsOfSurfaces = 0;
+  if ( isRemesher )
   {
-    myChordalErrorEnabled = new QCheckBox( tr( "NETGEN_CHORDAL_ERROR" ), GroupC1 );
-    aGroupLayout->addWidget( myChordalErrorEnabled, row, 0 );
-    myChordalError = new SMESHGUI_SpinBox( GroupC1 );
-    myChordalError->RangeStepAndValidator( COORD_MIN, COORD_MAX, .1, "length_precision" );
-    aGroupLayout->addWidget( myChordalError, row, 1 );
-    connect( myChordalErrorEnabled, SIGNAL( stateChanged(int)), SLOT( onChordalErrorEnabled()));
-    row++;
+    myKeepExistingEdges = new QCheckBox( tr( "NETGEN_KEEP_EXISTING_EDGES" ), GroupC1 );
+    aGroupLayout->addWidget( myKeepExistingEdges, row0, 0, 1, 2 );
+    row0++;
+
+    myMakeGroupsOfSurfaces = new QCheckBox( tr( "NETGEN_MAKE_SURFACE_GROUPS" ), GroupC1 );
+    aGroupLayout->addWidget( myMakeGroupsOfSurfaces, row0, 0, 1, 2 );
+    row0++;
   }
 
-  myRidgeAngle = 0;
-  if ( isRemesher )
+  aGroupLayout->setRowStretch( row0, 1 );
+
+  // ========
+  // STL TAB
+  // ========
+
+  QWidget* stlGroup = new QWidget();
+  QVBoxLayout* stlLay = new QVBoxLayout( stlGroup );
+  stlLay->setMargin( 5 );
+  stlLay->setSpacing( 10 );
+
+  // Charts group
   {
-    aGroupLayout->addWidget( new QLabel( tr( "NETGEN_RIDGE_ANGLE" ), GroupC1 ), row, 0 );
-    myRidgeAngle = new SMESHGUI_SpinBox( GroupC1 );
+    QGroupBox* chaGroup = new QGroupBox( tr("NETGEN_STL_CHARTS"), stlGroup );
+    stlLay->addWidget( chaGroup );
+
+    QGridLayout* chaLayout = new QGridLayout( chaGroup );
+    chaLayout->setMargin( 6 );
+    chaLayout->setSpacing( 6 );
+
+    int row = 0;
+    chaLayout->addWidget( new QLabel( tr( "NETGEN_RIDGE_ANGLE" ), chaGroup ), row, 0 );
+    myRidgeAngle = new SMESHGUI_SpinBox( chaGroup );
     myRidgeAngle->RangeStepAndValidator( 0, 90, 10, "angle_precision" );
-    aGroupLayout->addWidget( myRidgeAngle, row, 1 );
+    chaLayout->addWidget( myRidgeAngle, row, 1 );
     row++;
-  }
 
-  mySurfaceCurvature = 0;
-  if (( myIs2D && !isRemesher ) || !myIsONLY )
-  {
-    mySurfaceCurvature = new QCheckBox( tr( "NETGEN_SURFACE_CURVATURE" ), GroupC1 );
-    aGroupLayout->addWidget( mySurfaceCurvature, row, 0, 1, 2 );
-    connect( mySurfaceCurvature, SIGNAL( stateChanged( int ) ), this, SLOT( onSurfaceCurvatureChanged() ) );
+    chaLayout->addWidget( new QLabel( tr( "NETGEN_EDGE_CORNER_ANGLE" ), chaGroup ), row, 0 );
+    myEdgeCornerAngle = new SMESHGUI_SpinBox( chaGroup );
+    myEdgeCornerAngle->RangeStepAndValidator( 0., 180., 20., "angle_precision" );
+    chaLayout->addWidget( myEdgeCornerAngle, row, 1 );
     row++;
-  }
 
-  myAllowQuadrangles = 0;
-  if ( myIs2D || !myIsONLY ) // disable only for NETGEN 3D
-  {
-    myAllowQuadrangles = new QCheckBox( tr( "NETGEN_ALLOW_QUADRANGLES" ), GroupC1 );
-    aGroupLayout->addWidget( myAllowQuadrangles, row, 0, 1, 2 );
+    chaLayout->addWidget( new QLabel( tr( "NETGEN_CHART_ANGLE" ), chaGroup ), row, 0 );
+    myChartAngle = new SMESHGUI_SpinBox( chaGroup );
+    myChartAngle->RangeStepAndValidator( 0., 180., 20., "angle_precision" );
+    chaLayout->addWidget( myChartAngle, row, 1 );
     row++;
-  }
 
-  myOptimize = 0;
-  if ( !isRemesher )
-  {
-    myOptimize = new QCheckBox( tr( "NETGEN_OPTIMIZE" ), GroupC1 );
-    aGroupLayout->addWidget( myOptimize, row, 0, 1, 2 );
+    chaLayout->addWidget( new QLabel( tr( "NETGEN_OUTER_CHART_ANGLE" ), chaGroup ), row, 0 );
+    myOuterChartAngle = new SMESHGUI_SpinBox( chaGroup );
+    myOuterChartAngle->RangeStepAndValidator( 0., 180., 20., "angle_precision" );
+    chaLayout->addWidget( myOuterChartAngle, row, 1 );
     row++;
   }
-
-  myFuseEdges = 0;
-  if ( !myIsONLY )
+  // STL size group
   {
-    myFuseEdges = new QCheckBox( tr( "NETGEN_FUSE_EDGES" ), GroupC1 );
-    aGroupLayout->addWidget( myFuseEdges, row, 0, 1, 2 );
+    QGroupBox* sizeGroup = new QGroupBox( tr("NETGEN_STL_SIZE"), stlGroup );
+    stlLay->addWidget( sizeGroup );
+
+    QGridLayout* sizeLayout = new QGridLayout( sizeGroup );
+    sizeLayout->setMargin( 6 );
+    sizeLayout->setSpacing( 6 );
+
+    int row = 0;
+    myRestHChartDistEnable = new QCheckBox( tr("NETGEN_RESTH_CHART_DIST"), sizeGroup );
+    sizeLayout->addWidget( myRestHChartDistEnable, row, 0 );
+    myRestHChartDistFactor = new SMESHGUI_SpinBox( sizeGroup );
+    myRestHChartDistFactor->RangeStepAndValidator( 0.2, 5., 0.1, "length_precision" );
+    sizeLayout->addWidget( myRestHChartDistFactor, row, 1 );
+    row++;
+
+    myRestHLineLengthEnable = new QCheckBox( tr("NETGEN_RESTH_LINE_LENGTH"), sizeGroup );
+    sizeLayout->addWidget( myRestHLineLengthEnable, row, 0 );
+    myRestHLineLengthFactor = new SMESHGUI_SpinBox( sizeGroup );
+    myRestHLineLengthFactor->RangeStepAndValidator( 0.2, 5., 0.1, "length_precision" );
+    sizeLayout->addWidget( myRestHLineLengthFactor, row, 1 );
+    row++;
+
+    myRestHCloseEdgeEnable = new QCheckBox( tr("NETGEN_RESTH_CLOSE_EDGE"), sizeGroup );
+    sizeLayout->addWidget( myRestHCloseEdgeEnable, row, 0 );
+    myRestHCloseEdgeFactor = new SMESHGUI_SpinBox( sizeGroup );
+    myRestHCloseEdgeFactor->RangeStepAndValidator( 0.2, 8., 0.1, "length_precision" );
+    sizeLayout->addWidget( myRestHCloseEdgeFactor, row, 1 );
     row++;
+
+    myRestHSurfCurvEnable = new QCheckBox( tr("NETGEN_RESTH_SURF_CURV"), sizeGroup );
+    sizeLayout->addWidget( myRestHSurfCurvEnable, row, 0 );
+    myRestHSurfCurvFactor = new SMESHGUI_SpinBox( sizeGroup );
+    myRestHSurfCurvFactor->RangeStepAndValidator( 0.2, 5., 0.1, "length_precision" );
+    sizeLayout->addWidget( myRestHSurfCurvFactor, row, 1 );
+    row++;
+
+    myRestHEdgeAngleEnable = new QCheckBox( tr("NETGEN_RESTH_EDGE_ANGLE"), sizeGroup );
+    sizeLayout->addWidget( myRestHEdgeAngleEnable, row, 0 );
+    myRestHEdgeAngleFactor = new SMESHGUI_SpinBox( sizeGroup );
+    myRestHEdgeAngleFactor->RangeStepAndValidator( 0.2, 5., 0.1, "length_precision" );
+    sizeLayout->addWidget( myRestHEdgeAngleFactor, row, 1 );
+    row++;
+
+    myRestHSurfMeshCurvEnable = new QCheckBox( tr("NETGEN_RESTH_SURF_MESH_CURV"), sizeGroup );
+    sizeLayout->addWidget( myRestHSurfMeshCurvEnable, row, 0 );
+    myRestHSurfMeshCurvFactor = new SMESHGUI_SpinBox( sizeGroup );
+    myRestHSurfMeshCurvFactor->RangeStepAndValidator( 0.2, 5., 0.1, "length_precision" );
+    sizeLayout->addWidget( myRestHSurfMeshCurvFactor, row, 1 );
+    row++;
+  }
+  if ( isRemesher )
+  {
+    tab->insertTab( STL_TAB, stlGroup, tr( "NETGEN_STL" ));
+    connect( myRestHChartDistEnable   , SIGNAL( toggled(bool) ), this, SLOT( onSTLEnable() ));
+    connect( myRestHLineLengthEnable  , SIGNAL( toggled(bool) ), this, SLOT( onSTLEnable() ));
+    connect( myRestHCloseEdgeEnable   , SIGNAL( toggled(bool) ), this, SLOT( onSTLEnable() ));
+    connect( myRestHSurfCurvEnable    , SIGNAL( toggled(bool) ), this, SLOT( onSTLEnable() ));
+    connect( myRestHEdgeAngleEnable   , SIGNAL( toggled(bool) ), this, SLOT( onSTLEnable() ));
+    connect( myRestHSurfMeshCurvEnable, SIGNAL( toggled(bool) ), this, SLOT( onSTLEnable() ));
+  }
+  else
+  {
+    delete stlGroup;
+    myRidgeAngle = 0;
   }
 
+  // ===============
+  // Local Size TAB
+  // ===============
+
   myLocalSizeTable = 0;
   //if ( !myIsONLY )
   {
@@ -325,6 +456,94 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
 
     tab->insertTab(LSZ_TAB, localSizeGroup, tr("NETGEN_LOCAL_SIZE"));
   }
+
+  // =============
+  // Advanced TAB
+  // =============
+
+  QWidget* advGroup = new QWidget();
+  tab->insertTab( ADV_TAB, advGroup, tr( "SMESH_ADVANCED" ));
+  QVBoxLayout* advLay = new QVBoxLayout( advGroup );
+  advLay->setSpacing( 6 );
+  advLay->setMargin( 5 );
+
+  // Optimizer group
+  // ----------------
+  {
+    QGroupBox* optBox = new QGroupBox( tr("NETGEN_OPTIMIZER"), advGroup );
+    advLay->addWidget( optBox );
+
+    QGridLayout* optLayout = new QGridLayout( optBox );
+    optLayout->setMargin( 6 );
+    optLayout->setSpacing( 6 );
+
+    int row = 0;
+    optLayout->addWidget( new QLabel( tr( "NETGEN_ELEM_SIZE_WEIGHT" ), optBox ), row, 0 );
+    myElemSizeWeight = new SMESHGUI_SpinBox( optBox );
+    myElemSizeWeight->RangeStepAndValidator( 0., 1., 0.1, "parametric_precision" );
+    optLayout->addWidget( myElemSizeWeight, row, 1 );
+    row++;
+
+    myNbSurfOptSteps = 0;
+    if ( myIs2D || !myIsONLY )
+    {
+      optLayout->addWidget( new QLabel( tr( "NETGEN_NB_SURF_OPT_STEPS" ), optBox ), row, 0 );
+      myNbSurfOptSteps = new SalomeApp_IntSpinBox( optBox );
+      myNbSurfOptSteps->setMinimum( 0 );
+      myNbSurfOptSteps->setMaximum( 99 );
+      optLayout->addWidget( myNbSurfOptSteps, row, 1 );
+      row++;
+    }
+
+    myNbVolOptSteps = 0;
+    if ( !myIs2D )
+    {
+      optLayout->addWidget( new QLabel( tr( "NETGEN_NB_VOL_OPT_STEPS" ), optBox ), row, 0 );
+      myNbVolOptSteps = new SalomeApp_IntSpinBox( optBox );
+      myNbVolOptSteps->setMinimum( 0 );
+      myNbVolOptSteps->setMaximum( 99 );
+      optLayout->addWidget( myNbVolOptSteps, row, 1 );
+    }
+  }
+  // Insider group
+  {
+    QGroupBox* insGroup = new QGroupBox( tr("NETGEN_INSIDER"), advGroup );
+    advLay->addWidget( insGroup );
+
+    QGridLayout* insLayout = new QGridLayout( insGroup );
+    insLayout->setMargin( 6 );
+    insLayout->setSpacing( 6 );
+
+    int row = 0;
+    insLayout->addWidget( new QLabel( tr( "NETGEN_WORST_ELEM_MEASURE" ), insGroup ), row, 0 );
+    myWorstElemMeasure = new SalomeApp_IntSpinBox( insGroup );
+    myWorstElemMeasure->setMinimum( 1 );
+    myWorstElemMeasure->setMaximum( 10 );
+    insLayout->addWidget( myWorstElemMeasure, row, 1, 1, 2 );
+    row++;
+
+    myUseDelauney = new QCheckBox( tr( "NETGEN_USE_DELAUNEY" ), insGroup );
+    insLayout->addWidget( myUseDelauney, row, 0, 1, 2 );
+    row++;
+
+    myCheckOverlapping = new QCheckBox( tr( "NETGEN_CHECK_OVERLAPPING" ), insGroup );
+    insLayout->addWidget( myCheckOverlapping, row, 0, 1, 2 );
+    row++;
+
+    myCheckChartBoundary = new QCheckBox( tr( "NETGEN_CHECK_CHART_BOUNDARY" ), insGroup );
+    insLayout->addWidget( myCheckChartBoundary, row, 0, 1, 2 );
+    row++;
+
+    myFuseEdges = 0;
+    if ( !myIsONLY && !isRemesher )
+    {
+      myFuseEdges = new QCheckBox( tr( "NETGEN_FUSE_EDGES" ), insGroup );
+      insLayout->addWidget( myFuseEdges, row, 0, 1, 2 );
+      row++;
+    }
+    insLayout->setRowStretch( row, 1 );
+  }
+
   return fr;
 }
 
@@ -335,65 +554,72 @@ void NETGENPluginGUI_HypothesisCreator::retrieveParams() const
 
   if( myName )
     myName->setText( data.myName );
-  if(data.myMaxSizeVar.isEmpty())
-    myMaxSize->setValue( data.myMaxSize );
-  else
-    myMaxSize->setText( data.myMaxSizeVar );
-
-  if(data.myMinSizeVar.isEmpty())
-    myMinSize->setValue( data.myMinSize );
-  else
-    myMinSize->setText( data.myMinSizeVar );
 
+  setTextOrVar( myMaxSize, data.myMaxSize, data.myMaxSizeVar );
+  setTextOrVar( myMinSize, data.myMinSize, data.myMinSizeVar );
   if ( mySecondOrder )
     mySecondOrder->setChecked( data.mySecondOrder );
   if ( myOptimize )
     myOptimize->setChecked( data.myOptimize );
   myFineness->setCurrentIndex( data.myFineness );
+  setTextOrVar( myGrowthRate, data.myGrowthRate, data.myGrowthRateVar );
+  setTextOrVar( myNbSegPerEdge, data.myNbSegPerEdge, data.myNbSegPerEdgeVar );
+  setTextOrVar( myNbSegPerRadius, data.myNbSegPerRadius, data.myNbSegPerRadiusVar );
 
-  if(data.myGrowthRateVar.isEmpty())
-    myGrowthRate->setValue( data.myGrowthRate );
-  else
-    myGrowthRate->setText( data.myGrowthRateVar );
-
-  if ( myNbSegPerEdge )
-  {
-    if(data.myNbSegPerEdgeVar.isEmpty())
-      myNbSegPerEdge->setValue( data.myNbSegPerEdge );
-    else
-      myNbSegPerEdge->setText( data.myNbSegPerEdgeVar );
-  }
-  if ( myNbSegPerRadius )
-  {
-    if(data.myNbSegPerRadiusVar.isEmpty())
-      myNbSegPerRadius->setValue( data.myNbSegPerRadius );
-    else
-      myNbSegPerRadius->setText( data.myNbSegPerRadiusVar );
-  }
   if ( myChordalError )
   {
     myChordalErrorEnabled->setChecked( data.myChordalErrorEnabled && data.myChordalError > 0 );
-    if(data.myChordalErrorVar.isEmpty())
-      myChordalError->setValue( data.myChordalError > 0 ? data.myChordalError : 0.1 );
-    else
-      myChordalError->setText( data.myChordalErrorVar );
+    setTextOrVar( myChordalError, data.myChordalError, data.myChordalErrorVar );
     myChordalError->setEnabled( myChordalErrorEnabled->isChecked() );
   }
-  if ( myRidgeAngle )
-  {
-    if ( data.myRidgeAngleVar.isEmpty() )
-      myRidgeAngle->setValue( data.myRidgeAngle );
-    else
-      myRidgeAngle->setText( data.myRidgeAngleVar );
-  }
   if (myAllowQuadrangles)
     myAllowQuadrangles->setChecked( data.myAllowQuadrangles );
-
   if (mySurfaceCurvature)
     mySurfaceCurvature->setChecked( data.mySurfaceCurvature );
 
+  if ( myKeepExistingEdges )
+  {
+    myKeepExistingEdges->setChecked( data.myKeepExistingEdges );
+    myMakeGroupsOfSurfaces->setChecked( data.myMakeGroupsOfSurfaces );
+  }
+
+  setTextOrVar( myElemSizeWeight, data.myElemSizeWeight, data.myElemSizeWeightVar );
+  setTextOrVar( myNbSurfOptSteps, data.myNbSurfOptSteps, data.myNbSurfOptStepsVar );
+  setTextOrVar( myNbVolOptSteps,  data.myNbVolOptSteps,  data.myNbVolOptStepsVar );
+
   if (myFuseEdges)
     myFuseEdges->setChecked( data.myFuseEdges );
+  setTextOrVar( myWorstElemMeasure, data.myWorstElemMeasure, data.myWorstElemMeasureVar );
+  myUseDelauney->setChecked( data.myUseDelauney );
+  myCheckOverlapping->setChecked( data.myCheckOverlapping );
+  myCheckChartBoundary->setChecked( data.myCheckChartBoundary );
+
+  if ( myRidgeAngle )
+  {
+    setTextOrVar( myRidgeAngle, data.myRidgeAngle, data.myRidgeAngleVar );
+    setTextOrVar( myEdgeCornerAngle, data.myEdgeCornerAngle, data.myEdgeCornerAngleVar );
+    setTextOrVar( myChartAngle, data.myChartAngle, data.myChartAngleVar );
+    setTextOrVar( myOuterChartAngle, data.myOuterChartAngle, data.myOuterChartAngleVar );
+    setTextOrVar( myRestHChartDistFactor, data.myRestHChartDistFactor,
+                  data.myRestHChartDistFactorVar );
+    setTextOrVar( myRestHLineLengthFactor, data.myRestHLineLengthFactor,
+                  data.myRestHLineLengthFactorVar );
+    setTextOrVar( myRestHCloseEdgeFactor, data.myRestHCloseEdgeFactor,
+                  data.myRestHCloseEdgeFactorVar );
+    setTextOrVar( myRestHSurfCurvFactor, data.myRestHSurfCurvFactor,
+                  data.myRestHSurfCurvFactorVar );
+    setTextOrVar( myRestHEdgeAngleFactor, data.myRestHEdgeAngleFactor,
+                  data.myRestHEdgeAngleFactorVar );
+    setTextOrVar( myRestHSurfMeshCurvFactor, data.myRestHSurfMeshCurvFactor,
+                  data.myRestHSurfMeshCurvFactorVar );
+
+    myRestHChartDistEnable->setChecked( data.myRestHChartDistEnable );
+    myRestHLineLengthEnable->setChecked( data.myRestHLineLengthEnable );
+    myRestHCloseEdgeEnable->setChecked( data.myRestHCloseEdgeEnable );
+    myRestHSurfCurvEnable->setChecked( data.myRestHSurfCurvEnable );
+    myRestHEdgeAngleEnable->setChecked( data.myRestHEdgeAngleEnable );
+    myRestHSurfMeshCurvEnable->setChecked( data.myRestHSurfMeshCurvEnable );
+  }
 
   // update widgets
   ((NETGENPluginGUI_HypothesisCreator*) this )-> onSurfaceCurvatureChanged();
@@ -440,10 +666,12 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromHypo( NetgenHypothesisData
 
   h_data.myName = isCreation() ? hypName() : "";
 
-  h_data.myMaxSize     = h->GetMaxSize();
-  h_data.myMaxSizeVar  = getVariableName("SetMaxSize");
-  h_data.mySecondOrder = h->GetSecondOrder();
-  h_data.myOptimize    = h->GetOptimize();
+  h_data.myMaxSize             = h->GetMaxSize();
+  h_data.myMaxSizeVar          = getVariableName("SetMaxSize");
+  h_data.myMinSize             = h->GetMinSize();
+  h_data.myMinSizeVar          = getVariableName("SetMinSize");
+  h_data.mySecondOrder         = h->GetSecondOrder();
+  h_data.myOptimize            = h->GetOptimize();
 
   h_data.myFineness            = (int) h->GetFineness();
   h_data.myGrowthRate          = h->GetGrowthRate();
@@ -455,10 +683,21 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromHypo( NetgenHypothesisData
   h_data.myChordalError        = h->GetChordalError();
   h_data.myChordalErrorVar     = getVariableName("SetChordalError");
   h_data.myChordalErrorEnabled = h->GetChordalErrorEnabled();
-  h_data.myMinSize             = h->GetMinSize();
-  h_data.myMinSizeVar          = getVariableName("SetMinSize");
   h_data.mySurfaceCurvature    = h->GetUseSurfaceCurvature();
+
+  h_data.myElemSizeWeight      = h->GetElemSizeWeight    ();
+  h_data.myElemSizeWeightVar   = getVariableName("SetElemSizeWeight");
+  h_data.myNbSurfOptSteps      = h->GetNbSurfOptSteps    ();
+  h_data.myNbSurfOptStepsVar   = getVariableName("SetNbSurfOptSteps");
+  h_data.myNbVolOptSteps       = h->GetNbVolOptSteps     ();
+  h_data.myNbVolOptStepsVar    = getVariableName("SetNbVolOptSteps");
   h_data.myFuseEdges           = h->GetFuseEdges();
+  h_data.myWorstElemMeasure    = h->GetWorstElemMeasure  ();
+  h_data.myWorstElemMeasureVar = getVariableName("SetWorstElemMeasure");
+  h_data.myUseDelauney         = h->GetUseDelauney       ();
+  h_data.myCheckOverlapping    = h->GetCheckOverlapping  ();
+  h_data.myCheckChartBoundary  = h->GetCheckChartBoundary();
+
   h_data.myMeshSizeFile        = h->GetMeshSizeFile();
 
   //if ( myIs2D )
@@ -473,9 +712,37 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromHypo( NetgenHypothesisData
   {
     NETGENPlugin::NETGENPlugin_RemesherHypothesis_2D_var rh =
       NETGENPlugin::NETGENPlugin_RemesherHypothesis_2D::_narrow( h );
-
     if ( !rh->_is_nil() )
-      h_data.myRidgeAngle = rh->GetRidgeAngle();
+    {
+      h_data.myRidgeAngle                 = rh->GetRidgeAngle();
+      h_data.myRidgeAngleVar              = getVariableName("SetRidgeAngle");
+      h_data.myEdgeCornerAngle            = rh->GetEdgeCornerAngle        ();
+      h_data.myEdgeCornerAngleVar         = getVariableName("SetEdgeCornerAngle");
+      h_data.myChartAngle                 = rh->GetChartAngle             ();
+      h_data.myChartAngleVar              = getVariableName("SetChartAngle");
+      h_data.myOuterChartAngle            = rh->GetOuterChartAngle        ();
+      h_data.myOuterChartAngleVar         = getVariableName("SetOuterChartAngle");
+      h_data.myRestHChartDistFactor       = rh->GetRestHChartDistFactor   ();
+      h_data.myRestHChartDistFactorVar    = getVariableName("SetRestHChartDistFactor");
+      h_data.myRestHLineLengthFactor      = rh->GetRestHLineLengthFactor  ();
+      h_data.myRestHLineLengthFactorVar   = getVariableName("SetRestHLineLengthFactor");
+      h_data.myRestHCloseEdgeFactor       = rh->GetRestHCloseEdgeFactor   ();
+      h_data.myRestHCloseEdgeFactorVar    = getVariableName("SetRestHCloseEdgeFactor");
+      h_data.myRestHSurfCurvFactor        = rh->GetRestHSurfCurvFactor    ();
+      h_data.myRestHSurfCurvFactorVar     = getVariableName("SetRestHSurfCurvFactor");
+      h_data.myRestHEdgeAngleFactor       = rh->GetRestHEdgeAngleFactor   ();
+      h_data.myRestHEdgeAngleFactorVar    = getVariableName("SetRestHEdgeAngleFactor");
+      h_data.myRestHSurfMeshCurvFactor    = rh->GetRestHSurfMeshCurvFactor();
+      h_data.myRestHSurfMeshCurvFactorVar = getVariableName("SetRestHSurfMeshCurvFactor");
+      h_data.myRestHChartDistEnable       = rh->GetRestHChartDistEnable   ();
+      h_data.myRestHLineLengthEnable      = rh->GetRestHLineLengthEnable  ();
+      h_data.myRestHCloseEdgeEnable       = rh->GetRestHCloseEdgeEnable   ();
+      h_data.myRestHSurfCurvEnable        = rh->GetRestHSurfCurvEnable    ();
+      h_data.myRestHEdgeAngleEnable       = rh->GetRestHEdgeAngleEnable   ();
+      h_data.myRestHSurfMeshCurvEnable    = rh->GetRestHSurfMeshCurvEnable();
+      h_data.myKeepExistingEdges          = rh->GetKeepExistingEdges      ();
+      h_data.myMakeGroupsOfSurfaces       = rh->GetMakeGroupsOfSurfaces   ();
+    }
   }
 
   NETGENPluginGUI_HypothesisCreator*  that = (NETGENPluginGUI_HypothesisCreator*)this;
@@ -503,18 +770,19 @@ bool NETGENPluginGUI_HypothesisCreator::storeParamsToHypo( const NetgenHypothesi
   bool ok = true;
   try
   {
-    if( isCreation() )
+    if ( isCreation() )
       SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() );
     h->SetVarParameter( h_data.myMaxSizeVar.toLatin1().constData(), "SetMaxSize");
     h->SetMaxSize     ( h_data.myMaxSize );
+    h->SetVarParameter( h_data.myMinSizeVar.toLatin1().constData(), "SetMinSize");
+    h->SetMinSize     ( h_data.myMinSize );
     if ( mySecondOrder )
       h->SetSecondOrder ( h_data.mySecondOrder );
     if ( myOptimize )
       h->SetOptimize    ( h_data.myOptimize );
-    int fineness = h_data.myFineness;
-    h->SetFineness    ( fineness );
+    h->SetFineness    ( h_data.myFineness );
 
-    if( fineness==UserDefined )
+    if ( h_data.myFineness == UserDefined )
     {
       h->SetVarParameter  ( h_data.myGrowthRateVar.toLatin1().constData(), "SetGrowthRate");
       h->SetGrowthRate    ( h_data.myGrowthRate );
@@ -535,14 +803,31 @@ bool NETGENPluginGUI_HypothesisCreator::storeParamsToHypo( const NetgenHypothesi
       h->SetChordalError       ( h_data.myChordalError );
       h->SetChordalErrorEnabled( h_data.myChordalErrorEnabled );
     }
-    h->SetVarParameter       ( h_data.myMinSizeVar.toLatin1().constData(), "SetMinSize");
-    h->SetMinSize            ( h_data.myMinSize );
     if ( mySurfaceCurvature )
       h->SetUseSurfaceCurvature( h_data.mySurfaceCurvature );
-    if ( myFuseEdges )
-      h->SetFuseEdges          ( h_data.myFuseEdges );
-    h->SetMeshSizeFile       ( h_data.myMeshSizeFile.toUtf8().constData() );
+    h->SetMeshSizeFile         ( h_data.myMeshSizeFile.toUtf8().constData() );
 
+    h->SetVarParameter  ( h_data.myElemSizeWeightVar.toLatin1().constData(), "SetElemSizeWeight");
+    h->SetElemSizeWeight( h_data.myElemSizeWeight );
+    if ( myNbSurfOptSteps )
+    {
+      h->SetVarParameter  ( h_data.myNbSurfOptStepsVar.toLatin1().constData(), "SetNbSurfOptSteps");
+      h->SetNbSurfOptSteps( h_data.myNbSurfOptSteps );
+    }
+    if ( myNbVolOptSteps )
+    {
+      h->SetVarParameter ( h_data.myNbVolOptStepsVar.toLatin1().constData(), "SetNbVolOptSteps");
+      h->SetNbVolOptSteps( h_data.myNbVolOptSteps );
+    }
+    if ( myFuseEdges )
+      h->SetFuseEdges( h_data.myFuseEdges );
+    h->SetVarParameter    ( h_data.myWorstElemMeasureVar.toLatin1().constData(), "SetWorstElemMeasure");
+    h->SetWorstElemMeasure( h_data.myWorstElemMeasure );
+
+    h->SetUseDelauney( myUseDelauney );
+    h->SetCheckOverlapping( myCheckOverlapping );
+    h->SetCheckChartBoundary( myCheckChartBoundary );
+    
     //if ( myIs2D )
     {
       // NETGENPlugin::NETGENPlugin_Hypothesis_2D_var h_2d =
@@ -558,8 +843,38 @@ bool NETGENPluginGUI_HypothesisCreator::storeParamsToHypo( const NetgenHypothesi
         NETGENPlugin::NETGENPlugin_RemesherHypothesis_2D::_narrow( h );
       if ( !rh->_is_nil() )
       {
-        rh->SetVarParameter( h_data.myRidgeAngleVar.toLatin1().constData(), "SetRidgeAngle");
-        rh->SetRidgeAngle  ( h_data.myRidgeAngle );
+        rh->SetVarParameter   ( h_data.myRidgeAngleVar.toLatin1().constData(), "SetRidgeAngle");
+        rh->SetRidgeAngle     ( h_data.myRidgeAngle );
+        rh->SetVarParameter   ( h_data.myEdgeCornerAngleVar.toLatin1().constData(), "SetEdgeCornerAngle");
+        rh->SetEdgeCornerAngle( h_data.myEdgeCornerAngle );
+        rh->SetVarParameter   ( h_data.myChartAngleVar.toLatin1().constData(), "SetChartAngle");
+        rh->SetChartAngle     ( h_data.myChartAngle );
+        rh->SetVarParameter   ( h_data.myOuterChartAngleVar.toLatin1().constData(), "SetOuterChartAngle");
+        rh->SetOuterChartAngle( h_data.myOuterChartAngle );
+
+        rh->SetVarParameter           ( h_data.myRestHChartDistFactorVar.toLatin1().constData(), "SetRestHChartDistFactor");
+        rh->SetRestHChartDistFactor   ( h_data.myRestHChartDistFactor );
+        rh->SetVarParameter           ( h_data.myRestHLineLengthFactorVar.toLatin1().constData(), "SetRestHLineLengthFactor");
+        rh->SetRestHLineLengthFactor  ( h_data.myRestHLineLengthFactor );
+        rh->SetVarParameter           ( h_data.myRestHCloseEdgeFactorVar.toLatin1().constData(), "SetRestHCloseEdgeFactor");
+        rh->SetRestHCloseEdgeFactor   ( h_data.myRestHCloseEdgeFactor );
+        rh->SetVarParameter           ( h_data.myRestHSurfCurvFactorVar.toLatin1().constData(), "SetRestHSurfCurvFactor");
+        rh->SetRestHSurfCurvFactor    ( h_data.myRestHSurfCurvFactor );
+        rh->SetVarParameter           ( h_data.myRestHEdgeAngleFactorVar.toLatin1().constData(), "SetRestHEdgeAngleFactor");
+        rh->SetRestHEdgeAngleFactor   ( h_data.myRestHEdgeAngleFactor );
+        rh->SetVarParameter           ( h_data.myRestHSurfMeshCurvFactorVar.toLatin1().constData(), "SetRestHSurfMeshCurvFactor");
+        rh->SetRestHSurfMeshCurvFactor( h_data.myRestHSurfMeshCurvFactor );
+
+        rh->SetRestHChartDistEnable   ( h_data.myRestHChartDistEnable );
+        rh->SetRestHLineLengthEnable  ( h_data.myRestHLineLengthEnable );
+        rh->SetRestHCloseEdgeEnable   ( h_data.myRestHCloseEdgeEnable );
+        rh->SetRestHSurfCurvEnable    ( h_data.myRestHSurfCurvEnable );
+        rh->SetRestHEdgeAngleEnable   ( h_data.myRestHEdgeAngleEnable );
+        rh->SetRestHSurfMeshCurvEnable( h_data.myRestHSurfMeshCurvEnable );
+
+        rh->SetKeepExistingEdges      ( h_data.myKeepExistingEdges );
+        rh->SetMakeGroupsOfSurfaces   ( h_data.myMakeGroupsOfSurfaces );
+        rh->SetFixedEdgeGroup         ( 0 );
       }
     }
     for ( QMapIterator<QString,QString> i(myLocalSizeMap); i.hasNext(); )
@@ -614,12 +929,6 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromWidgets( NetgenHypothesisD
     h_data.myChordalError    = myChordalError->value();
     h_data.myChordalErrorEnabled = myChordalError->isEnabled();
   }
-  if ( myRidgeAngle )
-  {
-    h_data.myRidgeAngleVar = myRidgeAngle->text();
-    h_data.myRidgeAngle    = myRidgeAngle->value();
-  }
-
   if ( myAllowQuadrangles )
     h_data.myAllowQuadrangles = myAllowQuadrangles->isChecked();
 
@@ -629,6 +938,57 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromWidgets( NetgenHypothesisD
   if ( myFuseEdges )
     h_data.myFuseEdges = myFuseEdges->isChecked();
 
+  h_data.myElemSizeWeight    = myElemSizeWeight->value();
+  h_data.myElemSizeWeightVar = myElemSizeWeight->text();
+  if ( myNbSurfOptSteps )
+  {
+    h_data.myNbSurfOptSteps    = myNbSurfOptSteps->value();
+    h_data.myNbSurfOptStepsVar = myNbSurfOptSteps->text();
+  }
+  if ( myNbVolOptSteps )
+  {
+    h_data.myNbVolOptSteps    = myNbVolOptSteps->value();
+    h_data.myNbVolOptStepsVar = myNbVolOptSteps->text();
+  }
+  h_data.myWorstElemMeasure    = myWorstElemMeasure->value();
+  h_data.myWorstElemMeasureVar = myWorstElemMeasure->text();
+
+  h_data.myUseDelauney        = myUseDelauney->isChecked();
+  h_data.myCheckOverlapping   = myCheckOverlapping->isChecked();
+  h_data.myCheckChartBoundary = myCheckChartBoundary->isChecked();
+
+  if ( myRidgeAngle )
+  {
+    h_data.myRidgeAngle                 = myRidgeAngle             ->value();
+    h_data.myRidgeAngleVar              = myRidgeAngle             ->text();
+    h_data.myEdgeCornerAngle            = myEdgeCornerAngle        ->value();
+    h_data.myEdgeCornerAngleVar         = myEdgeCornerAngle        ->text();
+    h_data.myChartAngle                 = myChartAngle             ->value();
+    h_data.myChartAngleVar              = myChartAngle             ->text();
+    h_data.myOuterChartAngle            = myOuterChartAngle        ->value();
+    h_data.myOuterChartAngleVar         = myOuterChartAngle        ->text();
+    h_data.myRestHChartDistFactor       = myRestHChartDistFactor   ->value();
+    h_data.myRestHChartDistFactorVar    = myRestHChartDistFactor   ->text();
+    h_data.myRestHLineLengthFactor      = myRestHLineLengthFactor  ->value();
+    h_data.myRestHLineLengthFactorVar   = myRestHLineLengthFactor  ->text();
+    h_data.myRestHCloseEdgeFactor       = myRestHCloseEdgeFactor   ->value();
+    h_data.myRestHCloseEdgeFactorVar    = myRestHCloseEdgeFactor   ->text();
+    h_data.myRestHSurfCurvFactor        = myRestHSurfCurvFactor    ->value();
+    h_data.myRestHSurfCurvFactorVar     = myRestHSurfCurvFactor    ->text();
+    h_data.myRestHEdgeAngleFactor       = myRestHEdgeAngleFactor   ->value();
+    h_data.myRestHEdgeAngleFactorVar    = myRestHEdgeAngleFactor   ->text();
+    h_data.myRestHSurfMeshCurvFactor    = myRestHSurfMeshCurvFactor->value();
+    h_data.myRestHSurfMeshCurvFactorVar = myRestHSurfMeshCurvFactor->text();
+    h_data.myRestHChartDistEnable       = myRestHChartDistEnable   ->isChecked();
+    h_data.myRestHLineLengthEnable      = myRestHLineLengthEnable  ->isChecked();
+    h_data.myRestHCloseEdgeEnable       = myRestHCloseEdgeEnable   ->isChecked();
+    h_data.myRestHSurfCurvEnable        = myRestHSurfCurvEnable    ->isChecked();
+    h_data.myRestHEdgeAngleEnable       = myRestHEdgeAngleEnable   ->isChecked();
+    h_data.myRestHSurfMeshCurvEnable    = myRestHSurfMeshCurvEnable->isChecked();
+    h_data.myKeepExistingEdges          = myKeepExistingEdges      ->isChecked();
+    h_data.myMakeGroupsOfSurfaces       = myMakeGroupsOfSurfaces   ->isChecked();
+  }
+
   if ( myLocalSizeTable )
   {
     NETGENPluginGUI_HypothesisCreator* that = (NETGENPluginGUI_HypothesisCreator*)this;
@@ -836,6 +1196,16 @@ void NETGENPluginGUI_HypothesisCreator::onSetSizeFile()
   myMeshSizeFile->setText( dir );
 }
 
+void NETGENPluginGUI_HypothesisCreator::onSTLEnable()
+{
+  myRestHChartDistFactor   ->setEnabled( myRestHChartDistEnable   ->isChecked() );
+  myRestHLineLengthFactor  ->setEnabled( myRestHLineLengthEnable  ->isChecked() );
+  myRestHCloseEdgeFactor   ->setEnabled( myRestHCloseEdgeEnable   ->isChecked() );
+  myRestHSurfCurvFactor    ->setEnabled( myRestHSurfCurvEnable    ->isChecked() );
+  myRestHEdgeAngleFactor   ->setEnabled( myRestHEdgeAngleEnable   ->isChecked() );
+  myRestHSurfMeshCurvFactor->setEnabled( myRestHSurfMeshCurvEnable->isChecked() );
+}
+
 GeomSelectionTools* NETGENPluginGUI_HypothesisCreator::getGeomSelectionTools()
 {
   if (myGeomSelectionTools == NULL) {
index 8ca5992f24875c5d9fca69d54a089bfe95d08705..a3aee9c6386a2e55b0f90d6df8835915eec904e7 100644 (file)
 
 #include <TopAbs_ShapeEnum.hxx>
 
-class SMESHGUI_SpinBox;
 class GeomSelectionTools;
-class QComboBox;
 class QCheckBox;
+class QComboBox;
 class QLineEdit;
 class QTableWidget;
+class SMESHGUI_SpinBox;
+class SalomeApp_IntSpinBox;
 
 typedef struct
 {
-  double  myMaxSize, myMinSize, myGrowthRate, myNbSegPerEdge, myNbSegPerRadius, myRidgeAngle, myChordalError;
-  int     myFineness;
-  bool    mySecondOrder, myAllowQuadrangles, myOptimize, mySurfaceCurvature, myFuseEdges, myChordalErrorEnabled;
+  double  myMaxSize, myMinSize, myGrowthRate, myNbSegPerEdge, myNbSegPerRadius, myRidgeAngle, myChordalError, myElemSizeWeight, myEdgeCornerAngle, myChartAngle, myOuterChartAngle, myRestHChartDistFactor, myRestHLineLengthFactor, myRestHCloseEdgeFactor, myRestHSurfCurvFactor, myRestHEdgeAngleFactor, myRestHSurfMeshCurvFactor;
+  int     myFineness, myNbSurfOptSteps, myNbVolOptSteps, myWorstElemMeasure;
+  bool    mySecondOrder, myAllowQuadrangles, myOptimize, mySurfaceCurvature, myFuseEdges, myChordalErrorEnabled, myUseDelauney, myCheckOverlapping, myCheckChartBoundary, myRestHChartDistEnable, myRestHLineLengthEnable, myRestHCloseEdgeEnable, myRestHSurfCurvEnable, myRestHEdgeAngleEnable, myRestHSurfMeshCurvEnable, myKeepExistingEdges, myMakeGroupsOfSurfaces;
   QString myName, myMeshSizeFile;
-  QString myMaxSizeVar, myMinSizeVar, myGrowthRateVar, myNbSegPerEdgeVar, myNbSegPerRadiusVar, myRidgeAngleVar, myChordalErrorVar;
+  QString myMaxSizeVar, myMinSizeVar, myGrowthRateVar, myNbSegPerEdgeVar, myNbSegPerRadiusVar, myRidgeAngleVar, myChordalErrorVar, myNbSurfOptStepsVar, myNbVolOptStepsVar, myElemSizeWeightVar, myWorstElemMeasureVar, myEdgeCornerAngleVar, myChartAngleVar, myOuterChartAngleVar, myRestHChartDistFactorVar, myRestHLineLengthFactorVar, myRestHCloseEdgeFactorVar, myRestHSurfCurvFactorVar, myRestHEdgeAngleFactorVar, myRestHSurfMeshCurvFactorVar;
 } NetgenHypothesisData;
 
 /*!
@@ -85,6 +86,7 @@ protected slots:
   virtual void     onRemoveLocalSizeOnShape();
   virtual void     onSetLocalSize(int,int);
   virtual void     onSetSizeFile();
+  virtual void     onSTLEnable();
 
 private:
   bool readParamsFromHypo( NetgenHypothesisData& ) const;
@@ -94,21 +96,50 @@ private:
   void addLocalSizeOnShape(TopAbs_ShapeEnum);
 
 private:
- QLineEdit*        myName;
- SMESHGUI_SpinBox* myMaxSize;
- SMESHGUI_SpinBox* myMinSize;
- QCheckBox*        mySecondOrder;
- QCheckBox*        myOptimize;
- QComboBox*        myFineness;
- SMESHGUI_SpinBox* myGrowthRate;
- SMESHGUI_SpinBox* myNbSegPerEdge;
- SMESHGUI_SpinBox* myNbSegPerRadius;
- SMESHGUI_SpinBox* myRidgeAngle;
- QCheckBox*        myChordalErrorEnabled;
- SMESHGUI_SpinBox* myChordalError;
- QCheckBox*        myAllowQuadrangles;
- QCheckBox*        mySurfaceCurvature;
- QCheckBox*        myFuseEdges;
+ QLineEdit*            myName;
+ SMESHGUI_SpinBox*     myMaxSize;
+ SMESHGUI_SpinBox*     myMinSize;
+ QCheckBox*            mySecondOrder;
+ QCheckBox*            myOptimize;
+ QComboBox*            myFineness;
+ SMESHGUI_SpinBox*     myGrowthRate;
+ SMESHGUI_SpinBox*     myNbSegPerEdge;
+ SMESHGUI_SpinBox*     myNbSegPerRadius;
+ QCheckBox*            myChordalErrorEnabled;
+ SMESHGUI_SpinBox*     myChordalError;
+ QCheckBox*            myAllowQuadrangles;
+ QCheckBox*            mySurfaceCurvature;
+ // optimizer
+ SMESHGUI_SpinBox*     myElemSizeWeight;
+ SalomeApp_IntSpinBox* myNbSurfOptSteps;
+ SalomeApp_IntSpinBox* myNbVolOptSteps;
+ // insider
+ QCheckBox*            myFuseEdges;
+ SalomeApp_IntSpinBox* myWorstElemMeasure;
+ QCheckBox*            myUseDelauney;
+ QCheckBox*            myCheckOverlapping;
+ QCheckBox*            myCheckChartBoundary;
+ // stl options
+ QCheckBox*            myKeepExistingEdges;
+ QCheckBox*            myMakeGroupsOfSurfaces;
+ // stl charts
+ SMESHGUI_SpinBox*     myRidgeAngle;
+ SMESHGUI_SpinBox*     myEdgeCornerAngle;
+ SMESHGUI_SpinBox*     myChartAngle;
+ SMESHGUI_SpinBox*     myOuterChartAngle;
+ // stl size
+ SMESHGUI_SpinBox*     myRestHChartDistFactor;
+ SMESHGUI_SpinBox*     myRestHLineLengthFactor;
+ SMESHGUI_SpinBox*     myRestHCloseEdgeFactor;
+ SMESHGUI_SpinBox*     myRestHSurfCurvFactor;
+ SMESHGUI_SpinBox*     myRestHEdgeAngleFactor;
+ SMESHGUI_SpinBox*     myRestHSurfMeshCurvFactor;
+ QCheckBox*            myRestHChartDistEnable;
+ QCheckBox*            myRestHLineLengthEnable;
+ QCheckBox*            myRestHCloseEdgeEnable;
+ QCheckBox*            myRestHSurfCurvEnable;
+ QCheckBox*            myRestHEdgeAngleEnable;
+ QCheckBox*            myRestHSurfMeshCurvEnable;
 
  bool myIs2D;   // 2D or 3D
  bool myIsONLY; // one dim or several
index 9f1050b82215d990b169324ae09da317bd02bcda..190415bc9bfcfd5effe9665b710fb9620bde3f15 100644 (file)
@@ -37,7 +37,7 @@
     </message>
     <message>
         <source>NETGEN_ALLOW_QUADRANGLES</source>
-        <translation>Allow Quadrangles</translation>
+        <translation>Quad-dominated</translation>
     </message>
     <message>
         <source>NETGEN_COARSE</source>
     </message>
     <message>
         <source>NETGEN_FUSE_EDGES</source>
-        <translation>Fuse Coincident Nodes on Edges and Vertices</translation>
+        <translation>Fuse coincident nodes on edges and vertices</translation>
     </message>
     <message>
         <source>NETGEN_GROWTH_RATE</source>
-        <translation>Growth Rate</translation>
+        <translation>Growth rate</translation>
     </message>
     <message>
         <source>NETGEN_MAX_SIZE</source>
-        <translation>Max. Size</translation>
+        <translation>Max. size</translation>
     </message>
     <message>
         <source>NETGEN_MIN_SIZE</source>
-        <translation>Min. Size</translation>
+        <translation>Min. size</translation>
     </message>
     <message>
         <source>NETGEN_MODERATE</source>
         <source>NETGEN_OPTIMIZE</source>
         <translation>Optimize</translation>
     </message>
+    <message>
+        <source>NETGEN_OPTIMIZER</source>
+        <translation>Optimizer</translation>
+    </message>
     <message>
         <source>NETGEN_SECOND_ORDER</source>
-        <translation>Second Order</translation>
+        <translation>Second order</translation>
     </message>
     <message>
         <source>NETGEN_SEG_PER_EDGE</source>
-        <translation>Nb. Segs per Edge</translation>
+        <translation>Nb. segs per edge</translation>
     </message>
     <message>
         <source>NETGEN_SEG_PER_RADIUS</source>
-        <translation>Nb. Segs per Radius</translation>
+        <translation>Nb. segs per radius</translation>
     </message>
     <message>
         <source>NETGEN_CHORDAL_ERROR</source>
-        <translation>Chordal Error</translation>
+        <translation>Chordal error</translation>
     </message>
     <message>
         <source>NETGEN_RIDGE_ANGLE</source>
-        <translation>Ridge Angle</translation>
+        <translation>Ridge angle</translation>
+    </message>
+    <message>
+        <source>NETGEN_KEEP_EXISTING_EDGES</source>
+        <translation>Keep existing edges</translation>
+    </message>
+    <message>
+        <source>NETGEN_MAKE_SURFACE_GROUPS</source>
+        <translation>Create groups of surfaces</translation>
     </message>
     <message>
         <source>NETGEN_SURFACE_CURVATURE</source>
-        <translation>Limit Size by Surface Curvature</translation>
+        <translation>Limit size by surface curvature</translation>
     </message>
     <message>
         <source>NETGEN_VERYCOARSE</source>
-        <translation>Very Coarse</translation>
+        <translation>Very coarse</translation>
     </message>
     <message>
         <source>NETGEN_VERYFINE</source>
-        <translation>Very Fine</translation>
+        <translation>Very fine</translation>
     </message>
     <message>
         <source>NG_1D</source>
     </message>
     <message>
         <source>NETGEN_LSZ_VERTEX</source>
-        <translation>On Vertex</translation>
+        <translation>On vertex</translation>
     </message>
     <message>
         <source>NETGEN_LSZ_EDGE</source>
-        <translation>On Edge</translation>
+        <translation>On edge</translation>
     </message>
     <message>
         <source>NETGEN_LSZ_FACE</source>
-        <translation>On Face</translation>
+        <translation>On face</translation>
     </message>
     <message>
         <source>NETGEN_LSZ_SOLID</source>
-        <translation>On Solid</translation>
+        <translation>On solid</translation>
     </message>
     <message>
         <source>NETGEN_LSZ_REMOVE</source>
     </message>
     <message>
         <source>NETGEN_LSZ_FILE</source>
-        <translation>Mesh-size File</translation>
+        <translation>Mesh-size file</translation>
+    </message>
+    <message>
+        <source>NETGEN_MESH_SIZE</source>
+        <translation>Mesh size</translation>
+    </message>
+    <message>
+        <source>NETGEN_INSIDER</source>
+        <translation>Insider</translation>
+    </message>
+    <message>
+        <source>NETGEN_WORST_ELEM_MEASURE</source>
+        <translation>Worst element measure</translation>
+    </message>
+    <message>
+        <source>NETGEN_USE_DELAUNEY</source>
+        <translation>Use Delaunay</translation>
+    </message>
+    <message>
+        <source>NETGEN_CHECK_OVERLAPPING</source>
+        <translation>Check overlapping</translation>
+    </message>
+    <message>
+        <source>NETGEN_CHECK_CHART_BOUNDARY</source>
+        <translation>Check chart boundary</translation>
+    </message>
+    <message>
+        <source>NETGEN_ELEM_SIZE_WEIGHT</source>
+        <translation>Element size weight</translation>
+    </message>
+    <message>
+        <source>NETGEN_NB_SURF_OPT_STEPS</source>
+        <translation>Nb. surface optimization steps</translation>
+    </message>
+    <message>
+        <source>NETGEN_NB_VOL_OPT_STEPS</source>
+        <translation>Nb. volume optimization steps</translation>
+    </message>
+    <message>
+        <source>NETGEN_STL</source>
+        <translation>STL</translation>
+    </message>
+    <message>
+        <source>NETGEN_STL_CHARTS</source>
+        <translation>Charts</translation>
+    </message>
+    <message>
+        <source>NETGEN_STL_SIZE</source>
+        <translation>Mesh size depends on... (enable and factor)</translation>
+    </message>
+    <message>
+        <source>NETGEN_EDGE_CORNER_ANGLE</source>
+        <translation>Edge corner angle</translation>
+    </message>
+    <message>
+        <source>NETGEN_CHART_ANGLE</source>
+        <translation>Chart angle</translation>
+    </message>
+    <message>
+        <source>NETGEN_OUTER_CHART_ANGLE</source>
+        <translation>Outer chart angle</translation>
+    </message>
+    <message>
+        <source>NETGEN_RESTH_CHART_DIST</source>
+        <translation>Chart distance</translation>
+    </message>
+    <message>
+        <source>NETGEN_RESTH_LINE_LENGTH</source>
+        <translation>Line length</translation>
+    </message>
+    <message>
+        <source>NETGEN_RESTH_CLOSE_EDGE</source>
+        <translation>Close edges</translation>
+    </message>
+    <message>
+        <source>NETGEN_RESTH_SURF_CURV</source>
+        <translation>Surface curvature</translation>
+    </message>
+    <message>
+        <source>NETGEN_RESTH_EDGE_ANGLE</source>
+        <translation>Edge angle</translation>
+    </message>
+    <message>
+        <source>NETGEN_RESTH_SURF_MESH_CURV</source>
+        <translation>Surface mesh curvature</translation>
     </message>
 </context>
 </TS>
index 1a64251c1a2c16a77294bb327533e0b1dc738d91..0e55fd9cae357e5872802ee49e15aeb454cd7afa 100755 (executable)
 #define _NETGENPlugin_DEFS_HXX_
 
 #ifdef WIN32
+
   #if defined NETGENPLUGIN_EXPORTS || defined NETGENEngine_EXPORTS
     #define NETGENPLUGIN_EXPORT __declspec( dllexport )
   #else
     #define NETGENPLUGIN_EXPORT __declspec( dllimport )
   #endif
+
+  #if defined(NETGEN_V5)
+    #define NETGENPLUGIN_DLL_HEADER DLL_HEADER
+  #else
+    #define NETGENPLUGIN_DLL_HEADER
+  #endif
+
 #else
+
   #define NETGENPLUGIN_EXPORT
+  #define NETGENPLUGIN_DLL_HEADER
+
 #endif
 
 #endif
index afce99b85ac41791c3b6ab588e39891f376a2b32..4748b1fcd19d7196c605c26d96c40c7a483d0c26 100644 (file)
@@ -37,35 +37,40 @@ using namespace std;
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
-NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId,
-                                                  SMESH_Gen * gen)
+NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId, SMESH_Gen * gen)
 
   : SMESH_Hypothesis(hypId, gen),
+    _fineness           (GetDefaultFineness()),
+    _secondOrder        (GetDefaultSecondOrder()),
+    _quadAllowed        (GetDefaultQuadAllowed()),
     _maxSize            (GetDefaultMaxSize()),
     _minSize            (0),
     _growthRate         (GetDefaultGrowthRate()),
-    _nbSegPerEdge       (GetDefaultNbSegPerEdge()),
     _nbSegPerRadius     (GetDefaultNbSegPerRadius()),
-    _fineness           (GetDefaultFineness()),
+    _nbSegPerEdge       (GetDefaultNbSegPerEdge()),
     _chordalErrorEnabled(GetDefaultChordalError() > 0),
     _chordalError       (GetDefaultChordalError() ),
-    _secondOrder        (GetDefaultSecondOrder()),
     _optimize           (GetDefaultOptimize()),
-    _quadAllowed        (GetDefaultQuadAllowed()),
+    _nbSurfOptSteps     (GetDefaultNbSurfOptSteps()),
+    _nbVolOptSteps      (GetDefaultNbVolOptSteps()),
+    _elemSizeWeight     (GetDefaultElemSizeWeight()),
+    _worstElemMeasure   (GetDefaultWorstElemMeasure()),
     _surfaceCurvature   (GetDefaultSurfaceCurvature()),
+    _useDelauney        (GetDefaultUseDelauney()),
+    _checkOverlapping   (GetDefaultCheckOverlapping()),
+    _checkChartBoundary (GetDefaultCheckChartBoundary()),
     _fuseEdges          (GetDefaultFuseEdges())
 {
   _name = "NETGEN_Parameters";
   _param_algo_dim = 3;
-  _localSize.clear();
 }
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 void NETGENPlugin_Hypothesis::SetMaxSize(double theSize)
@@ -305,16 +310,6 @@ void NETGENPlugin_Hypothesis::SetQuadAllowed(bool theVal)
   }
 }
 
-//=============================================================================
-/*!
- *  
- */
-//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultQuadAllowed()
-{
-  return false;
-}
-
 //=============================================================================
 /*!
  *  
@@ -329,16 +324,6 @@ void NETGENPlugin_Hypothesis::SetSurfaceCurvature(bool theVal)
   }
 }
 
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultSurfaceCurvature()
-{
-  return true;
-}
-
 //=============================================================================
 /*!
  *
@@ -353,14 +338,102 @@ void NETGENPlugin_Hypothesis::SetFuseEdges(bool theVal)
   }
 }
 
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultFuseEdges()
+//=======================================================================
+//function : SetNbSurfOptSteps
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetNbSurfOptSteps( int theVal )
 {
-  return true; // false; -- for SALOME_TESTS/Grids/smesh/3D_mesh_NETGEN_05/F6
+  if (theVal != _nbSurfOptSteps)
+  {
+    _nbSurfOptSteps = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetNbVolOptSteps
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetNbVolOptSteps( int theVal )
+{
+  if (theVal != _nbVolOptSteps)
+  {
+    _nbVolOptSteps = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetElemSizeWeight
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetElemSizeWeight( double theVal )
+{
+  if (theVal != _elemSizeWeight)
+  {
+    _elemSizeWeight = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetWorstElemMeasure
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetWorstElemMeasure( int theVal )
+{
+  if (theVal != _worstElemMeasure)
+  {
+    _worstElemMeasure = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetUseDelauney
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetUseDelauney( bool theVal )
+{
+  if (theVal != _useDelauney )
+  {
+    _useDelauney = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetCheckOverlapping
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetCheckOverlapping( bool theVal )
+{
+  if (theVal != _checkOverlapping )
+  {
+    _checkOverlapping = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetCheckChartBoundary
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis::SetCheckChartBoundary( bool theVal )
+{
+  if (theVal != _checkChartBoundary)
+  {
+    _checkChartBoundary = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
 }
 
 //=============================================================================
@@ -395,6 +468,18 @@ ostream & NETGENPlugin_Hypothesis::SaveTo(ostream & save)
 
   save << " " << ( _chordalErrorEnabled ? _chordalError : 0. );
 
+
+  // added for option set completion
+
+  save << " " << _nbSurfOptSteps;
+  save << " " << _nbVolOptSteps;
+  save << " " << _elemSizeWeight;
+  save << " " << _worstElemMeasure;
+
+  save << " " << _useDelauney;
+  save << " " << _checkOverlapping;
+  save << " " << _checkChartBoundary;
+
   return save;
 }
 
@@ -515,29 +600,39 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load)
     load.clear(ios::badbit | load.rdstate());
   _chordalErrorEnabled = ( _chordalError > 0 );
 
-  return load;
-}
 
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp)
-{
-  return hyp.SaveTo( save );
-}
+  // added for option set completion
 
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-istream & operator >>(istream & load, NETGENPlugin_Hypothesis & hyp)
-{
-  return hyp.LoadFrom( load );
-}
+  isOK = static_cast<bool>( load >> is );
+  if ( isOK )
+    _nbSurfOptSteps = is;
+
+  isOK = static_cast<bool>( load >> is );
+  if ( isOK )
+    _nbVolOptSteps = is;
+
+  isOK = static_cast<bool>( load >> val );
+  if ( isOK )
+    _elemSizeWeight =  val;
+
+  isOK = static_cast<bool>( load >> is );
+  if ( isOK )
+    _worstElemMeasure = is;
+
+  isOK = static_cast<bool>( load >> is );
+  if ( isOK )
+    _useDelauney = (bool) is;
+
+  isOK = static_cast<bool>( load >> is );
+  if ( isOK )
+    _checkOverlapping = (bool) is;
 
+  isOK = static_cast<bool>( load >> is );
+  if ( isOK )
+    _checkChartBoundary = (bool) is;
+
+  return load;
+}
 
 //================================================================================
 /*!
@@ -573,82 +668,3 @@ bool NETGENPlugin_Hypothesis::SetParametersByDefaults(const TDefaults&  dflts,
 
   return _nbSegPerEdge && _maxSize > 0;
 }
-
-//=============================================================================
-/*!
- *  
- */
-//=============================================================================
-double NETGENPlugin_Hypothesis::GetDefaultMaxSize()
-{
-  return 1000;
-}
-
-//=============================================================================
-/*!
- *  
- */
-//=============================================================================
-NETGENPlugin_Hypothesis::Fineness NETGENPlugin_Hypothesis::GetDefaultFineness()
-{
-  return Moderate;
-}
-
-//=============================================================================
-/*!
- *  
- */
-//=============================================================================
-double NETGENPlugin_Hypothesis::GetDefaultGrowthRate()
-{
-  return 0.3;
-}
-
-//=============================================================================
-/*!
- *  
- */
-//=============================================================================
-double NETGENPlugin_Hypothesis::GetDefaultNbSegPerEdge()
-{
-  return 1;
-}
-
-//=============================================================================
-/*!
- *  
- */
-//=============================================================================
-double NETGENPlugin_Hypothesis::GetDefaultNbSegPerRadius()
-{
-  return 2;
-}
-//=============================================================================
-/*!
- *  
- */
-//=============================================================================
-double NETGENPlugin_Hypothesis::GetDefaultChordalError()
-{
-  return -1; // disabled by default
-}
-
-//=============================================================================
-/*!
- *  
- */
-//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultSecondOrder()
-{
-  return false;
-}
-
-//=============================================================================
-/*!
- *  
- */
-//=============================================================================
-bool NETGENPlugin_Hypothesis::GetDefaultOptimize()
-{
-  return true;
-}
index e68d3050f52bd83ec0cabffdafd9d184ea334519..e8f54552487d7dffb0b1390ed73db54179e641d0 100644 (file)
@@ -47,17 +47,17 @@ public:
 
   NETGENPlugin_Hypothesis(int hypId, SMESH_Gen * gen);
 
-  void SetMaxSize(double theSize);
+  void   SetMaxSize(double theSize);
   double GetMaxSize() const { return _maxSize; }
 
-  void SetMinSize(double theSize);
+  void   SetMinSize(double theSize);
   double GetMinSize() const { return _minSize; }
 
-  void SetSecondOrder(bool theVal);
-  bool GetSecondOrder() const { return _secondOrder; }
+  void   SetSecondOrder(bool theVal);
+  bool   GetSecondOrder() const { return _secondOrder; }
 
-  void SetOptimize(bool theVal);
-  bool GetOptimize() const { return _optimize; }
+  void   SetOptimize(bool theVal);
+  bool   GetOptimize() const { return _optimize; }
 
   enum Fineness
   {
@@ -69,59 +69,87 @@ public:
     UserDefined
   };
 
-  void SetFineness(Fineness theFineness);
+  void   SetFineness(Fineness theFineness);
   Fineness GetFineness() const { return _fineness; }
 
-  // the following parameters are controlled by Fineness
+  // the following parameters are controlled by Fineness
 
-  void SetGrowthRate(double theRate);
+  void   SetGrowthRate(double theRate);
   double GetGrowthRate() const { return _growthRate; }
 
-  void SetNbSegPerEdge(double theVal);
+  void   SetNbSegPerEdge(double theVal);
   double GetNbSegPerEdge() const { return _nbSegPerEdge; }
 
-  void SetNbSegPerRadius(double theVal);
+  void   SetNbSegPerRadius(double theVal);
   double GetNbSegPerRadius() const { return _nbSegPerRadius; }
 
-  void SetChordalErrorEnabled(bool value);
+  void   SetChordalErrorEnabled(bool value);
   double GetChordalErrorEnabled() const { return _chordalErrorEnabled; }
-  void SetChordalError(double value);
+  void   SetChordalError(double value);
   double GetChordalError() const { return _chordalError; }
 
   typedef std::map<std::string, double> TLocalSize;
   void   SetLocalSizeOnEntry(const std::string& entry, double localSize);
   double GetLocalSizeOnEntry(const std::string& entry);
   const TLocalSize& GetLocalSizesAndEntries() const { return _localSize; }
-  void UnsetLocalSizeOnEntry(const std::string& entry);
+  void   UnsetLocalSizeOnEntry(const std::string& entry);
 
-  void SetMeshSizeFile(const std::string& fileName);
+  void   SetMeshSizeFile(const std::string& fileName);
   const std::string& GetMeshSizeFile() const { return _meshSizeFile; }
 
-  void SetQuadAllowed(bool theVal);
-  bool GetQuadAllowed() const { return _quadAllowed; }
+  void   SetQuadAllowed(bool theVal);
+  bool   GetQuadAllowed() const { return _quadAllowed; }
 
-  void SetSurfaceCurvature(bool theVal);
-  bool GetSurfaceCurvature() const { return _surfaceCurvature; }
+  void   SetSurfaceCurvature(bool theVal);
+  bool   GetSurfaceCurvature() const { return _surfaceCurvature; }
 
-  void SetFuseEdges(bool theVal);
-  bool GetFuseEdges() const { return _fuseEdges; }
+  void   SetFuseEdges(bool theVal);
+  bool   GetFuseEdges() const { return _fuseEdges; }
+
+  void   SetNbSurfOptSteps( int nb );
+  int    GetNbSurfOptSteps() const { return _nbSurfOptSteps; }
+
+  void   SetNbVolOptSteps( int nb );
+  int    GetNbVolOptSteps() const { return _nbVolOptSteps; }
+
+  void   SetElemSizeWeight( double size );
+  double GetElemSizeWeight() const { return _elemSizeWeight; }
+
+  void   SetWorstElemMeasure( int val );
+  int    GetWorstElemMeasure() const { return _worstElemMeasure; }
+
+  void   SetUseDelauney( bool toUse);
+  bool   GetUseDelauney() const { return _useDelauney; }
+
+  void   SetCheckOverlapping( bool toCheck );
+  bool   GetCheckOverlapping() const { return _checkOverlapping; }
+
+  void   SetCheckChartBoundary( bool toCheck );
+  bool   GetCheckChartBoundary() const { return _checkChartBoundary; }
 
   // the default values (taken from NETGEN 4.5 sources)
 
-  static double GetDefaultMaxSize();
-  static Fineness GetDefaultFineness();
-  static double GetDefaultGrowthRate();
-  static double GetDefaultNbSegPerEdge();
-  static double GetDefaultNbSegPerRadius();
-  static double GetDefaultChordalError();
-  static bool GetDefaultSecondOrder();
-  static bool GetDefaultOptimize();
-  static bool GetDefaultQuadAllowed();
-  static bool GetDefaultSurfaceCurvature();
-  static bool GetDefaultFuseEdges();
+  static Fineness GetDefaultFineness()          { return Moderate; }
+  static bool     GetDefaultSecondOrder()       { return false; }
+  static bool     GetDefaultQuadAllowed()       { return false; }
+  static double   GetDefaultMaxSize()           { return 1000; }
+  static double   GetDefaultGrowthRate()        { return 0.3; }
+  static double   GetDefaultNbSegPerRadius()    { return 2; }
+  static double   GetDefaultNbSegPerEdge()      { return 1; }
+  static double   GetDefaultChordalError()      { return -1; } // disabled by default
+  static bool     GetDefaultOptimize()          { return true; }
+  static int      GetDefaultNbSurfOptSteps()    { return 3; }
+  static int      GetDefaultNbVolOptSteps()     { return 3; }
+  static double   GetDefaultElemSizeWeight()    { return 0.2; }
+  static int      GetDefaultWorstElemMeasure()  { return 2; }
+  static bool     GetDefaultSurfaceCurvature()  { return true; }
+  static bool     GetDefaultUseDelauney()       { return true; }
+  static bool     GetDefaultCheckOverlapping()  { return true; }
+  static bool     GetDefaultCheckChartBoundary(){ return true; }
+  static bool     GetDefaultFuseEdges()         { return true; }
 
   // Persistence
-  virtual std::ostream & SaveTo(std::ostream & save);
+  virtual std::ostream & SaveTo  (std::ostream & save);
   virtual std::istream & LoadFrom(std::istream & load);
 
   /*!
@@ -139,19 +167,37 @@ public:
   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
 
 private:
+
+  // General
+  Fineness      _fineness;
+  bool          _secondOrder;
+  bool          _quadAllowed;
+
+  // Mesh size
   double        _maxSize, _minSize;
   double        _growthRate;
-  double        _nbSegPerEdge;
+  std::string   _meshSizeFile;
   double        _nbSegPerRadius;
-  Fineness      _fineness;
+  double        _nbSegPerEdge;
+  // (SALOME additions)
+  TLocalSize    _localSize;
   bool          _chordalErrorEnabled;
   double        _chordalError;
-  bool          _secondOrder;
+
+  // Optimizer
   bool          _optimize;
-  TLocalSize    _localSize;
-  std::string   _meshSizeFile;
-  bool          _quadAllowed;
+  int           _nbSurfOptSteps;
+  int           _nbVolOptSteps;
+  double        _elemSizeWeight;
+  int           _worstElemMeasure;
+
+  // Insider
   bool          _surfaceCurvature;
+  bool          _useDelauney;
+  bool          _checkOverlapping;
+  bool          _checkChartBoundary;
+  //bool          _blockFilling; -- not used by netgen
+  // (SALOME additions)
   bool          _fuseEdges;
 };
 
index d7f52e846ac4b564ad0f2419fd04022860bb41e7..0bdebb7c3f1bb51955281f7377d89126ef98e7a9 100644 (file)
 //
 #include "NETGENPlugin_Hypothesis_2D.hxx"
 
+#include <SMESH_Mesh.hxx>
+#include <SMESH_Group.hxx>
+#include <SMESHDS_GroupBase.hxx>
+
 using namespace std;
 
 //=============================================================================
@@ -47,22 +51,40 @@ NETGENPlugin_Hypothesis_2D::NETGENPlugin_Hypothesis_2D (int hypId,
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 NETGENPlugin_RemesherHypothesis_2D::
 NETGENPlugin_RemesherHypothesis_2D (int hypId, SMESH_Gen * gen)
-  : NETGENPlugin_Hypothesis(hypId, gen)
+  : NETGENPlugin_Hypothesis(hypId, gen),
+    _ridgeAngle             ( DefaultRidgeAngle()             ),
+    _edgeCornerAngle        ( DefaultEdgeCornerAngle()        ),
+    _chartAngle             ( DefaultChartAngle()             ),
+    _outerChartAngle        ( DefaultOuterChartAngle()        ),
+    _restHChartDistFactor   ( DefaultRestHChartDistFactor()   ),
+    _restHChartDistEnable   ( DefaultRestHChartDistEnable()   ),
+    _restHLineLengthFactor  ( DefaultRestHLineLengthFactor()  ),
+    _restHLineLengthEnable  ( DefaultRestHLineLengthEnable()  ),
+    _restHCloseEdgeFactor   ( DefaultRestHCloseEdgeFactor()   ),
+    _restHCloseEdgeEnable   ( DefaultRestHCloseEdgeEnable()   ),
+    _restHSurfCurvFactor    ( DefaultRestHSurfCurvFactor()    ),
+    _restHSurfCurvEnable    ( DefaultRestHSurfCurvEnable()    ),
+    _restHEdgeAngleFactor   ( DefaultRestHEdgeAngleFactor()   ),
+    _restHEdgeAngleEnable   ( DefaultRestHEdgeAngleEnable()   ),
+    _restHSurfMeshCurvFactor( DefaultRestHSurfMeshCurvFactor()),
+    _restHSurfMeshCurvEnable( DefaultRestHSurfMeshCurvEnable()),
+    _keepExistingEdges      ( DefaultKeepExistingEdges()      ),
+    _makeGroupsOfSurfaces   ( DefaultMakeGroupsOfSurfaces()   ),
+    _fixedEdgeGroupID       ( -1                              ),
+    _loadOnCancel           ( false                           )
 {
   _name = "NETGEN_RemesherParameters_2D";
   _param_algo_dim = 2;
-
-  _ridgeAngle = DefaultRidgeAngle();
 }
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -75,15 +97,286 @@ void NETGENPlugin_RemesherHypothesis_2D::SetRidgeAngle( double angle )
   }
 }
 
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
+//=======================================================================
+//function : SetEdgeCornerAngle
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetEdgeCornerAngle( double angle )
+{
+  if ( _edgeCornerAngle != angle )
+  {
+    _edgeCornerAngle = angle;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetChartAngle
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetChartAngle( double angle )
+{
+  if ( _chartAngle != angle )
+  {
+    _chartAngle = angle;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetOuterChartAngle
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetOuterChartAngle( double angle )
+{
+  if ( _outerChartAngle != angle )
+  {
+    _outerChartAngle = angle;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetRestHChartDistFactor
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetRestHChartDistFactor( double f )
+{
+  if ( _restHChartDistFactor != f )
+  {
+    _restHChartDistFactor = f;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetRestHChartDistEnable
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetRestHChartDistEnable( bool enable )
+{
+  if ( _restHChartDistEnable != enable )
+  {
+    _restHChartDistEnable = enable;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetRestHLineLengthFactor
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetRestHLineLengthFactor( double f )
+{
+  if ( _restHLineLengthFactor != f )
+  {
+    _restHLineLengthFactor = f;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetRestHLineLengthEnable
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetRestHLineLengthEnable( bool enable )
+{
+  if ( _restHLineLengthEnable != enable )
+  {
+    _restHLineLengthEnable = enable;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetRestHCloseEdgeFactor
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetRestHCloseEdgeFactor( double f )
+{
+  if ( _restHCloseEdgeFactor != f )
+  {
+    _restHCloseEdgeFactor = f;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetRestHCloseEdgeEnable
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetRestHCloseEdgeEnable( bool enable )
+{
+  if ( _restHCloseEdgeEnable != enable )
+  {
+    _restHCloseEdgeEnable = enable;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetRestHSurfCurvFactor
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetRestHSurfCurvFactor( double f )
+{
+  if ( _restHSurfCurvFactor != f )
+  {
+    _restHSurfCurvFactor = f;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetRestHSurfCurvEnable
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetRestHSurfCurvEnable( bool enable )
+{
+  if ( _restHSurfCurvEnable != enable )
+  {
+    _restHSurfCurvEnable = enable;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetRestHEdgeAngleFactor
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetRestHEdgeAngleFactor( double f )
+{
+  if ( _restHEdgeAngleFactor != f )
+  {
+    _restHEdgeAngleFactor = f;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetRestHEdgeAngleEnable
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetRestHEdgeAngleEnable( bool enable )
+{
+  if ( _restHEdgeAngleEnable != enable )
+  {
+    _restHEdgeAngleEnable = enable;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetRestHSurfMeshCurvFactor
+//purpose  :
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetRestHSurfMeshCurvFactor( double f )
+{
+  if ( _restHSurfMeshCurvFactor != f )
+  {
+    _restHSurfMeshCurvFactor = f;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetRestHSurfMeshCurvEnable
+//purpose  :
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetRestHSurfMeshCurvEnable( bool enable )
+{
+  if ( _restHSurfMeshCurvEnable != enable )
+  {
+    _restHSurfMeshCurvEnable = enable;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetKeepExistingEdges
+//purpose  :
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetKeepExistingEdges( bool toKeep )
+{
+  if ( _keepExistingEdges != toKeep )
+  {
+    _keepExistingEdges = toKeep;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetMakeGroupsOfSurfaces
+//purpose  :
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetMakeGroupsOfSurfaces( bool toMake )
+{
+  if ( _makeGroupsOfSurfaces != toMake )
+  {
+    _makeGroupsOfSurfaces = toMake;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetFixedEdgeGroup
+//purpose  : Set a group of edges whose nodes must not be moved
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetFixedEdgeGroup( const SMESH_Group* edgeGroup )
+{
+  int id = edgeGroup ? edgeGroup->GetID() : -1;
+  if ( id != _fixedEdgeGroupID )
+  {
+    _fixedEdgeGroupID = id;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : SetLoadMeshOnCancel
+//purpose  : allow getting a current mesh existing upon CancelCompute()
+//=======================================================================
+
+void NETGENPlugin_RemesherHypothesis_2D::SetLoadMeshOnCancel( bool toLoad )
+{
+  if ( toLoad != _loadOnCancel )
+  {
+    _loadOnCancel = toLoad;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=======================================================================
+//function : GetFixedEdgeGroup
+//purpose  : Return a group of edges whose nodes must not be moved
+//=======================================================================
 
-double NETGENPlugin_RemesherHypothesis_2D::GetRidgeAngle() const
+SMESH_Group*
+NETGENPlugin_RemesherHypothesis_2D::GetFixedEdgeGroup( const SMESH_Mesh& mesh ) const
 {
-  return _ridgeAngle;
+  SMESH_Group* group = mesh.GetGroup( _fixedEdgeGroupID );
+  if ( group && group->GetGroupDS()->GetType() != SMDSAbs_Edge )
+    group = NULL;
+
+  return group;
 }
 
 //=============================================================================
@@ -97,6 +390,26 @@ std::ostream & NETGENPlugin_RemesherHypothesis_2D::SaveTo(std::ostream & save)
   NETGENPlugin_Hypothesis::SaveTo( save );
   save << " " << _ridgeAngle;
 
+  save << " " << _edgeCornerAngle        ;
+  save << " " << _chartAngle             ;
+  save << " " << _outerChartAngle        ;
+  save << " " << _restHChartDistFactor   ;
+  save << " " << _restHChartDistEnable   ;
+  save << " " << _restHLineLengthFactor  ;
+  save << " " << _restHLineLengthEnable  ;
+  save << " " << _restHCloseEdgeFactor   ;
+  save << " " << _restHCloseEdgeEnable   ;
+  save << " " << _restHSurfCurvFactor    ;
+  save << " " << _restHSurfCurvEnable    ;
+  save << " " << _restHEdgeAngleFactor   ;
+  save << " " << _restHEdgeAngleEnable   ;
+  save << " " << _restHSurfMeshCurvFactor;
+  save << " " << _restHSurfMeshCurvEnable;
+  save << " " << _keepExistingEdges      ;
+  save << " " << _makeGroupsOfSurfaces   ;
+  save << " " << _fixedEdgeGroupID       ;
+  save << " " << _loadOnCancel           ;
+
   return save;
 }
 
@@ -117,5 +430,81 @@ std::istream & NETGENPlugin_RemesherHypothesis_2D::LoadFrom(std::istream & load)
   if ( !load )
     _ridgeAngle = DefaultRidgeAngle();
 
+  load >> _edgeCornerAngle;
+  if ( !load )
+    _edgeCornerAngle = DefaultEdgeCornerAngle();
+
+  load >> _chartAngle;
+  if ( !load )
+    _chartAngle = DefaultChartAngle();
+
+  load >> _outerChartAngle;
+  if ( !load )
+    _outerChartAngle = DefaultOuterChartAngle();
+
+  load >> _restHChartDistFactor;
+  if ( !load )
+    _restHChartDistFactor = DefaultRestHChartDistFactor();
+
+  load >> _restHChartDistEnable;
+  if ( !load )
+    _restHChartDistEnable = DefaultRestHChartDistEnable();
+
+  load >> _restHLineLengthFactor;
+  if ( !load )
+    _restHLineLengthFactor = DefaultRestHLineLengthFactor();
+
+  load >> _restHLineLengthEnable;
+  if ( !load )
+    _restHLineLengthEnable = DefaultRestHLineLengthEnable();
+
+  load >> _restHCloseEdgeFactor;
+  if ( !load )
+    _restHCloseEdgeFactor = DefaultRestHCloseEdgeFactor();
+
+  load >> _restHCloseEdgeEnable;
+  if ( !load )
+    _restHCloseEdgeEnable = DefaultRestHCloseEdgeEnable();
+
+  load >> _restHSurfCurvFactor;
+  if ( !load )
+    _restHSurfCurvFactor = DefaultRestHSurfCurvFactor();
+
+  load >> _restHSurfCurvEnable;
+  if ( !load )
+    _restHSurfCurvEnable = DefaultRestHSurfCurvEnable();
+
+  load >> _restHEdgeAngleFactor;
+  if ( !load )
+    _restHEdgeAngleFactor = DefaultRestHEdgeAngleFactor();
+
+  load >> _restHEdgeAngleEnable;
+  if ( !load )
+    _restHEdgeAngleEnable = DefaultRestHEdgeAngleEnable();
+
+  load >> _restHSurfMeshCurvFactor;
+  if ( !load )
+    _restHSurfMeshCurvFactor = DefaultRestHSurfMeshCurvFactor();
+
+  load >> _restHSurfMeshCurvEnable;
+  if ( !load )
+    _restHSurfMeshCurvEnable = DefaultRestHSurfMeshCurvEnable();
+
+  load >> _keepExistingEdges;
+  if ( !load )
+    _keepExistingEdges = DefaultKeepExistingEdges();
+
+  load >> _makeGroupsOfSurfaces;
+  if ( !load )
+    _makeGroupsOfSurfaces = DefaultMakeGroupsOfSurfaces();
+
+  load >> _fixedEdgeGroupID;
+  if ( !load )
+    _fixedEdgeGroupID = -1;
+
+  load >> _loadOnCancel;
+  if ( !load )
+    _loadOnCancel = false;
+
   return load;
 }
index 877e99545fe90c58b4b566cdd3cc43d074736bfc..4f9c9b15185d0bcae4fe9866e2745700fb2721de 100644 (file)
@@ -35,7 +35,9 @@
 #include "NETGENPlugin_Hypothesis.hxx"
 #include "Utils_SALOME_Exception.hxx"
 
-//  Parameters for work of NETGEN.
+class SMESH_Group;
+
+//  Parameters of NETGEN.
 // This class is just to give 2D dimension, actually
 // it inherits all behaviour of the parent 
 
@@ -45,14 +47,6 @@ public:
 
   NETGENPlugin_Hypothesis_2D(int hypId, SMESH_Gen * gen);
 
-  // void SetQuadAllowed(bool theVal);
-  // bool GetQuadAllowed() const { return _quadAllowed; }
-  // static bool GetDefaultQuadAllowed();
-
-  // Persistence
-  // virtual ostream & SaveTo(ostream & save);
-  // virtual istream & LoadFrom(istream & load);
-
 // private:
 //   bool _quadAllowed;
 };
@@ -67,17 +61,117 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_RemesherHypothesis_2D: public NETGENPlugi
 
   NETGENPlugin_RemesherHypothesis_2D(int hypId, SMESH_Gen * gen);
 
-  void SetRidgeAngle( double angle );
-  double GetRidgeAngle() const;
+  void   SetRidgeAngle( double angle );
+  double GetRidgeAngle() const{ return _ridgeAngle; }
+
+  void   SetEdgeCornerAngle( double angle );
+  double GetEdgeCornerAngle() const { return _edgeCornerAngle; }
+
+  void   SetChartAngle( double angle );
+  double GetChartAngle() const { return _chartAngle; }
+
+  void   SetOuterChartAngle( double angle );
+  double GetOuterChartAngle() const { return _outerChartAngle; }
+
+  void   SetRestHChartDistFactor( double f );
+  double GetRestHChartDistFactor() const { return _restHChartDistFactor; }
+
+  void   SetRestHChartDistEnable( bool enable );
+  bool   GetRestHChartDistEnable() const { return _restHChartDistEnable; }
+
+  void   SetRestHLineLengthFactor( double f );
+  double GetRestHLineLengthFactor() const { return _restHLineLengthFactor; }
+
+  void   SetRestHLineLengthEnable( bool enable );
+  bool   GetRestHLineLengthEnable() const { return _restHLineLengthEnable; }
+
+  void   SetRestHCloseEdgeFactor( double f );
+  double GetRestHCloseEdgeFactor() const { return _restHCloseEdgeFactor; }
+
+  void   SetRestHCloseEdgeEnable( bool enable );
+  bool   GetRestHCloseEdgeEnable() const { return _restHCloseEdgeEnable; }
 
-  static double DefaultRidgeAngle() { return 30.; }
+  void   SetRestHSurfCurvFactor( double f );
+  double GetRestHSurfCurvFactor() const { return _restHSurfCurvFactor; }
+
+  void   SetRestHSurfCurvEnable( bool enable );
+  bool   GetRestHSurfCurvEnable() const { return _restHSurfCurvEnable; }
+
+  void   SetRestHEdgeAngleFactor( double f );
+  double GetRestHEdgeAngleFactor() const { return _restHEdgeAngleFactor; }
+
+  void   SetRestHEdgeAngleEnable( bool enable );
+  bool   GetRestHEdgeAngleEnable() const { return _restHEdgeAngleEnable; }
+
+  void   SetRestHSurfMeshCurvFactor( double f );
+  double GetRestHSurfMeshCurvFactor() const { return _restHSurfMeshCurvFactor; }
+
+  void   SetRestHSurfMeshCurvEnable( bool enable );
+  bool   GetRestHSurfMeshCurvEnable() const { return _restHSurfMeshCurvEnable; }
+
+  void   SetKeepExistingEdges( bool toKeep );
+  bool   GetKeepExistingEdges() const { return _keepExistingEdges; }
+
+  void   SetMakeGroupsOfSurfaces( bool toMake );
+  bool   GetMakeGroupsOfSurfaces() const { return _makeGroupsOfSurfaces; }
+
+  void   SetFixedEdgeGroup( const SMESH_Group* edgeGroup );
+  int    GetFixedEdgeGroupID() const { return _fixedEdgeGroupID; }
+  SMESH_Group* GetFixedEdgeGroup( const SMESH_Mesh& mesh ) const;
+
+  void   SetLoadMeshOnCancel( bool toLoad );
+  bool   GetLoadMeshOnCancel() const { return _loadOnCancel; }
+
+  static double DefaultRidgeAngle()              { return 30.; }
+  static double DefaultEdgeCornerAngle()         { return 60.; }
+  static double DefaultChartAngle()              { return 15.; }
+  static double DefaultOuterChartAngle()         { return 70.; }
+  static double DefaultRestHChartDistFactor()    { return 1.2; }
+  static bool   DefaultRestHChartDistEnable()    { return true; }
+  static double DefaultRestHLineLengthFactor()   { return 0.5; }
+  static bool   DefaultRestHLineLengthEnable()   { return true; }
+  static double DefaultRestHCloseEdgeFactor()    { return 1.; }
+  static bool   DefaultRestHCloseEdgeEnable()    { return true; }
+  static double DefaultRestHSurfCurvFactor()     { return 1.; }
+  static bool   DefaultRestHSurfCurvEnable()     { return false; }
+  static double DefaultRestHEdgeAngleFactor()    { return 1.; }
+  static bool   DefaultRestHEdgeAngleEnable()    { return false; }
+  static double DefaultRestHSurfMeshCurvFactor() { return 1.; }
+  static bool   DefaultRestHSurfMeshCurvEnable() { return false; }
+  static bool   DefaultKeepExistingEdges()       { return false; }
+  static bool   DefaultMakeGroupsOfSurfaces()    { return false; }
 
   virtual std::ostream & SaveTo(std::ostream & save);
   virtual std::istream & LoadFrom(std::istream & load);
 
  private:
 
-  double _ridgeAngle; // in degrees
+  // STL charts
+  double _ridgeAngle; // yellow edges angle (in degrees)
+  double _edgeCornerAngle;
+  double _chartAngle;
+  double _outerChartAngle;
+
+  // Mesh size: restrict h due to ...
+  double _restHChartDistFactor;    // chart distance
+  bool   _restHChartDistEnable;
+  double _restHLineLengthFactor;   // line length
+  bool   _restHLineLengthEnable;
+  double _restHCloseEdgeFactor;    // close edges
+  bool   _restHCloseEdgeEnable;
+  double _restHSurfCurvFactor;     // surface curvature
+  bool   _restHSurfCurvEnable;
+  double _restHEdgeAngleFactor;    // edge angle
+  bool   _restHEdgeAngleEnable;
+  double _restHSurfMeshCurvFactor; // surface mesh curv
+  bool   _restHSurfMeshCurvEnable;
+
+  // SALOME features
+  bool   _keepExistingEdges;
+  bool   _makeGroupsOfSurfaces;
+  int    _fixedEdgeGroupID;
+  bool   _loadOnCancel;
+
 };
 
 #endif
index 2a2ffa3360248fb18f3a8f500d43d7d845c70d4e..9652d55ca6f57abe3bff9fe08643f16a95b7979d 100644 (file)
 //=============================================================================
 //
 #include "NETGENPlugin_Hypothesis_2D_i.hxx"
-#include "SMESH_Gen.hxx"
-#include "SMESH_PythonDump.hxx"
+
+#include <SMESH_Gen.hxx>
+#include <SMESH_Gen_i.hxx>
+#include <SMESH_Group_i.hxx>
+#include <SMESH_Group.hxx>
+#include <SMESH_PythonDump.hxx>
 
 //=============================================================================
 /*!
@@ -141,9 +145,12 @@ CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::IsDimSupported( SMESH::Dime
 
 void NETGENPlugin_RemesherHypothesis_2D_i::SetRidgeAngle( CORBA::Double angle )
 {
-  GetImpl()->SetRidgeAngle( angle );
+  if ( GetRidgeAngle() != angle )
+  {
+    GetImpl()->SetRidgeAngle( angle );
 
-  SMESH::TPythonDump() << _this() << ".SetRidgeAngle( " << SMESH::TVar(angle) << " )";
+    SMESH::TPythonDump() << _this() << ".SetRidgeAngle( " << SMESH::TVar(angle) << " )";
+  }
 }
 
 //================================================================================
@@ -156,3 +163,306 @@ CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRidgeAngle()
 {
   return GetImpl()->GetRidgeAngle();
 }
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetEdgeCornerAngle(CORBA::Double angle )
+{
+  if ( GetEdgeCornerAngle() != angle )
+  {
+    GetImpl()->SetEdgeCornerAngle( angle );
+
+    SMESH::TPythonDump() << _this() << ".SetEdgeCornerAngle( " << SMESH::TVar(angle) << " )";
+  }
+}
+
+CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetEdgeCornerAngle()
+{
+  return GetImpl()->GetEdgeCornerAngle();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetChartAngle(CORBA::Double angle )
+{
+  if ( GetChartAngle() != angle )
+  {
+    GetImpl()->SetChartAngle( angle );
+
+    SMESH::TPythonDump() << _this() << ".SetChartAngle( " << SMESH::TVar(angle) << " )";
+  }
+}
+
+CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetChartAngle()
+{
+  return GetImpl()->GetChartAngle();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetOuterChartAngle(CORBA::Double angle )
+{
+  if ( GetOuterChartAngle() != angle )
+  {
+    GetImpl()->SetOuterChartAngle( angle );
+
+    SMESH::TPythonDump() << _this() << ".SetOuterChartAngle( " << SMESH::TVar(angle) << " )";
+  }
+}
+
+CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetOuterChartAngle()
+{
+  return GetImpl()->GetOuterChartAngle();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHChartDistFactor(CORBA::Double f )
+{
+  if ( GetRestHChartDistFactor() != f )
+  {
+    GetImpl()->SetRestHChartDistFactor( f );
+
+    SMESH::TPythonDump() << _this() << ".SetRestHChartDistFactor( " << SMESH::TVar(f) << " )";
+  }
+}
+
+CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHChartDistFactor()
+{
+  return GetImpl()->GetRestHChartDistFactor();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHChartDistEnable(CORBA::Boolean enable )
+{
+  if ( GetRestHChartDistEnable() != enable )
+  {
+    GetImpl()->SetRestHChartDistEnable( enable );
+
+    SMESH::TPythonDump() << _this() << ".SetRestHChartDistEnable( " << enable << " )";
+  }
+}
+
+CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHChartDistEnable()
+{
+  return GetImpl()->GetRestHChartDistEnable();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHLineLengthFactor(CORBA::Double f )
+{
+  if ( GetRestHLineLengthFactor() != f )
+  {
+    GetImpl()->SetRestHLineLengthFactor( f );
+
+    SMESH::TPythonDump() << _this() << ".SetRestHLineLengthFactor( " << SMESH::TVar(f) << " )";
+  }
+}
+
+CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHLineLengthFactor()
+{
+  return GetImpl()->GetRestHLineLengthFactor();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHLineLengthEnable(CORBA::Boolean enable )
+{
+  if ( GetRestHLineLengthEnable() != enable )
+  {
+    GetImpl()->SetRestHLineLengthEnable( enable );
+
+    SMESH::TPythonDump() << _this() << ".SetRestHLineLengthEnable( " << enable << " )";
+  }
+}
+
+CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHLineLengthEnable()
+{
+  return GetImpl()->GetRestHLineLengthEnable();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHCloseEdgeFactor(CORBA::Double f )
+{
+  if ( GetRestHCloseEdgeFactor() != f )
+  {
+    GetImpl()->SetRestHCloseEdgeFactor( f );
+
+    SMESH::TPythonDump() << _this() << ".SetRestHCloseEdgeFactor( " << SMESH::TVar(f) << " )";
+  }
+}
+
+CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHCloseEdgeFactor()
+{
+  return GetImpl()->GetRestHCloseEdgeFactor();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHCloseEdgeEnable(CORBA::Boolean enable )
+{
+  if ( GetRestHCloseEdgeEnable() != enable )
+  {
+    GetImpl()->SetRestHCloseEdgeEnable( enable );
+
+    SMESH::TPythonDump() << _this() << ".SetRestHCloseEdgeEnable( " << enable << " )";
+  }
+}
+
+CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHCloseEdgeEnable()
+{
+  return GetImpl()->GetRestHCloseEdgeEnable();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHSurfCurvFactor(CORBA::Double f )
+{
+  if ( GetRestHSurfCurvFactor() != f )
+  {
+    GetImpl()->SetRestHSurfCurvFactor( f );
+
+    SMESH::TPythonDump() << _this() << ".SetRestHSurfCurvFactor( " << SMESH::TVar(f) << " )";
+  }
+}
+
+CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHSurfCurvFactor()
+{
+  return GetImpl()->GetRestHSurfCurvFactor();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHSurfCurvEnable(CORBA::Boolean enable )
+{
+  if ( GetRestHSurfCurvEnable() != enable )
+  {
+    GetImpl()->SetRestHSurfCurvEnable( enable );
+
+    SMESH::TPythonDump() << _this() << ".SetRestHSurfCurvEnable( " << enable << " )";
+  }
+}
+
+CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHSurfCurvEnable()
+{
+  return GetImpl()->GetRestHSurfCurvEnable();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHEdgeAngleFactor(CORBA::Double f )
+{
+  if ( GetRestHEdgeAngleFactor() != f )
+  {
+    GetImpl()->SetRestHEdgeAngleFactor( f );
+
+    SMESH::TPythonDump() << _this() << ".SetRestHEdgeAngleFactor( " << SMESH::TVar(f) << " )";
+  }
+}
+
+CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHEdgeAngleFactor()
+{
+  return GetImpl()->GetRestHEdgeAngleFactor();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHEdgeAngleEnable(CORBA::Boolean enable )
+{
+  if ( GetRestHEdgeAngleEnable() != enable )
+  {
+    GetImpl()->SetRestHEdgeAngleEnable( enable );
+
+    SMESH::TPythonDump() << _this() << ".SetRestHEdgeAngleEnable( " << enable << " )";
+  }
+}
+
+CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHEdgeAngleEnable()
+{
+  return GetImpl()->GetRestHEdgeAngleEnable();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHSurfMeshCurvFactor(CORBA::Double f )
+{
+  if ( GetRestHSurfMeshCurvFactor() != f )
+  {
+    GetImpl()->SetRestHSurfMeshCurvFactor( f );
+
+    SMESH::TPythonDump() << _this() << ".SetRestHSurfMeshCurvFactor( " << SMESH::TVar(f) << " )";
+  }
+}
+
+CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHSurfMeshCurvFactor()
+{
+  return GetImpl()->GetRestHSurfMeshCurvFactor();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHSurfMeshCurvEnable(CORBA::Boolean enable )
+{
+  if ( GetRestHSurfMeshCurvEnable() != enable )
+  {
+    GetImpl()->SetRestHSurfMeshCurvEnable( enable );
+
+    SMESH::TPythonDump() << _this() << ".SetRestHSurfMeshCurvEnable( " << enable << " )";
+  }
+}
+
+CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHSurfMeshCurvEnable()
+{
+  return GetImpl()->GetRestHSurfMeshCurvEnable();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetKeepExistingEdges( CORBA::Boolean toKeep )
+{
+  if ( GetKeepExistingEdges() != toKeep )
+  {
+    GetImpl()->SetKeepExistingEdges( toKeep );
+
+    SMESH::TPythonDump() << _this() << ".SetKeepExistingEdges( " << toKeep << " )";
+  }
+}
+
+CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetKeepExistingEdges()
+{
+  return GetImpl()->GetKeepExistingEdges();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetMakeGroupsOfSurfaces( CORBA::Boolean toMake )
+{
+  if ( GetMakeGroupsOfSurfaces() != toMake )
+  {
+    GetImpl()->SetMakeGroupsOfSurfaces( toMake );
+
+    SMESH::TPythonDump() << _this() << ".SetMakeGroupsOfSurfaces( " << toMake << " )";
+  }
+}
+
+CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetMakeGroupsOfSurfaces()
+{
+  return GetImpl()->GetMakeGroupsOfSurfaces();
+}
+
+void
+NETGENPlugin_RemesherHypothesis_2D_i::SetFixedEdgeGroup( SMESH::SMESH_GroupBase_ptr edgeGroup )
+{
+  const SMESH_Group * group = 0;
+  if ( SMESH_GroupBase_i* group_i = SMESH::DownCast< SMESH_GroupBase_i* >( edgeGroup ))
+  {
+    if ( group_i->GetType() == SMESH::EDGE )
+      group = group_i->GetSmeshGroup();
+  }
+
+  int id = group ? group->GetID() : -1;
+  if ( id != GetImpl()->GetFixedEdgeGroupID() )
+  {
+    GetImpl()->SetFixedEdgeGroup( group );
+    SMESH::TPythonDump() << _this() << ".SetFixedEdgeGroup( " << edgeGroup << " )";
+  }
+}
+
+SMESH::SMESH_GroupBase_ptr
+NETGENPlugin_RemesherHypothesis_2D_i::GetFixedEdgeGroup( SMESH::SMESH_Mesh_ptr mesh )
+{
+  SMESH::SMESH_GroupBase_var resGroup;
+  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast< SMESH_Mesh_i* >( mesh ))
+  {
+    const std::map<int, SMESH::SMESH_GroupBase_ptr>& groups = mesh_i->getGroups();
+    std::map<int, SMESH::SMESH_GroupBase_ptr>::const_iterator i_gr =
+      groups.find( GetImpl()->GetFixedEdgeGroupID() );
+    if ( i_gr != groups.end() && i_gr->second->GetType() == SMESH::EDGE )
+      resGroup = SMESH::SMESH_GroupBase::_duplicate( i_gr->second );
+  }
+  return resGroup._retn();
+}
+
+void NETGENPlugin_RemesherHypothesis_2D_i::SetLoadMeshOnCancel( CORBA::Boolean toMake )
+{
+  if ( GetLoadMeshOnCancel() != toMake )
+  {
+    GetImpl()->SetLoadMeshOnCancel( toMake );
+
+    SMESH::TPythonDump() << _this() << ".SetLoadMeshOnCancel( " << toMake << " )";
+  }
+}
+
+CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetLoadMeshOnCancel()
+{
+  return GetImpl()->GetLoadMeshOnCancel();
+}
index a3bfa8dbcbde5fcb5e45b3cd79c711394e3f3be7..b98677bad14d15e3fa90ef91e8fa2fdb29fb088b 100644 (file)
@@ -81,9 +81,66 @@ class NETGENPLUGIN_EXPORT  NETGENPlugin_RemesherHypothesis_2D_i:
                                         ::SMESH_Gen*            theGenImpl);
 
   void SetRidgeAngle( CORBA::Double angle );
-
   CORBA::Double GetRidgeAngle();
 
+  void SetEdgeCornerAngle( CORBA::Double angle );
+  CORBA::Double GetEdgeCornerAngle();
+
+  void SetChartAngle( CORBA::Double angle );
+  CORBA::Double GetChartAngle();
+
+  void SetOuterChartAngle( CORBA::Double angle );
+  CORBA::Double GetOuterChartAngle();
+
+  void SetRestHChartDistFactor( CORBA::Double f );
+  CORBA::Double GetRestHChartDistFactor();
+
+  void SetRestHChartDistEnable( CORBA::Boolean enable );
+  CORBA::Boolean GetRestHChartDistEnable();
+
+  void SetRestHLineLengthFactor( CORBA::Double f );
+  CORBA::Double GetRestHLineLengthFactor();
+
+  void SetRestHLineLengthEnable( CORBA::Boolean enable );
+  CORBA::Boolean GetRestHLineLengthEnable();
+
+  void SetRestHCloseEdgeFactor( CORBA::Double f );
+  CORBA::Double GetRestHCloseEdgeFactor();
+
+  void SetRestHCloseEdgeEnable( CORBA::Boolean enable );
+  CORBA::Boolean GetRestHCloseEdgeEnable();
+
+  void SetRestHSurfCurvFactor( CORBA::Double f );
+  CORBA::Double GetRestHSurfCurvFactor();
+
+  void SetRestHSurfCurvEnable( CORBA::Boolean enable );
+  CORBA::Boolean GetRestHSurfCurvEnable();
+
+  void SetRestHEdgeAngleFactor( CORBA::Double f );
+  CORBA::Double GetRestHEdgeAngleFactor();
+
+  void SetRestHEdgeAngleEnable( CORBA::Boolean enable );
+  CORBA::Boolean GetRestHEdgeAngleEnable();
+
+  void SetRestHSurfMeshCurvFactor( CORBA::Double f );
+  CORBA::Double GetRestHSurfMeshCurvFactor();
+
+  void SetRestHSurfMeshCurvEnable( CORBA::Boolean enable );
+  CORBA::Boolean GetRestHSurfMeshCurvEnable();
+
+  void SetKeepExistingEdges( CORBA::Boolean toKeep );
+  CORBA::Boolean GetKeepExistingEdges();
+
+  void SetMakeGroupsOfSurfaces( CORBA::Boolean toMake );
+  CORBA::Boolean GetMakeGroupsOfSurfaces();
+
+  void SetFixedEdgeGroup( SMESH::SMESH_GroupBase_ptr edgeGroup );
+  SMESH::SMESH_GroupBase_ptr GetFixedEdgeGroup( SMESH::SMESH_Mesh_ptr mesh );
+
+  void SetLoadMeshOnCancel( CORBA::Boolean toLoad );
+  CORBA::Boolean GetLoadMeshOnCancel();
+
+
   // Get implementation
   ::NETGENPlugin_RemesherHypothesis_2D* GetImpl();
 
index 4da301ebb395318b9425fc1c672e1a64c9c3688a..c64dca3e76fc16ac82418e11e69c04ff2571e05e 100644 (file)
@@ -470,6 +470,175 @@ CORBA::Boolean NETGENPlugin_Hypothesis_i::GetFuseEdges()
   return this->GetImpl()->GetFuseEdges();
 }
 
+//=======================================================================
+//function : SetNbSurfOptSteps
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis_i::SetNbSurfOptSteps(CORBA::Short nb )
+{
+  if ( GetNbSurfOptSteps() != nb )
+  {
+    this->GetImpl()->SetNbSurfOptSteps( nb );
+    SMESH::TPythonDump() << _this() << ".SetNbSurfOptSteps( " << SMESH::TVar(nb) << " )";
+  }
+}
+
+//=======================================================================
+//function : GetNbSurfOptSteps
+//purpose  :
+//=======================================================================
+
+CORBA::Short NETGENPlugin_Hypothesis_i::GetNbSurfOptSteps()
+{
+  return GetImpl()->GetNbSurfOptSteps();
+}
+
+//=======================================================================
+//function : SetNbVolOptSteps
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis_i::SetNbVolOptSteps(CORBA::Short nb )
+{
+  if ( GetNbVolOptSteps() != nb )
+  {
+    this->GetImpl()->SetNbVolOptSteps( nb );
+    SMESH::TPythonDump() << _this() << ".SetNbVolOptSteps( " << SMESH::TVar(nb) << " )";
+  }
+
+}
+
+//=======================================================================
+//function : GetNbVolOptSteps
+//purpose  :
+//=======================================================================
+
+CORBA::Short NETGENPlugin_Hypothesis_i::GetNbVolOptSteps()
+{
+  return GetImpl()->GetNbVolOptSteps();
+}
+
+//=======================================================================
+//function : SetElemSizeWeight
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis_i::SetElemSizeWeight(CORBA::Double size )
+{
+  if ( GetElemSizeWeight() != size )
+  {
+    this->GetImpl()->SetElemSizeWeight( size );
+    SMESH::TPythonDump() << _this() << ".SetElemSizeWeight( " << SMESH::TVar(size) << " )";
+  }
+}
+
+//=======================================================================
+//function : GetElemSizeWeight
+//purpose  :
+//=======================================================================
+
+CORBA::Double NETGENPlugin_Hypothesis_i::GetElemSizeWeight()
+{
+  return GetImpl()->GetElemSizeWeight();
+}
+
+//=======================================================================
+//function : SetWorstElemMeasure
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis_i::SetWorstElemMeasure(CORBA::Short val )
+{
+  if ( GetWorstElemMeasure() != val )
+  {
+    this->GetImpl()->SetWorstElemMeasure( val );
+    SMESH::TPythonDump() << _this() << ".SetWorstElemMeasure( " << SMESH::TVar(val) << " )";
+  }
+}
+
+//=======================================================================
+//function : GetWorstElemMeasure
+//purpose  : 
+//=======================================================================
+
+CORBA::Short NETGENPlugin_Hypothesis_i::GetWorstElemMeasure()
+{
+  return GetImpl()->GetWorstElemMeasure();
+}
+
+//=======================================================================
+//function : SetUseDelauney
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis_i::SetUseDelauney(CORBA::Boolean toUse)
+{
+  if ( GetUseDelauney() != toUse )
+  {
+    this->GetImpl()->SetUseDelauney( toUse );
+    SMESH::TPythonDump() << _this() << ".SetUseDelauney( " << toUse << " )";
+  }
+}
+
+//=======================================================================
+//function : GetUseDelauney
+//purpose  : 
+//=======================================================================
+
+CORBA::Boolean NETGENPlugin_Hypothesis_i::GetUseDelauney()
+{
+  return GetImpl()->GetUseDelauney();
+}
+
+//=======================================================================
+//function : SetCheckOverlapping
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis_i::SetCheckOverlapping(CORBA::Boolean toCheck )
+{
+  if ( GetCheckOverlapping() != toCheck )
+  {
+    this->GetImpl()->SetCheckOverlapping( toCheck );
+    SMESH::TPythonDump() << _this() << ".SetCheckOverlapping( " << toCheck << " )";
+  }
+}
+
+//=======================================================================
+//function : GetCheckOverlapping
+//purpose  : 
+//=======================================================================
+
+CORBA::Boolean NETGENPlugin_Hypothesis_i::GetCheckOverlapping()
+{
+  return GetImpl()->GetCheckOverlapping();
+}
+
+//=======================================================================
+//function : SetCheckChartBoundary
+//purpose  : 
+//=======================================================================
+
+void NETGENPlugin_Hypothesis_i::SetCheckChartBoundary(CORBA::Boolean toCheck )
+{
+  if ( GetCheckChartBoundary() != toCheck )
+  {
+    this->GetImpl()->SetCheckChartBoundary( toCheck );
+    SMESH::TPythonDump() << _this() << ".SetCheckChartBoundary( " << toCheck << " )";
+  }
+}
+
+//=======================================================================
+//function : GetCheckChartBoundary
+//purpose  : Get implementation
+//=======================================================================
+
+CORBA::Boolean NETGENPlugin_Hypothesis_i::GetCheckChartBoundary()
+{
+  return GetImpl()->GetCheckChartBoundary();
+}
+
 //=============================================================================
 /*!
  *  NETGENPlugin_Hypothesis_i::GetImpl
index 59963e6faeb6b0db1a104f7365a9edb5f74a8c3d..6dcd6af212968f4eaf7433b5fd5f99abceaedb21 100644 (file)
@@ -102,9 +102,30 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
   void SetFuseEdges(CORBA::Boolean theVal);
   CORBA::Boolean GetFuseEdges();
 
+  void    SetNbSurfOptSteps(CORBA::Short nb );
+  CORBA::Short GetNbSurfOptSteps();
+
+  void    SetNbVolOptSteps(CORBA::Short nb );
+  CORBA::Short GetNbVolOptSteps();
+
+  void    SetElemSizeWeight(CORBA::Double size );
+  CORBA::Double GetElemSizeWeight();
+
+  void    SetWorstElemMeasure(CORBA::Short val );
+  CORBA::Short GetWorstElemMeasure();
+
+  void    SetUseDelauney(CORBA::Boolean toUse);
+  CORBA::Boolean GetUseDelauney();
+
+  void    SetCheckOverlapping(CORBA::Boolean toCheck );
+  CORBA::Boolean GetCheckOverlapping();
+
+  void    SetCheckChartBoundary(CORBA::Boolean toCheck );
+  CORBA::Boolean GetCheckChartBoundary();
+
   // Get implementation
   ::NETGENPlugin_Hypothesis* GetImpl();
-  
+
   // Verify whether hypothesis supports given entity type 
   CORBA::Boolean IsDimSupported( SMESH::Dimension type );
 
index 877b0a96b28a6612a23b2bbbc7766eec166b48fb..d1b32d9835cb37fa7296e5ec756027a86e0bd8cf 100644 (file)
@@ -90,18 +90,14 @@ namespace netgen {
   extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
 #endif
   //extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh);
-#if defined(NETGEN_V5) && defined(WIN32)
-  DLL_HEADER 
-#endif
+
+  NETGENPLUGIN_DLL_HEADER
   extern MeshingParameters mparam;
-#if defined(NETGEN_V5) && defined(WIN32)
-  DLL_HEADER 
-#endif
+
+  NETGENPLUGIN_DLL_HEADER
   extern volatile multithreadt multithread;
 
-#if defined(NETGEN_V5) && defined(WIN32)
-  DLL_HEADER 
-#endif
+  NETGENPLUGIN_DLL_HEADER
   extern bool merge_solids;
 
   // values used for occgeo.facemeshstatus
@@ -285,25 +281,32 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
     netgen::MeshingParameters& mparams = netgen::mparam;
     // Initialize global NETGEN parameters:
     // maximal mesh segment size
-    mparams.maxh            = hyp->GetMaxSize();
+    mparams.maxh               = hyp->GetMaxSize();
     // maximal mesh element linear size
-    mparams.minh            = hyp->GetMinSize();
+    mparams.minh               = hyp->GetMinSize();
     // minimal number of segments per edge
-    mparams.segmentsperedge = hyp->GetNbSegPerEdge();
+    mparams.segmentsperedge    = hyp->GetNbSegPerEdge();
     // rate of growth of size between elements
-    mparams.grading         = hyp->GetGrowthRate();
+    mparams.grading            = hyp->GetGrowthRate();
     // safety factor for curvatures (elements per radius)
-    mparams.curvaturesafety = hyp->GetNbSegPerRadius();
+    mparams.curvaturesafety    = hyp->GetNbSegPerRadius();
     // create elements of second order
-    mparams.secondorder     = hyp->GetSecondOrder() ? 1 : 0;
+    mparams.secondorder        = hyp->GetSecondOrder() ? 1 : 0;
     // quad-dominated surface meshing
-    mparams.quad            = hyp->GetQuadAllowed() ? 1 : 0;
-    _optimize               = hyp->GetOptimize();
-    _fineness               = hyp->GetFineness();
-    mparams.uselocalh       = hyp->GetSurfaceCurvature();
-    netgen::merge_solids    = hyp->GetFuseEdges();
-    _chordalError           = hyp->GetChordalErrorEnabled() ? hyp->GetChordalError() : -1.;
-    _simpleHyp              = NULL;
+    mparams.quad               = hyp->GetQuadAllowed() ? 1 : 0;
+    _optimize                  = hyp->GetOptimize();
+    _fineness                  = hyp->GetFineness();
+    mparams.uselocalh          = hyp->GetSurfaceCurvature();
+    netgen::merge_solids       = hyp->GetFuseEdges();
+    _chordalError              = hyp->GetChordalErrorEnabled() ? hyp->GetChordalError() : -1.;
+    mparams.optsteps2d         = hyp->GetNbSurfOptSteps();
+    mparams.optsteps3d         = hyp->GetNbVolOptSteps();
+    mparams.elsizeweight       = hyp->GetElemSizeWeight();
+    mparams.opterrpow          = hyp->GetWorstElemMeasure();
+    mparams.delaunay           = hyp->GetUseDelauney();
+    mparams.checkoverlap       = hyp->GetCheckOverlapping();
+    mparams.checkchartboundary = hyp->GetCheckChartBoundary();
+    _simpleHyp                 = NULL;
     // mesh size file
     mparams.meshsizefilename= hyp->GetMeshSizeFile().empty() ? 0 : hyp->GetMeshSizeFile().c_str();
 
@@ -3382,7 +3385,7 @@ bool NETGENPlugin_Mesher::Compute()
           SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
           if ( !smComputed && ( !smError || smError->IsOK() ))
           {
-            smError.reset( new SMESH_ComputeError( *error ));
+            smError = error;
             if ( nbVol && SMESH_Algo::GetMeshError( sm ) == SMESH_Algo::MEr_OK )
             {
               smError->myName = COMPERR_WARNING;
index 59baa3eb9b80b6e95b8b24c9b3a3728db415d981..4a2a4aa8b20260b5678f1f0221241d09bdd8c222 100644 (file)
@@ -68,9 +68,7 @@ namespace netgen {
 #else
   extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
 #endif
-#if defined(NETGEN_V5) && defined(WIN32)
-  DLL_HEADER 
-#endif
+  NETGENPLUGIN_DLL_HEADER
   extern MeshingParameters mparam;
   extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh);
 }
index dee55a6380fcbc72451e0ec83f32ad9271735f4c..4228a3508229decca5464d0a71693e811341afbf 100644 (file)
@@ -81,13 +81,11 @@ namespace netgen {
 #else
   extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
 #endif
-#if defined(NETGEN_V5) && defined(WIN32)
-  DLL_HEADER 
-#endif
-extern MeshingParameters mparam;
-#if defined(NETGEN_V5) && defined(WIN32)
-  DLL_HEADER
-#endif
+
+  NETGENPLUGIN_DLL_HEADER
+  extern MeshingParameters mparam;
+
+  NETGENPLUGIN_DLL_HEADER
   extern volatile multithreadt multithread;
 }
 using namespace nglib;
index 0baf5f7a2d26f5deaa4c2b931a000a66c0ec6116..1d8a2c420f4297baf1370c96aaa8a625c31d78fb 100644 (file)
 #include "NETGENPlugin_Hypothesis_2D.hxx"
 
 #include <SMDS_SetIterator.hxx>
+#include <SMESHDS_Group.hxx>
 #include <SMESHDS_Mesh.hxx>
 #include <SMESH_ControlsDef.hxx>
 #include <SMESH_Gen.hxx>
 #include <SMESH_MeshAlgos.hxx>
 #include <SMESH_MesherHelper.hxx>
+#include <SMESH_Group.hxx>
 #include <SMESH_subMesh.hxx>
 
 #include <Bnd_B3d.hxx>
@@ -51,16 +53,15 @@ using namespace nglib;
 
 namespace netgen {
 
-#if defined(NETGEN_V5) && defined(WIN32)
-   DLL_HEADER 
- #endif
-   extern STLParameters stlparam;
+  NETGENPLUGIN_DLL_HEADER
+  extern STLParameters stlparam;
+
+  NETGENPLUGIN_DLL_HEADER
+  extern netgen::STLDoctorParams stldoctor;
 }
 namespace nglib
 {
-#if defined(NETGEN_V5) && defined(WIN32)
-       DLL_HEADER
-#endif
+  NETGENPLUGIN_DLL_HEADER
   extern netgen::Array<netgen::Point<3> > readedges;
 }
 
@@ -76,7 +77,7 @@ namespace
   public:
     HoleFiller( SMESH_Mesh& meshDS );
     ~HoleFiller();
-    void AddHoleBorders( Ng_STL_Geometry * ngStlGeo );
+    void AddHoleBordersAndEdges( Ng_STL_Geometry * ngStlGeo, bool toAddEdges );
     void KeepHole() { myHole.clear(); myCapElems.clear(); }
     void ClearCapElements() { myCapElems.clear(); }
 
@@ -220,7 +221,7 @@ namespace
    */
   //================================================================================
 
-  void HoleFiller::AddHoleBorders( Ng_STL_Geometry * ngStlGeo )
+  void HoleFiller::AddHoleBordersAndEdges( Ng_STL_Geometry * ngStlGeo, bool toAddEdges )
   {
     nglib::readedges.SetSize(0);
 
@@ -231,6 +232,27 @@ namespace
                         myHole[i][iP-1].ChangeData(),
                         myHole[i][iP-0].ChangeData() );
       }
+
+    if ( toAddEdges )
+    {
+      std::vector<const SMDS_MeshNode *>    nodes(2);
+      std::vector<const SMDS_MeshElement *> faces(2);
+      SMDS_EdgeIteratorPtr eIt = myMeshDS->edgesIterator();
+      while ( eIt->more() )
+      {
+        const SMDS_MeshElement* edge = eIt->next();
+        nodes[0] = edge->GetNode(0);
+        nodes[1] = edge->GetNode(1);
+        // check that an edge is a face border
+        if ( myMeshDS->GetElementsByNodes( nodes, faces, SMDSAbs_Face ))
+        {
+          Ng_STL_AddEdge( ngStlGeo,
+                          SMESH_NodeXYZ( nodes[0] ).ChangeData(),
+                          SMESH_NodeXYZ( nodes[1] ).ChangeData() );
+        }
+      }
+    }
+    return;
   }
   //================================================================================
   /*!
@@ -464,6 +486,35 @@ namespace
     return;
   } // ~HoleFiller()
 
+
+  //================================================================================
+  /*!
+   * \brief Fix nodes of a group
+   */
+  //================================================================================
+
+  void fixNodes( SMESHDS_GroupBase* group, netgen::STLGeometry* stlGeom )
+  {
+    SMESH_MeshAlgos::MarkElemNodes( group->GetElements(), false ); // un-mark nodes
+
+    for ( SMDS_ElemIteratorPtr eIt = group->GetElements(); eIt->more(); )
+    {
+      const SMDS_MeshElement* e = eIt->next();
+      for ( SMDS_NodeIteratorPtr nIt = e->nodeIterator(); nIt->more(); )
+      {
+        const SMDS_MeshNode* n = nIt->next();
+        if ( n->isMarked() )
+          continue;
+        n->setIsMarked( true );
+
+        SMESH_NodeXYZ p( n );
+        int id = stlGeom->GetPointNum( netgen::Point<3>( p.X(),p.Y(),p.Z() ));
+        if ( id > 0 )
+          stlGeom->SetLineEndPoint( id );
+      }
+    }
+  }
+
 } // namespace
 
 //=============================================================================
@@ -563,9 +614,11 @@ bool NETGENPlugin_Remesher_2D::Compute(SMESH_Mesh&         theMesh,
     }
   }
   // add edges
-  holeFiller.AddHoleBorders( ngStlGeo );
+  bool toAddExistingEdges = ( hyp && hyp->GetKeepExistingEdges() );
+  holeFiller.AddHoleBordersAndEdges( ngStlGeo, toAddExistingEdges );
 
   // init stl DS
+  //netgen::stldoctor.geom_tol_fact = 1e-12; // pointtol=boundingbox.Diam()*stldoctor.geom_tol_fact
   Ng_Result ng_res = Ng_STL_InitSTLGeometry( ngStlGeo );
   if ( ng_res != NG_OK )
   {
@@ -578,19 +631,32 @@ bool NETGENPlugin_Remesher_2D::Compute(SMESH_Mesh&         theMesh,
     return error( COMPERR_BAD_INPUT_MESH, txt );
   }
 
-  Ng_Meshing_Parameters ngParams;
-  ng_res = Ng_STL_MakeEdges( ngStlGeo, ngLib._ngMesh, &ngParams );
-  if ( ng_res != NG_OK )
-    return error( "Error in Edge Meshing" );
-
   // set parameters
+  Ng_Meshing_Parameters ngParams;
   if ( hyp )
   {
     ngParams.maxh              = hyp->GetMaxSize();
     ngParams.minh              = hyp->GetMinSize();
     ngParams.meshsize_filename = (char*) hyp->GetMeshSizeFile().c_str();
     ngParams.quad_dominated    = hyp->GetQuadAllowed();
-    netgen::stlparam.yangle    = hyp->GetRidgeAngle();
+
+    netgen::stlparam.yangle                  = hyp->GetRidgeAngle();
+    netgen::stlparam.edgecornerangle         = hyp->GetEdgeCornerAngle();
+    netgen::stlparam.chartangle              = hyp->GetChartAngle();
+    netgen::stlparam.outerchartangle         = hyp->GetOuterChartAngle();
+    netgen::stlparam.resthchartdistfac       = hyp->GetRestHChartDistFactor();
+    netgen::stlparam.resthchartdistenable    = hyp->GetRestHChartDistEnable();
+    netgen::stlparam.resthlinelengthfac      = hyp->GetRestHLineLengthFactor();
+    netgen::stlparam.resthlinelengthenable   = hyp->GetRestHLineLengthEnable();
+    netgen::stlparam.resthcloseedgefac       = hyp->GetRestHCloseEdgeFactor();
+    netgen::stlparam.resthcloseedgeenable    = hyp->GetRestHCloseEdgeEnable();
+    netgen::stlparam.resthsurfcurvfac        = hyp->GetRestHSurfCurvFactor();
+    netgen::stlparam.resthsurfcurvenable     = hyp->GetRestHSurfCurvEnable();
+    netgen::stlparam.resthedgeanglefac       = hyp->GetRestHEdgeAngleFactor();
+    netgen::stlparam.resthedgeangleenable    = hyp->GetRestHEdgeAngleEnable();
+    netgen::stlparam.resthsurfmeshcurvfac    = hyp->GetRestHSurfMeshCurvFactor();
+    netgen::stlparam.resthsurfmeshcurvenable = hyp->GetRestHSurfMeshCurvEnable();
+
     mesher.SetParameters( hyp );
   }
   else
@@ -600,11 +666,34 @@ bool NETGENPlugin_Remesher_2D::Compute(SMESH_Mesh&         theMesh,
     netgen::mparam.minh = netgen::mparam.maxh;
   }
 
-  // TODO: expose stlparam.resth* to the user
-  // netgen::stlparam.resthcloseedgeenable = 0; // Restrict H due to close edges
-  // netgen::stlparam.resthlinelengthenable = 0; // Restrict H due to line-length
-  // netgen::stlparam.resthatlasenable = 0;
-  // //netgen::stlparam.resthchartdistenable = 0;
+  // save netgen::mparam as Ng_STL_MakeEdges() modify it by Ng_Meshing_Parameters
+  netgen::MeshingParameters savedParams = netgen::mparam;
+
+  if ( SMESH_Group* fixedEdges = ( hyp ? hyp->GetFixedEdgeGroup( theMesh ) : 0 ))
+  {
+    netgen::STLGeometry* stlGeom = (netgen::STLGeometry*)ngStlGeo;
+
+    // the following code is taken from STLMeshing() method
+    stlGeom->Clear();
+    stlGeom->BuildEdges();
+    stlGeom->MakeAtlas( *ngMesh );
+    stlGeom->CalcFaceNums();
+    stlGeom->AddFaceEdges();
+    fixNodes( fixedEdges->GetGroupDS(), stlGeom );
+    stlGeom->LinkEdges();
+
+    ngMesh->ClearFaceDescriptors();
+    for (int i = 1; i <= stlGeom->GetNOFaces(); i++)
+      ngMesh->AddFaceDescriptor (netgen::FaceDescriptor (i, 1, 0, 0));
+
+    stlGeom->edgesfound = 1;
+  }
+  else
+  {
+    Ng_STL_MakeEdges( ngStlGeo, ngLib._ngMesh, &ngParams );
+  }
+
+  netgen::mparam = savedParams;
 
   double h = netgen::mparam.maxh;
   ngMesh->SetGlobalH( h );
@@ -617,6 +706,9 @@ bool NETGENPlugin_Remesher_2D::Compute(SMESH_Mesh&         theMesh,
   netgen::OCCGeometry occgeo;
   mesher.SetLocalSize( occgeo, *ngMesh );
 
+  // const char* optStr = "SmSmSm";//"smsmsmSmSmSm";
+  // netgen::mparam.optimize2d = optStr;
+
   // meshing
   try
   {
@@ -625,7 +717,8 @@ bool NETGENPlugin_Remesher_2D::Compute(SMESH_Mesh&         theMesh,
   catch (netgen::NgException & ex)
   {
     if ( netgen::multithread.terminate )
-      return false;
+      if ( !hyp || !hyp->GetLoadMeshOnCancel() )
+        return false;
   }
   if ( ng_res != NG_OK )
     return error( "Error in Surface Meshing" );
@@ -673,6 +766,24 @@ bool NETGENPlugin_Remesher_2D::Compute(SMESH_Mesh&         theMesh,
       meshDS->AddEdge( nodes[0], nodes[1] );
   }
 
+  // find existing groups
+  const char* theNamePrefix = "Surface_";
+  const int   theNamePrefixLen = strlen( theNamePrefix );
+  std::vector< SMESHDS_Group* > groups;
+  if ( hyp && hyp->GetMakeGroupsOfSurfaces() )
+  {
+    SMESH_Mesh::GroupIteratorPtr grIt = theMesh.GetGroups();
+    while ( grIt->more() )
+    {
+      SMESH_Group* group = grIt->next();
+      SMESHDS_Group* groupDS;
+      if (( group->GetGroupDS()->GetType() == SMDSAbs_Face ) &&
+          ( strncmp( group->GetName(), theNamePrefix, theNamePrefixLen ) == 0 ) &&
+          ( groupDS = dynamic_cast<SMESHDS_Group*>( group->GetGroupDS() )))
+        groups.push_back( groupDS );
+    }
+  }
+
   // add faces
   for ( int i = 1; i <= nbF; ++i )
   {
@@ -686,10 +797,42 @@ bool NETGENPlugin_Remesher_2D::Compute(SMESH_Mesh&         theMesh,
       else
         break;
     }
+    const SMDS_MeshElement* newFace = 0;
     switch( nodes.size() )
     {
-    case 3: meshDS->AddFace( nodes[0], nodes[1], nodes[2] ); break;
-    case 4: meshDS->AddFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break;
+    case 3: newFace = meshDS->AddFace( nodes[0], nodes[1], nodes[2] ); break;
+    case 4: newFace = meshDS->AddFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break;
+    }
+
+    // add newFace to a group
+    if ( newFace && hyp && hyp->GetMakeGroupsOfSurfaces() )
+    {
+      if ((size_t) elem.GetIndex()-1 >= groups.size() )
+        groups.resize( elem.GetIndex(), 0 );
+
+      SMESHDS_Group* & group = groups[  elem.GetIndex()-1 ];
+      if ( !group )
+      {
+        SMESH_Group* gr = theMesh.AddGroup( SMDSAbs_Face, "");
+        group = static_cast<SMESHDS_Group*>( gr->GetGroupDS() );
+      }
+      group->SMDSGroup().Add( newFace );
+    }
+  }
+
+  // update groups
+  int groupIndex = 1;
+  for ( size_t i = 0; i < groups.size(); ++i )
+  {
+    if ( !groups[i] )
+      continue;
+    if ( groups[i]->IsEmpty() )
+    {
+      theMesh.RemoveGroup( groups[i]->GetID() );
+    }
+    else if ( SMESH_Group* g = theMesh.GetGroup( groups[i]->GetID() ))
+    {
+      g->SetName( SMESH_Comment( theNamePrefix ) << groupIndex++ );
     }
   }