X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARD_I%2FHOMARD_Gen_i.cxx;h=6683369435315cf51105911da7724feec111820d;hb=259960aae337825d77ff62b057f0a0d9773f5eb2;hp=fbc5f9c7613e325e1a9db3ce3f6e778bddd2a7e9;hpb=ecf108fd059964209a0148e0e7724cd175f6709f;p=modules%2Fhomard.git diff --git a/src/HOMARD_I/HOMARD_Gen_i.cxx b/src/HOMARD_I/HOMARD_Gen_i.cxx index fbc5f9c7..66833694 100755 --- a/src/HOMARD_I/HOMARD_Gen_i.cxx +++ b/src/HOMARD_I/HOMARD_Gen_i.cxx @@ -1248,11 +1248,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, // A. Decodage du point de reprise // A.1. Controle du repertoire de depart de l'iteration -#ifndef WIN32 - codret = chdir(DirNameStart) ; -#else - codret = _chdir(DirNameStart) ; -#endif + codret = CHDIR(DirNameStart) ; if ( codret != 0 ) { SALOME::ExceptionStruct es; @@ -1436,11 +1432,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, throw SALOME::SALOME_Exception(es); } // E.3. Copie du maillage HOMARD au format MED -#ifndef WIN32 - codret = chdir(DirNameStart) ; -#else - codret = _chdir(DirNameStart) ; -#endif + codret = CHDIR(DirNameStart) ; std::string commande = "cp " + file_maillage_homard + " " + nomDirIterTotal ; MESSAGE ( "commande : " << commande ) ; codret = system(commande.c_str()) ; @@ -1459,11 +1451,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, delete[] MeshName ; delete[] MeshFile ; -#ifndef WIN32 - chdir(nomDirWork.c_str()); -#else - _chdir(nomDirWork.c_str()); -#endif + CHDIR(nomDirWork.c_str()); return HOMARD::HOMARD_Cas::_duplicate(myCase); } //============================================================================= @@ -1522,11 +1510,7 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb int NumeIterMax = -1 ; // A.1. Controle du repertoire de depart du cas -#ifndef WIN32 - codret = chdir(DirNameStart) ; -#else - codret = _chdir(DirNameStart) ; -#endif + codret = CHDIR(DirNameStart) ; if ( codret != 0 ) { SALOME::ExceptionStruct es; @@ -1556,11 +1540,11 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb #endif if ( ( DirName_1 != "." ) && ( DirName_1 != ".." ) ) { -#ifndef WIN32 - if ( chdir(DirName_1.c_str()) == 0 ) + if ( CHDIR(DirName_1.c_str()) == 0 ) { // On cherche le fichier de configuration dans ce sous-repertoire - codret = chdir(DirNameStart); + codret = CHDIR(DirNameStart); +#ifndef WIN32 DIR *dp_1; struct dirent *dirp_1; dp_1 = opendir(DirName_1.c_str()) ; @@ -1568,9 +1552,6 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb { std::string file_name_1(dirp_1->d_name); #else - if ( _chdir(DirName_1.c_str()) == 0 ) - { - codret = _chdir(DirNameStart); HANDLE hFind1 = INVALID_HANDLE_VALUE; WIN32_FIND_DATA ffd1; hFind1 = FindFirstFile(DirName_1.c_str(), &ffd1); @@ -1583,11 +1564,7 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb if ( bilan != string::npos ) { // Decodage du fichier pour trouver le numero d'iteration -#ifndef WIN32 - chdir(DirName_1.c_str()) ; -#else - _chdir(DirName_1.c_str()) ; -#endif + CHDIR(DirName_1.c_str()) ; std::ifstream fichier( file_name_1.c_str() ); if ( fichier ) // ce test échoue si le fichier n'est pas ouvert @@ -1634,11 +1611,7 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb es.text = CORBA::string_dup(text.c_str()); throw SALOME::SALOME_Exception(es); } -#ifndef WIN32 - chdir(DirNameStart) ; -#else - _chdir(DirNameStart) ; -#endif + CHDIR(DirNameStart) ; } if ( existe ) { break ; } } @@ -1653,12 +1626,10 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb } #ifndef WIN32 closedir(dp); - chdir(nomDirWork.c_str()); #else - FindClose(hFind); - } - _chdir(nomDirWork.c_str()); + FindClose(hFind); #endif + CHDIR(nomDirWork.c_str()); if ( ( Number >= 0 && ( !existe ) ) || ( Number < 0 && ( NumeIterMax == -1 ) ) ) { @@ -1827,7 +1798,7 @@ HOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::CreateHypothesis(const char* nomHypo myHypothesis->SetNivMax(-1); myHypothesis->SetDiamMin(-1.0); myHypothesis->SetAdapInit(0); - myHypothesis->SetLevelOutput(0); + myHypothesis->SetExtraOutput(1); return HOMARD::HOMARD_Hypothesis::_duplicate(myHypothesis); } @@ -1962,7 +1933,7 @@ HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundary(const char* BoundaryNam //============================================================================= HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryDi(const char* BoundaryName, const char* MeshName, const char* MeshFile) { - INFOS ("CreateBoundaryDi : BoundaryName = " << BoundaryName << "MeshName = " << MeshName ); + INFOS ("CreateBoundaryDi : BoundaryName = " << BoundaryName << ", MeshName = " << MeshName ); HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 0); myBoundary->SetMeshFile( MeshFile ) ; myBoundary->SetMeshName( MeshName ) ; @@ -2536,11 +2507,7 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena // D. On passe dans le repertoire de l'iteration a calculer MESSAGE ( ". On passe dans DirCompute = " << DirCompute ); -#ifndef WIN32 - chdir(DirCompute); -#else - _chdir(DirCompute); -#endif + CHDIR(DirCompute); // E. Les donnees de l'execution HOMARD // E.1. L'objet du texte du fichier de configuration @@ -2628,7 +2595,7 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena // H.3 Message d'erreur if (codretexec != 0) { - std::string text ; + std::string text = "" ; // Message d'erreur en cas de probleme en adaptation if ( modeHOMARD == 1 ) { @@ -2651,10 +2618,7 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena } } } - else - { - text = "Voir le fichier Liste.log.\n" ; - } + text += "\n\nSee the file " + LogFile + "\n" ; INFOS ( text ) ; SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; @@ -2672,11 +2636,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 - _chdir(nomDirWork.c_str()); -#endif + CHDIR(nomDirWork.c_str()); } return codretexec ; @@ -2780,6 +2740,7 @@ CORBA::Long HOMARD_Gen_i::ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOM int TypeAdap = (*ListTypes)[0]; int TypeRaff = (*ListTypes)[1]; int TypeDera = (*ListTypes)[2]; +// MESSAGE ( ". TypeAdap = " << TypeAdap << ", TypeRaff = " << TypeRaff << ", TypeDera = " << TypeDera ); // E. Texte du fichier de configuration // E.1. Incontournables du texte @@ -2823,9 +2784,9 @@ CORBA::Long HOMARD_Gen_i::ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOM MESSAGE ( ". DiamMin = " << DiamMin ); int AdapInit = myHypo->GetAdapInit(); MESSAGE ( ". AdapInit = " << AdapInit ); - int LevelOutput = myHypo->GetLevelOutput(); - MESSAGE ( ". LevelOutput = " << LevelOutput ); - myDriver->TexteAdvanced(Pyram, NivMax, DiamMin, AdapInit, LevelOutput); + int ExtraOutput = myHypo->GetExtraOutput(); + MESSAGE ( ". ExtraOutput = " << ExtraOutput ); + myDriver->TexteAdvanced(Pyram, NivMax, DiamMin, AdapInit, ExtraOutput); // E.7. Ajout des informations sur le deroulement de l'execution int MessInfo = myIteration->GetInfoCompute(); @@ -2843,11 +2804,7 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num ) { MESSAGE ( "CreateDirNameIter : nomrep ="<< nomrep << ", num = "< DirName = " << DirName); MESSAGE ( ". On retourne dans nomDirActuel = " << nomDirActuel ); -#ifndef WIN32 - chdir(nomDirActuel.c_str()); -#else - _chdir(nomDirActuel.c_str()); -#endif + CHDIR(nomDirActuel.c_str()); return CORBA::string_dup( DirName.c_str() ); } //============================================================================= @@ -2957,19 +2900,14 @@ char* HOMARD_Gen_i::ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD:: MESSAGE (". DirCompute = " << DirCompute.str() ); // B.3.3. Si le sous-repertoire n'existe pas, on le cree -#ifndef WIN32 - if (chdir(DirCompute.str().c_str()) != 0) + if (CHDIR(DirCompute.str().c_str()) != 0) { -// Creation du repertoire car il n'existe pas : +#ifndef WIN32 if (mkdir(DirCompute.str().c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) - { #else - if (_chdir(DirCompute.str().c_str()) != 0) - { -// Creation du repertoire car il n'existe pas : if (_mkdir(DirCompute.str().c_str()) != 0) - { #endif + { // GERALD -- QMESSAGE BOX std::cerr << "Pb Creation du repertoire DirCompute = " << DirCompute.str() << std::endl; VERIFICATION("Pb a la creation du repertoire" == 0); @@ -3167,7 +3105,7 @@ void HOMARD_Gen_i::DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriv std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); MESSAGE ( "... BoundaryName = " << BoundaryName); // 2.1. La frontiere a-t-elle deja ete ecrite ? - // Cela arrive quand elle estliéé a plusieurs groupes. Il ne faut l'ecrire que la premiere fois + // Cela arrive quand elle est liee a plusieurs groupes. Il ne faut l'ecrire que la premiere fois int A_faire = 1 ; std::list::const_iterator it = ListeBoundaryTraitees.begin(); while (it != ListeBoundaryTraitees.end()) @@ -3189,7 +3127,9 @@ void HOMARD_Gen_i::DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriv if (BoundaryType == 0) { const char* MeshName = myBoundary->GetMeshName() ; + MESSAGE ( ". MeshName = " << MeshName ); const char* MeshFile = myBoundary->GetMeshFile() ; + MESSAGE ( ". MeshFile = " << MeshFile ); myDriver->TexteBoundaryDi( MeshName, MeshFile); if ( BoundaryOption % 2 != 0 ) { BoundaryOption = BoundaryOption*2 ; } } @@ -4224,12 +4164,14 @@ CORBA::Long HOMARD_Gen_i::YACSWriteOnFile(const char* nomYACS, const char* XMLFi // G.1.8. Execution de HOMARD : les options de l'iteration else if ( mot_cle == "HOMARD_Exec_Iter_Options" ) { myDriver->Texte_python_2( pythonIter, "TimeStep", "Iter" ) ; } - // G.1.9. Zones et frontieres : les creations + // G.1.9. a. Creation eventuelles des zones et frontieres + // b. Enchainement else if ( mot_cle == "Iter_1" ) { - std::string texte_control = myDriver->Texte_Iter_1_control() ; + std::string texte_control = "" ; if ( TypeAdap == 0 ) { texte_control += YACSDriverTexteZone( myHypo, myDriver ) ; } texte_control += YACSDriverTexteBoundary( myCase, myDriver ) ; + texte_control += myDriver->Texte_Iter_1_control() ; myDriver->TexteAdd(texte_control); } // G.1.10. Les tests de convergence @@ -4359,8 +4301,17 @@ std::string HOMARD_Gen_i::YACSDriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, // 4. Mise en place des instructions int BoundaryType = myBoundary->GetType(); MESSAGE ( "... BoundaryType = " << BoundaryType); + const char* MeshName ; + const char* MeshFile ; + if (BoundaryType == 0) + { + MeshName = myBoundary->GetMeshName() ; + MESSAGE ( ". MeshName = " << MeshName ); + MeshFile = myBoundary->GetMeshFile() ; + MESSAGE ( ". MeshFile = " << MeshFile ); + } std::string texte_control_0 ; - texte_control_0 = myDriver->Texte_Iter_1_Boundary(BoundaryType, pythonStructure, methode, BoundaryName ); + texte_control_0 = myDriver->Texte_Iter_1_Boundary(BoundaryType, pythonStructure, methode, BoundaryName, MeshName, MeshFile ); texte_control += texte_control_0 ; // 5. Memorisation du traitement ListeBoundaryTraitees.push_back( BoundaryName );