Salome HOME
Enrichissement des possibilités de sortie : niveau, diamètre et
[modules/homard.git] / src / HOMARD_I / HOMARD_Gen_i.cxx
index bd1db458c7ca2f688a6d99b498dd4b93a298836f..6683369435315cf51105911da7724feec111820d 100755 (executable)
@@ -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
@@ -2669,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 ;
@@ -2821,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();
@@ -2841,11 +2804,7 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
 {
   MESSAGE ( "CreateDirNameIter : nomrep ="<< nomrep << ", num = "<<num);
   // On verifie que le repertoire parent existe
-#ifndef WIN32
-  int codret = chdir(nomrep) ;
-#else
-  int codret = _chdir(nomrep) ;
-#endif
+  int codret = CHDIR(nomrep) ;
   if ( codret != 0 )
   {
     SALOME::ExceptionStruct es;
@@ -2862,11 +2821,7 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
   {
     // On passe dans le repertoire parent
 
-#ifndef WIN32
-  chdir(nomrep);
-#else
-  _chdir(nomrep);
-#endif
+    CHDIR(nomrep);
     // On recherche un nom sous la forme Iabc, avec abc representant le numero
     int jaux ;
     if      ( num <    100 ) { jaux = 2 ; }
@@ -2880,11 +2835,7 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
     DirNameA << "I" << iaux.str();
     // Si on ne pas peut entrer dans le repertoire, on doit verifier
     // que c'est bien un probleme d'absence
-#ifndef WIN32
-    if ( chdir(DirNameA.str().c_str()) != 0 )
-#else
-    if ( _chdir(DirNameA.str().c_str()) != 0 )
-#endif
+    if ( CHDIR(DirNameA.str().c_str()) != 0 )
     {
       bool existe = false ;
 #ifndef WIN32
@@ -2908,7 +2859,6 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
 #ifndef WIN32
       closedir(dp);
 #else
-      }
       FindClose(hFind);
 #endif
       if ( !existe )
@@ -2923,11 +2873,7 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
 
   MESSAGE ( "==> 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() );
 }
 //=============================================================================
@@ -2954,13 +2900,11 @@ 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)
   {
+#ifndef WIN32
     if (mkdir(DirCompute.str().c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0)
 #else
-  if (_chdir(DirCompute.str().c_str()) != 0)
-  {
     if (_mkdir(DirCompute.str().c_str()) != 0)
 #endif
     {
@@ -3161,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<std::string>::const_iterator it = ListeBoundaryTraitees.begin();
     while (it != ListeBoundaryTraitees.end())
@@ -3183,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 ; }
       }
@@ -4218,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
@@ -4353,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 );