From: vsr Date: Thu, 9 Jan 2014 14:24:21 +0000 (+0000) Subject: Merge from V7_3_BR (09/01/2014) X-Git-Tag: V7_4_0a1~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4aef4b766c3248f82b3a3ad1a19225b4826db280;p=modules%2Fhomard.git Merge from V7_3_BR (09/01/2014) --- diff --git a/idl/HOMARD_Cas.idl b/idl/HOMARD_Cas.idl index a278eabb..348587bf 100644 --- a/idl/HOMARD_Cas.idl +++ b/idl/HOMARD_Cas.idl @@ -74,6 +74,7 @@ module HOMARD void AddBoundaryGroup(in string BoundaryName, in string Group) raises (SALOME::SALOME_Exception); ListBoundaryGroupType GetBoundaryGroup() raises (SALOME::SALOME_Exception); + void SupprBoundaryGroup() raises (SALOME::SALOME_Exception); void SetPyram(in long Pyram) raises (SALOME::SALOME_Exception); long GetPyram() raises (SALOME::SALOME_Exception); diff --git a/src/HOMARDGUI/MonCreateCase.cxx b/src/HOMARDGUI/MonCreateCase.cxx index 4738ba34..42250931 100644 --- a/src/HOMARDGUI/MonCreateCase.cxx +++ b/src/HOMARDGUI/MonCreateCase.cxx @@ -99,7 +99,7 @@ void MonCreateCase::InitConnect() connect( CBAdvanced, SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced())); connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK())); - connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply())); + connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply(0))); connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close())); connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp())); } @@ -138,7 +138,7 @@ void MonCreateCase::InitBoundarys() TWBoundary->clearSelection(); } // ------------------------------- -bool MonCreateCase::PushOnApply() +bool MonCreateCase::PushOnApply(int option) // -------------------------------- { MESSAGE("PushOnApply"); @@ -160,7 +160,7 @@ bool MonCreateCase::PushOnApply() if ( aDirName != _aDirName) { QString CaseNameDir = myHomardGen->VerifieDir( aDirName.toStdString().c_str()) ; - if ( CaseNameDir != "" ) + if ( ( CaseNameDir != "" ) & ( CaseNameDir != aCaseName ) ) { QString texte ; texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ; @@ -196,6 +196,7 @@ bool MonCreateCase::PushOnApply() return false; } +// On verifie qu'un groupe n'est pas associe a deux frontieres differentes if (CBBoundaryA->isChecked()) { QStringList ListeGroup ; @@ -227,6 +228,7 @@ bool MonCreateCase::PushOnApply() } } +// Creation du cas if (aCaseName != _aCaseName ) { _aCaseName = aCaseName; @@ -241,17 +243,6 @@ bool MonCreateCase::PushOnApply() { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), QObject::tr(CORBA::string_dup(S_ex.details.text)) ); - try - { - aCase = myHomardGen->GetCase(_aCaseName.toStdString().c_str()); - string iter0 = aCase->GetIter0Name(); - HOMARD::HOMARD_Iteration_var aIter = myHomardGen->GetIteration(iter0.c_str()); - QString aFileName = aIter->GetMeshFile(); - LEFileName->setText(aFileName); - LEFileName->setReadOnly(true); - PushFichier->hide(); - } - catch( SALOME::SALOME_Exception& S_ex ) {}; return false; } LEFileName->setReadOnly(true); @@ -259,43 +250,49 @@ bool MonCreateCase::PushOnApply() InitBoundarys(); } +// Repertoire et type aCase->SetDirName(aDirName.toStdString().c_str()); _aDirName=aDirName; aCase->SetConfType(_ConfType); -// Enregistrement de la frontiere discrete - if (CBBoundaryD->isChecked()) +// Menage des eventuelles frontieres deja enregistrees + aCase->SupprBoundaryGroup() ; + + // Enregistrement et publication dans l'arbre d'etudes a la sortie definitive + if ( option > 0 ) { - QString monBoundaryDiName=CBBoundaryDi->currentText(); - if (monBoundaryDiName != "" ) + if (CBBoundaryD->isChecked()) { - aCase->AddBoundaryGroup(monBoundaryDiName.toStdString().c_str(), ""); + QString monBoundaryDiName=CBBoundaryDi->currentText(); + if (monBoundaryDiName != "" ) + { + aCase->AddBoundaryGroup(monBoundaryDiName.toStdString().c_str(), ""); + } } - } - -// Enregistrement des liens (groupe,frontiere analytique) - if (CBBoundaryA->isChecked()) - { - QString NomGroup ; - int nbcol = TWBoundary->columnCount(); - int nbrow = TWBoundary->rowCount(); - for ( int col=1; col< nbcol; col++) + if (CBBoundaryA->isChecked()) { - for ( int row=0; row< nbrow; row++) + QString NomGroup ; + int nbcol = TWBoundary->columnCount(); + int nbrow = TWBoundary->rowCount(); + for ( int col=1; col< nbcol; col++) { - if ( TWBoundary->item( row, col )->checkState() == Qt::Checked ) + for ( int row=0; row< nbrow; row++) { -// Nom du groupe - NomGroup = QString(TWBoundary->item(row, 0)->text()) ; -// Nom de la frontiere - QTableWidgetItem *__colItem = new QTableWidgetItem(); - __colItem = TWBoundary->horizontalHeaderItem(col); - aCase->AddBoundaryGroup(QString(__colItem->text()).toStdString().c_str(), NomGroup.toStdString().c_str()); + if ( TWBoundary->item( row, col )->checkState() == Qt::Checked ) + { + // Nom du groupe + NomGroup = QString(TWBoundary->item(row, 0)->text()) ; + // Nom de la frontiere + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem = TWBoundary->horizontalHeaderItem(col); + aCase->AddBoundaryGroup(QString(__colItem->text()).toStdString().c_str(), NomGroup.toStdString().c_str()); + } } } } } + // Options avancees if (CBAdvanced->isChecked()) { @@ -311,7 +308,7 @@ bool MonCreateCase::PushOnApply() void MonCreateCase::PushOnOK() // --------------------------- { - bool bOK = PushOnApply(); + bool bOK = PushOnApply(1); if ( bOK ) this->close(); } //------------------------------ @@ -403,7 +400,7 @@ void MonCreateCase::SetBoundaryD() MESSAGE("Debut de SetBoundaryD "); if (CBBoundaryD->isChecked()) { - bool bOK = PushOnApply(); + bool bOK = PushOnApply(0); if (bOK) { GBBoundaryD->setVisible(1); } else { GBBoundaryD->setVisible(0); CBBoundaryD->setChecked(0); @@ -450,7 +447,7 @@ void MonCreateCase::SetBoundaryA() MESSAGE("Debut de SetBoundaryA "); if (CBBoundaryA->isChecked()) { - bool bOK = PushOnApply(); + bool bOK = PushOnApply(0); if (bOK) { GBBoundaryA->setVisible(1); } else { GBBoundaryA->setVisible(0); CBBoundaryA->setChecked(0); diff --git a/src/HOMARDGUI/MonCreateCase.h b/src/HOMARDGUI/MonCreateCase.h index cf2bb6d9..16186f3d 100644 --- a/src/HOMARDGUI/MonCreateCase.h +++ b/src/HOMARDGUI/MonCreateCase.h @@ -80,7 +80,7 @@ public slots: virtual void SetAdvanced(); virtual void PushOnOK(); - virtual bool PushOnApply(); + virtual bool PushOnApply(int option); virtual void PushOnHelp(); virtual void CaseNameChanged(); diff --git a/src/HOMARD_I/HOMARD_Cas_i.cxx b/src/HOMARD_I/HOMARD_Cas_i.cxx index 6515972f..105a487a 100755 --- a/src/HOMARD_I/HOMARD_Cas_i.cxx +++ b/src/HOMARD_I/HOMARD_Cas_i.cxx @@ -125,17 +125,21 @@ void HOMARD_Cas_i::SetDirName( const char* NomDir ) int codret ; // A. recuperation du nom ; on ne fait rien si c'est le meme char* oldrep = GetDirName() ; - if ( oldrep == NomDir ) { return ; } + if ( strcmp(oldrep,NomDir) == 0 ) + { + return ; + } MESSAGE ( "SetDirName : passage de oldrep = "<< oldrep << " a NomDir = "<VerifieDir(NomDir) ; - if ( std::string(casename).size() > 0 ) + char* CaseName = GetName() ; + char* casenamedir = _gen_i->VerifieDir(NomDir) ; + if ( ( std::string(casenamedir).size() > 0 ) & ( strcmp(CaseName,casenamedir)!=0 ) ) { - INFOS ( "Le repertoire " << NomDir << " est deja utilise pour le cas "<< casename ); + INFOS ( "Le repertoire " << NomDir << " est deja utilise pour le cas "<< casenamedir ); SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; std::string text ; - text = "The directory " + std::string(NomDir) + " is already used for the case " + std::string(casename) ; + text = "The directory " + std::string(NomDir) + " is already used for the case " + std::string(casenamedir) ; es.text = CORBA::string_dup(text.c_str()); throw SALOME::SALOME_Exception(es); } @@ -330,7 +334,7 @@ void HOMARD_Cas_i::AddBoundaryGroup( const char* BoundaryName, const char* Group it++ ; // MESSAGE (".. Group : "<< *it ); if ( *it == Group ) - { INFOS ("Le groupe " << Group << " est deja associe a la frontiere " << boun) ; + { INFOS ("Frontiere " << boun << " Un groupe est deja associe " << Group ) ; SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; es.text = "Invalid AddBoundaryGroup"; @@ -358,6 +362,13 @@ HOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup() return aResult._retn(); } //============================================================================= +void HOMARD_Cas_i::SupprBoundaryGroup() +{ + MESSAGE ("SupprBoundaryGroup"); + ASSERT(myHomardCas ); + myHomardCas->SupprBoundaryGroup(); +} +//============================================================================= void HOMARD_Cas_i::SetPyram( CORBA::Long Pyram ) { MESSAGE ("SetPyram, Pyram = " << Pyram ); diff --git a/src/HOMARD_I/HOMARD_Cas_i.hxx b/src/HOMARD_I/HOMARD_Cas_i.hxx index a3f032a0..3aa1ae35 100644 --- a/src/HOMARD_I/HOMARD_Cas_i.hxx +++ b/src/HOMARD_I/HOMARD_Cas_i.hxx @@ -84,6 +84,7 @@ public: void AddBoundaryGroup( const char* Boundary, const char* Group); HOMARD::ListBoundaryGroupType* GetBoundaryGroup(); + void SupprBoundaryGroup( ); void SetPyram( CORBA::Long Pyram ); CORBA::Long GetPyram(); diff --git a/src/HOMARD_I/HOMARD_Gen_i.cxx b/src/HOMARD_I/HOMARD_Gen_i.cxx index d38628bb..71966dc7 100755 --- a/src/HOMARD_I/HOMARD_Gen_i.cxx +++ b/src/HOMARD_I/HOMARD_Gen_i.cxx @@ -1208,7 +1208,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, // A.1. Controle du repertoire de depart de l'iteration #ifndef WIN32 codret = chdir(DirNameStart) ; -#else +#else codret = _chdir(DirNameStart) ; #endif if ( codret != 0 ) @@ -1241,7 +1241,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, } } closedir(dp); -#else +#else HANDLE hFind = INVALID_HANDLE_VALUE; WIN32_FIND_DATA ffd; hFind = FindFirstFile(DirNameStart, &ffd); @@ -1259,7 +1259,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, } } FindClose(hFind); - } + } #endif MESSAGE ( "==> file_configuration : " << file_configuration ) ; MESSAGE ( "==> file_maillage_homard : " << file_maillage_homard ) ; @@ -1381,7 +1381,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, nomDirIterTotal = std::string(nomDirCase) + "/" + std::string(nomDirIter) ; #ifndef WIN32 if (mkdir(nomDirIterTotal.c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) -#else +#else if (_mkdir(nomDirIterTotal.c_str()) != 0) #endif { @@ -1531,11 +1531,11 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb HANDLE hFind1 = INVALID_HANDLE_VALUE; WIN32_FIND_DATA ffd1; hFind1 = FindFirstFile(DirName_1.c_str(), &ffd1); - while (FindNextFile(hFind1, &ffd1) != 0) + while (FindNextFile(hFind1, &ffd1) != 0) { - if (ffd1.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + if (ffd1.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories std::string file_name_1(ffd1.cFileName); -#endif +#endif int bilan = file_name_1.find("HOMARD.Configuration.") ; if ( bilan != string::npos ) { @@ -1610,7 +1610,7 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb } #ifndef WIN32 closedir(dp); - chdir(nomDirWork.c_str()); + chdir(nomDirWork.c_str()); #else FindClose(hFind); } @@ -2554,7 +2554,7 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena { delete myDriver; MESSAGE ( ". On retourne dans nomDirWork = " << nomDirWork ); - + #ifndef WIN32 chdir(nomDirWork.c_str()); #else @@ -2738,7 +2738,7 @@ CORBA::Long HOMARD_Gen_i::ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOM char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num ) { MESSAGE ( "CreateDirNameIter : nomrep ="<< nomrep << ", num = "<NewObject(aCaseSO); aStudyBuilder->Addreference(aSubSO, aBoundarySO); +// aStudyBuilder->RemoveReference(aSubSO); aStudyBuilder->CommitCommand();