-// Copyright (C) 2004-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2004-2016 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// 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
// File : GHS3DPluginGUI_HypothesisCreator.cxx
// Author : Michael Zorin
// Module : GHS3DPlugin
-// $Header:
//
#include "GHS3DPluginGUI_HypothesisCreator.h"
-// #include "GHS3DPluginGUI_EnforcedDelegates.h"
#include "GHS3DPluginGUI_Enums.h"
+#include "GHS3DPluginGUI_Dlg.h"
-#include "GeometryGUI.h"
+#include <GeometryGUI.h>
#include <SMESHGUI_Utils.h>
#include <SMESHGUI_SpinBox.h>
#include <boost/algorithm/string.hpp>
-namespace {
-
-#ifdef WIN32
-#include <windows.h>
-#else
-#include <sys/sysinfo.h>
-#endif
-
- int maxAvailableMemory()
- {
-#ifdef WIN32
- // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
- MEMORYSTATUSEX statex;
- statex.dwLength = sizeof (statex);
- int err = GlobalMemoryStatusEx (&statex);
- if (err != 0) {
- int totMB =
- statex.ullTotalPhys / 1024 / 1024 +
- statex.ullTotalPageFile / 1024 / 1024 +
- statex.ullTotalVirtual / 1024 / 1024;
- return (int) ( 0.7 * totMB );
- }
-#else
- struct sysinfo si;
- int err = sysinfo( &si );
- if ( err == 0 ) {
- int totMB =
- si.totalram * si.mem_unit / 1024 / 1024 +
- si.totalswap * si.mem_unit / 1024 / 1024 ;
- return (int) ( 0.7 * totMB );
- }
-#endif
- return 0;
- }
-}
-
//
// BEGIN EnforcedVertexTableWidgetDelegate
//
void EnforcedMeshTableWidgetDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
- QItemDelegate::setEditorData(editor, index);
+ QItemDelegate::setEditorData(editor, index);
}
void EnforcedMeshTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
}
/**
- * \brief {Get or create the geom selection tool for active study}
+ * \brief {Get or create the geom selection tool for study}
* */
GeomSelectionTools* GHS3DPluginGUI_HypothesisCreator::getGeomSelectionTool()
{
GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) {
- that->GeomToolSelected = new GeomSelectionTools(aStudy);
+ if (that->GeomToolSelected == NULL) {
+ that->GeomToolSelected = new GeomSelectionTools();
}
return that->GeomToolSelected;
}
}
myToMeshHolesCheck = new QCheckBox( tr( "GHS3D_TO_MESH_HOLES" ), myStdGroup );
- aStdLayout->addWidget( myToMeshHolesCheck, row++, 0, 1, 2 );
+ aStdLayout->addWidget( myToMeshHolesCheck, row, 0, 1, 1 );
+ myToMakeGroupsOfDomains = new QCheckBox( tr( "GHS3D_TO_MAKE_DOMAIN_GROUPS" ), myStdGroup );
+ aStdLayout->addWidget( myToMakeGroupsOfDomains, row++, 1, 1, 1 );
aStdLayout->addWidget( new QLabel( tr( "GHS3D_OPTIMIZATIOL_LEVEL" ), myStdGroup ), row, 0, 1, 1 );
myOptimizationLevelCombo = new QComboBox( myStdGroup );
QGridLayout* anAdvLayout = new QGridLayout( myAdvGroup );
anAdvLayout->setSpacing( 6 );
anAdvLayout->setMargin( 11 );
-
- myMaximumMemoryCheck = new QCheckBox( tr( "MAX_MEMORY_SIZE" ), myAdvGroup );
- myMaximumMemorySpin = new QSpinBox( myAdvGroup );
- myMaximumMemorySpin->setMinimum( 1 );
- myMaximumMemorySpin->setMaximum( maxAvailableMemory() );
- myMaximumMemorySpin->setSingleStep( 10 );
- QLabel* aMegabyteLabel = new QLabel( tr( "MEGABYTE" ), myAdvGroup );
-
- myInitialMemoryCheck = new QCheckBox( tr( "INIT_MEMORY_SIZE" ), myAdvGroup );
- myInitialMemorySpin = new QSpinBox( myAdvGroup );
- myInitialMemorySpin->setMinimum( 1 );
- myInitialMemorySpin->setMaximum( maxAvailableMemory() );
- myInitialMemorySpin->setSingleStep( 10 );
- QLabel* aMegabyteLabel2 = new QLabel( tr( "MEGABYTE" ), myAdvGroup );
-
- QLabel* aWorkinDirLabel = new QLabel( tr( "WORKING_DIR" ), myAdvGroup );
- myWorkingDir = new QLineEdit( myAdvGroup );
- //myWorkingDir->setReadOnly( true );
- QPushButton* dirBtn = new QPushButton( tr( "SELECT_DIR" ), myAdvGroup );
- dirBtn->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
-
- myKeepFiles = new QCheckBox( tr( "KEEP_WORKING_FILES" ), myAdvGroup );
+ myAdvWidget = new GHS3DPluginGUI_AdvWidget(myAdvGroup);
+ anAdvLayout->addWidget( myAdvWidget);
- QLabel* aVerboseLevelLabel = new QLabel( tr( "VERBOSE_LEVEL" ), myAdvGroup );
- myVerboseLevelSpin = new QSpinBox( myAdvGroup );
- myVerboseLevelSpin->setMinimum( 0 );
- myVerboseLevelSpin->setMaximum( 10 );
- myVerboseLevelSpin->setSingleStep( 1 );
+ myAdvWidget->maxMemoryCheck->setText(tr( "MAX_MEMORY_SIZE" ));
+ myAdvWidget->initialMemoryCheck->setText(tr( "INIT_MEMORY_SIZE" ));
- myToCreateNewNodesCheck = new QCheckBox( tr( "TO_ADD_NODES" ), myAdvGroup );
-
- myRemoveInitialCentralPointCheck = new QCheckBox( tr( "NO_INITIAL_CENTRAL_POINT" ), myAdvGroup );
+ myAdvWidget->maxMemorySpin->stepBy(10);
+ myAdvWidget->maxMemorySpin->setValue( 128 );
+
+ myAdvWidget->initialMemorySpin->stepBy(10);
+ myAdvWidget->initialMemorySpin->setValue( 100 );
+
+ myAdvWidget->initialMemoryLabel ->setText (tr( "MEGABYTE" ));
+ myAdvWidget->maxMemoryLabel ->setText (tr( "MEGABYTE" ));
- myBoundaryRecoveryCheck = new QCheckBox( tr( "RECOVERY_VERSION" ), myAdvGroup );
+ myAdvWidget->workingDirectoryLabel ->setText (tr( "WORKING_DIR" ));
+ myAdvWidget->workingDirectoryPushButton ->setText (tr( "SELECT_DIR" ));
+ myAdvWidget->keepWorkingFilesCheck ->setText (tr( "KEEP_WORKING_FILES" ));
+ myAdvWidget->verboseLevelLabel ->setText (tr( "VERBOSE_LEVEL" ));
+ myAdvWidget->removeLogOnSuccessCheck ->setText (tr( "REMOVE_LOG_ON_SUCCESS" ));
+ myAdvWidget->logInFileCheck ->setText (tr( "LOG_IN_FILE" ));
- myFEMCorrectionCheck = new QCheckBox( tr( "FEM_CORRECTION" ), myAdvGroup );
+ myAdvWidget->memoryGroupBox ->setTitle(tr( "MEMORY_GROUP_TITLE" ));
+ myAdvWidget->logGroupBox ->setTitle(tr( "LOG_GROUP_TITLE" ));
+ myAdvWidget->advancedMeshingGroupBox ->setTitle(tr( "ADVANCED_MESHING_GROUP_TITLE" ));
- QLabel* myGradationLabel = new QLabel( tr( "GHS3D_GRADATION" ), myAdvGroup );
- myGradation = new SMESHGUI_SpinBox(myAdvGroup);
- myGradation->RangeStepAndValidator(1.05, 5.0, 0.05, "length_precision");
-
- QLabel* aTextOptionLabel = new QLabel( tr( "TEXT_OPTION" ), myAdvGroup );
- myTextOption = new QLineEdit( myAdvGroup );
-
- row = 0;
- anAdvLayout->addWidget( myMaximumMemoryCheck, row, 0, 1, 1 );
- anAdvLayout->addWidget( myMaximumMemorySpin, row, 1, 1, 1 );
- anAdvLayout->addWidget( aMegabyteLabel, row++, 2, 1, 1 );
- anAdvLayout->addWidget( myInitialMemoryCheck, row, 0, 1, 1 );
- anAdvLayout->addWidget( myInitialMemorySpin, row, 1, 1, 1 );
- anAdvLayout->addWidget( aMegabyteLabel2, row++, 2, 1, 1 );
- anAdvLayout->addWidget( aWorkinDirLabel, row, 0, 1, 1 );
- anAdvLayout->addWidget( myWorkingDir, row, 1, 1, 2 );
- anAdvLayout->addWidget( dirBtn, row++, 3, 1, 1 );
- anAdvLayout->addWidget( myKeepFiles, row++, 0, 1, 4 );
- anAdvLayout->addWidget( aVerboseLevelLabel, row, 0, 1, 1 );
- anAdvLayout->addWidget( myVerboseLevelSpin, row++, 1, 1, 2 );
- anAdvLayout->addWidget( myToCreateNewNodesCheck, row++, 0, 1, 4 );
- anAdvLayout->addWidget( myRemoveInitialCentralPointCheck, row++, 0, 1, 4 );
- anAdvLayout->addWidget( myBoundaryRecoveryCheck, row++, 0, 1, 4 );
- anAdvLayout->addWidget( myFEMCorrectionCheck, row++, 0, 1, 4 );
- anAdvLayout->addWidget( myGradationLabel, row, 0, 1, 1 );
- anAdvLayout->addWidget( myGradation, row++, 1, 1, 2 );
- anAdvLayout->addWidget( aTextOptionLabel, row, 0, 1, 1 );
- anAdvLayout->addWidget( myTextOption, row++, 1, 1, 2 );
+ myAdvWidget->createNewNodesCheck ->setText (tr( "TO_ADD_NODES" ));
+ myAdvWidget->removeInitialCentralPointCheck->setText (tr( "NO_INITIAL_CENTRAL_POINT" ));
+ myAdvWidget->boundaryRecoveryCheck ->setText (tr( "RECOVERY_VERSION" ));
+ myAdvWidget->FEMCorrectionCheck ->setText (tr( "FEM_CORRECTION" ));
+ myAdvWidget->gradationLabel ->setText (tr( "GHS3D_GRADATION" ));
+ myAdvWidget->gradationSpinBox->RangeStepAndValidator(0.0, 5.0, 0.05, "length_precision");
// Enforced vertices parameters
myEnfGroup = new QWidget();
myEnforcedTableWidget->setAlternatingRowColors(true);
myEnforcedTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
myEnforcedTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
myEnforcedTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
+#else
+ myEnforcedTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
+#endif
myEnforcedTableWidget->resizeColumnsToContents();
myEnforcedTableWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
myEnforcedTableWidget->hideColumn(ENF_VER_COMPOUND_COLUMN);
shapeTypes.Add( TopAbs_COMPOUND );
SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes);
- myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true, /*stretch=*/false);
+ myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true);
myEnfVertexWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_VERTEX"), "QLineEdit { color: grey }");
QLabel* myXCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_X_LABEL" ), myEnfGroup );
// myGlobalGroupName = new QCheckBox(tr("GHS3D_ENF_VER_GROUPS"), myEnfGroup);
// myGlobalGroupName->setChecked(false);
- QGroupBox* GroupBox = new QGroupBox( myEnfGroup );
- QLabel* info = new QLabel( GroupBox );
- info->setText( tr( "GHS3D_ENF_VER_INFO" ) );
- info->setWordWrap( true );
- QVBoxLayout* GroupBoxVLayout = new QVBoxLayout( GroupBox );
- GroupBoxVLayout->setSpacing( 6 );
- GroupBoxVLayout->setMargin( 11 );
- GroupBoxVLayout->addWidget( info );
+ // QGroupBox* GroupBox = new QGroupBox( myEnfGroup );
+ // QLabel* info = new QLabel( GroupBox );
+ // info->setText( tr( "GHS3D_ENF_VER_INFO" ) );
+ // info->setWordWrap( true );
+ // QVBoxLayout* GroupBoxVLayout = new QVBoxLayout( GroupBox );
+ // GroupBoxVLayout->setSpacing( 6 );
+ // GroupBoxVLayout->setMargin( 11 );
+ // GroupBoxVLayout->addWidget( info );
- anEnfLayout->addWidget(GroupBox, ENF_VER_WARNING, 0, 1, 2 );
+ //anEnfLayout->addWidget(GroupBox, ENF_VER_WARNING, 0, 1, 2 );
anEnfLayout->addWidget(myEnforcedTableWidget, ENF_VER_VERTEX, 0, ENF_VER_NB_LINES, 1);
QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
<< tr( "GHS3D_ENF_GROUP_COLUMN" );
myEnforcedMeshTableWidget->setHorizontalHeaderLabels(enforcedMeshHeaders);
myEnforcedMeshTableWidget->horizontalHeader()->setStretchLastSection(true);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
myEnforcedMeshTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
+#else
+ myEnforcedMeshTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
+#endif
myEnforcedMeshTableWidget->setAlternatingRowColors(true);
myEnforcedMeshTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
myEnforcedMeshTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
// addEnfMeshButton->setEnabled(false);
removeEnfMeshButton = new QPushButton(tr("GHS3D_ENF_REMOVE"),myEnfMeshGroup);
- QGroupBox* GroupBox2 = new QGroupBox( myEnfMeshGroup );
- QLabel* info2 = new QLabel( GroupBox2 );
- info2->setText( tr( "GHS3D_ENF_MESH_INFO" ) );
- info2->setWordWrap( true );
- QVBoxLayout* GroupBox2VLayout = new QVBoxLayout( GroupBox2 );
- GroupBox2VLayout->setSpacing( 6 );
- GroupBox2VLayout->setMargin( 11 );
- GroupBox2VLayout->addWidget( info2 );
+ // QGroupBox* GroupBox2 = new QGroupBox( myEnfMeshGroup );
+ // QLabel* info2 = new QLabel( GroupBox2 );
+ // info2->setText( tr( "GHS3D_ENF_MESH_INFO" ) );
+ // info2->setWordWrap( true );
+ // QVBoxLayout* GroupBox2VLayout = new QVBoxLayout( GroupBox2 );
+ // GroupBox2VLayout->setSpacing( 6 );
+ // GroupBox2VLayout->setMargin( 11 );
+ // GroupBox2VLayout->addWidget( info2 );
- anEnfMeshLayout->addWidget( GroupBox2, ENF_MESH_WARNING, 0, 1, 2 );
+ // anEnfMeshLayout->addWidget( GroupBox2, ENF_MESH_WARNING, 0, 1, 2 );
anEnfMeshLayout->addWidget(myEnforcedMeshTableWidget, ENF_MESH_MESH, 0, ENF_MESH_NB_LINES , 1);
QGridLayout* anEnfMeshLayout2 = new QGridLayout(myEnfMeshGroup);
tab->setCurrentIndex( STD_TAB );
// connections
- connect( myMaximumMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
- connect( myInitialMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
- connect( myBoundaryRecoveryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
- connect( dirBtn, SIGNAL( clicked() ), this, SLOT( onDirBtnClicked() ) );
+ //connect( myToMeshHolesCheck, SIGNAL( toggled( bool ) ), this, SLOT( onToMeshHoles(bool)));
+ connect( myAdvWidget->maxMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
+ connect( myAdvWidget->initialMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
+ connect( myAdvWidget->boundaryRecoveryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
+ connect( myAdvWidget->logInFileCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
+ connect( myAdvWidget->keepWorkingFilesCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
+ connect( myAdvWidget->workingDirectoryPushButton, SIGNAL( clicked() ), this, SLOT( onDirBtnClicked() ) );
+
connect( myEnforcedTableWidget, SIGNAL( itemClicked(QTableWidgetItem *)), this, SLOT( synchronizeCoords() ) );
connect( myEnforcedTableWidget, SIGNAL( itemChanged(QTableWidgetItem *)), this, SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
connect( myEnforcedTableWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( synchronizeCoords() ) );
return;
if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
- GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
+ GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( );
if (CORBA::is_nil(measureOp))
return;
break;
- if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) || /*( (itemEntry.toStdString() != "") && */ (itemEntry.toStdString() == geomEntry)/*)*/) {
+ if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) ||
+ ( !itemEntry.isEmpty() && ( itemEntry == geomEntry.c_str() )))
+ {
// update size
if (itemSize != size) {
MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
int elementType = myEnfMeshConstraint->currentIndex();
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ _PTR(Study) aStudy = SMESH::getStudy();
_PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil;
QString meshEntry = myEnfMeshWdg->GetValue();
MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString());
// myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >();
// std::string entry = myEnfMeshWdg->GetValue();
aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str());
- CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
+ CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj);
if (!CORBA::is_nil(anObj)) {
// SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
QStringListIterator meshEntriesIt (meshEntries);
while (meshEntriesIt.hasNext()) {
aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str());
- CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
+ CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj);
if (!CORBA::is_nil(anObj)) {
// SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
if (selEnfVertex == 1) {
MESSAGE("1 GEOM object selected");
myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
- std::string entry = "";
- if (myEnfVertex != GEOM::GEOM_Object::_nil())
- entry = myEnfVertex->GetStudyEntry();
- addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),entry, groupName, myEnfVertex->GetShapeType() == GEOM::COMPOUND);
+ std::string entry = "", name = "";
+ bool isCompound = false;
+ if ( !myEnfVertex->_is_nil() ) {
+ entry = SMESH::toStdStr( myEnfVertex->GetStudyEntry() );
+ name = SMESH::toStdStr( myEnfVertex->GetName() );
+ isCompound = ( myEnfVertex->GetShapeType() == GEOM::COMPOUND );
+ }
+ addEnforcedVertex(x, y, z, size, name, entry, groupName, isCompound);
}
else {
MESSAGE("0 GEOM object selected");
if ( CORBA::is_nil(getGeomEngine()))
return;
- GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
+ GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( );
if (CORBA::is_nil(measureOp))
return;
myEnforcedTableWidget->selectionModel()->clearSelection();
}
+void GHS3DPluginGUI_HypothesisCreator::onToMeshHoles(bool isOn)
+{
+ // myToMakeGroupsOfDomains->setEnabled( isOn );
+ // if ( !isOn )
+ // myToMakeGroupsOfDomains->setChecked( false );
+}
+
void GHS3DPluginGUI_HypothesisCreator::onDirBtnClicked()
{
- QString dir = SUIT_FileDlg::getExistingDirectory( dlg(), myWorkingDir->text(), QString() );
+ QString dir = SUIT_FileDlg::getExistingDirectory( dlg(), myAdvWidget->workingDirectoryLineEdit->text(), QString() );
if ( !dir.isEmpty() )
- myWorkingDir->setText( dir );
+ myAdvWidget->workingDirectoryLineEdit->setText( dir );
}
void GHS3DPluginGUI_HypothesisCreator::updateWidgets()
{
- myMaximumMemorySpin->setEnabled( myMaximumMemoryCheck->isChecked() );
- myInitialMemoryCheck->setEnabled( !myBoundaryRecoveryCheck->isChecked() );
- myInitialMemorySpin->setEnabled( myInitialMemoryCheck->isChecked() && !myBoundaryRecoveryCheck->isChecked() );
- myOptimizationLevelCombo->setEnabled( !myBoundaryRecoveryCheck->isChecked() );
+ //myToMakeGroupsOfDomains->setEnabled( myToMeshHolesCheck->isChecked() );
+ myAdvWidget->maxMemorySpin->setEnabled( myAdvWidget->maxMemoryCheck->isChecked() );
+ myAdvWidget->initialMemoryCheck->setEnabled( !myAdvWidget->boundaryRecoveryCheck->isChecked() );
+ myAdvWidget->initialMemorySpin->setEnabled( myAdvWidget->initialMemoryCheck->isChecked() && !myAdvWidget->boundaryRecoveryCheck->isChecked() );
+ myOptimizationLevelCombo->setEnabled( !myAdvWidget->boundaryRecoveryCheck->isChecked() );
+ if ( sender() == myAdvWidget->logInFileCheck ||
+ sender() == myAdvWidget->keepWorkingFilesCheck )
+ {
+ bool logFileRemovable = myAdvWidget->logInFileCheck->isChecked() &&
+ !myAdvWidget->keepWorkingFilesCheck->isChecked();
+
+ myAdvWidget->removeLogOnSuccessCheck->setEnabled( logFileRemovable );
+ }
}
bool GHS3DPluginGUI_HypothesisCreator::checkParams(QString& msg) const
{
MESSAGE("GHS3DPluginGUI_HypothesisCreator::checkParams");
- if ( !QFileInfo( myWorkingDir->text().trimmed() ).isWritable() ) {
+ if ( !QFileInfo( myAdvWidget->workingDirectoryLineEdit->text().trimmed() ).isWritable() ) {
SUIT_MessageBox::warning( dlg(),
tr( "SMESH_WRN_WARNING" ),
tr( "GHS3D_PERMISSION_DENIED" ) );
if ( myName )
myName->setText( data.myName );
- myToMeshHolesCheck ->setChecked ( data.myToMeshHoles );
- myOptimizationLevelCombo ->setCurrentIndex( data.myOptimizationLevel );
- myMaximumMemoryCheck ->setChecked ( data.myMaximumMemory > 0 );
- myMaximumMemorySpin ->setValue ( qMax( data.myMaximumMemory,
- myMaximumMemorySpin->minimum() ));
- myInitialMemoryCheck ->setChecked ( data.myInitialMemory > 0 );
- myInitialMemorySpin ->setValue ( qMax( data.myInitialMemory,
- myInitialMemorySpin->minimum() ));
- myWorkingDir ->setText ( data.myWorkingDir );
- myKeepFiles ->setChecked ( data.myKeepFiles );
- myVerboseLevelSpin ->setValue ( data.myVerboseLevel );
- myToCreateNewNodesCheck ->setChecked ( data.myToCreateNewNodes );
- myRemoveInitialCentralPointCheck ->setChecked ( data.myRemoveInitialCentralPoint );
- myBoundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery );
- myFEMCorrectionCheck ->setChecked ( data.myFEMCorrection );
- myGradation ->setValue ( data.myGradation );
- myTextOption ->setText ( data.myTextOption );
+ myToMeshHolesCheck ->setChecked ( data.myToMeshHoles );
+ myToMakeGroupsOfDomains ->setChecked ( data.myToMakeGroupsOfDomains );
+ myOptimizationLevelCombo ->setCurrentIndex( data.myOptimizationLevel );
+ myAdvWidget->maxMemoryCheck ->setChecked ( data.myMaximumMemory > 0 );
+ myAdvWidget->maxMemorySpin ->setValue ( qMax( (int)data.myMaximumMemory,
+ myAdvWidget->maxMemorySpin->minimum() ));
+ myAdvWidget->initialMemoryCheck ->setChecked ( data.myInitialMemory > 0 );
+ myAdvWidget->initialMemorySpin ->setValue ( qMax( (int)data.myInitialMemory,
+ myAdvWidget->initialMemorySpin->minimum() ));
+ myAdvWidget->workingDirectoryLineEdit ->setText ( data.myWorkingDir );
+ myAdvWidget->keepWorkingFilesCheck ->setChecked ( data.myKeepFiles );
+ myAdvWidget->verboseLevelSpin ->setValue ( data.myVerboseLevel );
+ myAdvWidget->createNewNodesCheck ->setChecked ( data.myToCreateNewNodes );
+ myAdvWidget->removeInitialCentralPointCheck ->setChecked ( data.myRemoveInitialCentralPoint );
+ myAdvWidget->boundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery );
+ myAdvWidget->FEMCorrectionCheck ->setChecked ( data.myFEMCorrection );
+ myAdvWidget->gradationSpinBox ->setValue ( data.myGradation );
+ myAdvWidget->advOptionTable ->SetCustomOptions( data.myTextOption );
+ myAdvWidget->logInFileCheck ->setChecked ( !data.myLogInStandardOutput );
+ myAdvWidget->removeLogOnSuccessCheck ->setChecked ( data.myRemoveLogOnSuccess );
TEnfVertexList::const_iterator it;
int rowCount = 0;
QString valStr = "";
if ( !data.myBoundaryRecovery )
- valStr = "-c " + QString::number( !data.myToMeshHoles );
+ valStr = " --components " + data.myToMeshHoles ? "all" : "outside_components" ;
if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
- valStr += " -o ";
+ valStr += " --optimisation_level ";
valStr += level[ data.myOptimizationLevel ];
}
if ( data.myMaximumMemory > 0 ) {
- valStr += " -m ";
+ valStr += " --max_memory ";
valStr += QString::number( data.myMaximumMemory );
}
if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
- valStr += " -M ";
+ valStr += " --automatic_memory ";
valStr += QString::number( data.myInitialMemory );
}
- valStr += " -v ";
+ valStr += " --verbose ";
valStr += QString::number( data.myVerboseLevel );
if ( !data.myToCreateNewNodes )
- valStr += " -p0";
+ valStr += " --no_internal_points";
if ( data.myRemoveInitialCentralPoint )
- valStr += " -no_initial_central_point";
+ valStr += " --no_initial_central_point";
if ( data.myBoundaryRecovery )
valStr += " -C";
h_data.myName = isCreation() && data ? hypName() : "";
h_data.myToMeshHoles = h->GetToMeshHoles();
+ h_data.myToMakeGroupsOfDomains = /*h->GetToMeshHoles() &&*/ h->GetToMakeGroupsOfDomains();
h_data.myMaximumMemory = h->GetMaximumMemory();
h_data.myInitialMemory = h->GetInitialMemory();
h_data.myInitialMemory = h->GetInitialMemory();
h_data.myBoundaryRecovery = h->GetToUseBoundaryRecoveryVersion();
h_data.myFEMCorrection = h->GetFEMCorrection();
h_data.myGradation = h->GetGradation();
- h_data.myTextOption = h->GetTextOption();
+ h_data.myTextOption = h->GetAdvancedOption();
+ h_data.myLogInStandardOutput = h->GetStandardOutputLog();
+ h_data.myRemoveLogOnSuccess = h->GetRemoveLogOnSuccess();
GHS3DPlugin::GHS3DEnforcedVertexList_var vertices = h->GetEnforcedVertices();
MESSAGE("vertices->length(): " << vertices->length());
h_data.myEnforcedVertices.clear();
- for (int i=0 ; i<vertices->length() ; i++) {
+ for (CORBA::ULong i=0 ; i<vertices->length() ; i++) {
TEnfVertex* myVertex = new TEnfVertex();
myVertex->name = CORBA::string_dup(vertices[i].name.in());
myVertex->geomEntry = CORBA::string_dup(vertices[i].geomEntry.in());
myVertex->size = vertices[i].size;
myVertex->isCompound = vertices[i].isCompound;
if (vertices[i].coords.length()) {
- for (int c = 0; c < vertices[i].coords.length() ; c++)
+ for (CORBA::ULong c = 0; c < vertices[i].coords.length() ; c++)
myVertex->coords.push_back(vertices[i].coords[c]);
MESSAGE("Add enforced vertex ("<< myVertex->coords.at(0) << ","<< myVertex->coords.at(1) << ","<< myVertex->coords.at(2) << ") ="<< myVertex->size);
}
GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshes = h->GetEnforcedMeshes();
MESSAGE("enfMeshes->length(): " << enfMeshes->length());
h_data.myEnforcedMeshes.clear();
- for (int i=0 ; i<enfMeshes->length() ; i++) {
+ for (CORBA::ULong i=0 ; i<enfMeshes->length() ; i++) {
TEnfMesh* myEnfMesh = new TEnfMesh();
myEnfMesh->name = CORBA::string_dup(enfMeshes[i].name.in());
myEnfMesh->entry = CORBA::string_dup(enfMeshes[i].entry.in());
if ( h->GetToMeshHoles() != h_data.myToMeshHoles ) // avoid duplication of DumpPython commands
h->SetToMeshHoles ( h_data.myToMeshHoles );
+ if ( h->GetToMakeGroupsOfDomains() != h_data.myToMakeGroupsOfDomains )
+ h->SetToMakeGroupsOfDomains( h_data.myToMakeGroupsOfDomains );
if ( h->GetMaximumMemory() != h_data.myMaximumMemory )
h->SetMaximumMemory ( h_data.myMaximumMemory );
if ( h->GetInitialMemory() != h_data.myInitialMemory )
h->SetInitialMemory ( h_data.myInitialMemory );
if ( h->GetOptimizationLevel() != h_data.myOptimizationLevel )
h->SetOptimizationLevel( h_data.myOptimizationLevel );
- if ( h->GetKeepFiles() != h_data.myKeepFiles )
+ if ( h->GetKeepFiles() != h_data.myKeepFiles )
h->SetKeepFiles ( h_data.myKeepFiles );
if ( h->GetWorkingDirectory() != h_data.myWorkingDir )
h->SetWorkingDirectory ( h_data.myWorkingDir.toLatin1().constData() );
- if ( h->GetVerboseLevel() != h_data.myVerboseLevel )
- h->SetVerboseLevel ( h_data.myVerboseLevel );
+ if ( h->GetVerboseLevel() != h_data.myVerboseLevel )
+ h->SetVerboseLevel ( h_data.myVerboseLevel );
if ( h->GetToCreateNewNodes() != h_data.myToCreateNewNodes )
- h->SetToCreateNewNodes( h_data.myToCreateNewNodes );
+ h->SetToCreateNewNodes( h_data.myToCreateNewNodes );
if ( h->GetToRemoveCentralPoint() != h_data.myRemoveInitialCentralPoint )
h->SetToRemoveCentralPoint( h_data.myRemoveInitialCentralPoint );
if ( h->GetToUseBoundaryRecoveryVersion() != h_data.myBoundaryRecovery )
h->SetToUseBoundaryRecoveryVersion( h_data.myBoundaryRecovery );
if ( h->GetFEMCorrection() != h_data.myFEMCorrection )
- h->SetFEMCorrection( h_data.myFEMCorrection );
- if ( h->GetGradation() != h_data.myGradation )
- h->SetGradation ( h_data.myGradation );
- if ( h->GetTextOption() != h_data.myTextOption )
- h->SetTextOption ( h_data.myTextOption.toLatin1().constData() );
+ h->SetFEMCorrection ( h_data.myFEMCorrection );
+ if ( h->GetGradation() != h_data.myGradation )
+ h->SetGradation ( h_data.myGradation );
+ if ( h->GetAdvancedOption() != h_data.myTextOption )
+ h->SetAdvancedOption ( h_data.myTextOption.toLatin1().constData() );
+ if ( h->GetStandardOutputLog() != h_data.myLogInStandardOutput )
+ h->SetStandardOutputLog( h_data.myLogInStandardOutput );
+ if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess )
+ h->SetRemoveLogOnSuccess( h_data.myRemoveLogOnSuccess );
// Enforced vertices
int nbVertex = (int) h_data.myEnforcedVertices.size();
TEnfMeshList::const_iterator itEnfMesh;
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ _PTR(Study) aStudy = SMESH::getStudy();
for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
TEnfMesh* enfMesh = (*itEnfMesh);
MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets");
h_data.myName = myName ? myName->text() : "";
h_data.myToMeshHoles = myToMeshHolesCheck->isChecked();
- h_data.myMaximumMemory = myMaximumMemoryCheck->isChecked() ? myMaximumMemorySpin->value() : -1;
- h_data.myInitialMemory = myInitialMemoryCheck->isChecked() ? myInitialMemorySpin->value() : -1;
+ h_data.myToMakeGroupsOfDomains = myToMakeGroupsOfDomains->isChecked();
+ h_data.myMaximumMemory = myAdvWidget->maxMemoryCheck->isChecked() ? myAdvWidget->maxMemorySpin->value() : -1;
+ h_data.myInitialMemory = myAdvWidget->initialMemoryCheck->isChecked() ? myAdvWidget->initialMemorySpin->value() : -1;
h_data.myOptimizationLevel = myOptimizationLevelCombo->currentIndex();
- h_data.myKeepFiles = myKeepFiles->isChecked();
- h_data.myWorkingDir = myWorkingDir->text().trimmed();
- h_data.myVerboseLevel = myVerboseLevelSpin->value();
- h_data.myToCreateNewNodes = myToCreateNewNodesCheck->isChecked();
- h_data.myRemoveInitialCentralPoint = myRemoveInitialCentralPointCheck->isChecked();
- h_data.myBoundaryRecovery = myBoundaryRecoveryCheck->isChecked();
- h_data.myFEMCorrection = myFEMCorrectionCheck->isChecked();
- h_data.myGradation = myGradation->value();
- h_data.myTextOption = myTextOption->text();
+ h_data.myKeepFiles = myAdvWidget->keepWorkingFilesCheck->isChecked();
+ h_data.myWorkingDir = myAdvWidget->workingDirectoryLineEdit->text().trimmed();
+ h_data.myVerboseLevel = myAdvWidget->verboseLevelSpin->value();
+ h_data.myToCreateNewNodes = myAdvWidget->createNewNodesCheck->isChecked();
+ h_data.myRemoveInitialCentralPoint = myAdvWidget->removeInitialCentralPointCheck->isChecked();
+ h_data.myBoundaryRecovery = myAdvWidget->boundaryRecoveryCheck->isChecked();
+ h_data.myFEMCorrection = myAdvWidget->FEMCorrectionCheck->isChecked();
+ h_data.myGradation = myAdvWidget->gradationSpinBox->value();
+ h_data.myTextOption = myAdvWidget->advOptionTable->GetCustomOptions();
+ h_data.myLogInStandardOutput = !myAdvWidget->logInFileCheck->isChecked();
+ h_data.myRemoveLogOnSuccess = myAdvWidget->removeLogOnSuccessCheck->isChecked();
// Enforced vertices
h_data.myEnforcedVertices.clear();