From: nicolas Date: Mon, 11 Mar 2013 10:00:13 +0000 (+0000) Subject: Filtrage des suppressions de maillage pour une suppression d'itération X-Git-Tag: V7_1_0~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ba57d0e970c92bc66732a38b796aaa0e86162de5;p=modules%2Fhomard.git Filtrage des suppressions de maillage pour une suppression d'itération --- diff --git a/doc/intro.rst b/doc/intro.rst index 9fc5cbfc..efc780bf 100644 --- a/doc/intro.rst +++ b/doc/intro.rst @@ -47,11 +47,10 @@ Des variantes de ce sch .. note:: Pour une référence à HOMARD, utiliser : - G. Nicolas and T. Fouquet, Adaptive Mesh Refinement for Conformal Hexahedral Meshes, Finite Elements in Analysis and Design, Vol. 67, pp. 1-12, 2013, doi:10.1016/j.finel.2012.11.008 + G. Nicolas and T. Fouquet, Adaptive Mesh Refinement for Conformal Hexahedral Meshes, Finite Elements in Analysis and Design, Vol. 67, pp. 1-12, 2013, doi:10.1016/j.finel.2012.11.008 `Acessible en cliquant ici `_ . - Quelques illustrations de maillage adaptés """""""""""""""""""""""""""""""""""""""""" .. index:: single: illustration diff --git a/doc/tui_create_case.rst b/doc/tui_create_case.rst index f1e0c291..d3902d5b 100644 --- a/doc/tui_create_case.rst +++ b/doc/tui_create_case.rst @@ -112,8 +112,9 @@ M | .. index:: single: Delete | | | | **Delete()** | -| Detruit le cas et toutes les itérations associées. | -| Le fichier du maillage associé est conservé. | +| Detruit le cas et toutes les itérations associées ainsi | +| que tous les maillages produits. Le fichier du maillage | +| initial associé est conservé. | | | | Retourne un entier : | | * 0 : destruction réussie | diff --git a/doc/tui_create_iteration.rst b/doc/tui_create_iteration.rst index 96db65ff..afb8b964 100644 --- a/doc/tui_create_iteration.rst +++ b/doc/tui_create_iteration.rst @@ -157,9 +157,14 @@ G +---------------------------------------------------------------+ | .. index:: single: Delete | | | -| **Delete()** | -| Detruit l'itération et toutes ses filles éventuelles. Les | -| fichiers des maillages associés sont supprimés. | +| **Delete(option)** | +| Detruit l'itération et toutes ses filles éventuelles. | +| | +| - ``option`` : un entier précisant ce qui est fait des | +| fichiers de maillage associés | +| | +| * 0 : les fichiers sont conservés | +| * 1 : les fichiers sont détruits | | | | Retourne un entier : | | * 0 : destruction réussie | diff --git a/idl/HOMARD_Gen.idl b/idl/HOMARD_Gen.idl index 85602cda..b91f3524 100644 --- a/idl/HOMARD_Gen.idl +++ b/idl/HOMARD_Gen.idl @@ -130,13 +130,16 @@ module HOMARD void InvalideBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception); void InvalideHypo (in string HypoName) raises (SALOME::SALOME_Exception); void InvalideIter (in string IterName) raises (SALOME::SALOME_Exception); + void InvalideIterOption (in string IterName, in long Option) + raises (SALOME::SALOME_Exception); void InvalideZone (in string ZoneName) raises (SALOME::SALOME_Exception); long DeleteBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception); long DeleteCase(in string CaseName) raises (SALOME::SALOME_Exception); long DeleteHypo(in string HypoName) raises (SALOME::SALOME_Exception); - long DeleteIteration(in string IterName) raises (SALOME::SALOME_Exception); - long DeleteIterationOption(in string IterName, in long Option) + long DeleteIteration(in string IterName, in long Option) + raises (SALOME::SALOME_Exception); + long DeleteIterationOption(in string IterName, in long Option1, in long Option2) raises (SALOME::SALOME_Exception); long DeleteZone (in string ZoneName) raises (SALOME::SALOME_Exception); // @@ -157,7 +160,7 @@ module HOMARD void PublishFileUnderIteration(in string IterName, in string FileName, in string Comment) raises (SALOME::SALOME_Exception); void PublishBoundaryUnderCase(in string CaseName, in string BoundaryName); - void PublishResultInSmesh(in string FileName, in long IconeType) + void PublishResultInSmesh(in string FileName, in long Option) raises (SALOME::SALOME_Exception); }; diff --git a/idl/HOMARD_Iteration.idl b/idl/HOMARD_Iteration.idl index f5fd7ef5..f7380483 100644 --- a/idl/HOMARD_Iteration.idl +++ b/idl/HOMARD_Iteration.idl @@ -43,7 +43,7 @@ module HOMARD void SetName(in string Name) raises (SALOME::SALOME_Exception); string GetName() raises (SALOME::SALOME_Exception); - long Delete() raises (SALOME::SALOME_Exception); + long Delete(in long Option) raises (SALOME::SALOME_Exception); string GetDumpPython() raises (SALOME::SALOME_Exception); diff --git a/src/HOMARDGUI/CreateHypothesis.h b/src/HOMARDGUI/CreateHypothesis.h index b3daf396..ef9c6164 100644 --- a/src/HOMARDGUI/CreateHypothesis.h +++ b/src/HOMARDGUI/CreateHypothesis.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'CreateHypothesis.ui' ** -** Created: Mon Jan 14 14:54:59 2013 +** Created: Thu Feb 28 13:29:51 2013 ** by: Qt User Interface Compiler version 4.6.3 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! @@ -43,7 +43,6 @@ public: QRadioButton *RBUniforme; QRadioButton *RBChamp; QRadioButton *RBZone; - QCheckBox *CBGroupe; QGroupBox *GBUniform; QGridLayout *gridLayout; QRadioButton *RBUniDera; @@ -106,6 +105,7 @@ public: QRadioButton *RBFieldAll; QRadioButton *RBFieldChosen; QTableWidget *TWField; + QCheckBox *CBGroupe; QCheckBox *CBAdvanced; QGroupBox *GBAdvancedOptions; QGridLayout *gridLayout_1; @@ -131,7 +131,7 @@ public: { if (CreateHypothesis->objectName().isEmpty()) CreateHypothesis->setObjectName(QString::fromUtf8("CreateHypothesis")); - CreateHypothesis->resize(770, 1453); + CreateHypothesis->resize(794, 1481); QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); @@ -177,11 +177,6 @@ public: gridLayout_3->addWidget(GBTypeAdaptation, 1, 0, 1, 2); - CBGroupe = new QCheckBox(CreateHypothesis); - CBGroupe->setObjectName(QString::fromUtf8("CBGroupe")); - - gridLayout_3->addWidget(CBGroupe, 2, 0, 1, 2); - GBUniform = new QGroupBox(CreateHypothesis); GBUniform->setObjectName(QString::fromUtf8("GBUniform")); gridLayout = new QGridLayout(GBUniform); @@ -408,9 +403,10 @@ public: SpinBox_RMuSigma->setObjectName(QString::fromUtf8("SpinBox_RMuSigma")); SpinBox_RMuSigma->setEnabled(false); SpinBox_RMuSigma->setDecimals(8); - SpinBox_RMuSigma->setMinimum(0); + SpinBox_RMuSigma->setMinimum(-1e+12); SpinBox_RMuSigma->setMaximum(1e+12); SpinBox_RMuSigma->setSingleStep(0.1); + SpinBox_RMuSigma->setValue(3); gridLayout3->addWidget(SpinBox_RMuSigma, 3, 1, 1, 1); @@ -486,9 +482,10 @@ public: SpinBox_CMuSigma->setObjectName(QString::fromUtf8("SpinBox_CMuSigma")); SpinBox_CMuSigma->setEnabled(false); SpinBox_CMuSigma->setDecimals(8); - SpinBox_CMuSigma->setMinimum(0); + SpinBox_CMuSigma->setMinimum(-1e+12); SpinBox_CMuSigma->setMaximum(1e+12); SpinBox_CMuSigma->setSingleStep(0.1); + SpinBox_CMuSigma->setValue(4); gridLayout4->addWidget(SpinBox_CMuSigma, 3, 1, 1, 1); @@ -630,6 +627,11 @@ public: gridLayout_3->addWidget(GBField, 7, 0, 1, 2); + CBGroupe = new QCheckBox(CreateHypothesis); + CBGroupe->setObjectName(QString::fromUtf8("CBGroupe")); + + gridLayout_3->addWidget(CBGroupe, 2, 0, 1, 2); + CBAdvanced = new QCheckBox(CreateHypothesis); CBAdvanced->setObjectName(QString::fromUtf8("CBAdvanced")); @@ -761,7 +763,6 @@ public: RBUniforme->setText(QApplication::translate("CreateHypothesis", "Uniform", 0, QApplication::UnicodeUTF8)); RBChamp->setText(QApplication::translate("CreateHypothesis", "Driven by a field", 0, QApplication::UnicodeUTF8)); RBZone->setText(QApplication::translate("CreateHypothesis", "With geometrical zones", 0, QApplication::UnicodeUTF8)); - CBGroupe->setText(QApplication::translate("CreateHypothesis", "Filtering with groups", 0, QApplication::UnicodeUTF8)); GBUniform->setTitle(QApplication::translate("CreateHypothesis", "Uniform adaptation", 0, QApplication::UnicodeUTF8)); RBUniDera->setText(QApplication::translate("CreateHypothesis", "Coarsening", 0, QApplication::UnicodeUTF8)); RBUniRaff->setText(QApplication::translate("CreateHypothesis", "Refinement", 0, QApplication::UnicodeUTF8)); @@ -810,6 +811,7 @@ public: ___qtablewidgetitem5->setText(QApplication::translate("CreateHypothesis", "Selection", 0, QApplication::UnicodeUTF8)); QTableWidgetItem *___qtablewidgetitem6 = TWField->horizontalHeaderItem(1); ___qtablewidgetitem6->setText(QApplication::translate("CreateHypothesis", "Field Name", 0, QApplication::UnicodeUTF8)); + CBGroupe->setText(QApplication::translate("CreateHypothesis", "Filtering with groups", 0, QApplication::UnicodeUTF8)); CBAdvanced->setText(QApplication::translate("CreateHypothesis", "Advanced options", 0, QApplication::UnicodeUTF8)); GBAdvancedOptions->setTitle(QApplication::translate("CreateHypothesis", "Advanced options", 0, QApplication::UnicodeUTF8)); TLMinimalDiameter->setText(QApplication::translate("CreateHypothesis", "Minimal diameter", 0, QApplication::UnicodeUTF8)); diff --git a/src/HOMARDGUI/CreateHypothesis.ui b/src/HOMARDGUI/CreateHypothesis.ui index 177c5074..e7ac9dae 100644 --- a/src/HOMARDGUI/CreateHypothesis.ui +++ b/src/HOMARDGUI/CreateHypothesis.ui @@ -6,8 +6,8 @@ 0 0 - 770 - 1453 + 794 + 1481 @@ -78,13 +78,6 @@ - - - - Filtering with groups - - - @@ -435,7 +428,7 @@ 8 - 0.000000000000000 + -1000000000000.000000000000000 1000000000000.000000000000000 @@ -443,6 +436,9 @@ 0.100000000000000 + + 3.000000000000000 + @@ -567,7 +563,7 @@ 8 - 0.000000000000000 + -1000000000000.000000000000000 1000000000000.000000000000000 @@ -575,6 +571,9 @@ 0.100000000000000 + + 4.000000000000000 + @@ -783,6 +782,13 @@ + + + + Filtering with groups + + + diff --git a/src/HOMARDGUI/EditFile.h b/src/HOMARDGUI/EditFile.h index 4248dd51..66500c6b 100644 --- a/src/HOMARDGUI/EditFile.h +++ b/src/HOMARDGUI/EditFile.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'EditFile.ui' +** Form generated from reading UI file 'EditFile.ui' ** -** Created: Tue Mar 15 10:38:58 2011 -** by: Qt User Interface Compiler version 4.2.1 +** Created: Thu Feb 28 13:53:13 2013 +** by: Qt User Interface Compiler version 4.6.3 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef EDITFILE_H @@ -16,11 +16,14 @@ #include #include #include +#include #include #include #include #include +QT_BEGIN_NAMESPACE + class Ui_EditFile { public: @@ -35,68 +38,75 @@ public: void setupUi(QWidget *EditFile) { - EditFile->setObjectName(QString::fromUtf8("EditFile")); - gridLayout = new QGridLayout(EditFile); - gridLayout->setSpacing(6); - gridLayout->setMargin(9); - gridLayout->setObjectName(QString::fromUtf8("gridLayout")); - spacerItem = new QSpacerItem(331, 49, QSizePolicy::Expanding, QSizePolicy::Minimum); - - gridLayout->addItem(spacerItem, 2, 1, 1, 1); - - GroupButtons = new QGroupBox(EditFile); - GroupButtons->setObjectName(QString::fromUtf8("GroupButtons")); - gridLayout1 = new QGridLayout(GroupButtons); - gridLayout1->setSpacing(6); - gridLayout1->setMargin(9); - gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); - buttonPrint = new QPushButton(GroupButtons); - buttonPrint->setObjectName(QString::fromUtf8("buttonPrint")); - - gridLayout1->addWidget(buttonPrint, 0, 1, 1, 1); - - buttonQuit = new QPushButton(GroupButtons); - buttonQuit->setObjectName(QString::fromUtf8("buttonQuit")); - buttonQuit->setAutoDefault(true); - buttonQuit->setDefault(true); - buttonQuit->setFlat(true); - - gridLayout1->addWidget(buttonQuit, 0, 0, 1, 1); - - - gridLayout->addWidget(GroupButtons, 2, 0, 1, 1); - - spacerItem1 = new QSpacerItem(20, 14, QSizePolicy::Minimum, QSizePolicy::Expanding); - - gridLayout->addItem(spacerItem1, 1, 0, 1, 2); - - QTBEditFile = new QTextBrowser(EditFile); - QTBEditFile->setObjectName(QString::fromUtf8("QTBEditFile")); - QTBEditFile->setMinimumSize(QSize(530, 800)); - QFont font; - font.setFamily(QString::fromUtf8("Courier New")); - QTBEditFile->setFont(font); - - gridLayout->addWidget(QTBEditFile, 0, 0, 1, 2); - - - retranslateUi(EditFile); - - QSize size(675, 901); - size = size.expandedTo(EditFile->minimumSizeHint()); - EditFile->resize(size); - - - QMetaObject::connectSlotsByName(EditFile); + if (EditFile->objectName().isEmpty()) + EditFile->setObjectName(QString::fromUtf8("EditFile")); + EditFile->resize(675, 901); + gridLayout = new QGridLayout(EditFile); +#ifndef Q_OS_MAC + gridLayout->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + spacerItem = new QSpacerItem(331, 49, QSizePolicy::Expanding, QSizePolicy::Minimum); + + gridLayout->addItem(spacerItem, 2, 1, 1, 1); + + GroupButtons = new QGroupBox(EditFile); + GroupButtons->setObjectName(QString::fromUtf8("GroupButtons")); + gridLayout1 = new QGridLayout(GroupButtons); +#ifndef Q_OS_MAC + gridLayout1->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout1->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + buttonPrint = new QPushButton(GroupButtons); + buttonPrint->setObjectName(QString::fromUtf8("buttonPrint")); + buttonPrint->setAutoDefault(false); + buttonPrint->setDefault(false); + buttonPrint->setFlat(false); + + gridLayout1->addWidget(buttonPrint, 0, 1, 1, 1); + + buttonQuit = new QPushButton(GroupButtons); + buttonQuit->setObjectName(QString::fromUtf8("buttonQuit")); + buttonQuit->setAutoDefault(false); + buttonQuit->setDefault(true); + buttonQuit->setFlat(false); + + gridLayout1->addWidget(buttonQuit, 0, 0, 1, 1); + + + gridLayout->addWidget(GroupButtons, 2, 0, 1, 1); + + spacerItem1 = new QSpacerItem(20, 14, QSizePolicy::Minimum, QSizePolicy::Expanding); + + gridLayout->addItem(spacerItem1, 1, 0, 1, 2); + + QTBEditFile = new QTextBrowser(EditFile); + QTBEditFile->setObjectName(QString::fromUtf8("QTBEditFile")); + QTBEditFile->setMinimumSize(QSize(530, 800)); + QFont font; + font.setFamily(QString::fromUtf8("Courier New")); + QTBEditFile->setFont(font); + + gridLayout->addWidget(QTBEditFile, 0, 0, 1, 2); + + + retranslateUi(EditFile); + + QMetaObject::connectSlotsByName(EditFile); } // setupUi void retranslateUi(QWidget *EditFile) { - EditFile->setWindowTitle(QApplication::translate("EditFile", "Edit a file", 0, QApplication::UnicodeUTF8)); - GroupButtons->setTitle(QString()); - buttonPrint->setText(QApplication::translate("EditFile", "Print", 0, QApplication::UnicodeUTF8)); - buttonQuit->setText(QApplication::translate("EditFile", "Quit", 0, QApplication::UnicodeUTF8)); - Q_UNUSED(EditFile); + EditFile->setWindowTitle(QApplication::translate("EditFile", "Edit a file", 0, QApplication::UnicodeUTF8)); + GroupButtons->setTitle(QString()); + buttonPrint->setText(QApplication::translate("EditFile", "Print", 0, QApplication::UnicodeUTF8)); + buttonQuit->setText(QApplication::translate("EditFile", "Quit", 0, QApplication::UnicodeUTF8)); } // retranslateUi }; @@ -105,4 +115,6 @@ namespace Ui { class EditFile: public Ui_EditFile {}; } // namespace Ui +QT_END_NAMESPACE + #endif // EDITFILE_H diff --git a/src/HOMARDGUI/EditFile.ui b/src/HOMARDGUI/EditFile.ui index 266c3d35..bfccdc17 100644 --- a/src/HOMARDGUI/EditFile.ui +++ b/src/HOMARDGUI/EditFile.ui @@ -1,7 +1,8 @@ - + + EditFile - - + + 0 0 @@ -9,22 +10,22 @@ 901 - + Edit a file - - + + 9 - + 6 - + - + Qt::Horizontal - + 331 49 @@ -32,50 +33,59 @@ - - - + + + - - + + 9 - + 6 - - - + + + Print + + false + + + false + + + false + - - - + + + Quit - - true + + false - + true - - true + + false - + - + Qt::Vertical - + 20 14 @@ -83,15 +93,15 @@ - - - + + + 530 800 - + Courier New diff --git a/src/HOMARDGUI/HOMARDGUI.cxx b/src/HOMARDGUI/HOMARDGUI.cxx index 3125a90a..610157b3 100644 --- a/src/HOMARDGUI/HOMARDGUI.cxx +++ b/src/HOMARDGUI/HOMARDGUI.cxx @@ -379,7 +379,7 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) else if (HOMARD_UTILS::isIter(obj)) { try - { homardGen->DeleteIteration(_ObjectName.toStdString().c_str()); } + { homardGen->DeleteIteration(_ObjectName.toStdString().c_str(), 1); } catch( SALOME::SALOME_Exception& S_ex ) { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), @@ -447,7 +447,7 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) if ((obj) and ((HOMARD_UTILS::isFilelog(obj) or HOMARD_UTILS::isFileSummary(obj)))) { MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ; - aDlg->show(); + if ( aDlg->_codret == 0 ) { aDlg->show(); } } break; } diff --git a/src/HOMARDGUI/HOMARD_msg_en.ts b/src/HOMARDGUI/HOMARD_msg_en.ts index 89aca2f5..d646b82f 100644 --- a/src/HOMARDGUI/HOMARD_msg_en.ts +++ b/src/HOMARDGUI/HOMARD_msg_en.ts @@ -131,6 +131,10 @@ HOM_SELECT_FILE_2 Select only one file. + + HOM_SELECT_FILE_3 + This file cannot be opened. + HOM_MED_FILE_1 This MED file cannot be read. diff --git a/src/HOMARDGUI/HOMARD_msg_fr.ts b/src/HOMARDGUI/HOMARD_msg_fr.ts index 3a63a413..4d0509b9 100644 --- a/src/HOMARDGUI/HOMARD_msg_fr.ts +++ b/src/HOMARDGUI/HOMARD_msg_fr.ts @@ -183,6 +183,10 @@ HOM_SELECT_FILE_2 Sélectionner un seul fichier. + + HOM_SELECT_FILE_3 + Impossible d'ouvrir ce fichier. + HOM_MED_FILE_1 Ce fichier MED est illisible. diff --git a/src/HOMARDGUI/MonEditFile.cxx b/src/HOMARDGUI/MonEditFile.cxx index d399466f..4ec9252c 100644 --- a/src/HOMARDGUI/MonEditFile.cxx +++ b/src/HOMARDGUI/MonEditFile.cxx @@ -47,7 +47,8 @@ MonEditFile::MonEditFile( QWidget* parent, bool modal, QString aFileName): // QWidget(0), Ui_EditFile(), - _aFileName (aFileName) + _aFileName (aFileName), + _codret (0) { MESSAGE("Debut de MonEditFile " << aFileName.toStdString().c_str()); setupUi(this); @@ -94,7 +95,10 @@ void MonEditFile::EditText() else { // GERALD -- QMESSAGE BOX - MESSAGE( "EditText " << _aFileName.toStdString().c_str() << "est impossible a ouvrir "); + MESSAGE( "EditText " << _aFileName.toStdString().c_str() << " est impossible a ouvrir "); + QMessageBox::warning( 0, QObject::tr("HOM_WARNING"), + QObject::tr("HOM_SELECT_FILE_3") ); + _codret = 1 ; } } // ------------------------------------------------------------------------ diff --git a/src/HOMARDGUI/MonEditFile.h b/src/HOMARDGUI/MonEditFile.h index d6e36501..e11f2286 100644 --- a/src/HOMARDGUI/MonEditFile.h +++ b/src/HOMARDGUI/MonEditFile.h @@ -44,6 +44,7 @@ public: HOMARD::HOMARD_Gen_var myHomardGen, QString FileName ); ~MonEditFile(); + int _codret ; protected : diff --git a/src/HOMARD_I/HOMARD_Gen_i.cxx b/src/HOMARD_I/HOMARD_Gen_i.cxx index 6aba5456..19835e13 100755 --- a/src/HOMARD_I/HOMARD_Gen_i.cxx +++ b/src/HOMARD_I/HOMARD_Gen_i.cxx @@ -169,7 +169,7 @@ CORBA::Long HOMARD_Gen_i::GetCurrentStudyID() void HOMARD_Gen_i::SetEtatIter(const char* nomIter, const CORBA::Boolean EtatCalcul) //===================================================================================== { - MESSAGE( "SetEtatIter : affectation de l etat " << EtatCalcul << " a l iteration " << nomIter ); + MESSAGE( "SetEtatIter : affectation de l'etat '" << EtatCalcul << "' a l'iteration " << nomIter ); HOMARD::HOMARD_Iteration_var myIteration = myContextMap[GetCurrentStudyID()]._mesIterations[nomIter]; if (CORBA::is_nil(myIteration)) { @@ -276,8 +276,9 @@ CORBA::Long HOMARD_Gen_i::DeleteCase(const char* nomCas) }; // On commence par detruire toutes les iterations en partant de l'initiale et y compris elle CORBA::String_var nomIter = myCase->GetIter0Name(); - CORBA::Long Option = 0 ; - if ( DeleteIterationOption(nomIter, Option) != 0 ) + CORBA::Long Option1 = 0 ; + CORBA::Long Option2 = 1 ; + if ( DeleteIterationOption(nomIter, Option1, Option2) != 0 ) { return 2; }; @@ -339,19 +340,25 @@ CORBA::Long HOMARD_Gen_i::DeleteHypo(const char* nomHypo) return 0 ; } //============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteIteration(const char* nomIter) +CORBA::Long HOMARD_Gen_i::DeleteIteration(const char* nomIter, CORBA::Long Option) { + // Option = 0 : On ne supprime pas le fichier du maillage associe + // Option = 1 : On supprime le fichier du maillage associe + // Option = 2 : On supprime le fichier du maillage associe, sauf si c'est la derniere iteration // Pour detruire une iteration courante - MESSAGE ( "DeleteIteration : nomIter = " << nomIter ); - CORBA::Long Option = 1 ; - return DeleteIterationOption(nomIter, Option); + MESSAGE ( "DeleteIteration : nomIter = " << nomIter << ", avec option = " << Option ); + CORBA::Long Option1 = 1 ; + return DeleteIterationOption(nomIter, Option1, Option); } //============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteIterationOption(const char* nomIter, CORBA::Long Option) +CORBA::Long HOMARD_Gen_i::DeleteIterationOption(const char* nomIter, CORBA::Long Option1, CORBA::Long Option2) { - // Option = 0 : On autorise la destruction de l'iteration 0 - // Option = 1 : On interdit la destruction de l'iteration 0 - MESSAGE ( "DeleteIterationOption : nomIter = " << nomIter << ", avec option = " << Option ); + // Option1 = 0 : On autorise la destruction de l'iteration 0 + // Option1 = 1 : On interdit la destruction de l'iteration 0 + + // Option2 = 0 : On ne supprime pas le fichier du maillage associe + // Option2 = 1 : On supprime le fichier du maillage associe + MESSAGE ( "DeleteIterationOption : nomIter = " << nomIter << ", avec options = " << Option1<< ", " << Option2 ); HOMARD::HOMARD_Iteration_var myIteration = myContextMap[GetCurrentStudyID()]._mesIterations[nomIter]; if (CORBA::is_nil(myIteration)) { @@ -364,7 +371,7 @@ CORBA::Long HOMARD_Gen_i::DeleteIterationOption(const char* nomIter, CORBA::Long int numero = myIteration->GetNumber(); MESSAGE ( "DeleteIterationOption : numero = " << numero ); - if ( numero == 0 and Option == 1 ) + if ( numero == 0 and Option1 == 1 ) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; @@ -380,14 +387,14 @@ CORBA::Long HOMARD_Gen_i::DeleteIterationOption(const char* nomIter, CORBA::Long { std::string nomIterFille = std::string((*maListe)[NumeIter]); MESSAGE ( ".. appel recursif de DeleteIterationOption pour nomIter = " << nomIterFille.c_str() ); - DeleteIterationOption(nomIterFille.c_str(), Option); + DeleteIterationOption(nomIterFille.c_str(), Option1, Option2); } // On arrive ici pour une iteration sans fille MESSAGE ( "Destruction effective de " << nomIter ); // On commence par invalider l'iteration pour faire le menage des dependances - // et des publications dans SMESH - InvalideIter(nomIter) ; + // et eventeullement du maillage associe + InvalideIterOption(nomIter, Option2) ; // Retrait dans la descendance de l'iteration parent if ( numero > 0 ) @@ -525,6 +532,16 @@ void HOMARD_Gen_i::InvalideHypo(const char* nomHypo) void HOMARD_Gen_i::InvalideIter(const char* nomIter) { MESSAGE("InvalideIter : nomIter = " << nomIter); + // Pour invalider totalement une iteration courante + CORBA::Long Option = 1 ; + return InvalideIterOption(nomIter, Option); +} +//============================================================================= +void HOMARD_Gen_i::InvalideIterOption(const char* nomIter, CORBA::Long Option) +{ + // Option = 0 : On ne supprime pas le fichier du maillage associe + // Option = 1 : On supprime le fichier du maillage associe + MESSAGE ( "InvalideIterOption : nomIter = " << nomIter << ", avec option = " << Option ); HOMARD::HOMARD_Iteration_var myIteration = myContextMap[GetCurrentStudyID()]._mesIterations[nomIter]; if (CORBA::is_nil(myIteration)) { @@ -578,7 +595,7 @@ void HOMARD_Gen_i::InvalideIter(const char* nomIter) const char* nomDir = myIteration->GetDirName(); const char* nomFichier = myIteration->GetMeshFile(); std::string commande= "rm -rf " + std::string(dirCase) + "/" + std::string(nomDir); - commande = commande + ";rm -rf " + std::string(nomFichier); + if ( Option == 1 ) { commande = commande + ";rm -rf " + std::string(nomFichier) ; } MESSAGE ( "commande = " << commande ); if ((system(commande.c_str())) != 0) { @@ -589,7 +606,7 @@ void HOMARD_Gen_i::InvalideIter(const char* nomIter) return ; } // Suppression du maillage publie dans SMESH - const char* MeshName = myIteration->GetMeshName(); + const char* MeshName = myIteration->GetMeshName() ; DeleteResultInSmesh(nomFichier, MeshName) ; }; @@ -2500,9 +2517,11 @@ void HOMARD_Gen_i::PublishBoundaryUnderCase(const char* CaseName, const char* Bo }; //============================================================================= -void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long IconeType) +void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option) +// Option = 0 : fichier issu d'une importation +// Option = 1 : fichier issu d'une execution HOMARD { - MESSAGE( "PublishResultInSmesh " << NomFich); + MESSAGE( "PublishResultInSmesh " << NomFich << ", avec Option = " << Option); if (CORBA::is_nil(myCurrentStudy)) { SALOME::ExceptionStruct es; @@ -2529,9 +2548,22 @@ void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long IconeTy CORBA::String_var value=anAttr->Value(); if (strcmp((const char*)value,NomFich) == 0) { - // GERALD -- QMESSAGE BOX - std::cerr << "fichier : "<< NomFich << " deja publie "<< std::endl; + MESSAGE ( "PublishResultInSmesh : le fichier " << NomFich << " est deja publie." ); + // Pour un fichier importe, on ne republie pas + if ( Option == 0 ) + { return; + } + // Pour un fichier calcule, on commence par faire la depublication + else + { + MESSAGE ( "PublishResultInSmesh : depublication" ); + SALOMEDS::AttributeName_var anAttr2 = SALOMEDS::AttributeName::_narrow(aGAttr); + CORBA::String_var value2=anAttr2->Value(); + const char* MeshName = value2 ; + MESSAGE ( "PublishResultInSmesh : depublication de " << MeshName ); + DeleteResultInSmesh(NomFich, MeshName) ; + } } } } @@ -2559,11 +2591,9 @@ void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long IconeTy anAttr->SetValue(NomFich); SALOMEDS::GenericAttribute_var aPixMap = aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePixMap" ); SALOMEDS::AttributePixMap_var anAttr2 = SALOMEDS::AttributePixMap::_narrow(aPixMap); -// IconeType = 0 : fichier issu d'une importation -// IconeType = 1 : fichier issu d'une execution HOMARD const char* icone ; - if ( IconeType == 0 ) { icone = "mesh_tree_importedmesh.png" ; } - else { icone = "mesh_tree_mesh.png" ; } + if ( Option == 0 ) { icone = "mesh_tree_importedmesh.png" ; } + else { icone = "mesh_tree_mesh.png" ; } anAttr2->SetPixMap( icone ); } diff --git a/src/HOMARD_I/HOMARD_Gen_i.hxx b/src/HOMARD_I/HOMARD_Gen_i.hxx index 20ae2135..72d74caf 100644 --- a/src/HOMARD_I/HOMARD_Gen_i.hxx +++ b/src/HOMARD_I/HOMARD_Gen_i.hxx @@ -130,14 +130,15 @@ public: void InvalideBoundary(const char* nomBoundary); void InvalideHypo(const char* nomHypo); void InvalideIter(const char* nomIter); + void InvalideIterOption(const char* nomIter, CORBA::Long Option); void InvalideIterInfo(const char* nomIter); void InvalideZone(const char* nomZone); CORBA::Long DeleteBoundary(const char* nomBoundary); CORBA::Long DeleteCase(const char* nomCas); CORBA::Long DeleteHypo(const char* nomHypothesis); - CORBA::Long DeleteIteration(const char* nomIter); - CORBA::Long DeleteIterationOption(const char* nomIter, CORBA::Long Option); + CORBA::Long DeleteIteration(const char* nomIter, CORBA::Long Option); + CORBA::Long DeleteIterationOption(const char* nomIter, CORBA::Long Option1, CORBA::Long Option2); CORBA::Long DeleteZone(const char* nomZone); void AssociateIterHypo(const char* nomIter, const char* nomHypothesis); @@ -161,7 +162,7 @@ public: CORBA::Boolean VerifieDir(const char* nomDir); - void PublishResultInSmesh(const char* NomFich, CORBA::Long IconeType); + void PublishResultInSmesh(const char* NomFich, CORBA::Long Option); void DeleteResultInSmesh(const char* NomFich, const char* MeshName); void PublishFileUnderIteration(const char* NomIter, const char* NomFich, const char* Commentaire); diff --git a/src/HOMARD_I/HOMARD_Iteration_i.cxx b/src/HOMARD_I/HOMARD_Iteration_i.cxx index 222dd663..72a593e0 100644 --- a/src/HOMARD_I/HOMARD_Iteration_i.cxx +++ b/src/HOMARD_I/HOMARD_Iteration_i.cxx @@ -86,12 +86,12 @@ char* HOMARD_Iteration_i::GetName() return CORBA::string_dup( myHomardIteration->GetName().c_str() ); } //============================================================================= -CORBA::Long HOMARD_Iteration_i::Delete() +CORBA::Long HOMARD_Iteration_i::Delete( CORBA::Long Option ) { ASSERT( myHomardIteration ); char* IterName = GetName() ; - MESSAGE ( "Delete : destruction de l'iteration " << IterName ); - return _gen_i->DeleteIteration(IterName) ; + MESSAGE ( "Delete : destruction de l'iteration " << IterName << ", Option = " << Option ); + return _gen_i->DeleteIteration(IterName, Option) ; } //============================================================================= char* HOMARD_Iteration_i::GetDumpPython() diff --git a/src/HOMARD_I/HOMARD_Iteration_i.hxx b/src/HOMARD_I/HOMARD_Iteration_i.hxx index 103a5163..740eab5f 100644 --- a/src/HOMARD_I/HOMARD_Iteration_i.hxx +++ b/src/HOMARD_I/HOMARD_Iteration_i.hxx @@ -57,7 +57,7 @@ public: void SetName( const char* Name ); char* GetName(); - CORBA::Long Delete(); + CORBA::Long Delete( CORBA::Long Option ); char* GetDumpPython(); diff --git a/tests/test_3.py b/tests/test_3.py index e977157c..33047438 100644 --- a/tests/test_3.py +++ b/tests/test_3.py @@ -139,7 +139,7 @@ Copyright EDF-R&D 2010, 2013 # Destruction if ( iaux < n_boucle ) : # Recursive destruction of the iterations - error = Iter_1.Delete() + error = Iter_1.Delete(1) if error : error = 10*iaux + 3 break