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()));
}
TWBoundary->clearSelection();
}
// -------------------------------
-bool MonCreateCase::PushOnApply()
+bool MonCreateCase::PushOnApply(int option)
// --------------------------------
{
MESSAGE("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 ;
return false;
}
+// On verifie qu'un groupe n'est pas associe a deux frontieres differentes
if (CBBoundaryA->isChecked())
{
QStringList ListeGroup ;
}
}
+// Creation du cas
if (aCaseName != _aCaseName )
{
_aCaseName = aCaseName;
{
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);
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())
{
void MonCreateCase::PushOnOK()
// ---------------------------
{
- bool bOK = PushOnApply();
+ bool bOK = PushOnApply(1);
if ( bOK ) this->close();
}
//------------------------------
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);
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);
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);
}
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";
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 );
// A.1. Controle du repertoire de depart de l'iteration
#ifndef WIN32
codret = chdir(DirNameStart) ;
-#else
+#else
codret = _chdir(DirNameStart) ;
#endif
if ( codret != 0 )
}
}
closedir(dp);
-#else
+#else
HANDLE hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATA ffd;
hFind = FindFirstFile(DirNameStart, &ffd);
}
}
FindClose(hFind);
- }
+ }
#endif
MESSAGE ( "==> file_configuration : " << file_configuration ) ;
MESSAGE ( "==> file_maillage_homard : " << file_maillage_homard ) ;
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
{
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 )
{
}
#ifndef WIN32
closedir(dp);
- chdir(nomDirWork.c_str());
+ chdir(nomDirWork.c_str());
#else
FindClose(hFind);
}
{
delete myDriver;
MESSAGE ( ". On retourne dans nomDirWork = " << nomDirWork );
-
+
#ifndef WIN32
chdir(nomDirWork.c_str());
#else
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
while ( a_chercher )
{
// On passe dans le repertoire parent
-
+
#ifndef WIN32
chdir(nomrep);
#else
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
SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aCaseSO);
aStudyBuilder->Addreference(aSubSO, aBoundarySO);
+// aStudyBuilder->RemoveReference(aSubSO);
aStudyBuilder->CommitCommand();