<li><b>Name</b> - allows to define the name of the hypothesis (MG-Hexa
Parameters by default).</li>
-<li><b>Min size</b> - allows defining the minimal size of the elements (overrides <b>Nb. Hexes Max Level</b> value).</li>
+<li><b>Physical size</b> - defines size of elements
+ <ul>
+ <li><b>Type</b> - \a Global activates and \a None deactivates this option</li>
-<li><b>Max size</b> - allows defining the maximal size of the elements (overrides <b>Nb. Hexes Min Level</b> value).</li>
+ <li><b>Min size</b> - allows defining the minimal size of the elements (overrides <b>Nb. Hexes Max Level</b> value).</li>
-<li><b>Nb. Hexes Min Level</b> - allows defining the minimal level of recursive partitioning on the initial octree cube.</li>
-
-<li><b>Nb. Hexes Max Level</b> - allows defining the maximal level of recursive partitioning on the initial octree cube.</li>
-
-<li><b>Generate smooth meshes no ridges</b> - specifies that the mesher can ignore ridges. A ridge is a geometrical entity (a sharp edge). The resulting meshes will have better quality elements, at the price of "smoothing" out the geometry.
+ <li><b>Max size</b> - allows defining the maximal size of the
+ elements (overrides <b>Nb. Hexes Min Level</b> value).</li>
+ </ul>
</li>
-<li><b>Authorize invalid elements</b> - specifies that the mesher must conform as much as possible to the geometry (especially the sharp edges). The resulting meshes may contain invalid elements (but with positive volumes: for example, three vertices of an hexahedron on the same edge), for the benefit of better geometry accuracy.
-</li>
-
-<li><b>Sharp angle threshold in degrees</b> - specifies the angle between two triangles above which the hex mesher will consider the edge common to these two triangles as being a "ridge". A ridge is a geometrical entity (a sharp edge) which has to be kept as it is in the final hex mesh.The default value is 60 (degrees).<br>If you raise this value, the hex mesher will detect less ridges, and the final solid mesh will therefore be smoother. On the other hand, if you reduce this value, more ridges will be detected and the algorithm will face harder situations to conform to.
-</li>
-
-<li><b>Number of threads</b> - specifies the number of threads to be used (this should be the number of cores or processors of a shared memory parallel architecture).
-</li>
-
-<li><b>Working directory</b> - specifies the directory where the input/output files will be created.
-</li>
-
-<li><b>Verbosity</b> - specifies the verbose level to print information on meshing steps.
-</li>
-
-<li><b>Max memory (MB)</b> - specifies the maximum allocatable memory in MegaBytes.
+<li><b>Geometric size</b> - defines size of elements depending on curvature
+ <ul>
+ <li><b>Type</b> - \a Global activates and \a None deactivates this option</li>
+
+ <li><b>Mesh angle</b> - specifies the angle (in degrees) between two triangles
+ for the curvature based refinement. This angle should be in a
+ range between <b>ridge angle</b> and 180. This angle is a
+ threshold that will trigger the refinement: during the octree
+ building, each octant containing triangles that make an angle
+ greater than the threshold will be split. The process will be
+ repeated until every octants contain portion of the geometry
+ smoother than the threshold angle. </li>
+ </ul>
</li>
<li><b>Sub-domains mesh mode</b> - This option allows the user to mesh or not mesh internal subdomains (such as holes), or to mesh non-manifold domains.
In \b Advanced tab page you can specify advanced options of MG-Hexa not exposed in other pages.
+
<b>Add option</b> adds a line to the table where you can type an option and its value as text.
A check box in the first column activates/deactivates the option of the current row. A deactivated option will be erased upon pressing \a Ok.
+<ul>
+<li><b>Allow invalid elements</b> - specifies that the mesher must
+ conform as much as possible to the geometry (especially the sharp
+ edges). The resulting meshes may contain invalid elements (but with
+ positive volumes: for example, three vertices of an hexahedron on
+ the same edge), for the benefit of better geometry accuracy. </li>
+
+<li><b>Compute ridges</b> - Enables the computation of ridges. If set
+ to no, smooth meshes (without ridges) will be generated. A ridge is
+ a geometrical entity (a sharp edge). The resulting meshes will have
+ better quality elements, at the price of "smoothing" out the
+ geometry.
+</li>
+
+<li><b>Element order</b> - determines the order of the mesh elements
+ to be generated: \a linear or \a quadratic</li>
+
+<li><b>Enforce constant layer size</b> - force the first physical layer to have the same size throughout the mesh.</li>
+
+<li><b>Flatten hexa sides</b> - activates specific optimization process to flatten the sides of hexahedra.</li>
+
+<li><b>Nb. Hexes Min Level</b> - allows defining the minimal level of recursive partitioning on the initial octree cube.</li>
+
+<li><b>Nb. Hexes Max Level</b> - allows defining the maximal level of recursive partitioning on the initial octree cube.</li>
+
+<li><b>Maximal memory (MB)</b> - specifies the maximum allocatable memory in MegaBytes.
+</li>
+
+<li><b>Maximal number of threads</b> - specifies the number of threads to be used (this should be the number of cores or processors of a shared memory parallel architecture).
+</li>
+
+<li><b>Recover sharp angles</b> - subdivides elements around sharp angles up to <b>Nb. Hexes Max Level</b>.</li>
+
+<li><b>Ridge angle (degrees)</b> - specifies the angle between two triangles above which the hex mesher will consider the edge common to these two triangles as being a "ridge". A ridge is a geometrical entity (a sharp edge) which has to be kept as it is in the final hex mesh.The default value is 60 (degrees).<br>If you raise this value, the hex mesher will detect less ridges, and the final solid mesh will therefore be smoother. On the other hand, if you reduce this value, more ridges will be detected and the algorithm will face harder situations to conform to.
+</li>
+
+<li><b>Size map level</b> - when using a sizemap, sets the octree's
+ maximum subdivision level to apply to the sizemap.</li>
+
+<li><b>Tags</b> - sets how surface attributes must be considered.
+ <ul>
+ <li>\a respect: preserve surface attributes </li>
+ <li>\a clear: clear surface attributes </li>
+ </ul>
+</li>
+
+<li><b>Working directory</b> - specifies the directory where the input/output files will be created.
+</li>
+
+<li><b>Verbosity</b> - specifies the verbose level to print information on meshing steps.
+</li>
+
+<li><b>Print log in a file</b> - if this option is checked on the log is printed in a
+file placed in the working directory, otherwise it is printed on the standard output.
+</li>
+
+<li><b>Remove log on success</b> - if this option is checked on the log file is kept only
+if an error occurs during the computation. This option is only available if <b>Print log in a file</b>
+is enabled (there must be a log file to delete it) and <b>Keep all working files</b> is disabled
+(in this case the log file is always kept).
+</li>
+
+<li><b>Keep working files</b> - allows checking input and output files
+of MG-Hexa software, while usually these files are removed after the
+launch of the mesher. The log file (if any) is also kept if this option is checked.
+</li>
+</ul>
+
\section hexotic_local_size_parameters Local size
The local size allows you to drive locally the density of the 3D mesh.
*/
module HexoticPlugin
{
+ typedef sequence<string> string_array;
+
/*!
* Type definitions for the size maps
*/
struct HexoticPluginSizeMap {
- string entry;
- double size;
+ string entry;
+ double size;
};
-
- typedef sequence<HexoticPluginSizeMap> HexoticPluginSizeMapsList;
+
+ typedef sequence<HexoticPluginSizeMap> HexoticPluginSizeMapsList;
/*!
* HexoticPlugin_Hexotic: interface of Hexotic algorithm
void SetMaxSize(in double value);
double GetMaxSize();
+ void SetGeomApproxAngle(in double angle);
+ double GetGeomApproxAngle();
+
void SetHexoticIgnoreRidges(in boolean value);
boolean GetHexoticIgnoreRidges();
void SetHexoticInvalidElements(in boolean value);
boolean GetHexoticInvalidElements();
-
+
void SetHexoticSharpAngleThreshold(in double value);
double GetHexoticSharpAngleThreshold();
-
+
void SetHexoticNbProc(in long value);
long GetHexoticNbProc();
void SetHexoticWorkingDirectory(in string path) raises (SALOME::SALOME_Exception);
string GetHexoticWorkingDirectory();
-
+
void SetHexoticSdMode(in long value);
long GetHexoticSdMode();
-
+
void SetHexoticVerbosity(in long value);
long GetHexoticVerbosity();
void SetHexoticMaxMemory(in long value);
long GetHexoticMaxMemory();
-
- void SetAdvancedOption(in string option);
+
+ void SetKeepFiles(in boolean toKeep);
+ boolean GetKeepFiles();
+
+ void SetStandardOutputLog(in boolean logInStandardOutput);
+ boolean GetStandardOutputLog();
+
+ void SetRemoveLogOnSuccess(in boolean removeLogOnSuccess);
+ boolean GetRemoveLogOnSuccess();
+
+ /*!
+ * Set advanced option value
+ */
+ void SetOptionValue(in string optionName,
+ in string optionValue) raises (SALOME::SALOME_Exception);
+ string GetOptionValue(in string optionName) raises (SALOME::SALOME_Exception);
+ void UnsetOption(in string optionName);
+ /*!
+ * Adds custom advanced option and its value
+ */
+ void SetAdvancedOption(in string optionsAndValues) // in a form "option_1 v1 option_2 v2'"
+ raises (SALOME::SALOME_Exception);
string GetAdvancedOption();
+ void AddOption(in string optionName, in string optionValue);
+ string GetOption(in string optionName);
void SetTextOptions(in string option);// obsolete
- string GetTextOptions();
-
- void SetSizeMapEntry(in string entry,
- in double size);
+ string GetTextOptions(); // obsolete
+ /*!
+ * Return array of strings each of which is option name concatenated
+ * with option value devided by semicolon - "option_name:option_value:option_type".
+ * Option value is empty if an option is not set.
+ * option_type: 1 if user-define, 0 if default
+ * Note: the method is mostly for interaction with GUI.
+ */
+ string_array GetOptionValues();
+ string_array GetAdvancedOptionValues();
+ /*!
+ * Set option values each in the form "option_name[:option_value][:option_type]".
+ * Note: the method is mostly for interaction with GUI.
+ */
+ void SetOptionValues(in string_array options) raises (SALOME::SALOME_Exception);
+ void SetAdvancedOptionValues(in string_array options);
+
+
+ void SetSizeMapEntry(in string entry, in double size);
void UnsetSizeMapEntry(in string entry);
- void SetSizeMap(in GEOM::GEOM_Object GeomObj,
- in double size);
+ void SetSizeMap(in GEOM::GEOM_Object GeomObj, in double size);
void UnsetSizeMap(in GEOM::GEOM_Object GeomObj);
HexoticPluginSizeMapsList GetSizeMaps();
-
+
void SetNbLayers(in long theVal);
long GetNbLayers();
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_BINARY_DIR}/idl
${PROJECT_SOURCE_DIR}/src/HexoticPlugin
+ ${PROJECT_SOURCE_DIR}/src/GUI
)
# additional preprocessor / compiler flags
SET(_moc_HEADERS
HexoticPluginGUI_HypothesisCreator.h
HexoticPluginGUI_Dlg.h
+ HexoticPluginGUI_TreeWidget.h
)
# header files / no moc processed
SET(_other_SOURCES
HexoticPluginGUI.cxx
HexoticPluginGUI_StdWidget.cxx
+ HexoticPluginGUI_AdvWidget.cxx
HexoticPluginGUI_SizeMapsWidget.cxx
HexoticPluginGUI_ViscousLayersWidget.cxx
HexoticPluginGUI_HypothesisCreator.cxx
+ HexoticPluginGUI_TreeWidget.cxx
)
# --- resources ---
# resource files / to be processed by uic
SET(_uic_files
HexoticPluginGUI_StdWidget_QTD.ui
+ HexoticPluginGUI_AdvWidget_QTD.ui
HexoticPluginGUI_SizeMapsWidget_QTD.ui
HexoticPluginGUI_ViscousLayersWidget_QTD.ui
)
</message>
<message>
<source>Hexotic_INPUT_SIZE</source>
- <translation>Sizes</translation>
+ <translation>Physical size</translation>
</message>
<message>
<source>Hexotic_INPUT_LEVEL</source>
</message>
<message>
<source>Hexotic_VERBOSITY</source>
- <translation>Verbosity</translation>
+ <translation>Verbose level</translation>
</message>
<message>
<source>Hexotic_MAX_MEMORY</source>
<source>Hexotic_IMPRINTED_FACES</source>
<translation>Imprinted faces</translation>
</message>
+ <message>
+ <source>Hexotic_ADD_OPTION</source>
+ <translation>Add option</translation>
+ </message>
+ <message>
+ <source>Hexotic_GEOM_SIZE</source>
+ <translation>Geometric size</translation>
+ </message>
+ <message>
+ <source>Hexotic_PHY_SIZE_TYPE</source>
+ <translation>Type</translation>
+ </message>
+ <message>
+ <source>Hexotic_GEOM_SIZE_TYPE</source>
+ <translation>Type</translation>
+ </message>
+ <message>
+ <source>Hexotic_NONE</source>
+ <translation>None</translation>
+ </message>
+ <message>
+ <source>Hexotic_GLOBAL</source>
+ <translation>Global</translation>
+ </message>
+ <message>
+ <source>Hexotic_GEOM_APPROX_ANGLE</source>
+ <translation>Mesh Angle</translation>
+ </message>
+ <message>
+ <source>allow_invalid_elements</source>
+ <translation>Allow invalid elements</translation>
+ </message>
+ <message>
+ <source>element_order</source>
+ <translation>Element order</translation>
+ </message>
+ <message>
+ <source>enforce_constant_layer_size</source>
+ <translation>Enforce constant layer size</translation>
+ </message>
+ <message>
+ <source>compute_ridges</source>
+ <translation>Compute ridges</translation>
+ </message>
+ <message>
+ <source>flatten_hexa_sides</source>
+ <translation>Flatten hexa sides</translation>
+ </message>
+ <message>
+ <source>max_memory</source>
+ <translation>Maximal memory</translation>
+ </message>
+ <message>
+ <source>max_number_of_threads</source>
+ <translation>Maximal number of threads</translation>
+ </message>
+ <message>
+ <source>ridge_angle</source>
+ <translation>Ridge angle (degrees)</translation>
+ </message>
+ <message>
+ <source>min_level</source>
+ <translation>Nb. Hexes Min Level</translation>
+ </message>
+ <message>
+ <source>max_level</source>
+ <translation>Nb. Hexes Max Level</translation>
+ </message>
+ <message>
+ <source>recover_sharp_angles</source>
+ <translation>Recover sharp angles</translation>
+ </message>
+ <message>
+ <source>sizemap_level</source>
+ <translation>Size map level</translation>
+ </message>
+ <message>
+ <source>tags</source>
+ <translation>Tags</translation>
+ </message>
</context>
</TS>
--- /dev/null
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// ---
+// File : HexoticPluginGUI_Dlg.cxx
+// Authors : Renaud NEDELEC (OCC)
+// ---
+//
+
+#include "HexoticPluginGUI_Dlg.h"
+
+#include <QFileDialog>
+#include <QItemDelegate>
+
+#include <iostream>
+#include <HexoticPlugin_Hypothesis.hxx>
+#include <SUIT_FileDlg.h>
+
+namespace
+{
+ enum { EDITABLE_ROLE = Qt::UserRole + 1, PARAM_NAME,
+ NAME_COL = 0, VALUE_COL };
+
+ class ItemDelegate: public QItemDelegate {
+ public:
+ ItemDelegate(QObject* parent=0): QItemDelegate(parent) {}
+ QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &o, const QModelIndex &index) const
+ {
+ bool editable = index.data( EDITABLE_ROLE ).toInt();
+ return editable ? QItemDelegate::createEditor( parent, o, index ) : 0;
+ }
+ };
+}
+
+//////////////////////////////////////////
+// HexoticPluginGUI_AdvWidget
+//////////////////////////////////////////
+
+HexoticPluginGUI_AdvWidget::HexoticPluginGUI_AdvWidget( QWidget* parent, Qt::WindowFlags f )
+: QWidget( parent, f )
+{
+ setupUi( this );
+ //myOptionTable->layout()->setMargin( 0 );
+ myOptionTable->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
+ myOptionTable->setItemDelegate( new ItemDelegate( myOptionTable ) );
+
+ connect( myOptionTable, SIGNAL( itemChanged(QTreeWidgetItem *, int)), SLOT( itemChanged(QTreeWidgetItem *, int )));
+}
+
+HexoticPluginGUI_AdvWidget::~HexoticPluginGUI_AdvWidget()
+{
+}
+
+void HexoticPluginGUI_AdvWidget::AddOption( const char* option, bool isCustom )
+{
+ QTreeWidget * table = myOptionTable;
+ //table->setExpanded( true );
+
+ QTreeWidgetItem * row = new QTreeWidgetItem( table );
+ row->setData( NAME_COL, EDITABLE_ROLE, int( isCustom && !option ));
+ row->setFlags( row->flags() | Qt::ItemIsEditable );
+
+ QString name, value;
+ bool isDefault = false;
+ if ( option )
+ {
+ QStringList name_value_type = QString(option).split( ":", QString::KeepEmptyParts );
+ if ( name_value_type.size() > 0 )
+ name = name_value_type[0];
+ if ( name_value_type.size() > 1 )
+ value = name_value_type[1];
+ if ( name_value_type.size() > 2 )
+ isDefault = !name_value_type[2].toInt();
+
+ // if ( value == HexoticPlugin_Hypothesis::NoValue() )
+ // value.clear();
+ }
+ row->setText( 0, tr( name.toLatin1().constData() ));
+ row->setText( 1, tr( value.toLatin1().constData() ));
+ row->setCheckState( 0, isDefault ? Qt::Unchecked : Qt::Checked);
+ row->setData( NAME_COL, PARAM_NAME, name );
+
+ if ( isCustom )
+ {
+ myOptionTable->scrollToItem( row );
+ myOptionTable->setCurrentItem( row );
+ myOptionTable->editItem( row, NAME_COL );
+ }
+}
+
+void HexoticPluginGUI_AdvWidget::GetOptionAndValue( QTreeWidgetItem * tblRow,
+ QString& option,
+ QString& value,
+ bool& isDefault)
+{
+ option = tblRow->data( NAME_COL, PARAM_NAME ).toString();
+ value = tblRow->text( VALUE_COL );
+ isDefault = ! tblRow->checkState( NAME_COL );
+
+ // if ( value.isEmpty() )
+ // value = HexoticPlugin_Hypothesis::NoValue();
+}
+
+
+void HexoticPluginGUI_AdvWidget::itemChanged(QTreeWidgetItem * tblRow, int column)
+{
+ if ( tblRow )
+ {
+ myOptionTable->blockSignals( true );
+
+ tblRow->setData( VALUE_COL, EDITABLE_ROLE, int( tblRow->checkState( NAME_COL )));
+
+ int c = tblRow->checkState( NAME_COL ) ? 0 : 150;
+ tblRow->setForeground( VALUE_COL, QBrush( QColor( c, c, c )));
+
+ if ( column == NAME_COL && tblRow->data( NAME_COL, EDITABLE_ROLE ).toInt() ) // custom table
+ {
+ tblRow->setData( NAME_COL, PARAM_NAME, tblRow->text( NAME_COL ));
+ }
+
+ myOptionTable->blockSignals( false );
+ }
+}
+
+
+void HexoticPluginGUI_AdvWidget::onDirBtnClicked()
+{
+ QString dir = SUIT_FileDlg::getExistingDirectory( this, myHexoticWorkingDir->text(), QString() );
+ if ( !dir.isEmpty() )
+ myHexoticWorkingDir->setText( dir );
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>HexoticPluginGUI_AdvWidget_QTD</class>
+ <widget class="QWidget" name="HexoticPluginGUI_AdvWidget_QTD">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>344</width>
+ <height>355</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3" rowstretch="0,0,0">
+ <item row="0" column="0" colspan="2">
+ <widget class="HexoticPluginGUI_TreeWidget" name="myOptionTable">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>2</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="editTriggers">
+ <set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
+ </property>
+ <property name="tabKeyNavigation">
+ <bool>true</bool>
+ </property>
+ <column>
+ <property name="text">
+ <string>OPTION_NAME_COLUMN</string>
+ </property>
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>OPTION_VALUE_COLUMN</string>
+ </property>
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>188</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QGroupBox" name="logGroupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Logs and debug</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="workingDirectoryLabel">
+ <property name="text">
+ <string>Hexotic_WORKING_DIR</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="myHexoticWorkingDir"/>
+ </item>
+ <item row="0" column="2">
+ <widget class="QPushButton" name="dirBtn">
+ <property name="text">
+ <string>Hexotic_SELECT_DIR</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="verboseLevelLabel">
+ <property name="text">
+ <string>Hexotic_VERBOSITY</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="myHexoticVerbosity"/>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QCheckBox" name="logInFileCheck">
+ <property name="text">
+ <string>Print log in a file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="removeLogOnSuccessCheck">
+ <property name="text">
+ <string>Remove log file on success</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="keepWorkingFilesCheck">
+ <property name="text">
+ <string>Keep working files</string>
+ </property>
+ <property name="autoExclusive">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QPushButton" name="addBtn">
+ <property name="text">
+ <string>Hexotic_ADD_OPTION</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>HexoticPluginGUI_TreeWidget</class>
+ <extends>QTreeWidget</extends>
+ <header location="global">HexoticPluginGUI_TreeWidget.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
SD_MODE_4
};
+enum {
+ OPTION_ID_COLUMN = 0,
+ OPTION_TYPE_COLUMN,
+ OPTION_NAME_COLUMN = 0,
+ OPTION_VALUE_COLUMN,
+ NB_COLUMNS,
+};
+
//////////////////////////////////////////
// HexoticPluginGUI_StdWidget
//////////////////////////////////////////
#include "ui_HexoticPluginGUI_StdWidget_QTD.h"
+#include "ui_HexoticPluginGUI_AdvWidget_QTD.h"
#include "ui_HexoticPluginGUI_SizeMapsWidget_QTD.h"
#include "ui_HexoticPluginGUI_ViscousLayersWidget_QTD.h"
#include "HexoticPluginGUI.h"
~HexoticPluginGUI_StdWidget();
public slots:
- void onDirBtnClicked();
void onSdModeSelected(int sdMode);
+ void onSizeTypeChange(int);
public:
QPixmap imageSdMode;
};
+class HEXOTICPLUGIN_GUI_EXPORT HexoticPluginGUI_AdvWidget : public QWidget,
+ public Ui::HexoticPluginGUI_AdvWidget_QTD
+{
+ Q_OBJECT
+
+public:
+ HexoticPluginGUI_AdvWidget( QWidget* = 0, Qt::WindowFlags = 0 );
+ ~HexoticPluginGUI_AdvWidget();
+
+ void AddOption( const char* name_value_type, bool isCustom = false );
+ void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt );
+
+public slots:
+
+ void onDirBtnClicked();
+ void itemChanged(QTreeWidgetItem * tblRow, int column);
+
+};
+
class HEXOTICPLUGIN_GUI_EXPORT HexoticPluginGUI_SizeMapsWidget : public QWidget,
public Ui::HexoticPluginGUI_SizeMapsWidget_QTD
{
#include "utilities.h"
-#include CORBA_SERVER_HEADER(HexoticPlugin_Algorithm)
-
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_MessageBox.h>
HexoticPluginGUI_HypothesisCreator::HexoticPluginGUI_HypothesisCreator( const QString& theHypType )
-: SMESHGUI_GenericHypothesisCreator( theHypType ),
- myIs3D( true ),
- mySizeMapsToRemove()
+ : SMESHGUI_GenericHypothesisCreator( theHypType ),
+ myIs3D( true ),
+ mySizeMapsToRemove()
{
}
{
msg.clear();
+ HexoticPlugin::HexoticPlugin_Hypothesis_var h =
+ HexoticPlugin::HexoticPlugin_Hypothesis::_narrow( hypothesis() );
+
+ myAdvWidget->myOptionTable->setFocus();
+ QApplication::instance()->processEvents();
+
+ QString name, value;
+ bool isDefault, ok = true;
+ int iRow = 0, nbRows = myAdvWidget->myOptionTable->topLevelItemCount();
+ for ( ; iRow < nbRows; ++iRow )
+ {
+ QTreeWidgetItem* row = myAdvWidget->myOptionTable->topLevelItem( iRow );
+ myAdvWidget->GetOptionAndValue( row, name, value, isDefault );
+
+ if ( name.simplified().isEmpty() )
+ continue; // invalid custom option
+
+ if ( isDefault ) // not selected option
+ value.clear();
+
+ try {
+ h->SetOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
+ }
+ catch ( const SALOME::SALOME_Exception& ex )
+ {
+ msg = ex.details.text.in();
+ ok = false;
+ break;
+ }
+ }
+
+ if ( !ok )
+ {
+ h->SetOptionValues( myOptions ); // restore values
+ return false;
+ }
+
HexoticHypothesisData data_old, data_new;
- readParamsFromHypo( data_old );
-
+ readParamsFromHypo( data_old ); // new values of advanced options ( myOptions ) are read
+
bool res = readParamsFromWidgets( data_new );
if ( !res ){
return res;
}
- res = storeParamsToHypo( data_new );
+
+ res = data_old.myMinSize <= data_old.myMaxSize;
if ( !res ) {
- storeParamsToHypo( data_old );
+ msg = tr(QString("Min size (%1) is higher than max size (%2)").arg(data_old.myMinSize).arg(data_old.myMaxSize).toStdString().c_str());
return res;
}
- res = data_new.myMinSize <= data_new.myMaxSize;
+ res = data_old.myHexesMinLevel == 0 || \
+ ( data_old.myHexesMinLevel != 0 && (data_old.myHexesMinLevel < data_old.myHexesMaxLevel) );
if ( !res ) {
- msg = tr(QString("Min size (%1) is higher than max size (%2)").arg(data_new.myMinSize).arg(data_new.myMaxSize).toStdString().c_str());
+ msg = tr(QString("Min hexes level (%1) is higher than max hexes level (%2)").arg(data_old.myHexesMinLevel).arg(data_old.myHexesMaxLevel).toStdString().c_str());
return res;
}
- res = data_new.myHexesMinLevel == 0 || \
- ( data_new.myHexesMinLevel != 0 && (data_new.myHexesMinLevel < data_new.myHexesMaxLevel) );
+ res = storeParamsToHypo( data_new );
if ( !res ) {
- msg = tr(QString("Min hexes level (%1) is higher than max hexes level (%2)").arg(data_new.myHexesMinLevel).arg(data_new.myHexesMaxLevel).toStdString().c_str());
+ storeParamsToHypo( data_old );
return res;
}
QVBoxLayout* lay = new QVBoxLayout( fr );
lay->setMargin( 0 );
lay->setSpacing( 6 );
-
+
// main TabWidget of the dialog
QTabWidget* aTabWidget = new QTabWidget( fr );
aTabWidget->setTabShape( QTabWidget::Rounded );
QGridLayout* l = new QGridLayout( aStdGroup );
l->setSpacing( 6 );
l->setMargin( 11 );
-
+
int row = 0;
myName = 0;
if( isCreation() ) {
myName->setMinimumWidth( 150 );
}
- HexoticPlugin::HexoticPlugin_Hypothesis_var h =
- HexoticPlugin::HexoticPlugin_Hypothesis::_narrow( initParamsHypothesis() );
-
myStdWidget = new HexoticPluginGUI_StdWidget(aStdGroup);
#ifdef WIN32
myStdWidget->label_6->hide();
#endif
l->addWidget( myStdWidget, row++, 0, 1, 3 );
myStdWidget->onSdModeSelected(SD_MODE_4);
+ //myStdWidget->gridLayout->setRowStretch( 1, 2 );
+
+ // Advanced TAB
+ myAdvWidget = new HexoticPluginGUI_AdvWidget( aTabWidget );
+ //myAdvWidget->gridLayout->setRowStretch( 0, 2 );
- myAdvWidget = new SMESH_AdvOptionsWdg( aTabWidget );
-
// SIZE MAPS TAB
- QWidget* aSmpGroup = new QWidget();
- lay->addWidget( aSmpGroup );
-
- // Size map widget creation and initialisation
- mySmpWidget = new HexoticPluginGUI_SizeMapsWidget(aSmpGroup);
+ mySmpWidget = new HexoticPluginGUI_SizeMapsWidget( aTabWidget );
mySmpWidget->doubleSpinBox->RangeStepAndValidator(0.0, COORD_MAX, 1.0, "length_precision");
mySmpWidget->doubleSpinBox->setValue(0.0);
-
+
// Filters of selection
- TColStd_MapOfInteger SM_ShapeTypes;
+ TColStd_MapOfInteger SM_ShapeTypes;
SM_ShapeTypes.Add( TopAbs_VERTEX );
SM_ShapeTypes.Add( TopAbs_EDGE );
SM_ShapeTypes.Add( TopAbs_WIRE );
SM_ShapeTypes.Add( TopAbs_FACE );
SM_ShapeTypes.Add( TopAbs_SOLID );
- SM_ShapeTypes.Add( TopAbs_COMPOUND );
+ SM_ShapeTypes.Add( TopAbs_COMPOUND );
SMESH_NumberFilter* aFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, SM_ShapeTypes);
-
+
// Selection widget
myGeomSelWdg = new StdMeshersGUI_ObjectReferenceParamWdg( aFilter, mySmpWidget, /*multiSel=*/false);
myGeomSelWdg->SetDefaultText(tr("Hexotic_SEL_SHAPE"), "QLineEdit { color: grey }");
mySmpWidget->gridLayout->addWidget(myGeomSelWdg, 0, 1);
-
+
// Configuration of the table widget
QStringList headerLabels;
headerLabels << tr("Hexotic_ENTRY")<< tr("Hexotic_NAME")<< tr("Hexotic_SIZE");
mySmpWidget->label->setText(tr("LOCAL_SIZE"));
mySmpWidget->pushButton_1->setText(tr("Hexotic_ADD"));
mySmpWidget->pushButton_2->setText(tr("Hexotic_REMOVE"));
-
+
// Setting a custom delegate for the size column
SizeMapsTableWidgetDelegate* delegate = new SizeMapsTableWidgetDelegate();
mySmpWidget->tableWidget->setItemDelegateForColumn(SIZE_COL, delegate);
-
- // Add the size maps widget to a layout
- QHBoxLayout* aSmpLayout = new QHBoxLayout( aSmpGroup );
- aSmpLayout->setMargin( 0 );
- aSmpLayout->addWidget( mySmpWidget);
-
+
+
// Viscous Layers tab
- QWidget* aVLGroup = new QWidget();
- lay->addWidget( aVLGroup );
// Viscous layers widget creation and initialisation
- myVLWidget = new HexoticPluginGUI_ViscousLayersWidget(aVLGroup);
+ myVLWidget = new HexoticPluginGUI_ViscousLayersWidget( aTabWidget );
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
}
else
{
- myVLWidget->labelFacesWithLayers->setVisible(false);
+ myVLWidget->labelFacesWithLayers->setVisible(false);
myVLWidget->myFacesWithLayers->setVisible(false);
myVLWidget->labelImprintedFaces->setVisible(false);
myVLWidget->myImprintedFaces->setVisible(false);
}
- // Add the viscous layers widget to a layout
- QHBoxLayout* aVLLayout = new QHBoxLayout( aVLGroup );
- aVLLayout->setSpacing( 6 );
- aVLLayout->setMargin( 11 );
- aVLLayout->addWidget( myVLWidget );
-
-// resizeEvent();
-
- aTabWidget->insertTab( STD_TAB, aStdGroup, tr( "SMESH_ARGUMENTS" ));
+ aTabWidget->insertTab( STD_TAB, aStdGroup, tr( "SMESH_ARGUMENTS" ));
aTabWidget->insertTab( ADV_TAB, myAdvWidget, tr( "SMESH_ADVANCED" ));
- aTabWidget->insertTab( SMP_TAB, aSmpGroup, tr( "LOCAL_SIZE" ));
- aTabWidget->insertTab( VL_TAB, aVLGroup, tr( "Hexotic_VISCOUS_LAYERS"));
-
+ aTabWidget->insertTab( SMP_TAB, mySmpWidget, tr( "LOCAL_SIZE" ));
+ aTabWidget->insertTab( VL_TAB, myVLWidget, tr( "Hexotic_VISCOUS_LAYERS"));
+
myIs3D = true;
-
+
// Size Maps
mySizeMapsToRemove.clear();
connect( mySmpWidget->pushButton_1, SIGNAL( clicked() ), this, SLOT( onAddLocalSize() ) );
{
int rowCount = mySmpWidget->tableWidget->rowCount();
//int columnCount = mySmpWidget->tableWidget->columnCount();
-
+
// Get the selected object properties
GEOM::GEOM_Object_var sizeMapObject = myGeomSelWdg->GetObject< GEOM::GEOM_Object >(0);
if (sizeMapObject->_is_nil())
return;
-
+
std::string entry, shapeName;
entry = (std::string) sizeMapObject->GetStudyEntry();
shapeName = sizeMapObject->GetName();
-
+
// Check if the object is already in the widget
QList<QTableWidgetItem *> listFound = mySmpWidget->tableWidget
->findItems( QString(entry.c_str()), Qt::MatchExactly );
if( myName )
myName->setText( data.myName );
+ myStdWidget->myPhySizeType->setCurrentIndex( data.myMinSize > 0 || data.myMaxSize > 0 );
+
myStdWidget->myMinSize->setCleared(data.myMinSize == 0);
if (data.myMinSize == 0)
myStdWidget->myMinSize->setText("");
else
myStdWidget->myMaxSize->setValue( data.myMaxSize );
- myStdWidget->myHexesMinLevel->setCleared(data.myHexesMinLevel == 0);
- if (data.myHexesMinLevel == 0)
- myStdWidget->myHexesMinLevel->setText("");
- else
- myStdWidget->myHexesMinLevel->setValue( data.myHexesMinLevel );
-
- myStdWidget->myHexesMaxLevel->setCleared(data.myHexesMaxLevel == 0);
- if (data.myHexesMaxLevel == 0)
- myStdWidget->myHexesMaxLevel->setText("");
- else
- myStdWidget->myHexesMaxLevel->setValue( data.myHexesMaxLevel );
+ myStdWidget->myGeomSizeType->setCurrentIndex( data.myApproxAngle > 0 );
- myStdWidget->myHexoticIgnoreRidges->setChecked( data.myHexoticIgnoreRidges );
- myStdWidget->myHexoticInvalidElements->setChecked( data.myHexoticInvalidElements );
-
- myStdWidget->myHexoticSharpAngleThreshold->setCleared(data.myHexoticSharpAngleThreshold == 0);
- if (data.myHexoticSharpAngleThreshold == 0)
- myStdWidget->myHexoticSharpAngleThreshold->setText("");
+ myStdWidget->myGeomApproxAngle->setCleared( data.myApproxAngle == 0 );
+ if (data.myApproxAngle == 0)
+ myStdWidget->myGeomApproxAngle->setText("");
else
- myStdWidget->myHexoticSharpAngleThreshold->setValue( data.myHexoticSharpAngleThreshold );
-#ifndef WIN32
- myStdWidget->myHexoticNbProc->setValue( data.myHexoticNbProc );
-#endif
- myStdWidget->myHexoticWorkingDir->setText( data.myHexoticWorkingDir );
+ myStdWidget->myGeomApproxAngle->setValue( data.myApproxAngle );
- myStdWidget->myHexoticVerbosity->setValue( data.myHexoticVerbosity );
+ myAdvWidget->myHexoticWorkingDir->setText( data.myHexoticWorkingDir );
- myStdWidget->myHexoticMaxMemory->setValue( data.myHexoticMaxMemory );
+ myAdvWidget->myHexoticVerbosity->setValue( data.myHexoticVerbosity );
myStdWidget->myHexoticSdMode->setCurrentIndex(data.myHexoticSdMode);
-
- myAdvWidget->SetCustomOptions(data.myTextOptions);
+
+ //myAdvWidget->SetCustomOptions(data.myTextOptions);
+
+ if ( myOptions.operator->() ) {
+ for ( int i = 0, nb = myOptions->length(); i < nb; ++i )
+ myAdvWidget->AddOption( myOptions[i].in() );
+ }
+ if ( myCustomOptions.operator->() ) {
+ for ( int i = 0, nb = myCustomOptions->length(); i < nb; ++i )
+ myAdvWidget->AddOption( myCustomOptions[i].in() );
+ }
+ myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
+
+ myAdvWidget->keepWorkingFilesCheck->setChecked( data.myKeepFiles );
+ myAdvWidget->logInFileCheck->setChecked( !data.myLogInStandardOutput );
+ myAdvWidget->removeLogOnSuccessCheck->setChecked( data.myRemoveLogOnSuccess );
HexoticPlugin_Hypothesis::THexoticSizeMaps::const_iterator it = data.mySizeMaps.begin();
for ( int row = 0; it != data.mySizeMaps.end(); it++, row++ )
aVec[i]=vector.at(i);
myVLWidget->myImprintedFaces->SetListOfIDs(aVec);
-
- std::cout << "myStdWidget->myMinSize->value(): " << myStdWidget->myMinSize->value() << std::endl;
- std::cout << "myStdWidget->myMaxSize->value(): " << myStdWidget->myMaxSize->value() << std::endl;
- std::cout << "myStdWidget->myHexesMinLevel->value(): " << myStdWidget->myHexesMinLevel->value() << std::endl;
- std::cout << "myStdWidget->myHexesMaxLevel->value(): " << myStdWidget->myHexesMaxLevel->value() << std::endl;
- std::cout << "myStdWidget->myHexoticSharpAngleThreshold->value(): " << myStdWidget->myHexoticSharpAngleThreshold->value() << std::endl;
-
}
void HexoticPluginGUI_HypothesisCreator::printData( HexoticHypothesisData& data) const
h_data.myName = isCreation() && data ? data->Label : "";
h_data.myMinSize = h->GetMinSize();
h_data.myMaxSize = h->GetMaxSize();
+ h_data.myApproxAngle = h->GetGeomApproxAngle();
h_data.myHexesMinLevel = h->GetHexesMinLevel();
h_data.myHexesMaxLevel = h->GetHexesMaxLevel();
h_data.myHexoticIgnoreRidges = h->GetHexoticIgnoreRidges();
h_data.myHexoticVerbosity = h->GetHexoticVerbosity();
h_data.myHexoticMaxMemory = h->GetHexoticMaxMemory();
h_data.myHexoticSdMode = h->GetHexoticSdMode()-1;
- h_data.myTextOptions = h->GetAdvancedOption();
-
+ h_data.myKeepFiles = h->GetKeepFiles();
+ h_data.myLogInStandardOutput = h->GetStandardOutputLog();
+ h_data.myRemoveLogOnSuccess = h->GetRemoveLogOnSuccess();
+ //h_data.myTextOptions = h->GetAdvancedOption();
+
+ HexoticPluginGUI_HypothesisCreator* that = (HexoticPluginGUI_HypothesisCreator*)this;
+ that->myOptions = h->GetOptionValues();
+ that->myCustomOptions = h->GetAdvancedOptionValues();
+
// Size maps
HexoticPlugin::HexoticPluginSizeMapsList_var sizeMaps = h->GetSizeMaps();
- for ( CORBA::ULong i = 0 ; i < sizeMaps->length() ; i++)
+ for ( CORBA::ULong i = 0 ; i < sizeMaps->length() ; i++)
{
HexoticPlugin::HexoticPluginSizeMap aSizeMap = sizeMaps[i];
std::string entry = CORBA::string_dup(aSizeMap.entry.in());
h->SetMinSize( h_data.myMinSize );
h->SetMaxSize( h_data.myMaxSize );
- h->SetHexesMinLevel( h_data.myHexesMinLevel );
- h->SetHexesMaxLevel( h_data.myHexesMaxLevel );
- h->SetHexoticIgnoreRidges( h_data.myHexoticIgnoreRidges );
- h->SetHexoticInvalidElements( h_data.myHexoticInvalidElements );
- h->SetHexoticSharpAngleThreshold( h_data.myHexoticSharpAngleThreshold );
- h->SetHexoticNbProc( h_data.myHexoticNbProc );
+ h->SetGeomApproxAngle( h_data.myApproxAngle );
h->SetHexoticWorkingDirectory( h_data.myHexoticWorkingDir.toLatin1().constData() );
h->SetHexoticVerbosity( h_data.myHexoticVerbosity );
- h->SetHexoticMaxMemory( h_data.myHexoticMaxMemory );
h->SetHexoticSdMode( h_data.myHexoticSdMode+1 );
- h->SetAdvancedOption( h_data.myTextOptions.toLatin1().constData() );
+ h->SetKeepFiles( h_data.myKeepFiles );
+ h->SetStandardOutputLog( h_data.myLogInStandardOutput );
+ h->SetRemoveLogOnSuccess( h_data.myRemoveLogOnSuccess );
HexoticPlugin_Hypothesis::THexoticSizeMaps::const_iterator it;
{
h_data.myName = myName ? myName->text() : "";
- h_data.myHexoticIgnoreRidges = myStdWidget->myHexoticIgnoreRidges->isChecked();
- h_data.myHexoticInvalidElements = myStdWidget->myHexoticInvalidElements->isChecked();
-#ifndef WIN32
- h_data.myHexoticNbProc = myStdWidget->myHexoticNbProc->value();
-#endif
- h_data.myHexoticWorkingDir = myStdWidget->myHexoticWorkingDir->text();
- h_data.myHexoticVerbosity = myStdWidget->myHexoticVerbosity->value();
- h_data.myHexoticMaxMemory = myStdWidget->myHexoticMaxMemory->value();
- h_data.myHexoticSdMode = myStdWidget->myHexoticSdMode->currentIndex();
- h_data.myTextOptions = myAdvWidget->GetCustomOptions();
-
h_data.myMinSize = myStdWidget->myMinSize->text().isEmpty() ? 0.0 : myStdWidget->myMinSize->value();
h_data.myMaxSize = myStdWidget->myMaxSize->text().isEmpty() ? 0.0 : myStdWidget->myMaxSize->value();
- h_data.myHexesMinLevel = myStdWidget->myHexesMinLevel->text().isEmpty() ? 0 : myStdWidget->myHexesMinLevel->value();
- h_data.myHexesMaxLevel = myStdWidget->myHexesMaxLevel->text().isEmpty() ? 0 : myStdWidget->myHexesMaxLevel->value();
- h_data.myHexoticSharpAngleThreshold = myStdWidget->myHexoticSharpAngleThreshold->text().isEmpty() ? 0 : myStdWidget->myHexoticSharpAngleThreshold->value();
+ h_data.myApproxAngle = myStdWidget->myGeomApproxAngle->text().isEmpty() ? 0.0 : myStdWidget->myGeomApproxAngle->value();
+ h_data.myHexoticSdMode = myStdWidget->myHexoticSdMode->currentIndex();
+
+ h_data.myHexoticWorkingDir = myAdvWidget->myHexoticWorkingDir->text();
+ h_data.myHexoticVerbosity = myAdvWidget->myHexoticVerbosity->value();
+ h_data.myKeepFiles = myAdvWidget->keepWorkingFilesCheck->isChecked();
+ h_data.myLogInStandardOutput = !myAdvWidget->logInFileCheck->isChecked();
+ h_data.myRemoveLogOnSuccess = myAdvWidget->removeLogOnSuccessCheck->isChecked();
// Size maps reading
bool ok = readSizeMapsFromWidgets( h_data );
#define HexoticPLUGINGUI_HypothesisCreator_H
#include "HexoticPluginGUI.h"
-
-#include <SMESHGUI_Hypotheses.h>
-#include "StdMeshersGUI_ObjectReferenceParamWdg.h"
#include "HexoticPlugin_Hypothesis.hxx"
+#include <SMESHGUI_Hypotheses.h>
+#include <StdMeshersGUI_ObjectReferenceParamWdg.h>
#include <QItemDelegate>
+#include CORBA_SERVER_HEADER(HexoticPlugin_Algorithm)
+
class QtxIntSpinBox;
class QCheckBox;
class QLineEdit;
class QTableWidgetItem;
class HexoticPluginGUI_StdWidget;
+class HexoticPluginGUI_AdvWidget;
class HexoticPluginGUI_SizeMapsWidget;
class HexoticPluginGUI_ViscousLayersWidget;
class SMESH_AdvOptionsWdg;
{
QString myName;
int myHexesMinLevel, myHexesMaxLevel;
- double myMinSize, myMaxSize;
+ double myMinSize, myMaxSize, myApproxAngle;
bool myHexoticInvalidElements;
bool myHexoticIgnoreRidges;
double myHexoticSharpAngleThreshold;
int myHexoticMaxMemory;
int myHexoticSdMode;
QString myTextOptions;
+ bool myKeepFiles,myLogInStandardOutput, myRemoveLogOnSuccess;
HexoticPlugin_Hypothesis::THexoticSizeMaps mySizeMaps;
int myNbLayers;
double myFirstLayerSize;
private:
// QWidget* myStdGroup;
- QLineEdit* myName;
- HexoticPluginGUI_StdWidget* myStdWidget;
- SMESH_AdvOptionsWdg* myAdvWidget;
- HexoticPluginGUI_SizeMapsWidget* mySmpWidget;
- HexoticPluginGUI_ViscousLayersWidget* myVLWidget;
- StdMeshersGUI_ObjectReferenceParamWdg* myGeomSelWdg;
+ QLineEdit* myName;
+ HexoticPluginGUI_StdWidget* myStdWidget;
+ HexoticPluginGUI_AdvWidget* myAdvWidget;
+ mutable HexoticPlugin::string_array_var myOptions, myCustomOptions;
+ HexoticPluginGUI_SizeMapsWidget* mySmpWidget;
+ HexoticPluginGUI_ViscousLayersWidget* myVLWidget;
+ StdMeshersGUI_ObjectReferenceParamWdg* myGeomSelWdg;
bool myIs3D;
std::vector< std::string > mySizeMapsToRemove;
myMaxSize->setPrecision(precision);
// myMaxSize->setSpecialValueText(" ");
- myHexesMinLevel->setMinimum(0);
- myHexesMinLevel->setMaximum(10);
-// myHexesMinLevel->setSpecialValueText(" ");
-
- myHexesMaxLevel->setMinimum(0);
- myHexesMaxLevel->setMaximum(10);
-// myHexesMaxLevel->setSpecialValueText(" ");
-
- myHexoticSharpAngleThreshold->setMinimum(0);
- myHexoticSharpAngleThreshold->setMaximum(90);
- myHexoticSharpAngleThreshold->setPrecision(precision);
-// myHexoticSharpAngleThreshold->setSpecialValueText(" ");
-
- myHexoticNbProc->setMinimum( 1 );
- myHexoticNbProc->setMaximum( 256 );
-// myHexoticNbProc->setSingleStep( 1 );
+ myGeomApproxAngle->RangeStepAndValidator( 0, 180, 1, "angle_precision" );
myHexoticSdMode->setCurrentIndex(SD_MODE_4);
imageSdMode = SUIT_Session::session()->resourceMgr()->loadPixmap("HexoticPLUGIN", tr("Hexotic_SD_MODE_4_PIXMAP"));
-}
-HexoticPluginGUI_StdWidget::~HexoticPluginGUI_StdWidget()
-{
+ connect( myPhySizeType, SIGNAL( currentIndexChanged(int)), SLOT( onSizeTypeChange(int) ));
+ connect( myGeomSizeType, SIGNAL( currentIndexChanged(int)), SLOT( onSizeTypeChange(int) ));
}
-void HexoticPluginGUI_StdWidget::onDirBtnClicked()
+HexoticPluginGUI_StdWidget::~HexoticPluginGUI_StdWidget()
{
- QString dir = SUIT_FileDlg::getExistingDirectory( this, myHexoticWorkingDir->text(), QString() );
- if ( !dir.isEmpty() )
- myHexoticWorkingDir->setText( dir );
}
-
void HexoticPluginGUI_StdWidget::onSdModeSelected(int sdMode) {
imageSdMode = SUIT_Session::session()->resourceMgr()->loadPixmap("HexoticPLUGIN", tr(QString("Hexotic_SD_MODE_%1_PIXMAP").arg(sdMode+1).toStdString().c_str()));
sdModeLabel->setPixmap(imageSdMode.scaled(sdModeLabel->size(),
Qt::KeepAspectRatio,
Qt::SmoothTransformation));
}
+
+void HexoticPluginGUI_StdWidget::onSizeTypeChange(int index)
+{
+ if ( sender() == myPhySizeType )
+ {
+ myMinSize->setEnabled( index );
+ myMaxSize->setEnabled( index );
+ }
+ else
+ {
+ myGeomApproxAngle->setEnabled( index );
+ }
+}
+
<rect>
<x>0</x>
<y>0</y>
- <width>561</width>
- <height>908</height>
+ <width>649</width>
+ <height>482</height>
</rect>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item row="3" column="0" colspan="2">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Hexotic_SHARP_ANGLE_THRESHOLD</string>
- </property>
- </widget>
- </item>
- <item row="6" column="3">
- <widget class="QSpinBox" name="myHexoticMaxMemory">
- <property name="maximum">
- <number>99999</number>
- </property>
- <property name="singleStep">
- <number>128</number>
- </property>
- <property name="value">
- <number>2048</number>
- </property>
- </widget>
- </item>
- <item row="0" column="0" colspan="2">
+ <layout class="QGridLayout" name="gridLayout_3" rowstretch="1,3">
+ <item row="0" column="0">
<widget class="QGroupBox" name="hexoticInputSize">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="title">
<string>Hexotic_INPUT_SIZE</string>
</property>
- <layout class="QGridLayout" name="gridLayout_4">
+ <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
+ <widget class="QLabel" name="label_10">
+ <property name="text">
+ <string>Hexotic_PHY_SIZE_TYPE</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="myPhySizeType">
+ <property name="currentIndex">
+ <number>1</number>
+ </property>
+ <item>
+ <property name="text">
+ <string>Hexotic_NONE</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Hexotic_GLOBAL</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Hexotic_MIN_SIZE</string>
</property>
</widget>
</item>
- <item row="0" column="1">
+ <item row="1" column="1">
<widget class="SalomeApp_DoubleSpinBox" name="myMinSize"/>
</item>
- <item row="1" column="0">
+ <item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Hexotic_MAX_SIZE</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="2" column="1">
<widget class="SalomeApp_DoubleSpinBox" name="myMaxSize"/>
</item>
</layout>
</widget>
</item>
- <item row="6" column="0">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Hexotic_MAX_MEMORY</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>Hexotic_WORKING_DIR</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1" colspan="2">
- <widget class="QPushButton" name="dirBtn">
+ <item row="0" column="1">
+ <widget class="QGroupBox" name="hexoticInputLevel">
<property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text">
- <string>Hexotic_SELECT_DIR</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2" colspan="2">
- <widget class="QCheckBox" name="myHexoticInvalidElements">
- <property name="text">
- <string>Hexotic_INVALID_ELEMENTS</string>
- </property>
- </widget>
- </item>
- <item row="7" column="3">
- <widget class="QSpinBox" name="myHexoticVerbosity">
- <property name="maximum">
- <number>10</number>
- </property>
- <property name="value">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item row="0" column="2" colspan="2">
- <widget class="QGroupBox" name="hexoticInputLevel">
<property name="title">
- <string>Hexotic_INPUT_LEVEL</string>
+ <string>Hexotic_GEOM_SIZE</string>
</property>
- <layout class="QGridLayout" name="gridLayout_3">
+ <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
- <string>Hexotic_HEXES_MIN_LEVEL</string>
+ <string>Hexotic_GEOM_SIZE_TYPE</string>
</property>
</widget>
</item>
<item row="0" column="1">
- <widget class="SalomeApp_IntSpinBox" name="myHexesMinLevel"/>
+ <widget class="QComboBox" name="myGeomSizeType">
+ <item>
+ <property name="text">
+ <string>Hexotic_NONE</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Hexotic_GLOBAL</string>
+ </property>
+ </item>
+ </widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
- <string>Hexotic_HEXES_MAX_LEVEL</string>
+ <string>Hexotic_GEOM_APPROX_ANGLE</string>
</property>
</widget>
</item>
<item row="1" column="1">
- <widget class="SalomeApp_IntSpinBox" name="myHexesMaxLevel"/>
+ <widget class="SMESHGUI_SpinBox" name="myGeomApproxAngle"/>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>228</width>
+ <height>50</height>
+ </size>
+ </property>
+ </spacer>
</item>
</layout>
</widget>
</item>
- <item row="3" column="3">
- <widget class="SalomeApp_DoubleSpinBox" name="myHexoticSharpAngleThreshold"/>
- </item>
- <item row="4" column="3">
- <widget class="SalomeApp_IntSpinBox" name="myHexoticNbProc"/>
- </item>
<item row="1" column="0" colspan="2">
- <widget class="QCheckBox" name="myHexoticIgnoreRidges">
- <property name="text">
- <string>Hexotic_IGNORE_RIDGES</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Hexotic_NB_PROC</string>
- </property>
- </widget>
- </item>
- <item row="5" column="3">
- <widget class="QLineEdit" name="myHexoticWorkingDir"/>
- </item>
- <item row="8" column="0" colspan="4">
<widget class="QGroupBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="title">
<string>Hexotic_SUBDOMAIN_MESH_MODE</string>
</property>
</layout>
</widget>
</item>
- <item row="7" column="0">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Hexotic_VERBOSITY</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
<customwidgets>
<header location="global">SalomeApp_DoubleSpinBox.h</header>
</customwidget>
<customwidget>
- <class>SalomeApp_IntSpinBox</class>
- <extends>QLineEdit</extends>
- <header location="global">SalomeApp_IntSpinBox.h</header>
+ <class>SMESHGUI_SpinBox</class>
+ <extends>QDoubleSpinBox</extends>
+ <header location="global">SMESHGUI_SpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>myMinSize</tabstop>
<tabstop>myMaxSize</tabstop>
- <tabstop>myHexesMinLevel</tabstop>
- <tabstop>myHexesMaxLevel</tabstop>
- <tabstop>myHexoticIgnoreRidges</tabstop>
- <tabstop>myHexoticInvalidElements</tabstop>
- <tabstop>myHexoticSharpAngleThreshold</tabstop>
- <tabstop>myHexoticNbProc</tabstop>
- <tabstop>dirBtn</tabstop>
- <tabstop>myHexoticWorkingDir</tabstop>
- <tabstop>myHexoticMaxMemory</tabstop>
- <tabstop>myHexoticVerbosity</tabstop>
<tabstop>myHexoticSdMode</tabstop>
</tabstops>
<resources/>
<connections>
- <connection>
- <sender>dirBtn</sender>
- <signal>clicked()</signal>
- <receiver>HexoticPluginGUI_StdWidget_QTD</receiver>
- <slot>onDirBtnClicked()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>261</x>
- <y>220</y>
- </hint>
- <hint type="destinationlabel">
- <x>390</x>
- <y>143</y>
- </hint>
- </hints>
- </connection>
<connection>
<sender>myHexoticSdMode</sender>
<signal>currentIndexChanged(int)</signal>
<slot>onSdModeSelected(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>147</x>
- <y>310</y>
+ <x>166</x>
+ <y>207</y>
</hint>
<hint type="destinationlabel">
<x>170</x>
--- /dev/null
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HexoticPluginGUI_TreeWidget.h"
+#include <QKeyEvent>
+
+namespace
+{
+ bool isEditable( const QModelIndex& index )
+ {
+ return index.isValid() &&
+ index.flags() & Qt::ItemIsEditable &&
+ index.flags() & Qt::ItemIsEnabled &&
+ ( !index.data( Qt::UserRole + 1 ).isValid() || index.data( Qt::UserRole + 1 ).toInt() != 0 );
+ }
+}
+
+HexoticPluginGUI_TreeWidget::HexoticPluginGUI_TreeWidget( QWidget* parent )
+ : QTreeWidget( parent )
+{
+}
+
+QModelIndex HexoticPluginGUI_TreeWidget::moveCursor( CursorAction action, Qt::KeyboardModifiers modifiers )
+{
+ QModelIndex current = currentIndex();
+ int column = current.column();
+ if ( action == MoveNext ) {
+ if ( column < columnCount()-1 ) {
+ QModelIndex next = current.sibling( current.row(), column+1 );
+ if ( isEditable( next ) )
+ return next;
+ }
+ else {
+ QModelIndex next = current.sibling( current.row()+1, 0 );
+ if ( isEditable( next ) )
+ return next;
+ }
+ }
+ else if ( action == MovePrevious ) {
+ if ( column == 0 ) {
+ QModelIndex next = current.sibling( current.row()-1, columnCount()-1 );
+ if ( isEditable( next ) )
+ return next;
+ }
+ else {
+ QModelIndex next = current.sibling( current.row(), column-1 );
+ if ( isEditable( next ) )
+ return next;
+ }
+ }
+ return QTreeWidget::moveCursor( action, modifiers );
+}
+
+void HexoticPluginGUI_TreeWidget::keyPressEvent( QKeyEvent* e )
+{
+ switch ( e->key() ) {
+ case Qt::Key_F2:
+ {
+ QModelIndex index = currentIndex();
+ if ( !isEditable( index ) ) {
+ for ( int i = 0; i < columnCount(); i++ ) {
+ QModelIndex sibling = index.sibling( index.row(), i );
+ if ( isEditable( sibling ) ) {
+ if ( !edit( sibling, EditKeyPressed, e ) )
+ e->ignore();
+ }
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ QTreeWidget::keyPressEvent( e );
+}
--- /dev/null
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#if !defined(HexoticPluginGUI_TreeWidget_H)
+#define HexoticPluginGUI_TreeWidget_H
+
+#include <QTreeWidget>
+
+class HexoticPluginGUI_TreeWidget : public QTreeWidget
+{
+ Q_OBJECT
+public:
+ HexoticPluginGUI_TreeWidget( QWidget* );
+
+protected:
+ QModelIndex moveCursor( CursorAction, Qt::KeyboardModifiers );
+ void keyPressEvent( QKeyEvent* );
+};
+
+#endif // HexoticPluginGUI_TreeWidget_H
print("WARNING: Function MinMaxQuad is deprecated, use SetMinMaxHexes instead")
return self.SetMinMaxHexes(min, max)
+ ## Set advanced option value
+ # @param optionName option name
+ # @param optionValue option value
+ def SetOptionValue(self, optionName, optionValue):
+ self.Parameters().SetOptionValue( optionName, optionValue )
+ pass
+
## Defines "ViscousLayers" hypothesis to give MG-Hexa parameters
# @param numberOfLayers number of boundary layers
# @param firstLayerSize height of the first layer
return self.Parameters()
+ ## To keep working files or remove them.
+ # @param toKeep "keep working files" flag value
+ def SetKeepFiles(self, toKeep):
+ self.Parameters().SetKeepFiles(toKeep)
+ pass
+
+ ## Remove or not the log file (if any) in case of successful computation.
+ # The log file remains in case of errors anyway. If
+ # the "keep working files" flag is set to true, this option
+ # has no effect.
+ # @param toRemove "remove log on success" flag value
+ def SetRemoveLogOnSuccess(self, toRemove):
+ self.Parameters().SetRemoveLogOnSuccess(toRemove)
+ pass
+
+ ## Print the the log in a file. If set to false, the
+ # log is printed on the standard output
+ # @param toPrintLogInFile "print log in a file" flag value
+ def SetPrintLogInFile(self, toPrintLogInFile):
+ self.Parameters().SetStandardOutputLog(not toPrintLogInFile)
+ pass
+
## Defines hypothesis having several parameters
# @return hypothesis object
def Parameters(self):
_hexesMaxLevel = hyp->GetHexesMaxLevel();
_hexesMinSize = hyp->GetMinSize();
_hexesMaxSize = hyp->GetMaxSize();
+ _approxAngle = hyp->GetGeomApproxAngle();
_hexoticIgnoreRidges = hyp->GetHexoticIgnoreRidges();
_hexoticInvalidElements = hyp->GetHexoticInvalidElements();
_hexoticSharpAngleThreshold = hyp->GetHexoticSharpAngleThreshold();
_growth = hyp->GetGrowth();
_facesWithLayers = hyp->GetFacesWithLayers();
_imprintedFaces = hyp->GetImprintedFaces();
+ _keepFiles = hyp->GetKeepFiles();
+ _removeLogOnSuccess = hyp->GetRemoveLogOnSuccess();
+ _logInStandardOutput = hyp->GetStandardOutputLog();
}
else {
cout << std::endl;
_hexesMaxLevel = hyp->GetDefaultHexesMaxLevel();
_hexesMinSize = hyp->GetDefaultMinSize();
_hexesMaxSize = hyp->GetDefaultMaxSize();
+ _approxAngle = hyp->GetDefaultGeomApproxAngle();
_hexoticIgnoreRidges = hyp->GetDefaultHexoticIgnoreRidges();
_hexoticInvalidElements = hyp->GetDefaultHexoticInvalidElements();
_hexoticSharpAngleThreshold = hyp->GetDefaultHexoticSharpAngleThreshold();
_growth = hyp->GetDefaultGrowth();
_facesWithLayers = hyp->GetDefaultFacesWithLayers();
_imprintedFaces = hyp->GetDefaultImprintedFaces();
+ _keepFiles = hyp->GetDefaultKeepFiles();
+ _removeLogOnSuccess = hyp->GetDefaultRemoveLogOnSuccess();
+ _logInStandardOutput = hyp->GetDefaultStandardOutputLog();
}
}
&aHelper, _nbShape, tabShape, tabBox );
std::string log = mgHexa.GetLog();
+ hexahedraMessage = "failed";
if ( Ok )
{
hexahedraMessage = "success";
-#ifndef _DEBUG_
- removeFile(Hexotic_Out);
- removeFile(Hexotic_In);
- //removeFile(aLogFileName);
- for( size_t i=0; i<sizeMapFiles.size(); i++)
- {
- removeFile( TCollection_AsciiString( sizeMapFiles[i].c_str() ) );
- }
-#endif
+ if ( _removeLogOnSuccess )
+ removeFile( aLogFileName );
}
- else
+ else if ( !log.empty() )
{
- hexahedraMessage = "failed";
- if ( mgHexa.IsExecutable() )
- cout << "Problem with MG-Hexa output file " << Hexotic_Out.ToCString() << std::endl;
- // analyse log file
- if ( !log.empty() )
+ if( _computeCanceled )
+ error( "interruption initiated by user" );
+ else
{
+ // get problem description from the log file
char msgLic[] = " Dlim ";
- std::string log = mgHexa.GetLog();
const char* fileBeg = &log[0], *fileEnd = fileBeg + log.size();
if ( std::search( fileBeg, fileEnd, msgLic, msgLic+strlen(msgLic)) != fileEnd )
error("Licence problems.");
}
- if ( !errStr.empty() )
- error(errStr);
+ }
+ else if ( !errStr.empty() )
+ {
+ // the log file is empty
+ removeFile( aLogFileName );
+ INFOS( "MG-Hexa Error, " << errStr);
+ error(COMPERR_ALGO_FAILED, errStr);
+ }
+
+ if ( !Ok && mgHexa.IsExecutable() )
+ cout << "Problem with MG-Hexa output file " << Hexotic_Out.ToCString() << std::endl;
+
+ if ( !_keepFiles )
+ {
+ if (! Ok && _computeCanceled )
+ removeFile( aLogFileName );
+ removeFile(Hexotic_Out);
+ removeFile(Hexotic_In);
+ for ( size_t i = 0; i < sizeMapFiles.size(); i++ )
+ removeFile( sizeMapFiles[i].c_str() );
}
cout << "Hexahedra meshing " << hexahedraMessage << std::endl;
cout << std::endl;
_iShape = 0;
}
- if(_computeCanceled)
- return error(SMESH_Comment("interruption initiated by user"));
-
return Ok;
}
bool HexoticPlugin_Hexotic::Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper)
{
_computeCanceled = false;
-/*
+ /*
SMESH_ComputeErrorPtr myError = SMESH_ComputeError::New();
*/
bool Ok = true;
int _hexesMaxLevel;
double _hexesMinSize;
double _hexesMaxSize;
+ double _approxAngle;
bool _hexoticIgnoreRidges;
bool _hexoticInvalidElements;
bool _hexoticFilesKept;
std::vector<int> _facesWithLayers;
std::vector<int> _imprintedFaces;
SMDS_MeshNode** _tabNode;
+ bool _keepFiles;
+ bool _removeLogOnSuccess;
+ bool _logInStandardOutput;
#ifdef WITH_BLSURFPLUGIN
const BLSURFPlugin_Hypothesis* _blsurfHypo;
#include <utilities.h>
#include <TCollection_AsciiString.hxx>
+#include <SMESH_Comment.hxx>
+
+namespace
+{
+ struct GET_DEFAULT // struct used to get default value from GetOptionValue()
+ {
+ bool isDefault;
+ operator bool* () { return &isDefault; }
+ };
+}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis (int hypId, SMESH_Gen* gen)
_hexesMaxLevel( GetDefaultHexesMaxLevel() ),
_minSize( GetDefaultMinSize() ),
_maxSize( GetDefaultMaxSize() ),
+ _approxAngle( GetDefaultGeomApproxAngle() ),
_hexoticIgnoreRidges( GetDefaultHexoticIgnoreRidges() ),
- _hexoticInvalidElements( GetDefaultHexoticInvalidElements() ),
+ _hexoticInvalidElements( GetDefaultHexoticInvalidElements() ),
_hexoticSharpAngleThreshold( GetDefaultHexoticSharpAngleThreshold() ),
_hexoticNbProc( GetDefaultHexoticNbProc() ),
_hexoticSdMode(GetDefaultHexoticSdMode()),
_hexoticVerbosity(GetDefaultHexoticVerbosity()),
_hexoticMaxMemory(GetDefaultHexoticMaxMemory()),
- _textOptions(GetDefaultTextOptions()),
- _sizeMaps(GetDefaultHexoticSizeMaps()),
_hexoticWorkingDirectory( GetDefaultHexoticWorkingDirectory() ),
+ _logInStandardOutput( GetDefaultStandardOutputLog() ),
+ _removeLogOnSuccess( GetDefaultRemoveLogOnSuccess() ),
+ _keepFiles( GetDefaultKeepFiles() ),
_nbLayers(GetDefaultNbLayers()),
_firstLayerSize(GetDefaultFirstLayerSize()),
_direction(GetDefaultDirection()),
MESSAGE("HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis");
_name = GetHypType();
_param_algo_dim = 3;
+
+ const char* boolOptionNames[] = { "allow_invalid_elements",
+ "enforce_constant_layer_size",
+ "compute_ridges",
+ "flatten_hexa_sides",
+ "recover_sharp_angles",
+ "" // mark of end
+ };
+ const char* intOptionNames[] = { "max_memory", // 2048
+ "max_number_of_threads", // 4
+ "min_level", // 6
+ "max_level", // 10
+ "sizemap_level", // 10
+ "" // mark of end
+ };
+ const char* doubleOptionNames[] = { "ridge_angle", // 60
+ "" // mark of end
+ };
+ const char* charOptionNames[] = { "element_order", // linear
+ "tags", // respect
+ "" // mark of end
+ };
+
+ int i = 0;
+ while (boolOptionNames[i][0])
+ {
+ _boolOptions.insert( boolOptionNames[i] );
+ _option2value[boolOptionNames[i++]].clear();
+ }
+ i = 0;
+ while (intOptionNames[i][0])
+ _option2value[intOptionNames[i++]].clear();
+
+ i = 0;
+ while (doubleOptionNames[i][0]) {
+ _doubleOptions.insert(doubleOptionNames[i]);
+ _option2value[doubleOptionNames[i++]].clear();
+ }
+ i = 0;
+ while (charOptionNames[i][0]) {
+ _charOptions.insert(charOptionNames[i]);
+ _option2value[charOptionNames[i++]].clear();
+ }
+
+ // default values to be used while MG meshing
+
+ _defaultOptionValues["allow_invalid_elements" ] = "no";
+ _defaultOptionValues["enforce_constant_layer_size"] = "no";
+ _defaultOptionValues["compute_ridges" ] = "yes";
+ _defaultOptionValues["flatten_hexa_sides" ] = "no";
+ _defaultOptionValues["recover_sharp_angles" ] = "yes";
+ _defaultOptionValues["max_memory" ] = "2048";
+ _defaultOptionValues["max_number_of_threads" ] = "4";
+ _defaultOptionValues["min_level" ] = "6";
+ _defaultOptionValues["max_level" ] = "10";
+ _defaultOptionValues["sizemap_level" ] = "10";
+ _defaultOptionValues["ridge_angle" ] = "60";
+ _defaultOptionValues["element_order" ] = "linear";
+ _defaultOptionValues["tags" ] = "respect";
+
+#ifdef _DEBUG_
+ // check validity of option names of _defaultOptionValues
+ TOptionValues::iterator n2v = _defaultOptionValues.begin();
+ for ( ; n2v != _defaultOptionValues.end(); ++n2v )
+ ASSERT( _option2value.count( n2v->first ));
+ ASSERT( _option2value.size() == _defaultOptionValues.size() );
+#endif
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
-void HexoticPlugin_Hypothesis::SetHexesMinLevel(int theVal) {
- if (theVal != _hexesMinLevel) {
- _hexesMinLevel = theVal;
- NotifySubMeshesHypothesisModification();
- }
+void HexoticPlugin_Hypothesis::SetHexesMinLevel(int theVal)
+{
+ SetOptionValue( "min_level", SMESH_Comment( theVal ));
+ _hexesMinLevel = theVal;
}
-void HexoticPlugin_Hypothesis::SetHexesMaxLevel(int theVal) {
- if (theVal != _hexesMaxLevel) {
- _hexesMaxLevel = theVal;
- NotifySubMeshesHypothesisModification();
- }
+void HexoticPlugin_Hypothesis::SetHexesMaxLevel(int theVal)
+{
+ SetOptionValue( "max_level", SMESH_Comment( theVal ));
+ _hexesMaxLevel = theVal;
}
void HexoticPlugin_Hypothesis::SetMinSize(double theVal) {
if (theVal != _minSize) {
- _minSize = theVal;
+ _minSize = theVal;
NotifySubMeshesHypothesisModification();
}
}
void HexoticPlugin_Hypothesis::SetMaxSize(double theVal) {
if (theVal != _maxSize) {
- _maxSize = theVal;
+ _maxSize = theVal;
NotifySubMeshesHypothesisModification();
}
}
-void HexoticPlugin_Hypothesis::SetHexoticIgnoreRidges(bool theVal) {
- if (theVal != _hexoticIgnoreRidges) {
- _hexoticIgnoreRidges = theVal;
+void HexoticPlugin_Hypothesis::SetGeomApproxAngle(double theVal) {
+ if (theVal != _approxAngle) {
+ _approxAngle = theVal;
NotifySubMeshesHypothesisModification();
}
}
-void HexoticPlugin_Hypothesis::SetHexoticInvalidElements(bool theVal) {
- if (theVal != _hexoticInvalidElements) {
- _hexoticInvalidElements = theVal;
- NotifySubMeshesHypothesisModification();
- }
+void HexoticPlugin_Hypothesis::SetHexoticIgnoreRidges(bool theVal) {
+ SetOptionValue( "compute_ridges", theVal ? "no" : "yes" );
+ _hexoticIgnoreRidges = theVal;
}
-void HexoticPlugin_Hypothesis::SetHexoticSharpAngleThreshold(double theVal) {
- if (theVal != _hexoticSharpAngleThreshold) {
- _hexoticSharpAngleThreshold = theVal;
- NotifySubMeshesHypothesisModification();
- }
+void HexoticPlugin_Hypothesis::SetHexoticInvalidElements(bool theVal)
+{
+ SetOptionValue( "allow_invalid_elements", theVal ? "yes" : "no" );
+ _hexoticInvalidElements = theVal;
}
-void HexoticPlugin_Hypothesis::SetHexoticNbProc(int theVal) {
- if (theVal != _hexoticNbProc) {
- _hexoticNbProc = theVal;
- NotifySubMeshesHypothesisModification();
- }
+void HexoticPlugin_Hypothesis::SetHexoticSharpAngleThreshold(double theVal)
+{
+ SetOptionValue( "ridge_angle", SMESH_Comment( theVal ));
+ _hexoticSharpAngleThreshold = theVal;
+}
+
+void HexoticPlugin_Hypothesis::SetHexoticNbProc(int theVal)
+{
+ SetOptionValue( "max_number_of_threads", SMESH_Comment( theVal ));
+ _hexoticNbProc = theVal;
}
void HexoticPlugin_Hypothesis::SetHexoticWorkingDirectory(const std::string& path)
}
}
-void HexoticPlugin_Hypothesis::SetHexoticMaxMemory(int theVal) {
- if (theVal != _hexoticMaxMemory) {
- _hexoticMaxMemory = theVal;
+void HexoticPlugin_Hypothesis::SetHexoticMaxMemory(int theVal)
+{
+ SetOptionValue( "max_memory", SMESH_Comment( theVal ));
+ _hexoticMaxMemory = theVal;
+}
+
+void HexoticPlugin_Hypothesis::SetKeepFiles(bool toKeep)
+{
+ if ( _keepFiles != toKeep ) {
+ _keepFiles = toKeep;
NotifySubMeshesHypothesisModification();
}
}
-void HexoticPlugin_Hypothesis::SetAdvancedOption(const std::string& theOptions)
+void HexoticPlugin_Hypothesis::SetStandardOutputLog(bool logInStandardOutput)
{
- if (_textOptions != theOptions ) {
- _textOptions = theOptions;
+ if ( _logInStandardOutput != logInStandardOutput ) {
+ _logInStandardOutput = logInStandardOutput;
NotifySubMeshesHypothesisModification();
}
}
-void HexoticPlugin_Hypothesis::SetTextOptions(const std::string& theOptions)
+
+void HexoticPlugin_Hypothesis::SetRemoveLogOnSuccess(bool removeLogOnSuccess)
{
- if (_textOptions != theOptions ) {
- _textOptions = theOptions;
+ if ( _removeLogOnSuccess != removeLogOnSuccess ) {
+ _removeLogOnSuccess = removeLogOnSuccess;
NotifySubMeshesHypothesisModification();
}
}
-bool HexoticPlugin_Hypothesis::AddSizeMap(std::string theEntry, double theSize) {
+void HexoticPlugin_Hypothesis::SetOptionValue(const std::string& optionName,
+ const std::string& optionValue)
+ throw (std::invalid_argument)
+{
+ TOptionValues::iterator op_val = _option2value.find(optionName);
+ if (op_val == _option2value.end())
+ {
+ op_val = _customOption2value.find( optionName );
+ if ( op_val != _customOption2value.end() && op_val->second != optionValue )
+ NotifySubMeshesHypothesisModification();
+ _customOption2value[ optionName ] = optionValue;
+ return;
+ }
+
+ if (op_val->second != optionValue)
+ {
+ const char* ptr = optionValue.c_str();
+ // strip white spaces
+ while (ptr[0] == ' ')
+ ptr++;
+ int i = strlen(ptr);
+ while (i != 0 && ptr[i - 1] == ' ')
+ i--;
+ // check value type
+ bool typeOk = true;
+ std::string typeName;
+ if (i == 0) {
+ // empty string
+ } else if (_charOptions.count(optionName)) {
+ // do not check strings
+ } else if (_doubleOptions.count(optionName)) {
+ // check if value is double
+ ToDbl(ptr, &typeOk);
+ typeName = "real";
+ } else if (_boolOptions.count(optionName)) {
+ // check if value is bool
+ ToBool(ptr, &typeOk);
+ typeName = "bool";
+ } else {
+ // check if value is int
+ ToInt(ptr, &typeOk);
+ typeName = "integer";
+ }
+ if ( typeOk ) // check some specific values ?
+ {
+ }
+ if ( !typeOk )
+ {
+ std::string msg = "Advanced option '" + optionName + "' = '" + optionValue + "' but must be " + typeName;
+ throw std::invalid_argument(msg);
+ }
+ std::string value( ptr, i );
+ if ( _defaultOptionValues[ optionName ] == value )
+ value.clear();
+
+ op_val->second = value;
+
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=============================================================================
+//! Return option value. If isDefault provided, it can be a default value,
+// then *isDefault == true. If isDefault is not provided, the value will be
+// empty if it equals a default one.
+std::string HexoticPlugin_Hypothesis::GetOptionValue(const std::string& optionName,
+ bool* isDefault) const
+ throw (std::invalid_argument)
+{
+ TOptionValues::const_iterator op_val = _option2value.find(optionName);
+ if (op_val == _option2value.end())
+ {
+ op_val = _customOption2value.find(optionName);
+ if (op_val == _customOption2value.end())
+ {
+ std::string msg = "Unknown MG-Tetra option: <" + optionName + ">";
+ throw std::invalid_argument(msg);
+ }
+ }
+ std::string val = op_val->second;
+ if ( isDefault ) *isDefault = ( val.empty() );
+
+ if ( val.empty() && isDefault )
+ {
+ op_val = _defaultOptionValues.find( optionName );
+ if (op_val != _defaultOptionValues.end())
+ val = op_val->second;
+ }
+ return val;
+}
+
+
+//=============================================================================
+bool HexoticPlugin_Hypothesis::HasOptionDefined( const std::string& optionName ) const
+{
+ bool isDefault = false;
+ try
+ {
+ GetOptionValue( optionName, &isDefault );
+ }
+ catch ( std::invalid_argument )
+ {
+ return false;
+ }
+ return !isDefault;
+}
+
+//=============================================================================
+void HexoticPlugin_Hypothesis::ClearOption(const std::string& optionName)
+{
+ TOptionValues::iterator op_val = _customOption2value.find(optionName);
+ if (op_val != _customOption2value.end())
+ _customOption2value.erase(op_val);
+ else {
+ op_val = _option2value.find(optionName);
+ if (op_val != _option2value.end())
+ op_val->second.clear();
+ }
+}
+
+//=============================================================================
+HexoticPlugin_Hypothesis::TOptionValues HexoticPlugin_Hypothesis::GetOptionValues() const
+{
+ TOptionValues vals;
+ TOptionValues::const_iterator op_val = _option2value.begin();
+ for ( ; op_val != _option2value.end(); ++op_val )
+ vals.insert( make_pair( op_val->first, GetOptionValue( op_val->first, GET_DEFAULT() )));
+
+ return vals;
+}
+
+//================================================================================
+/*!
+ * \brief Converts a string to a bool
+ */
+//================================================================================
+
+bool HexoticPlugin_Hypothesis::ToBool(const std::string& str, bool* isOk )
+ throw (std::invalid_argument)
+{
+ std::string s = str;
+ if ( isOk ) *isOk = true;
+
+ for ( size_t i = 0; i <= s.size(); ++i )
+ s[i] = tolower( s[i] );
+
+ if ( s == "1" || s == "true" || s == "active" || s == "yes" )
+ return true;
+
+ if ( s == "0" || s == "false" || s == "inactive" || s == "no" )
+ return false;
+
+ if ( isOk )
+ *isOk = false;
+ else {
+ std::string msg = "Not a Boolean value:'" + str + "'";
+ throw std::invalid_argument(msg);
+ }
+ return false;
+}
+
+//================================================================================
+/*!
+ * \brief Converts a string to a real value
+ */
+//================================================================================
+
+double HexoticPlugin_Hypothesis::ToDbl(const std::string& str, bool* isOk )
+ throw (std::invalid_argument)
+{
+ if ( str.empty() ) throw std::invalid_argument("Empty value provided");
+
+ char * endPtr;
+ double val = strtod(&str[0], &endPtr);
+ bool ok = (&str[0] != endPtr);
+
+ if ( isOk ) *isOk = ok;
+
+ if ( !ok )
+ {
+ std::string msg = "Not a real value:'" + str + "'";
+ throw std::invalid_argument(msg);
+ }
+ return val;
+}
+
+//================================================================================
+/*!
+ * \brief Converts a string to a integer value
+ */
+//================================================================================
+
+int HexoticPlugin_Hypothesis::ToInt(const std::string& str, bool* isOk )
+ throw (std::invalid_argument)
+{
+ if ( str.empty() ) throw std::invalid_argument("Empty value provided");
+
+ char * endPtr;
+ int val = (int)strtol( &str[0], &endPtr, 10);
+ bool ok = (&str[0] != endPtr);
+
+ if ( isOk ) *isOk = ok;
+
+ if ( !ok )
+ {
+ std::string msg = "Not an integer value:'" + str + "'";
+ throw std::invalid_argument(msg);
+ }
+ return val;
+}
+
+void HexoticPlugin_Hypothesis::SetAdvancedOption(const std::string& option)
+{
+ size_t wsPos = option.find(' ');
+ if ( wsPos == std::string::npos )
+ {
+ SetOptionValue( option, "" );
+ }
+ else
+ {
+ std::string opt( option, 0, wsPos );
+ std::string val( option, wsPos + 1 );
+ SetOptionValue( opt, val );
+ }
+}
+
+//=======================================================================
+//function : GetAdvancedOption
+//purpose : Return only options having NO corresponding member fields
+//=======================================================================
+
+std::string HexoticPlugin_Hypothesis::GetAdvancedOption( bool customOnly ) const
+{
+ // options having corresponding member fields
+ static std::set< std::string > toSkip = {
+ "min_level",
+ "max_level",
+ "compute_ridges",
+ "allow_invalid_elements",
+ "ridge_angle",
+ "max_number_of_threads",
+ "max_memory"
+ };
+
+ // Return only options having NO corresponding member fields
+
+ SMESH_Comment txt;
+
+ TOptionValues::const_iterator o2v = _option2value.begin();
+ if ( !customOnly )
+ {
+ for ( ; o2v != _option2value.end(); ++o2v )
+ if ( !o2v->second.empty() && !toSkip.count( o2v->first ))
+ {
+ if ( !txt.empty() )
+ txt << " ";
+ txt << "--" << o2v->first << " " << o2v->second;
+ }
+ }
+ for ( o2v = _customOption2value.begin(); o2v != _customOption2value.end(); ++o2v )
+ {
+ if ( !txt.empty() )
+ txt << " ";
+ // if ( o2v->first[0] != '-' )
+ // txt << "--";
+ txt << o2v->first << " " << o2v->second;
+ }
+ return txt;
+}
+
+bool HexoticPlugin_Hypothesis::AddSizeMap(std::string theEntry, double theSize)
+{
THexoticSizeMaps::iterator it;
it=_sizeMaps.find(theEntry);
-
+
if(theSize <= 0)
return false;
-
+
if( it == _sizeMaps.end() ) // If no size map is defined on the given object
{
_sizeMaps[theEntry] = theSize;
}
else
{
- MESSAGE("NO size map added")
+ MESSAGE("NO size map added");
return false; // No size map added
}
}
//explicit outputs for future code compatibility of saved .hdf
//save without any whitespaces!
//int dummy = -1;
- save<<"hexesMinLevel="<<_hexesMinLevel<<";";
+ save<<"hexesMinLevel="<<_hexesMinLevel<<";";
save<<"hexesMaxLevel="<<_hexesMaxLevel<<";";
save<<"hexoticIgnoreRidges="<<(int)_hexoticIgnoreRidges<<";";
save<<"hexoticInvalidElements="<<(int)_hexoticInvalidElements<<";";
save<<"hexoticSdMode="<<_hexoticSdMode<<";";
save<<"hexoticVerbosity="<<_hexoticVerbosity<<";";
save<<"hexoticMaxMemory="<<_hexoticMaxMemory<<";";
- std::string textOptions = _textOptions; // save _textOptions
+ std::string textOptions;// = _textOptions;
replace(textOptions.begin(), textOptions.end(), ' ', '*');
save<<"textOptions="<<textOptions<<";";
THexoticSizeMaps::iterator it = _sizeMaps.begin();
}
save<<";";
}
+
+ // New options in 2.9.6 (issue #17784)
+
+ save << " " << _approxAngle;
+ save << " " << _logInStandardOutput;
+ save << " " << _removeLogOnSuccess;
+ save << " " << _keepFiles;
+
+ save << " " << _option2value.size();
+ TOptionValues::iterator o2v = _option2value.begin();
+ for ( ; o2v != _option2value.end(); ++o2v )
+ save << " -" << o2v->first << " -" << o2v->second;
+
+ save << " " << _customOption2value.size();
+ for ( o2v = _customOption2value.begin(); o2v != _customOption2value.end(); ++o2v )
+ save << " -" << o2v->first << " -" << o2v->second;
+
return save;
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
std::istream& HexoticPlugin_Hypothesis::LoadFrom(std::istream& load)
str4 = str2.substr(eqpos+1);
pos = found + 1;
- if (str3=="hexesMinLevel") _hexesMinLevel = atoi(str4.c_str());
- if (str3=="hexesMaxLevel") _hexesMaxLevel = atoi(str4.c_str());
+ if (str3=="hexesMinLevel") _hexesMinLevel = atoi(str4.c_str());
+ if (str3=="hexesMaxLevel") _hexesMaxLevel = atoi(str4.c_str());
if (str3=="hexoticQuadrangles") {}
- if (str3=="hexoticIgnoreRidges") _hexoticIgnoreRidges = (bool) atoi(str4.c_str());
- if (str3=="hexoticInvalidElements") _hexoticInvalidElements = (bool) atoi(str4.c_str());
+ if (str3=="hexoticIgnoreRidges") _hexoticIgnoreRidges = (bool) atoi(str4.c_str());
+ if (str3=="hexoticInvalidElements") _hexoticInvalidElements = (bool) atoi(str4.c_str());
if (str3=="hexoticSharpAngleThreshold") _hexoticSharpAngleThreshold = atof(str4.c_str());
- if (str3=="hexoticNbProc") _hexoticNbProc = atoi(str4.c_str());
- if (str3=="hexoticWorkingDirectory") _hexoticWorkingDirectory = str4;
- if (str3=="minSize") _minSize = atof(str4.c_str());
- if (str3=="maxSize") _maxSize = atof(str4.c_str());
- if (str3=="hexoticSdMode") _hexoticSdMode = atoi(str4.c_str());
- if (str3=="hexoticVerbosity") _hexoticVerbosity = atoi(str4.c_str());
- if (str3=="hexoticMaxMemory") _hexoticMaxMemory = atoi(str4.c_str());
+ if (str3=="hexoticNbProc") _hexoticNbProc = atoi(str4.c_str());
+ if (str3=="hexoticWorkingDirectory") _hexoticWorkingDirectory = str4;
+ if (str3=="minSize") _minSize = atof(str4.c_str());
+ if (str3=="maxSize") _maxSize = atof(str4.c_str());
+ if (str3=="hexoticSdMode") _hexoticSdMode = atoi(str4.c_str());
+ if (str3=="hexoticVerbosity") _hexoticVerbosity = atoi(str4.c_str());
+ if (str3=="hexoticMaxMemory") _hexoticMaxMemory = atoi(str4.c_str());
if (str3=="textOptions")
{
replace(str4.begin(), str4.end(), '*', ' ');
- _textOptions = str4;
+ //_textOptions = str4;
}
if (str3=="sizeMaps")
{
sm_pos = sm_found + 1;
}
}
- if (str3 == "nbLayers") _nbLayers = atoi(str4.c_str());
+ if (str3 == "nbLayers") _nbLayers = atoi(str4.c_str());
if (str3 == "firstLayerSize") _firstLayerSize = atof(str4.c_str());
- if (str3 == "direction") _direction = atoi(str4.c_str());
- if (str3 == "growth") _growth = atof(str4.c_str());
+ if (str3 == "direction") _direction = atoi(str4.c_str());
+ if (str3 == "growth") _growth = atof(str4.c_str());
if (str3 == "facesWithLayers")
{
std::string id;
}
}
}
+
+ // New options in 2.9.6 (issue #17784)
+
+ if ( static_cast<bool>( load >> _approxAngle ))
+ {
+ int i;
+ load >> i; _logInStandardOutput = (bool)i;
+ load >> i; _removeLogOnSuccess = (bool)i;
+ load >> i; _keepFiles = (bool)i;
+
+ std::string option, value;
+ if ( static_cast<bool>( load >> i ) && i >= 0 )
+ {
+ for ( int nbRead = 0; nbRead < i; ++nbRead )
+ {
+ load >> option >> value;
+ _option2value[ std::string( option, 1 )] = std::string( value, 1 );
+ }
+ }
+ if ( static_cast<bool>( load >> i ) && i >= 0 )
+ {
+ for ( int nbRead = 0; nbRead < i; ++nbRead )
+ {
+ load >> option >> value;
+ _customOption2value[ std::string( option, 1 )] = std::string( value, 1 );
+ }
+ }
+ }
+
return load;
}
#include "Utils_SALOME_Exception.hxx"
#include <map>
+#include <set>
#include <vector>
// class HexoticSizeMap
void SetMaxSize(double theVal);
double GetMaxSize() const { return _maxSize; }
+ void SetGeomApproxAngle(double angle);
+ double GetGeomApproxAngle() const { return _approxAngle; }
+
void SetHexoticIgnoreRidges(bool theVal);
bool GetHexoticIgnoreRidges() const { return _hexoticIgnoreRidges; }
void SetHexoticMaxMemory(int theVal);
int GetHexoticMaxMemory() const { return _hexoticMaxMemory; }
- void SetAdvancedOption(const std::string& theOptions);
- std::string GetAdvancedOption() const { return _textOptions; }
- void SetTextOptions(const std::string& theOptions); // obsolete
- std::string GetTextOptions() const { return _textOptions; }
+ void SetKeepFiles(bool toKeep);
+ bool GetKeepFiles() const { return _keepFiles; }
+ void SetStandardOutputLog(bool logInStandardOutput);
+ bool GetStandardOutputLog() const { return _logInStandardOutput; }
+ void SetRemoveLogOnSuccess(bool removeLogOnSuccess);
+ bool GetRemoveLogOnSuccess() const { return _removeLogOnSuccess; }
+
+
+ typedef std::map< std::string, std::string > TOptionValues;
+ typedef std::set< std::string > TOptionNames;
+
+ void SetOptionValue(const std::string& optionName,
+ const std::string& optionValue) throw (std::invalid_argument);
+ std::string GetOptionValue(const std::string& optionName,
+ bool* isDefault=0) const throw (std::invalid_argument);
+ bool HasOptionDefined( const std::string& optionName ) const;
+ void ClearOption(const std::string& optionName);
+ TOptionValues GetOptionValues() const;
+ const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
+ std::string GetAdvancedOption( bool customOnly = false ) const;
+ void SetAdvancedOption(const std::string& theOptions); // obsolete
+
+ static bool ToBool(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
+ static double ToDbl(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
+ static int ToInt(const std::string& str, bool* isOk=0) throw (std::invalid_argument);
+
// Size Maps
typedef std::map<std::string,double> THexoticSizeMaps;
-
+
// For the GUI HexoticPluginGUI_HypothesisCreator::storeParamToHypo
const THexoticSizeMaps& GetSizeMaps() const { return _sizeMaps; }
static int GetDefaultHexesMaxLevel();
static double GetDefaultMinSize();
static double GetDefaultMaxSize();
+ static double GetDefaultGeomApproxAngle() { return 0; }
static bool GetDefaultHexoticIgnoreRidges();
static bool GetDefaultHexoticInvalidElements();
static double GetDefaultHexoticSharpAngleThreshold();
static double GetDefaultGrowth();
static std::vector<int> GetDefaultFacesWithLayers();
static std::vector<int> GetDefaultImprintedFaces();
+ static bool GetDefaultStandardOutputLog() { return false; }
+ static bool GetDefaultRemoveLogOnSuccess() { return false; }
+ static bool GetDefaultKeepFiles() { return false; }
// Persistence
virtual std::ostream& SaveTo(std::ostream& save);
*/
virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
-private:
+ private:
int _hexesMinLevel;
int _hexesMaxLevel;
double _minSize;
double _maxSize;
+ double _approxAngle;
bool _hexoticIgnoreRidges;
bool _hexoticInvalidElements;
double _hexoticSharpAngleThreshold;
int _hexoticSdMode;
int _hexoticVerbosity;
int _hexoticMaxMemory;
- std::string _textOptions;
THexoticSizeMaps _sizeMaps;
+
+ TOptionValues _option2value, _customOption2value; // user defined values
+ TOptionValues _defaultOptionValues; // default values
+ TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
+
std::string _hexoticWorkingDirectory;
+ bool _logInStandardOutput;
+ bool _removeLogOnSuccess;
+ bool _keepFiles;
+
int _nbLayers;
double _firstLayerSize;
bool _direction;
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA )
{
- MESSAGE( "HexoticPlugin_Hypothesis_i::HexoticPlugin_Hypothesis_i" );
myBaseImpl = new ::HexoticPlugin_Hypothesis (theGenImpl->GetANewId(),
theGenImpl);
}
//=============================================================================
HexoticPlugin_Hypothesis_i::~HexoticPlugin_Hypothesis_i()
{
- MESSAGE( "HexoticPlugin_Hypothesis_i::~HexoticPlugin_Hypothesis_i" );
}
//=============================================================================
void HexoticPlugin_Hypothesis_i::SetHexesMinLevel (CORBA::Long theValue)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMinLevel");
ASSERT(myBaseImpl);
CORBA::Long oldValue = GetHexesMinLevel();
this->GetImpl()->SetHexesMinLevel(theValue);
void HexoticPlugin_Hypothesis_i::SetHexesMaxLevel (CORBA::Long theValue)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMaxLevel");
ASSERT(myBaseImpl);
CORBA::Long oldValue = GetHexesMaxLevel();
this->GetImpl()->SetHexesMaxLevel(theValue);
void HexoticPlugin_Hypothesis_i::SetMinSize (CORBA::Double theValue)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMaxLevel");
ASSERT(myBaseImpl);
CORBA::Double oldValue = GetMinSize();
this->GetImpl()->SetMinSize(theValue);
void HexoticPlugin_Hypothesis_i::SetMaxSize (CORBA::Double theValue)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMaxLevel");
ASSERT(myBaseImpl);
CORBA::Double oldValue = GetMaxSize();
this->GetImpl()->SetMaxSize(theValue);
SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theValue << " )";
}
+void HexoticPlugin_Hypothesis_i::SetGeomApproxAngle(CORBA::Double angle)
+{
+ CORBA::Double oldValue = GetGeomApproxAngle();
+ this->GetImpl()->SetGeomApproxAngle( angle );
+ if (angle != oldValue)
+ SMESH::TPythonDump() << _this() << ".SetGeomApproxAngle( " << angle << " )";
+}
+
+CORBA::Double HexoticPlugin_Hypothesis_i::GetGeomApproxAngle()
+{
+ return this->GetImpl()->GetGeomApproxAngle();
+}
+
void HexoticPlugin_Hypothesis_i::SetHexoticIgnoreRidges (CORBA::Boolean theValue)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticIgnoreRidges");
ASSERT(myBaseImpl);
CORBA::Boolean oldValue = GetHexoticIgnoreRidges();
this->GetImpl()->SetHexoticIgnoreRidges(theValue);
void HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements (CORBA::Boolean theValue)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements");
ASSERT(myBaseImpl);
CORBA::Boolean oldValue = GetHexoticInvalidElements();
this->GetImpl()->SetHexoticInvalidElements(theValue);
void HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold (CORBA::Double theValue)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold");
ASSERT(myBaseImpl);
CORBA::Double oldValue = GetHexoticSharpAngleThreshold();
this->GetImpl()->SetHexoticSharpAngleThreshold(theValue);
void HexoticPlugin_Hypothesis_i::SetHexoticNbProc (CORBA::Long theValue)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticNbProc");
ASSERT(myBaseImpl);
CORBA::Long oldValue = GetHexoticNbProc();
this->GetImpl()->SetHexoticNbProc(theValue);
SMESH::TPythonDump() << _this() << ".SetHexoticWorkingDirectory( '" << path << "' )";
}
+void HexoticPlugin_Hypothesis_i::SetKeepFiles(::CORBA::Boolean toKeep)
+{
+ if ( GetKeepFiles() != toKeep )
+ {
+ this->GetImpl()->SetKeepFiles(toKeep);
+ SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
+ }
+}
+
+::CORBA::Boolean HexoticPlugin_Hypothesis_i::GetKeepFiles()
+{
+ return this->GetImpl()->GetKeepFiles();
+}
+
+void HexoticPlugin_Hypothesis_i::SetStandardOutputLog(::CORBA::Boolean logInStandardOutput)
+{
+ if ( GetStandardOutputLog() != logInStandardOutput )
+ {
+ this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
+ SMESH::TPythonDump() << _this() << ".SetStandardOutputLog( " << logInStandardOutput << " )";
+ }
+}
+
+::CORBA::Boolean HexoticPlugin_Hypothesis_i::GetStandardOutputLog()
+{
+ return this->GetImpl()->GetStandardOutputLog();
+}
+
+void HexoticPlugin_Hypothesis_i::SetRemoveLogOnSuccess(::CORBA::Boolean removeLogOnSuccess)
+{
+ if ( GetRemoveLogOnSuccess() != removeLogOnSuccess )
+ {
+ this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
+ SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
+ }
+}
+
+::CORBA::Boolean HexoticPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
+{
+ return this->GetImpl()->GetRemoveLogOnSuccess();
+}
+
void HexoticPlugin_Hypothesis_i::SetHexoticSdMode (CORBA::Long theValue)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticSdMode");
ASSERT(myBaseImpl);
CORBA::Long oldValue = GetHexoticSdMode();
this->GetImpl()->SetHexoticSdMode(theValue);
void HexoticPlugin_Hypothesis_i::SetHexoticVerbosity (CORBA::Long theValue)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetVerbosity");
ASSERT(myBaseImpl);
CORBA::Long oldValue = GetHexoticVerbosity();
this->GetImpl()->SetHexoticVerbosity(theValue);
void HexoticPlugin_Hypothesis_i::SetHexoticMaxMemory (CORBA::Long theValue)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticMaxMemory");
ASSERT(myBaseImpl);
CORBA::Long oldValue = GetHexoticMaxMemory();
this->GetImpl()->SetHexoticMaxMemory(theValue);
SMESH::TPythonDump() << _this() << ".SetHexoticMaxMemory( " << theValue << " )";
}
-void HexoticPlugin_Hypothesis_i::SetTextOptions(const char* theOptions)
+void HexoticPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
+ throw (SALOME::SALOME_Exception)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetTextOptions");
ASSERT(myBaseImpl);
- std::string oldValue(GetAdvancedOption());
- this->GetImpl()->SetAdvancedOption(theOptions);
- if (theOptions != oldValue)
- SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << theOptions << "' )";
+ try {
+ std::string name( optionName );
+ if ( !optionValue || !optionValue[0] )
+ UnsetOption( optionName );
+
+ // options having corresponding methods
+
+ else if ( name == "max_memory" )
+ SetHexoticMaxMemory( GetImpl()->ToInt( optionValue ));
+
+ else if ( name == "min_level" )
+ SetHexesMinLevel( GetImpl()->ToInt( optionValue ));
+
+ else if ( name == "max_level" )
+ SetHexesMaxLevel( GetImpl()->ToInt( optionValue ));
+
+ else if ( name == "min_size" )
+ SetMinSize( GetImpl()->ToDbl( optionValue ));
+
+ else if ( name == "max_size" )
+ SetMaxSize( GetImpl()->ToDbl( optionValue ));
+
+ else if ( name == "ridge_angle" )
+ SetHexoticSharpAngleThreshold( GetImpl()->ToDbl( optionValue ));
+
+ else if ( name == "compute_ridges" )
+ SetHexoticIgnoreRidges( ! GetImpl()->ToBool( optionValue ));
+
+ else if ( name == "allow_invalid_elements" )
+ SetHexoticInvalidElements( GetImpl()->ToBool( optionValue ));
+
+ else if ( name == "max_number_of_threads" )
+ SetHexoticNbProc( GetImpl()->ToInt( optionValue ));
+
+ else if ( name == "verbose" )
+ SetHexoticVerbosity( GetImpl()->ToInt( optionValue ));
+
+ // advanced options (for backward compatibility)
+ // else if ( name == "create_tag_on_collision" ||
+ // name == "tiny_edge_respect_geometry" )
+ // AddOption( optionName, optionValue );
+
+ else {
+ bool valueChanged = true, isDefault;
+ try {
+ valueChanged = ( this->GetImpl()->GetOptionValue( name, &isDefault ) != optionValue );
+ }
+ catch ( std::invalid_argument ) {
+ }
+ if ( valueChanged )
+ {
+ this->GetImpl()->SetOptionValue(optionName, optionValue);
+ SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
+ }
+ }
+ } catch (const std::invalid_argument& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+//=============================================================================
+
+char* HexoticPlugin_Hypothesis_i::GetOptionValue(const char* optionName)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+ try {
+ bool isDefault;
+ return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
+ } catch (const std::invalid_argument& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+ return 0;
+}
+
+//=============================================================================
+
+void HexoticPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
+ ASSERT(myBaseImpl);
+ if ( !GetImpl()->GetOptionValue( optionName ).empty() )
+ {
+ this->GetImpl()->ClearOption(optionName);
+ SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
+ }
+}
+
+//=============================================================================
+
+HexoticPlugin::string_array* HexoticPlugin_Hypothesis_i::GetOptionValues()
+{
+ HexoticPlugin::string_array_var result = new HexoticPlugin::string_array();
+
+ const ::HexoticPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
+ result->length(opts.size());
+ int i=0;
+
+ bool isDefault;
+ ::HexoticPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
+ for (; opIt != opts.end(); ++opIt, ++i)
+ {
+ std::string name_value_type = opIt->first;
+ //if (!opIt->second.empty())
+ {
+ name_value_type += ":";
+ name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
+ name_value_type += isDefault ? ":0" : ":1";
+ }
+ result[i] = CORBA::string_dup(name_value_type.c_str());
+ }
+
+ return result._retn();
+}
+
+//=============================================================================
+
+HexoticPlugin::string_array* HexoticPlugin_Hypothesis_i::GetAdvancedOptionValues()
+{
+ HexoticPlugin::string_array_var result = new HexoticPlugin::string_array();
+
+ const ::HexoticPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
+ result->length(custom_opts.size());
+ int i=0;
+
+ ::HexoticPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
+ for (; opIt != custom_opts.end(); ++opIt, ++i) {
+ std::string name_value_type = opIt->first;
+ if (!opIt->second.empty()) {
+ name_value_type += ":";
+ name_value_type += opIt->second;
+ name_value_type += ":1"; // user defined
+ }
+ result[i] = CORBA::string_dup(name_value_type.c_str());
+ }
+ return result._retn();
+}
+
+//=============================================================================
+
+void HexoticPlugin_Hypothesis_i::SetOptionValues(const HexoticPlugin::string_array& options)
+ throw (SALOME::SALOME_Exception)
+{
+ for (CORBA::ULong i = 0; i < options.length(); ++i)
+ {
+ std::string name_value_type = options[i].in();
+ if(name_value_type.empty())
+ continue;
+ size_t colonPos = name_value_type.find(':');
+ std::string name, value;
+ if (colonPos == std::string::npos) // ':' not found
+ name = name_value_type;
+ else {
+ name = name_value_type.substr(0, colonPos);
+ if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
+ std::string value_type = name_value_type.substr(colonPos + 1);
+ colonPos = value_type.find(':');
+ value = value_type.substr(0, colonPos);
+ if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
+ if ( value_type.substr(colonPos + 1) == "0" ) // is default
+ value.clear();
+ }
+ }
+ SetOptionValue(name.c_str(), value.c_str());
+ }
}
-void HexoticPlugin_Hypothesis_i::SetAdvancedOption(const char* theOptions)
+//=============================================================================
+
+void HexoticPlugin_Hypothesis_i::SetAdvancedOptionValues(const HexoticPlugin::string_array& options)
+{
+ SMESH::TPythonDump dump;
+
+ std::string optionsAndValues;
+ for ( CORBA::ULong i = 0; i < options.length(); ++i) {
+ std::string name_value_type = options[i].in();
+ if(name_value_type.empty())
+ continue;
+ size_t colonPos = name_value_type.find(':');
+ std::string name, value;
+ if (colonPos == std::string::npos) // ':' not found
+ name = name_value_type;
+ else {
+ name = name_value_type.substr(0, colonPos);
+ if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
+ std::string value_type = name_value_type.substr(colonPos + 1);
+ colonPos = value_type.find(':');
+ value = value_type.substr(0, colonPos);
+ }
+ }
+ AddOption(name.c_str(), value.c_str());
+
+ optionsAndValues += name + " " + value + " ";
+ }
+
+ if ( !optionsAndValues.empty() )
+ dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
+}
+
+//=============================================================================
+
+void HexoticPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
+ throw (SALOME::SALOME_Exception)
+{
+ if ( !optionsAndValues ) return;
+
+ SMESH::TPythonDump dump;
+
+ std::istringstream strm( optionsAndValues );
+ std::istream_iterator<std::string> sIt( strm ), sEnd;
+ for ( int nbPairs = 0; sIt != sEnd; ++nbPairs )
+ {
+ std::string option = *sIt;
+ if ( ++sIt != sEnd )
+ {
+ std::string value = *sIt;
+ ++sIt;
+ AddOption( option.c_str(), value.c_str() );
+ }
+ else
+ {
+ if ( nbPairs > 0 )
+ THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
+ AddOption( option.c_str(), "" );
+ }
+ }
+ dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
+}
+
+//=============================================================================
+
+void HexoticPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
+{
+ ASSERT(myBaseImpl);
+ bool valueChanged = ( !this->GetImpl()->HasOptionDefined(optionName) ||
+ this->GetImpl()->GetOptionValue(optionName) != optionValue );
+ if (valueChanged) {
+ this->GetImpl()->SetOptionValue(optionName, optionValue);
+ SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
+ }
+}
+
+//=============================================================================
+
+char* HexoticPlugin_Hypothesis_i::GetOption(const char* optionName)
+{
+ ASSERT(myBaseImpl);
+ return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
+}
+
+void HexoticPlugin_Hypothesis_i::SetTextOptions(const char* theOptions)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetAdvancedOption");
ASSERT(myBaseImpl);
std::string oldValue(GetAdvancedOption());
this->GetImpl()->SetAdvancedOption(theOptions);
void HexoticPlugin_Hypothesis_i::SetSizeMapEntry ( const char* theEntry, CORBA::Double theSize )
{
-// MESSAGE("HexoticPlugin_Hypothesis_i::SetSizeMapEntry");
bool valueChanged = this->GetImpl()->AddSizeMap(theEntry, theSize);
if (valueChanged)
SMESH::TPythonDump() << _this() << ".SetSizeMap( "<< theEntry << ", " << theSize << " )";
void HexoticPlugin_Hypothesis_i::UnsetSizeMapEntry ( const char* theEntry )
{
-// MESSAGE("HexoticPlugin_Hypothesis_i::UnsetSizeMapEntry");
bool entryRemoved = this->GetImpl()->UnsetSizeMap(theEntry);
if (entryRemoved)
SMESH::TPythonDump() << _this() << ".UnsetSizeMap( "<< theEntry << " )";
void HexoticPlugin_Hypothesis_i::SetSizeMap (const GEOM::GEOM_Object_ptr theGeomObj, const double theSize)
{
-// MESSAGE("HexoticPlugin_Hypothesis_i::SetSizeMap");
ASSERT(myBaseImpl);
std::string entry = theGeomObj->GetStudyEntry();
SetSizeMapEntry( entry.c_str(), theSize);
void HexoticPlugin_Hypothesis_i::UnsetSizeMap (const GEOM::GEOM_Object_ptr theGeomObj)
{
-// MESSAGE("HexoticPlugin_Hypothesis_i::UnsetSizeMap");
ASSERT(myBaseImpl);
std::string entry = theGeomObj->GetStudyEntry();
UnsetSizeMapEntry( entry.c_str());
void HexoticPlugin_Hypothesis_i::SetNbLayers(CORBA::Long theVal)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetNbLayers");
ASSERT(myBaseImpl);
CORBA::Long oldValue = GetNbLayers();
this->GetImpl()->SetNbLayers(theVal);
void HexoticPlugin_Hypothesis_i::SetFirstLayerSize(CORBA::Double theVal)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetFirstLayerSize");
ASSERT(myBaseImpl);
CORBA::Double oldValue = GetFirstLayerSize();
this->GetImpl()->SetFirstLayerSize(theVal);
void HexoticPlugin_Hypothesis_i::SetDirection(CORBA::Boolean theVal)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetDirection");
ASSERT(myBaseImpl);
CORBA::Boolean oldValue = GetDirection();
this->GetImpl()->SetDirection(theVal);
void HexoticPlugin_Hypothesis_i::SetGrowth(CORBA::Double theVal)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetGrowth");
ASSERT(myBaseImpl);
CORBA::Double oldValue = GetGrowth();
this->GetImpl()->SetGrowth(theVal);
void HexoticPlugin_Hypothesis_i::SetFacesWithLayers(const ::SMESH::long_array& theVal)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetFacesWithLayers");
std::vector<int> ids( theVal.length() );
for ( unsigned i = 0; i < ids.size(); ++i )
ids[i] = theVal[i];
void HexoticPlugin_Hypothesis_i::SetImprintedFaces(const ::SMESH::long_array& theVal)
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::SetImprintedFaces");
std::vector<int> ids( theVal.length() );
for ( unsigned i = 0; i < ids.size(); ++i )
ids[i] = theVal[i];
CORBA::Long HexoticPlugin_Hypothesis_i::GetHexesMinLevel()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexesMinLevel");
ASSERT(myBaseImpl);
return this->GetImpl()->GetHexesMinLevel();
}
CORBA::Long HexoticPlugin_Hypothesis_i::GetHexesMaxLevel()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexesMaxLevel");
ASSERT(myBaseImpl);
return this->GetImpl()->GetHexesMaxLevel();
}
CORBA::Double HexoticPlugin_Hypothesis_i::GetMinSize()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetMinSize");
ASSERT(myBaseImpl);
return this->GetImpl()->GetMinSize();
}
CORBA::Double HexoticPlugin_Hypothesis_i::GetMaxSize()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetMaxSize");
ASSERT(myBaseImpl);
return this->GetImpl()->GetMaxSize();
}
CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges");
ASSERT(myBaseImpl);
return this->GetImpl()->GetHexoticIgnoreRidges();
}
CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements");
ASSERT(myBaseImpl);
return this->GetImpl()->GetHexoticInvalidElements();
}
CORBA::Double HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold");
ASSERT(myBaseImpl);
return this->GetImpl()->GetHexoticSharpAngleThreshold();
}
CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticNbProc()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticNbProc");
ASSERT(myBaseImpl);
return this->GetImpl()->GetHexoticNbProc();
}
CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticSdMode ()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticSdMode");
ASSERT(myBaseImpl);
return this->GetImpl()->GetHexoticSdMode();
}
CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticVerbosity()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetVerbosity");
ASSERT(myBaseImpl);
return this->GetImpl()->GetHexoticVerbosity();
}
CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory");
ASSERT(myBaseImpl);
return this->GetImpl()->GetHexoticMaxMemory();
}
char* HexoticPlugin_Hypothesis_i::GetAdvancedOption()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetAdvancedOption");
ASSERT(myBaseImpl);
- return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
+ return CORBA::string_dup( this->GetImpl()->GetAdvancedOption( /*customOnly=*/true ).c_str() );
}
char* HexoticPlugin_Hypothesis_i::GetTextOptions()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetTextOptions");
ASSERT(myBaseImpl);
return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
}
CORBA::Long HexoticPlugin_Hypothesis_i::GetNbLayers()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetNbLayers");
ASSERT(myBaseImpl);
return this->GetImpl()->GetNbLayers();
}
CORBA::Double HexoticPlugin_Hypothesis_i::GetFirstLayerSize()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetFirstLayerSize");
ASSERT(myBaseImpl);
return this->GetImpl()->GetFirstLayerSize();
}
CORBA::Boolean HexoticPlugin_Hypothesis_i::GetDirection()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetDirection");
ASSERT(myBaseImpl);
return this->GetImpl()->GetDirection();
}
CORBA::Double HexoticPlugin_Hypothesis_i::GetGrowth()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetGrowth");
ASSERT(myBaseImpl);
return this->GetImpl()->GetGrowth();
}
SMESH::long_array* HexoticPlugin_Hypothesis_i::GetFacesWithLayers()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetFacesWithLayers");
ASSERT(myBaseImpl);
std::vector<int> idsVec = this->GetImpl()->GetFacesWithLayers();
SMESH::long_array_var ids = new SMESH::long_array;
SMESH::long_array* HexoticPlugin_Hypothesis_i::GetImprintedFaces()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetImprintedFaces");
ASSERT(myBaseImpl);
std::vector<int> idsVec = this->GetImpl()->GetImprintedFaces();
SMESH::long_array_var ids = new SMESH::long_array;
//=============================================================================
::HexoticPlugin_Hypothesis* HexoticPlugin_Hypothesis_i::GetImpl()
{
- // MESSAGE("HexoticPlugin_Hypothesis_i::GetImpl");
return (::HexoticPlugin_Hypothesis*)myBaseImpl;
}
void SetMaxSize(CORBA::Double theVal);
CORBA::Double GetMaxSize();
+ void SetGeomApproxAngle(CORBA::Double angle);
+ CORBA::Double GetGeomApproxAngle();
+
void SetHexoticIgnoreRidges(CORBA::Boolean theVal);
CORBA::Boolean GetHexoticIgnoreRidges();
-
+
void SetHexoticInvalidElements(CORBA::Boolean theVal);
CORBA::Boolean GetHexoticInvalidElements();
-
+
void SetHexoticSharpAngleThreshold(CORBA::Double theVal);
CORBA::Double GetHexoticSharpAngleThreshold();
-
+
void SetHexoticNbProc(CORBA::Long theVal);
CORBA::Long GetHexoticNbProc();
-
+
void SetHexoticWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception );
char* GetHexoticWorkingDirectory();
+ void SetKeepFiles(::CORBA::Boolean toKeep);
+ ::CORBA::Boolean GetKeepFiles();
+
+ void SetStandardOutputLog(::CORBA::Boolean logInStandardOutput);
+ ::CORBA::Boolean GetStandardOutputLog();
+
+ void SetRemoveLogOnSuccess(::CORBA::Boolean removeLogOnSuccess);
+ ::CORBA::Boolean GetRemoveLogOnSuccess();
+
void SetHexoticSdMode(CORBA::Long value);
CORBA::Long GetHexoticSdMode();
void SetHexoticMaxMemory(CORBA::Long theVal);
CORBA::Long GetHexoticMaxMemory();
-
- void SetAdvancedOption(const char* theOptions);
+
+ void SetAdvancedOption(const char* theOptions) throw (SALOME::SALOME_Exception);
char* GetAdvancedOption();
void SetTextOptions(const char* theOptions); // obsolete
char* GetTextOptions();
+ void SetOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception);
+ char* GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception);
+ void UnsetOption(const char* optionName);
+
+ HexoticPlugin::string_array* GetOptionValues();
+ HexoticPlugin::string_array* GetAdvancedOptionValues();
+
+ void SetOptionValues(const HexoticPlugin::string_array& options) throw (SALOME::SALOME_Exception);
+ void SetAdvancedOptionValues(const HexoticPlugin::string_array& options);
+
+ void AddOption(const char* optionName, const char* optionValue);
+ char* GetOption(const char* optionName);
void SetSizeMapEntry(const char* theEntry, CORBA::Double theSize);
void UnsetSizeMapEntry(const char* theEntry);
-
+
void SetSizeMap(GEOM::GEOM_Object_ptr theGeomObj, double theSize);
void UnsetSizeMap(GEOM::GEOM_Object_ptr theGeomObj);
HexoticPlugin::HexoticPluginSizeMapsList* GetSizeMaps ();