X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARD%2FYACSDriver.cxx;h=3a559bcdc9fec98f80d96436b9755c7350367add;hb=refs%2Ftags%2FV9_13_0b1;hp=23c1483e37e85ca747d27133934d82bf28c5f4df;hpb=65cf5e33a70609ffd748452d23f957dfeb625b75;p=modules%2Fhomard.git diff --git a/src/HOMARD/YACSDriver.cxx b/src/HOMARD/YACSDriver.cxx index 23c1483e..3a559bcd 100644 --- a/src/HOMARD/YACSDriver.cxx +++ b/src/HOMARD/YACSDriver.cxx @@ -1,6 +1,6 @@ // HOMARD HOMARD : implementation of HOMARD idl descriptions // -// Copyright (C) 2011-2014 CEA/DEN, EDF R&D +// Copyright (C) 2011-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -34,16 +34,18 @@ //============================================================================= //============================================================================= -YACSDriver::YACSDriver(const std::string XMLFile, const std::string DirName): +YACSDriver::YACSDriver(const std::string XMLFile, const std::string DirName, const std::string LangueShort): _XMLFile( "" ), _DirName( "" ), _Texte( "" ), _Texte_parametres( "" ), - _noeud_1( "CreateHypothesis" ), + _noeud_1( "CreateCase" ), + _LangueShort( "" ), _bLu( false ) { MESSAGE("XMLFile = "<\n" ; - _Texte += " Etude_Initialisation.SetCurrentStudy\n" ; + INFOS("_LangueShort = "<<_LangueShort ); + if ( _LangueShort == "fr" ) { motcle = "Etude_Initialisation" ; } + else { motcle = "Study_Initialisation" ; } + INFOS("motcle = "<\n" ; _Texte += " " + methode + "\n" ; // 4. Les inports // 4.1. Le nom de la zone @@ -162,7 +173,7 @@ std::string YACSDriver::Texte_Iter_1_Zone( int ZoneType, const std::string pytho // La derniere valeur est toujours mise dans x8 x8 = GetStringInTexte ( ligne, ")", 0 ) ; MESSAGE("coor = "<< x0<<","< 10 ) && ( ZoneType < 14 ) ) { _Texte += Texte_inport( "double", "Umini" ) ; @@ -194,7 +205,7 @@ std::string YACSDriver::Texte_Iter_1_Zone( int ZoneType, const std::string pytho TexteParametre( node, "Orient", "int", x8 ) ; } // -// 4.2. Cas du disque (31, 32, 33) ou du disque perce (61, 62, 63) +// 4.2.4. Cas du disque (31, 32, 33) ou du disque perce (61, 62, 63) else if ( ( ( ZoneType > 30 ) && ( ZoneType < 34 ) ) || ( ( ZoneType > 60 ) && ( ZoneType < 64 ) ) ) { _Texte += Texte_inport( "double", "Ucentre" ) ; @@ -212,7 +223,7 @@ std::string YACSDriver::Texte_Iter_1_Zone( int ZoneType, const std::string pytho TexteParametre( node, "Orient", "int", x8 ) ; } // -// 4.2. Cas de la sphere (4) +// 4.2.5. Cas de la sphere (4) else if ( ZoneType == 4 ) { _Texte += Texte_inport( "double", "Xcentre" ) ; @@ -225,7 +236,7 @@ std::string YACSDriver::Texte_Iter_1_Zone( int ZoneType, const std::string pytho TexteParametre( node, "Radius", "double", x8 ) ; } // -// 4.2. Cas du cylindre (5) ou du tuyau (7) +// 4.2.6. Cas du cylindre (5) ou du tuyau (7) else if ( ZoneType == 5 || ZoneType == 7 ) { _Texte += Texte_inport( "double", "Xcentre" ) ; @@ -255,7 +266,7 @@ std::string YACSDriver::Texte_Iter_1_Zone( int ZoneType, const std::string pytho } } // -// 4.2. Erreur +// 4.2.7. Erreur else { VERIFICATION("Type de zone inconnu." == 0); } @@ -273,162 +284,174 @@ std::string YACSDriver::Texte_Iter_1_Zone( int ZoneType, const std::string pytho // pythonStructure : le python correspondant a la frontiere // methode : methode associee a la creation de la frontiere // BoundaryName : nom de la frontiere +// MeshName : nom du maillage dans le cas d'une frontiere discrete +// MeshFile : nom du fichier du maillage dans le cas d'une frontiere discrete //=============================================================================== -std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::string pythonStructure, const std::string methode, const std::string BoundaryName ) +std::string YACSDriver::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 ) { MESSAGE("Texte_Iter_1_Boundary, BoundaryType = "<\n" ; - _Texte += " Etude_Initialisation.SetCurrentStudy\n" ; + if ( _LangueShort == "fr" ) { motcle = "Etude_Initialisation" ; } + else { motcle = "Study_Initialisation" ; } + _Texte += " " + motcle + ".UpdateStudy\n" ; _Texte += " " + methode + "\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" ; @@ -438,15 +461,15 @@ std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::stri // } //=============================================================================== -// Controle des enchainements de noeud dans le noeud Iter_1 +// Fin du controle des enchainements de noeud dans le noeud Iter_1 //=============================================================================== std::string YACSDriver::Texte_Iter_1_control() { MESSAGE("Texte_Iter_1_control"); // std::string texte ; - texte = Texte_control ("CreateCase", "Case_Options") ; - texte += Texte_control ("Case_Options", "CreateHypothesis") ; + texte = Texte_control (_noeud_1, "CreateHypothesis", 1) ; + texte += Texte_control ("CreateHypothesis", "Case_Options", 0) ; // return texte ; // @@ -455,16 +478,19 @@ std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::stri // Controle des enchainements de noeuds // noeud_1 : noeud de depart // noeud_2 : noeud d'arrivee +// option : 0 : sans caractere de saut de ligne a la fin +// 1 : avec caractere de saut de ligne a la fin //=============================================================================== - std::string YACSDriver::Texte_control( const std::string noeud_1, const std::string noeud_2 ) + std::string YACSDriver::Texte_control( const std::string noeud_1, const std::string noeud_2, int option ) { - MESSAGE("Texte_control, noeud_1 = "< " ; texte += "" + noeud_1 + "" ; texte += " " + noeud_2 + "" ; - texte += " \n" ; + texte += " " ; + if ( option == 1 ) { texte += "\n" ; } return texte ; // @@ -476,7 +502,7 @@ std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::stri //=============================================================================== std::string YACSDriver::Texte_inport( const std::string inport_type, const std::string inport_nom ) { -// MESSAGE("Texte_control, inport_type = "< indice ) { int position = ligne.find_first_of( "." ) ; -// MESSAGE("\nposition : "<< position); + MESSAGE("\nposition : "<< position); if ( position > 0 ) { ligne_bis = ligne.substr( position ); -// MESSAGE("\nligne_bis : "<< ligne_bis); + MESSAGE("\nligne_bis : "<< ligne_bis); _Texte += concept + ligne_bis + "\n" ; } }