Salome HOME
Merge from V7_3_BR (09/01/2014)
authorvsr <vsr@opencascade.com>
Thu, 9 Jan 2014 14:24:21 +0000 (14:24 +0000)
committervsr <vsr@opencascade.com>
Thu, 9 Jan 2014 14:24:21 +0000 (14:24 +0000)
idl/HOMARD_Cas.idl
src/HOMARDGUI/MonCreateCase.cxx
src/HOMARDGUI/MonCreateCase.h
src/HOMARD_I/HOMARD_Cas_i.cxx
src/HOMARD_I/HOMARD_Cas_i.hxx
src/HOMARD_I/HOMARD_Gen_i.cxx

index a278eabb33262468016edd1b473d56f4bb6a724a..348587bf7260f05c9d0b7fa44c09dcd47f66ceda 100644 (file)
@@ -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);
index 4738ba342efbf2cc8872cdab3a7ba874636fbdf8..4225093181d4af8db13b552a998f1ecf1c24c2ac 100644 (file)
@@ -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);
index cf2bb6d9667cc8c1e801783c4a3f5893c852e3b6..16186f3d4cc04d88cbdec9b18ce88080fda1da3c 100644 (file)
@@ -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();
index 6515972fa5b1fd3edffea1f7b16461aa5484c704..105a487af2b2d79ab357b8898334d60ae5461b94 100755 (executable)
@@ -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 = "<<NomDir);
   // B. controle de l'usage du repertoire
-  char* casename = _gen_i->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 );
index a3f032a0648288d9db17384d7a089f5a8da99ce5..3aa1ae35e6f935a9229e027e2b649fcc7b3697ad 100644 (file)
@@ -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();
index d38628bba389070adbdcb59905e32c5b39b0c0bc..71966dc72952f7f123bb8758ea080b97874dae69 100755 (executable)
@@ -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 = "<<num);
-  // On verifie que le repertoire parent existe  
+  // On verifie que le repertoire parent existe
 #ifndef WIN32
   int codret = chdir(nomrep) ;
 #else
@@ -2759,7 +2759,7 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
   while ( a_chercher )
   {
     // On passe dans le repertoire parent
-    
+
 #ifndef WIN32
   chdir(nomrep);
 #else
@@ -2801,12 +2801,12 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
         while (FindNextFile(hFind, &ffd) != 0) {
          if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories
          std::string file_name(ffd.cFileName);
-#endif        
+#endif
         if ( file_name == DirNameA.str() ) { existe = true ; }
       }
 #ifndef WIN32
       closedir(dp);
-#else 
+#else
       }
       FindClose(hFind);
 #endif
@@ -3635,6 +3635,7 @@ void HOMARD_Gen_i::PublishBoundaryUnderCase(const char* CaseName, const char* Bo
 
   SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aCaseSO);
   aStudyBuilder->Addreference(aSubSO, aBoundarySO);
+//   aStudyBuilder->RemoveReference(aSubSO);
 
   aStudyBuilder->CommitCommand();