From 45faff73ba12a3f86bc1d8e35f97c1436fb8e976 Mon Sep 17 00:00:00 2001 From: Gerald Nicolas Date: Thu, 15 May 2014 17:18:12 +0200 Subject: [PATCH] =?utf8?q?Remplacement=20de=20mktemp=20par=20mkdtemp=20ou?= =?utf8?q?=20mkstemp.=20Suppression=20d'un=20groupe=20dans=20les=20liens?= =?utf8?q?=20avec=20les=20fronti=C3=A8res=20pour=20les=20hypoth=C3=A8ses.?= =?utf8?q?=20Documentation=20des=20sch=C3=A9mas=20YACS.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- doc/en/tui_create_yacs.rst | 71 ++++++++ doc/files/yacs_script.py | 11 +- doc/fr/tui_create_yacs.rst | 94 ++++++++-- idl/HOMARD_Hypothesis.idl | 2 + resources/yacs_01.en.xml | 2 - resources/yacs_01.fr.xml | 2 - src/HOMARD/HOMARD_Cas.cxx | 2 + src/HOMARD/HOMARD_Hypothesis.cxx | 19 +- src/HOMARD/HOMARD_Hypothesis.hxx | 4 +- src/HOMARD/HomardDriver.cxx | 5 +- src/HOMARD/YACSDriver.cxx | 255 ++++++++++++++------------- src/HOMARD/YACSDriver.hxx | 2 +- src/HOMARD_I/HOMARD_Gen_i.cxx | 17 +- src/HOMARD_I/HOMARD_Hypothesis_i.cxx | 12 ++ src/HOMARD_I/HOMARD_Hypothesis_i.hxx | 2 + tests/test_1.py | 6 +- tests/test_11.py | 5 +- tests/test_12.py | 5 +- tests/test_13.py | 5 +- tests/test_14.py | 5 +- tests/test_15.py | 5 +- tests/test_2.py | 7 +- tests/test_3.py | 66 +++---- 23 files changed, 399 insertions(+), 205 deletions(-) diff --git a/doc/en/tui_create_yacs.rst b/doc/en/tui_create_yacs.rst index 5790fb86..b42b0325 100644 --- a/doc/en/tui_create_yacs.rst +++ b/doc/en/tui_create_yacs.rst @@ -180,6 +180,76 @@ Informations about the schema +---------------------------------------------------------------+ +The options of the schema +========================= +The default values are defined by the preferences of the module HOMARD. + ++---------------------------------------------------------------+ ++---------------------------------------------------------------+ +| .. module:: SetMaxIter | +| | +| **SetMaxIter(MaxIter)** | +| Defines the maximal number of iterations for the schema. | +| | +| - ``MaxIter`` : the maximal number of iterations of the | +| schema | ++---------------------------------------------------------------+ +| .. module:: GetMaxIter | +| | +| **GetMaxIter()** | +| Returns the maximal number of iterations of the schema | ++---------------------------------------------------------------+ +| .. module:: SetMaxNode | +| | +| **SetMaxNode(MaxNode)** | +| Defines the maximal number of nodes for the adaptation. | +| | +| - ``MaxNode`` : the maximal number of nodes for the | +| adaptation. If MaxNode equals 0, no limit. | ++---------------------------------------------------------------+ +| .. module:: GetMaxNode | +| | +| **GetMaxNode()** | +| Returns the maximal number of nodes for the adaptation | ++---------------------------------------------------------------+ +| .. module:: SetMaxElem | +| | +| **SetMaxElem(MaxElem)** | +| Defines the maximal number of meshes for the adaptation. | +| | +| - ``MaxElem`` : the maximal number of meshes for the | +| adaptation. If MaxElem equals 0, no limit. | ++---------------------------------------------------------------+ +| .. module:: GetMaxElem | +| | +| **GetMaxElem()** | +| Returns the maximal number of meshes for the adaptation | ++---------------------------------------------------------------+ +| .. module:: SetTestConvergence | +| | +| **SetTestConvergence(Type, VRef)** | +| Defines a convergence test for the schema. | +| | +| - ``Type`` : the type of convergence of the schema. | +| | +| * 0 : no test | +| * 1 : if the test value is greater than VRef | +| * 2 : if the test value is lower than VRef | +| | +| - ``VRef`` : the reference value for the test | ++---------------------------------------------------------------+ +| .. module:: GetTestConvergenceType | +| | +| **GetTestConvergenceType()** | +| Returns the type of convergence of the schema. | ++---------------------------------------------------------------+ +| .. module:: GetTestConvergenceVRef | +| | +| **GetTestConvergenceVRef()** | +| Returns the reference value for the test. | ++---------------------------------------------------------------+ + + Example ******* The creation of a schema is done as follows: @@ -189,6 +259,7 @@ The creation of a schema is done as follows: DirName = "/scratch/D68518/computation" MeshFile = "/scratch/D68518/computation/maill.00.med" YACS_0 = Case.CreateYACSSchema("YACS_0", ScriptFile, DirName, MeshFile) + YACS_0.SetMaxIter(4) It can be writen down in a file : :: diff --git a/doc/files/yacs_script.py b/doc/files/yacs_script.py index 4a09ee4b..8866062b 100755 --- a/doc/files/yacs_script.py +++ b/doc/files/yacs_script.py @@ -22,7 +22,7 @@ """ Lancement d'un calcul ASTER """ -__revision__ = "V5.8" +__revision__ = "V5.9" # import sys import os @@ -998,8 +998,10 @@ Lancement d'un calcul #if self.verbose_max : #print commande_base # - fic_caract = tempfile.mktemp() - fic_caract_2 = tempfile.mktemp() + t_aux = tempfile.mkstemp() + fic_caract = t_aux[1] + t_aux = tempfile.mkstemp() + fic_caract_2 = t_aux[1] # # 3. Lancement # 3.1. Commande finale @@ -1091,7 +1093,8 @@ fic_caract : fichier caracteristique du job # 2. Commande de l'examen de l'etat du job, # fic_etat = os.path.join(self.rep_calc, self.nomjob+".etat") - fic_etat_2 = tempfile.mktemp() + t_aux = tempfile.mkstemp() + fic_etat_2 = t_aux[1] commande_base = os.path.join(self.aster_root, "bin", "as_run") commande_base += " --actu " + numjob + " " + self.nomjob + " " + self.mode if self.verbose_max : diff --git a/doc/fr/tui_create_yacs.rst b/doc/fr/tui_create_yacs.rst index ec627f77..d7d25ef8 100644 --- a/doc/fr/tui_create_yacs.rst +++ b/doc/fr/tui_create_yacs.rst @@ -105,7 +105,7 @@ Informations sur le sch | .. module:: GetName | | | | **GetName()** | -| Retourne le nom du schéma | +| Retourne le nom du schéma. | +---------------------------------------------------------------+ | .. module:: SetType | | | @@ -120,12 +120,13 @@ Informations sur le sch | .. module:: GetType | | | | **GetType()** | -| Retourne le type du schéma | +| Retourne le type du schéma. | +---------------------------------------------------------------+ | .. module:: SetScriptFile | | | | **SetScriptFile(script_file)** | -| Définit le fichier du script python de lancement du calcul| +| Définit le fichier du script python de lancement du | +| calcul. | | | | - ``script_file`` : le nom du fichier qui contient le | | le script python | @@ -134,24 +135,24 @@ Informations sur le sch | | | **GetScriptFile()** | | Retourne le nom du fichier MED qui contient le script | -| python | +| python. | +---------------------------------------------------------------+ | .. module:: SetDirName | | | | **SetDirName(dir_name)** | -| Définit le nom du répertoire de calcul | +| Définit le nom du répertoire de calcul. | | | | - ``dir_name`` : le nom du répertoire de calcul | +---------------------------------------------------------------+ | .. module:: GetDirName | | | | **GetDirName()** | -| Retourne le nom du répertoire de calcul | +| Retourne le nom du répertoire de calcul. | +---------------------------------------------------------------+ | .. module:: SetMeshFile | | | | **SetMeshFile(mesh_file)** | -| Définit le fichier MED du tout premier maillage | +| Définit le fichier MED du tout premier maillage. | | | | - ``mesh_file`` : le nom du fichier MED contenant le tout | | premier maillage de calcul | @@ -160,19 +161,91 @@ Informations sur le sch | | | **GetMeshFile()** | | Retourne le nom du fichier MED du tout premier maillage | -| de calcul | +| de calcul. | +---------------------------------------------------------------+ | .. module:: SetXMLFile | | | | **SetXMLFile(xml_file)** | -| Définit le fichier xml pour l'écriture | +| Définit le fichier xml pour l'écriture. | | | | - ``xml_file`` : le nom du fichier xml | +---------------------------------------------------------------+ | .. module:: GetXMLFile | | | | **GetXMLFile()** | -| Retourne le nom du fichier xml | +| Retourne le nom du fichier xml. | ++---------------------------------------------------------------+ + + +Les options du schéma +===================== +Les valeurs par défaut sont définies dans les préférences du module HOMARD. + ++---------------------------------------------------------------+ ++---------------------------------------------------------------+ +| .. module:: SetMaxIter | +| | +| **SetMaxIter(MaxIter)** | +| Définit le nombre maximal d'itérations pour le schéma. | +| | +| - ``MaxIter`` : le nombre maximal d'itérations du schéma | ++---------------------------------------------------------------+ +| .. module:: GetMaxIter | +| | +| **GetMaxIter()** | +| Retourne le nombre maximal d'itérations du schéma. | ++---------------------------------------------------------------+ +| .. module:: SetMaxNode | +| | +| **SetMaxNode(MaxNode)** | +| Définit le nombre maximal de noeuds pour l'adaptation. | +| | +| - ``MaxNode`` : le nombre maximal de noeuds pour | +| l'adaptation. Si MaxNode est nul, aucune limite n'est | +| imposée. | ++---------------------------------------------------------------+ +| .. module:: GetMaxNode | +| | +| **GetMaxNode()** | +| Retourne le nombre maximal de noeuds pour l'adaptation. | ++---------------------------------------------------------------+ +| .. module:: SetMaxElem | +| | +| **SetMaxElem(MaxElem)** | +| Définit le nombre maximal de mailles pour l'adaptation. | +| | +| - ``MaxElem`` : le nombre maximal de mailles pour | +| l'adaptation. Si MaxElem est nul, aucune limite n'est | +| imposée. | ++---------------------------------------------------------------+ +| .. module:: GetMaxElem | +| | +| **GetMaxElem()** | +| Retourne le nombre maximal de mailles pour l'adaptation. | ++---------------------------------------------------------------+ +| .. module:: SetTestConvergence | +| | +| **SetTestConvergence(Type, VRef)** | +| Précise un test de convergence pour le schéma. | +| | +| - ``Type`` : le type de convergence du schéma. | +| | +| * 0 : aucun test | +| * 1 : quand la valeur de test est supérieure à VRef | +| * 2 : quand la valeur de test est inférieure à VRef | +| | +| - ``VRef`` : la valeur de référence du test | ++---------------------------------------------------------------+ +| .. module:: GetTestConvergenceType | +| | +| **GetTestConvergenceType()** | +| Retourne le type de convergence du schéma. | ++---------------------------------------------------------------+ +| .. module:: GetTestConvergenceVRef | +| | +| **GetTestConvergenceVRef()** | +| Retourne la valeur de référence utilisée pour le test de | +| convergence du schéma. | +---------------------------------------------------------------+ @@ -185,6 +258,7 @@ La cr DirName = "/scratch/D68518/calcul" MeshFile = "/scratch/D68518/calcul/maill.00.med" YACS_0 = Case.CreateYACSSchema("YACS_0", ScriptFile, DirName, MeshFile) + YACS_0.SetMaxIter(4) On peut ensuite l'écrire dans un fichier : :: diff --git a/idl/HOMARD_Hypothesis.idl b/idl/HOMARD_Hypothesis.idl index daaf0ff2..508c0db4 100644 --- a/idl/HOMARD_Hypothesis.idl +++ b/idl/HOMARD_Hypothesis.idl @@ -103,6 +103,8 @@ module HOMARD long GetLevelOutput() raises (SALOME::SALOME_Exception); void AddGroup(in string LeGroupe) raises (SALOME::SALOME_Exception); + void SupprGroup(in string LeGroupe) raises (SALOME::SALOME_Exception); + void SupprGroups() raises (SALOME::SALOME_Exception); void SetGroups(in ListGroupType ListGroup) raises (SALOME::SALOME_Exception); ListGroupType GetGroups() raises (SALOME::SALOME_Exception); diff --git a/resources/yacs_01.en.xml b/resources/yacs_01.en.xml index dad1bf34..da766f03 100644 --- a/resources/yacs_01.en.xml +++ b/resources/yacs_01.en.xml @@ -219,7 +219,6 @@ Iter_1_Case_Options # Associated iteration #0 Iter0 = Case.GetIter0() ]]> - @@ -302,7 +301,6 @@ else : OK = 1 MessInfo = " " ]]> - diff --git a/resources/yacs_01.fr.xml b/resources/yacs_01.fr.xml index 1c14561d..a05d1645 100644 --- a/resources/yacs_01.fr.xml +++ b/resources/yacs_01.fr.xml @@ -219,7 +219,6 @@ Iter_1_Case_Options # Iteration 0 associee Iter0 = Case.GetIter0() ]]> - @@ -302,7 +301,6 @@ else : OK = 1 MessInfo = " " ]]> - diff --git a/src/HOMARD/HOMARD_Cas.cxx b/src/HOMARD/HOMARD_Cas.cxx index afde91b0..68a9b8bc 100644 --- a/src/HOMARD/HOMARD_Cas.cxx +++ b/src/HOMARD/HOMARD_Cas.cxx @@ -203,6 +203,8 @@ void HOMARD_Cas::SupprGroups() //============================================================================= void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group ) { +// MESSAGE ( ". AddBoundaryGroup : Boundary = " << Boundary ); +// MESSAGE ( ". AddBoundaryGroup : Group = " << Group ); _ListBoundaryGroup.push_back( Boundary ); _ListBoundaryGroup.push_back( Group ); } diff --git a/src/HOMARD/HOMARD_Hypothesis.cxx b/src/HOMARD/HOMARD_Hypothesis.cxx index f27051da..cfccb10e 100644 --- a/src/HOMARD/HOMARD_Hypothesis.cxx +++ b/src/HOMARD/HOMARD_Hypothesis.cxx @@ -231,7 +231,7 @@ int HOMARD_Hypothesis::GetUseComp() const //============================================================================= void HOMARD_Hypothesis::AddComp( const char* NomComp ) { -// On commence par la supprimer au cas ou elle aurait deja ete inseree +// On commence par supprimer la composante au cas ou elle aurait deja ete inseree // Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la // definition de l'hypothese SupprComp( NomComp ) ; @@ -341,9 +341,26 @@ const int HOMARD_Hypothesis::GetLevelOutput() const //============================================================================= void HOMARD_Hypothesis::AddGroup( const char* Group) { +// On commence par supprimer le groupe au cas ou il aurait deja ete insere +// Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la +// definition de l'hypothese + SupprGroup( Group ) ; +// Insertion veritable _ListGroupSelected.push_back(Group); } //============================================================================= +void HOMARD_Hypothesis::SupprGroup( const char* Group ) +{ + MESSAGE ("SupprGroup pour "<::iterator it = find( _ListGroupSelected.begin(), _ListGroupSelected.end(), Group ); + if ( it != _ListGroupSelected.end() ) { it = _ListGroupSelected.erase( it ); } +} +//============================================================================= +void HOMARD_Hypothesis::SupprGroups() +{ + _ListGroupSelected.clear(); +} +//============================================================================= void HOMARD_Hypothesis::SetGroups( const std::list& ListGroup ) { _ListGroupSelected.clear(); diff --git a/src/HOMARD/HOMARD_Hypothesis.hxx b/src/HOMARD/HOMARD_Hypothesis.hxx index fe2ec51d..33650da1 100644 --- a/src/HOMARD/HOMARD_Hypothesis.hxx +++ b/src/HOMARD/HOMARD_Hypothesis.hxx @@ -93,7 +93,9 @@ public: void SetLevelOutput( int LevelOutput ); const int GetLevelOutput() const; - void AddGroup( const char* LeGroupe); + void AddGroup( const char* Group); + void SupprGroup( const char* Group ); + void SupprGroups(); void SetGroups(const std::list& ListGroup ); const std::list& GetGroups() const; diff --git a/src/HOMARD/HomardDriver.cxx b/src/HOMARD/HomardDriver.cxx index e7282115..4a9e7fd3 100644 --- a/src/HOMARD/HomardDriver.cxx +++ b/src/HOMARD/HomardDriver.cxx @@ -114,7 +114,9 @@ void HomardDriver::TexteInfo( int TypeBila, int NumeIter ) //=============================================================================== void HomardDriver::TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres ) { - MESSAGE("TexteMaillage, NomMesh ="<\n" ; // 4. Les inports -// 4.1. Le nom de la zone +// ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc HOMARD_Gen.idl +// 4.1. Le nom de la frontiere _Texte += Texte_inport( "string", "BoundaryName" ) ; TexteParametre( node, "BoundaryName", "string", BoundaryName ) ; -// 4.2. Les valeurs numeriques -// ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc HOMARD_Gen.idl -// 4.2.1. Decodage des valeurs +// 4.2. Cas d une frontiere discrete + if (BoundaryType == 0) + { + _Texte += Texte_inport( "string", "MeshName" ) ; + TexteParametre( node, "MeshName", "string", MeshName ) ; + _Texte += Texte_inport( "string", "FileName" ) ; + TexteParametre( node, "FileName", "string", MeshFile ) ; + } +// 4.3. Cas d'une frontiere analytique : les valeurs numeriques + else + { +// 4.3.1. Decodage des valeurs // La chaine pythonStructure est de ce genre : // CreateBoundaryCylinder('cyl_2', 17.5, -2.5, -12.5, -100., -75., -25., 50.) // CreateBoundaryDi("intersection", "PIQUAGE", "/scratch/D68518/Salome/script/sfr_2d_piquage.fr.med") - std::string ligne = pythonStructure ; + std::string ligne = pythonStructure ; // On commence par ne garder que ce qui suit la premiere virgule - ligne = GetStringInTexte( ligne, ",", 1 ); + ligne = GetStringInTexte( ligne, ",", 1 ); // On boucle pour isoler toutes les chaines dans les virgules - std::string lignebis ; - std::string x0, x1, x2, x3, x4, x5, x6, x7 ; - int iaux = 0 ; - while ( ligne != lignebis ) - { - lignebis = GetStringInTexte ( ligne, ",", 0 ) ; + std::string lignebis ; + std::string x0, x1, x2, x3, x4, x5, x6, x7 ; + int iaux = 0 ; + while ( ligne != lignebis ) + { + lignebis = GetStringInTexte ( ligne, ",", 0 ) ; // MESSAGE("lignebis = "<\n" ; diff --git a/src/HOMARD/YACSDriver.hxx b/src/HOMARD/YACSDriver.hxx index d708dda0..b716696c 100644 --- a/src/HOMARD/YACSDriver.hxx +++ b/src/HOMARD/YACSDriver.hxx @@ -37,7 +37,7 @@ public: void Texte_DataInit_MeshFile( const std::string Meshfile ) ; void Texte_Alternance_Calcul_HOMARD_Calcul( const std::string FileName ) ; void Texte_Iter_1_Case_Options( const std::string pythonCas ) ; - std::string Texte_Iter_1_Boundary( int BoundaryType, const std::string pythonStructure, const std::string methode, const std::string BoundaryName ) ; + std::string Texte_Iter_1_Boundary( int BoundaryType, const std::string pythonStructure, const std::string methode, const std::string BoundaryName, const std::string MeshName, const std::string MeshFile ) ; std::string Texte_Iter_1_Zone( int ZoneType, const std::string pythonStructure, const std::string methode, const std::string ZoneName ) ; std::string Texte_Iter_1_control() ; std::string Texte_control( const std::string noeud_1, const std::string noeud_2, int option ) ; diff --git a/src/HOMARD_I/HOMARD_Gen_i.cxx b/src/HOMARD_I/HOMARD_Gen_i.cxx index 3f12a790..e66f02ff 100755 --- a/src/HOMARD_I/HOMARD_Gen_i.cxx +++ b/src/HOMARD_I/HOMARD_Gen_i.cxx @@ -1933,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 ) ; @@ -3105,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()) @@ -3127,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 ; } } @@ -4299,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 ); diff --git a/src/HOMARD_I/HOMARD_Hypothesis_i.cxx b/src/HOMARD_I/HOMARD_Hypothesis_i.cxx index c9850946..5e688c1e 100644 --- a/src/HOMARD_I/HOMARD_Hypothesis_i.cxx +++ b/src/HOMARD_I/HOMARD_Hypothesis_i.cxx @@ -317,6 +317,18 @@ void HOMARD_Hypothesis_i::AddGroup( const char* Group) myHomardHypothesis->AddGroup( Group ); } //============================================================================= +void HOMARD_Hypothesis_i::SupprGroup( const char* Group ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprGroup(Group); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprGroups() +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprGroups(); +} +//============================================================================= void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup) { ASSERT( myHomardHypothesis ); diff --git a/src/HOMARD_I/HOMARD_Hypothesis_i.hxx b/src/HOMARD_I/HOMARD_Hypothesis_i.hxx index d39a8912..734bb041 100644 --- a/src/HOMARD_I/HOMARD_Hypothesis_i.hxx +++ b/src/HOMARD_I/HOMARD_Hypothesis_i.hxx @@ -101,6 +101,8 @@ public: CORBA::Long GetLevelOutput(); void AddGroup( const char* Group); + void SupprGroup( const char* Group ); + void SupprGroups(); void SetGroups(const HOMARD::ListGroupType& ListGroup); HOMARD::ListGroupType* GetGroups(); diff --git a/tests/test_1.py b/tests/test_1.py index 196524c4..3849bd80 100755 --- a/tests/test_1.py +++ b/tests/test_1.py @@ -22,7 +22,7 @@ Python script for HOMARD Copyright EDF-R&D 2010, 2014 Test test_1 """ -__revision__ = "V2.3" +__revision__ = "V2.4" #======================================================================== Test_Name = "test_1" @@ -42,11 +42,9 @@ Rep_Test = os.path.normpath(Rep_Test) sys.path.append(Rep_Test) from test_util import test_results # Repertoire des resultats -dircase = tempfile.mktemp() -os.mkdir(dircase) +dircase = tempfile.mkdtemp() # ================================== - salome.salome_init() import iparameters ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1)) diff --git a/tests/test_11.py b/tests/test_11.py index eab14b50..ee55ac49 100755 --- a/tests/test_11.py +++ b/tests/test_11.py @@ -22,7 +22,7 @@ Python script for HOMARD Copyright EDF-R&D 2010, 2014 Test test_11 associe au tutorial 1 """ -__revision__ = "V2.1" +__revision__ = "V2.2" #======================================================================== Test_Name = "test_11" @@ -42,8 +42,7 @@ Rep_Test = os.path.normpath(Rep_Test) sys.path.append(Rep_Test) from test_util import test_results # Repertoire des resultats -dircase = tempfile.mktemp() -os.mkdir(dircase) +dircase = tempfile.mkdtemp() # Repertoire des donnees du tutorial data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads") data_dir = os.path.normpath(data_dir) diff --git a/tests/test_12.py b/tests/test_12.py index 0164c33f..d0b2f183 100755 --- a/tests/test_12.py +++ b/tests/test_12.py @@ -22,7 +22,7 @@ Python script for HOMARD Copyright EDF-R&D 2010, 2014 Test test_11 associe au tutorial 2 """ -__revision__ = "V2.1" +__revision__ = "V2.2" #======================================================================== Test_Name = "test_12" @@ -42,8 +42,7 @@ Rep_Test = os.path.normpath(Rep_Test) sys.path.append(Rep_Test) from test_util import test_results # Repertoire des resultats -dircase = tempfile.mktemp() -os.mkdir(dircase) +dircase = tempfile.mkdtemp() # Repertoire des donnees du tutorial data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads") data_dir = os.path.normpath(data_dir) diff --git a/tests/test_13.py b/tests/test_13.py index b75e25ec..bba1f254 100755 --- a/tests/test_13.py +++ b/tests/test_13.py @@ -22,7 +22,7 @@ Python script for HOMARD Copyright EDF-R&D 2010, 2014 Test test_11 associe au tutorial 3 """ -__revision__ = "V2.1" +__revision__ = "V2.2" #======================================================================== Test_Name = "test_13" @@ -42,8 +42,7 @@ Rep_Test = os.path.normpath(Rep_Test) sys.path.append(Rep_Test) from test_util import test_results # Repertoire des resultats -dircase = tempfile.mktemp() -os.mkdir(dircase) +dircase = tempfile.mkdtemp() # Repertoire des donnees du tutorial data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads") data_dir = os.path.normpath(data_dir) diff --git a/tests/test_14.py b/tests/test_14.py index 8a24a3b5..fd84c8ab 100755 --- a/tests/test_14.py +++ b/tests/test_14.py @@ -22,7 +22,7 @@ Python script for HOMARD Copyright EDF-R&D 2010, 2014 Test test_11 associe au tutorial 4 """ -__revision__ = "V2.1" +__revision__ = "V2.2" #======================================================================== Test_Name = "test_14" @@ -42,8 +42,7 @@ Rep_Test = os.path.normpath(Rep_Test) sys.path.append(Rep_Test) from test_util import test_results # Repertoire des resultats -dircase = tempfile.mktemp() -os.mkdir(dircase) +dircase = tempfile.mkdtemp() # Repertoire des donnees du tutorial data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads") data_dir = os.path.normpath(data_dir) diff --git a/tests/test_15.py b/tests/test_15.py index d75bb444..25f389d6 100755 --- a/tests/test_15.py +++ b/tests/test_15.py @@ -22,7 +22,7 @@ Python script for HOMARD Copyright EDF-R&D 2010, 2014 Test test_11 associe au tutorial 5 """ -__revision__ = "V2.1" +__revision__ = "V2.2" #======================================================================== Test_Name = "test_15" @@ -42,8 +42,7 @@ Rep_Test = os.path.normpath(Rep_Test) sys.path.append(Rep_Test) from test_util import test_results # Repertoire des resultats -dircase = tempfile.mktemp() -os.mkdir(dircase) +dircase = tempfile.mkdtemp() # Repertoire des donnees du tutorial data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads") data_dir = os.path.normpath(data_dir) diff --git a/tests/test_2.py b/tests/test_2.py index 4d9dd18d..10f7fde1 100755 --- a/tests/test_2.py +++ b/tests/test_2.py @@ -22,7 +22,7 @@ Python script for HOMARD Copyright EDF-R&D 2010, 2014 Test test_2 """ -__revision__ = "V2.3" +__revision__ = "V2.4" #======================================================================== Test_Name = "test_2" @@ -42,11 +42,9 @@ Rep_Test = os.path.normpath(Rep_Test) sys.path.append(Rep_Test) from test_util import test_results # Repertoire des resultats -dircase = tempfile.mktemp() -os.mkdir(dircase) +dircase = tempfile.mkdtemp() # ================================== - salome.salome_init() import iparameters ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1)) @@ -147,6 +145,7 @@ Python script for HOMARD ScriptFile = os.path.normpath(ScriptFile) DirName = dircase YACS_test_2 = Case_test_2.CreateYACSSchema("YACS_test_2", ScriptFile, DirName, MeshFile) + YACS_test_2.SetMaxIter(4) YACS_test_2.SetType(1) filexml = os.path.join(dircase, 'YACS_test_2.xml') error = YACS_test_2.WriteOnFile(filexml) diff --git a/tests/test_3.py b/tests/test_3.py index 02df6ef8..09d1d87b 100755 --- a/tests/test_3.py +++ b/tests/test_3.py @@ -22,7 +22,7 @@ Python script for HOMARD Copyright EDF-R&D 2011, 2013 Test test_3 """ -__revision__ = "V2.2" +__revision__ = "V2.3" #======================================================================== Test_Name = "test_3" @@ -35,14 +35,16 @@ import sys import HOMARD import salome # +# ================================== pathHomard = os.getenv('HOMARD_ROOT_DIR') +# Repertoire des donnees du test Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard") Rep_Test = os.path.normpath(Rep_Test) -dircase = tempfile.mktemp() -os.mkdir(dircase) - sys.path.append(Rep_Test) from test_util import test_results +# Repertoire des resultats +dircase = tempfile.mkdtemp() +# ================================== salome.salome_init() import iparameters @@ -54,34 +56,33 @@ ipar.append("AP_MODULES_LIST", "Homard") def homard_exec(theStudy): """ Python script for HOMARD -Copyright EDF-R&D 2010, 2013 """ error = 0 # while not error : # homard.SetCurrentStudy(theStudy) -# -# Creation of the boundaries -# ========================== -# Creation of the discrete boundary + # + # Creation of the boundaries + # ========================== + # Creation of the discrete boundary Boundary_3_1 = homard.CreateBoundaryDi('courbes', 'COURBES', os.path.join(Rep_Test, Test_Name + '.fr.med')) -# -# Creation of the external cylinder + # + # Creation of the external cylinder Boundary_3_2 = homard.CreateBoundaryCylinder('cyl_ext', 50.0, 25., -25., 1., 0., 0., 100.) -# -# Creation of the internal cylinder + # + # Creation of the internal cylinder Boundary_3_3 = homard.CreateBoundaryCylinder('cyl_int', 50.0, 25., -25., 1., 0., 0., 50.) -# -# Creation of the first sphere + # + # Creation of the first sphere Boundary_3_4 = homard.CreateBoundarySphere('sphere_1', 50.0, 25., -25., 100.) -# -# Creation of the second sphere + # + # Creation of the second sphere Boundary_3_5 = homard.CreateBoundarySphere('sphere_2', 450.0, 25., -25., 100.) -# -# Creation of the hypotheses -# ========================== -# Uniform refinement + # + # Creation of the hypotheses + # ========================== + # Uniform refinement HypoName = "Hypo_" + Test_Name print "-------- Creation of the hypothesis", HypoName Hypo_test_3 = homard.CreateHypothesis(HypoName) @@ -89,13 +90,13 @@ Copyright EDF-R&D 2010, 2013 print HypoName, " : zones utilisées :", Hypo_test_3.GetZones() print HypoName, " : champ utilisé :", Hypo_test_3.GetFieldName() print HypoName, " : composantes utilisées :", Hypo_test_3.GetComps() -# + # for num in range (n_boucle+1) : -# + # print "-------- num =", num, "--------" -# -# Creation of the case Case_test_3 -# =========================== + # + # Creation of the case Case_test_3 + # =========================== if ( num <= 1 ) : CaseName = "Case_" + Test_Name print "-------- Creation of the case", CaseName @@ -108,10 +109,10 @@ Copyright EDF-R&D 2010, 2013 Case_test_3.AddBoundaryGroup('cyl_int', 'INT') Case_test_3.AddBoundaryGroup('sphere_1', 'END_1') Case_test_3.AddBoundaryGroup('sphere_2', 'END_2') -# -# Creation of the iterations -# ========================== - # Creation of the iteration 1 + # + # Creation of the iterations + # ========================== + # Creation of the iteration 1 IterName = "I_" + Test_Name + "_1" print "-------- Creation of the iteration", IterName Iter_test_3_1 = Case_test_3.NextIteration(IterName) @@ -144,6 +145,7 @@ Copyright EDF-R&D 2010, 2013 print "-------- Creation of the schema", YACSName YACS_test_3 = Case_test_3.CreateYACSSchema(YACSName, ScriptFile, DirName, MeshFile) YACS_test_3.SetType(2) + YACS_test_3.SetMaxIter(2) error = YACS_test_3.Write() if error : error = 10*num + 5 @@ -184,9 +186,9 @@ Copyright EDF-R&D 2010, 2013 print "-------- Creation of the hypothesis", HypoName Hypo_test_3 = homard.CreateHypothesis(HypoName) Hypo_test_3.SetUnifRefinUnRef(1) -# + # break -# + # return error #======================================================================== -- 2.30.2