-// Copyright (C) 2004-2012 CEA/DEN, EDF R&D
+// Copyright (C) 2004-2014 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>
QWidget *EnforcedMeshTableWidgetDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem & option ,
const QModelIndex & index ) const
-{
- if (index.column() == ENF_MESH_SIZE_COLUMN) {
- SMESHGUI_SpinBox *editor = new SMESHGUI_SpinBox(parent);
- editor->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
- return editor;
- }
+{
return QItemDelegate::createEditor(parent, option, index);
}
void EnforcedMeshTableWidgetDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
- if (index.column() == ENF_MESH_SIZE_COLUMN) {
- SMESHGUI_SpinBox *spinBox = qobject_cast<SMESHGUI_SpinBox*>(editor);
- spinBox->SetValue(index.data().toDouble());
- }
- else
- QItemDelegate::setEditorData(editor, index);
+ QItemDelegate::setEditorData(editor, index);
}
void EnforcedMeshTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
- if (index.column() == ENF_MESH_SIZE_COLUMN)
- {
- SMESHGUI_SpinBox *spinBox = qobject_cast<SMESHGUI_SpinBox*>(editor);
- const double newsize = spinBox->GetValue();
- if (newsize > 0)
- model->setData(index, newsize, Qt::EditRole);
- }
- else
- QItemDelegate::setModelData(editor, model, index);
+ QItemDelegate::setModelData(editor, model, index);
}
}
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);
+
+ myAdvWidget->maxMemoryCheck->setText(tr( "MAX_MEMORY_SIZE" ));
+ myAdvWidget->initialMemoryCheck->setText(tr( "INIT_MEMORY_SIZE" ));
- QLabel* aVerboseLevelLabel = new QLabel( tr( "VERBOSE_LEVEL" ), myAdvGroup );
- myVerboseLevelSpin = new QSpinBox( myAdvGroup );
- myVerboseLevelSpin->setMinimum( 0 );
- myVerboseLevelSpin->setMaximum( 10 );
- myVerboseLevelSpin->setSingleStep( 1 );
+ myAdvWidget->maxMemorySpin->RangeStepAndValidator(20.0, 1e6, 10.0);
+ myAdvWidget->maxMemorySpin->setValue( 128.0 );
- myToCreateNewNodesCheck = new QCheckBox( tr( "TO_ADD_NODES" ), myAdvGroup );
+ myAdvWidget->initialMemorySpin->RangeStepAndValidator(0.0, 1e6, 10.0);
+ myAdvWidget->initialMemorySpin->setValue( 100.0 );
+
+ myAdvWidget->initialMemoryLabel ->setText (tr( "MEGABYTE" ));
+ myAdvWidget->maxMemoryLabel ->setText (tr( "MEGABYTE" ));
- myRemoveInitialCentralPointCheck = new QCheckBox( tr( "NO_INITIAL_CENTRAL_POINT" ), 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" ));
- myBoundaryRecoveryCheck = new QCheckBox( tr( "RECOVERY_VERSION" ), myAdvGroup );
+ myAdvWidget->memoryGroupBox ->setTitle(tr( "MEMORY_GROUP_TITLE" ));
+ myAdvWidget->logGroupBox ->setTitle(tr( "LOG_GROUP_TITLE" ));
+ myAdvWidget->advancedMeshingGroupBox ->setTitle(tr( "ADVANCED_MESHING_GROUP_TITLE" ));
- myFEMCorrectionCheck = new QCheckBox( tr( "FEM_CORRECTION" ), myAdvGroup );
-
- QLabel* aTextOptionLabel = new QLabel( tr( "TEXT_OPTION" ), myAdvGroup );
- myTextOption = new QLineEdit( myAdvGroup );
-
- anAdvLayout->addWidget( myMaximumMemoryCheck, 0, 0, 1, 1 );
- anAdvLayout->addWidget( myMaximumMemorySpin, 0, 1, 1, 1 );
- anAdvLayout->addWidget( aMegabyteLabel, 0, 2, 1, 1 );
- anAdvLayout->addWidget( myInitialMemoryCheck, 1, 0, 1, 1 );
- anAdvLayout->addWidget( myInitialMemorySpin, 1, 1, 1, 1 );
- anAdvLayout->addWidget( aMegabyteLabel2, 1, 2, 1, 1 );
- anAdvLayout->addWidget( aWorkinDirLabel, 2, 0, 1, 1 );
- anAdvLayout->addWidget( myWorkingDir, 2, 1, 1, 2 );
- anAdvLayout->addWidget( dirBtn, 2, 3, 1, 1 );
- anAdvLayout->addWidget( myKeepFiles, 3, 0, 1, 4 );
- anAdvLayout->addWidget( aVerboseLevelLabel, 4, 0, 1, 1 );
- anAdvLayout->addWidget( myVerboseLevelSpin, 4, 1, 1, 1 );
- anAdvLayout->addWidget( myToCreateNewNodesCheck, 5, 0, 1, 4 );
- anAdvLayout->addWidget( myRemoveInitialCentralPointCheck, 6, 0, 1, 4 );
- anAdvLayout->addWidget( myBoundaryRecoveryCheck, 7, 0, 1, 4 );
- anAdvLayout->addWidget( myFEMCorrectionCheck, 8, 0, 1, 4 );
- anAdvLayout->addWidget( aTextOptionLabel, 9, 0, 1, 1 );
- anAdvLayout->addWidget( myTextOption, 9, 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(1.05, 5.0, 0.05, "length_precision");
+ myAdvWidget->textOptionLabel->setText(tr( "TEXT_OPTION" ));
// Enforced vertices parameters
myEnfGroup = new QWidget();
myEnforcedTableWidget->setColumnCount( ENF_VER_NB_COLUMNS );
myEnforcedTableWidget->setSortingEnabled(true);
QStringList enforcedHeaders;
- enforcedHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
- << tr( "GHS3D_ENF_VER_X_COLUMN" )<< tr( "GHS3D_ENF_VER_Y_COLUMN" ) << tr( "GHS3D_ENF_VER_Z_COLUMN" )
+ enforcedHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
+ << tr( "GHS3D_ENF_VER_X_COLUMN" )<< tr( "GHS3D_ENF_VER_Y_COLUMN" ) << tr( "GHS3D_ENF_VER_Z_COLUMN" )
<< tr( "GHS3D_ENF_SIZE_COLUMN" ) << tr("GHS3D_ENF_ENTRY_COLUMN") << tr("GHS3D_ENF_VER_COMPOUND_COLUMN") << tr( "GHS3D_ENF_GROUP_COLUMN" );
-
+
myEnforcedTableWidget->setHorizontalHeaderLabels(enforcedHeaders);
myEnforcedTableWidget->verticalHeader()->hide();
myEnforcedTableWidget->horizontalHeader()->setStretchLastSection(true);
// 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);
enforcedMeshHeaders << tr( "GHS3D_ENF_NAME_COLUMN" )
<< tr( "GHS3D_ENF_ENTRY_COLUMN" )
<< tr( "GHS3D_ENF_MESH_CONSTRAINT_COLUMN" )
- << tr( "GHS3D_ENF_SIZE_COLUMN" )
<< tr( "GHS3D_ENF_GROUP_COLUMN" );
myEnforcedMeshTableWidget->setHorizontalHeaderLabels(enforcedMeshHeaders);
myEnforcedMeshTableWidget->horizontalHeader()->setStretchLastSection(true);
// myEnfMesh = SMESH::SMESH_Mesh::_nil();
// myEnfMeshArray = new SMESH::mesh_array();
- myEnfMeshWdg = new StdMeshersGUI_ObjectReferenceParamWdg( IDSOURCE, myEnfMeshGroup, /*multiSel=*/true);
+ myEnfMeshWdg = new StdMeshersGUI_ObjectReferenceParamWdg( SMESH::IDSOURCE, myEnfMeshGroup, /*multiSel=*/true);
myEnfMeshWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_MESH"), "QLineEdit { color: grey }");
myEnfMeshWdg->AvoidSimultaneousSelection(myEnfVertexWdg);
myEnfMeshConstraint->insertItems(0,myEnfMeshConstraintLabels);
myEnfMeshConstraint->setEditable(false);
myEnfMeshConstraint->setCurrentIndex(0);
-
- QLabel* myMeshSizeLabel = new QLabel( tr( "GHS3D_ENF_SIZE_LABEL" ), myEnfMeshGroup );
- myMeshSizeValue = new SMESHGUI_SpinBox(myEnfMeshGroup);
- myMeshSizeValue->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
QLabel* myMeshGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfMeshGroup );
myMeshGroupName = new QLineEdit(myEnfMeshGroup);
// 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);
anEnfMeshLayout2->addWidget(myEnfMeshWdg, ENF_MESH_MESH, 0, 1, 2);
anEnfMeshLayout2->addWidget(myMeshConstraintLabel, ENF_MESH_CONSTRAINT, 0, 1, 1);
anEnfMeshLayout2->addWidget(myEnfMeshConstraint, ENF_MESH_CONSTRAINT, 1, 1, 1);
- anEnfMeshLayout2->addWidget(myMeshSizeLabel, ENF_MESH_SIZE, 0, 1, 1);
- anEnfMeshLayout2->addWidget(myMeshSizeValue, ENF_MESH_SIZE, 1, 1, 1);
anEnfMeshLayout2->addWidget(myMeshGroupNameLabel, ENF_MESH_GROUP, 0, 1, 1);
anEnfMeshLayout2->addWidget(myMeshGroupName, ENF_MESH_GROUP, 1, 1, 1);
anEnfMeshLayout2->addWidget(addEnfMeshButton, ENF_MESH_BTN, 0, 1, 1);
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() ) );
connect( removeEnfMeshButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedMesh() ) );
// connect( myEnfMeshWdg, SIGNAL( contentModified()), this, SLOT( checkEnfMeshIsDefined() ) );
// connect( myEnfMeshConstraint, SIGNAL( currentIndexChanged(int) ), this, SLOT( checkEnfMeshIsDefined() ) );
-// connect( myMeshSizeValue, SIGNAL( textChanged(const QString&) ), this, SLOT( checkEnfMeshIsDefined() ) );
// connect( this, SIGNAL( enfMeshDefined(bool) ), addEnfMeshButton, SLOT( setEnabled(bool) ) );
return fr;
**/
void GHS3DPluginGUI_HypothesisCreator::checkEnfMeshIsDefined()
{
- emit enfMeshDefined((!myMeshSizeValue->GetString().isEmpty() && !myEnfVertexWdg->NbObjects() == 0));
+ emit enfMeshDefined( myEnfVertexWdg->NbObjects() != 0);
}
/**
/** GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh( meshName, geomEntry, elemType, size, groupName)
This method adds in the tree widget an enforced mesh from mesh, submesh or group with optionally size and and groupName.
*/
-void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, double size, std::string groupName)
+void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName)
{
- MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", " << size << ", \"" << groupName << "\")");
+ MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", \"" << groupName << "\")");
bool okToCreate = true;
QString itemEntry = "";
int itemElementType = 0;
break;
if (itemEntry == QString(entry.c_str()) && itemElementType == elementType) {
-// // update size
-// if (itemSize != size) {
-// MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
-// myEnforcedMeshTableWidget->item(row, ENF_MESH_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size));
-// }
// // update group name
// if (itemGroupName.toStdString() != groupName) {
// MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
myEnforcedMeshTableWidget->setItem(rowCount,col,item);
break;
- case ENF_MESH_SIZE_COLUMN:
- item->setData( 0, size );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- myEnforcedMeshTableWidget->setItem(rowCount,col,item);
- break;
case ENF_MESH_GROUP_COLUMN:
item->setData( 0, groupName.c_str() );
MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
groupName = "";
- double size = -1;
- if (!myMeshSizeValue->GetString().isEmpty())
- size = myMeshSizeValue->GetValue();
-// if (size < 0)
-// return;
-
int elementType = myEnfMeshConstraint->currentIndex();
CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
if (!CORBA::is_nil(anObj)) {
// SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
- addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, size, groupName);
+ addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
}
}
else
CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
if (!CORBA::is_nil(anObj)) {
// SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
- addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, size, groupName);
+ addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
}
}
}
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 );
- 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( data.myMaximumMemory,
+ myAdvWidget->maxMemorySpin->minimum() ));
+ myAdvWidget->initialMemoryCheck ->setChecked ( data.myInitialMemory > 0 );
+ myAdvWidget->initialMemorySpin ->setValue ( qMax( 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->textOptionLineEdit ->setText ( data.myTextOption );
+ myAdvWidget->logInFileCheck ->setChecked ( !data.myLogInStandardOutput );
+ myAdvWidget->removeLogOnSuccessCheck ->setChecked ( data.myRemoveLogOnSuccess );
TEnfVertexList::const_iterator it;
int rowCount = 0;
+ myEnforcedTableWidget->clearContents();
myEnforcedTableWidget->setSortingEnabled(false);
myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
for(it = data.myEnforcedVertices.begin() ; it != data.myEnforcedVertices.end(); it++ )
// Update Enforced meshes QTableWidget
TEnfMeshList::const_iterator itMesh;
rowCount = 0;
+ myEnforcedMeshTableWidget->clearContents();
myEnforcedMeshTableWidget->setSortingEnabled(false);
// myEnforcedMeshTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
for(itMesh = data.myEnforcedMeshes.begin() ; itMesh != data.myEnforcedMeshes.end(); itMesh++ )
MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
myEnforcedMeshTableWidget->setItem(rowCount,col,item);
break;
- case ENF_MESH_SIZE_COLUMN:
- item->setData( 0, enfMesh->size );
- MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
- myEnforcedMeshTableWidget->setItem(rowCount,col,item);
- break;
case ENF_MESH_GROUP_COLUMN:
item->setData( 0, enfMesh->groupName.c_str() );
MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
if ( data.myFEMCorrection )
valStr += " -FEM";
+ if ( data.myGradation != 1.05 ) {
+ valStr += " -Dcpropa=";
+ valStr += QString::number( data.myGradation );
+ }
+
valStr += " ";
valStr += data.myTextOption;
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.myRemoveInitialCentralPoint = h->GetToRemoveCentralPoint();
h_data.myBoundaryRecovery = h->GetToUseBoundaryRecoveryVersion();
h_data.myFEMCorrection = h->GetFEMCorrection();
+ h_data.myGradation = h->GetGradation();
h_data.myTextOption = h->GetTextOption();
+ h_data.myLogInStandardOutput = h->GetStandardOutputLog();
+ h_data.myRemoveLogOnSuccess = h->GetRemoveLogOnSuccess();
GHS3DPlugin::GHS3DEnforcedVertexList_var vertices = h->GetEnforcedVertices();
MESSAGE("vertices->length(): " << vertices->length());
myEnfMesh->name = CORBA::string_dup(enfMeshes[i].name.in());
myEnfMesh->entry = CORBA::string_dup(enfMeshes[i].entry.in());
myEnfMesh->groupName = CORBA::string_dup(enfMeshes[i].groupName.in());
- myEnfMesh->size = enfMeshes[i].size;
switch (enfMeshes[i].elementType) {
case SMESH::NODE:
myEnfMesh->elementType = 0;
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->GetTextOption() != h_data.myTextOption )
+ 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() );
+ 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();
h->ClearEnforcedMeshes();
TEnfMeshList::const_iterator itEnfMesh;
+
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+
for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
TEnfMesh* enfMesh = (*itEnfMesh);
-
+
_PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str());
SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
- SMESH::ElementType elementType;
+
MESSAGE("enfMesh->elementType: " << enfMesh->elementType);
+ SMESH::ElementType elementType;
switch(enfMesh->elementType) {
case 0:
elementType = SMESH::NODE;
break;
}
- ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->size, enfMesh->groupName.c_str());
+ std::cout << "h->p_SetEnforcedMesh(theSource, "<< elementType <<", \""<< enfMesh->name << "\", \"" << enfMesh->groupName.c_str() <<"\")"<<std::endl;
+ ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->name.c_str(), enfMesh->groupName.c_str());
} // for
} // try
// catch(const std::exception& ex) {
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.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->textOptionLineEdit->text();
+ h_data.myLogInStandardOutput = !myAdvWidget->logInFileCheck->isChecked();
+ h_data.myRemoveLogOnSuccess = myAdvWidget->removeLogOnSuccessCheck->isChecked();
// Enforced vertices
h_data.myEnforcedVertices.clear();
MESSAGE("Entry is \"" << myEnfMesh->entry << "\"" );
myEnfMesh->groupName = myEnforcedMeshTableWidget->item(row,ENF_MESH_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
MESSAGE("Group name is \"" << myEnfMesh->groupName << "\"" );
- myEnfMesh->size = myEnforcedMeshTableWidget->item(row,ENF_MESH_SIZE_COLUMN)->data(Qt::EditRole).toDouble();
- MESSAGE("Size is " << myEnfMesh->size);
QComboBox* combo = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row,ENF_MESH_CONSTRAINT_COLUMN));
myEnfMesh->elementType = combo->currentIndex();
MESSAGE("Element type: " << myEnfMesh->elementType);
h_data.myEnforcedMeshes.insert(myEnfMesh);
+ std::cout << "h_data.myEnforcedMeshes.size(): " << h_data.myEnforcedMeshes.size() << std::endl;
}
return true;