From: nicolas Date: Mon, 25 Feb 2013 09:20:38 +0000 (+0000) Subject: Introduction of informations on the meshes X-Git-Tag: V7_1_0b1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b93f68e791d9a197c7130c94d2e317b1ebcd7220;p=modules%2Fhomard.git Introduction of informations on the meshes --- diff --git a/doc/Makefile.am b/doc/Makefile.am index 5c5c24e9..6eae2243 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -62,6 +62,7 @@ gui_create_iteration.rst \ gui_create_zone.rst \ gui_homard.rst \ gui_usage.rst \ +gui_mesh_info.rst \ index.rst \ intro.rst \ tui_create_boundary.rst \ diff --git a/doc/conf.py.in b/doc/conf.py.in index 4aa0a92c..c2d218e5 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -38,7 +38,7 @@ master_doc = 'index' # General information about the project. project = u'HOMARD' -copyright = u'1996, 2011, 2012, EDF R&D, G. Nicolas, T. Fouquet, P. Noyret' +copyright = u'1996, 2011, 2013, EDF R&D, G. Nicolas, T. Fouquet, P. Noyret' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/doc/gui_create_case.rst b/doc/gui_create_case.rst index aaac4a77..e1dcac09 100644 --- a/doc/gui_create_case.rst +++ b/doc/gui_create_case.rst @@ -22,7 +22,7 @@ Un nom de cas est propos Le répertoire """"""""""""" -Le répertoire est celui qui contiendra les fichiers produits par les adaptations successives. Ce répertoire doit exister. Par défaut, Salome propose ``/tmp``. Ce choix peut être modifié, soit en tapant le nom dans la zone de texte, soit en activant la fonction de recherche. C'est dans ce répertoire que seront exportés les maillages au format MED, dans des fichiers de nom ``maill.xx.med``, où ``xx`` est un numéro d'ordre créé automatiquement ; ces noms de fichiers seront visibles dans l'arbre d'études. +Le répertoire est celui qui contiendra les fichiers produits par les adaptations successives. Par défaut, rien n'est proposé. Le choix est fait, soit en tapant le nom dans la zone de texte, soit en activant la fonction de recherche. C'est dans ce répertoire que seront exportés les maillages au format MED, dans des fichiers de nom ``maill.xx.med``, où ``xx`` est un numéro d'ordre créé automatiquement. Ces fichiers seront visibles dans l'arbre d'études. .. image:: images/create_case_2.png :align: center diff --git a/doc/gui_homard.rst b/doc/gui_homard.rst index c4df6439..08f8928c 100644 --- a/doc/gui_homard.rst +++ b/doc/gui_homard.rst @@ -12,7 +12,6 @@ Lancer une adaptation s'obtient en s .. image:: images/lancement_1.png :align: center - .. index:: single: arbre d'étude L'arbre d'étude @@ -20,11 +19,12 @@ L'arbre d' A l'issue de ce calcul, l'arbre d'études a été enrichi. L'icone devant l'itération est validée. Sous l'itération, on trouve la référence aux fichiers de résultats créés, identifiés par leur nom dans le répertoire *rep* qui a été défini à la création du cas : - - *rep*/I(n+1)/Liste.n.vers.(n+1) + - *rep*/I(n+1)/Liste.n.vers.(n+1).log - *rep*/I(n+1)/apad.n.vers.(n+1).bilan - *rep*/maill.(n+1).med -Les deux premiers fichiers sont des fichiers de texte, éditables. Liste.n.vers.(n+1) contient des informations sur le déroulement de l'adaptation : récapitulatif du mode d'adaptation, pourcentage de mailles concernées, etc. Le fichier apad.n.vers.(n+1).bilan est un résumé des caractéristiques du maillage obtenus. +Les deux premiers fichiers sont des fichiers de texte, éditables. Liste.n.vers.(n+1).log contient des informations sur le déroulement de l'adaptation : récapitulatif du mode d'adaptation, pourcentage de mailles concernées, etc. Le fichier apad.n.vers.(n+1).bilan est un résumé des caractéristiques du maillage obtenu. + Le fichier maill.(n+1).med est celui qui contient le maillage produit au format MED. On retrouve ce maillage dans la section de l'arbre d'études du module SMESH. Il est alors visible dans ce module et utilisable ensuite comme tout autre maillage. @@ -33,13 +33,12 @@ Le fichier maill.(n+1).med est celui qui contient le maillage produit au format Consulter le résultat d'une adaptation """""""""""""""""""""""""""""""""""""" -Les deux fichiers de texte, Liste.n.vers.(n+1) et apad.n.vers.(n+1).bilan, sont visibles en les sélectionnant. On choisit ensuite "*Afficher le fichier*" dans le menu HOMARD ou à la souris. +Les deux fichiers de texte, Liste.n.vers.(n+1).log et apad.n.vers.(n+1).bilan, sont visibles en les sélectionnant. On choisit ensuite "*Afficher le fichier*" dans le menu HOMARD ou à la souris. .. image:: images/lancement_3.png :align: center - .. note:: Par défaut, le calcul est lancé avec l'exécutable de HOMARD installé avec Salome. Si on souhaite utiliser une version privée de HOMARD, pour tester une évolution par exemple, il faut préciser où le nouvel exécutable est disponible. Pour cela, il faut renseigner deux variables d'environnement. "*HOMARD_REP_EXE_PRIVATE*" définit le répertoire dans lequel se trouve l'exécutable voulu. diff --git a/doc/gui_mesh_info.rst b/doc/gui_mesh_info.rst new file mode 100644 index 00000000..58b00ca4 --- /dev/null +++ b/doc/gui_mesh_info.rst @@ -0,0 +1,92 @@ +.. _gui_mesh_info: + +Analyse de maillage +=================== +.. index:: single: analyse +.. index:: single: information + +La demande d'analyse d'un maillage se fait par la donnée des informations suivantes : + + - Un répertoire + - Le fichier du maillage + +Si le maillage fait partie d'un cas enregistré, son analyse est faite à partir de son itération dans l'arbre d'études. Voir plus loin. + + +Maillage à importer +""""""""""""""""""" +La sélection de la fonction d'analyse est faite par le menu de la barre supérieure de la fenêtre : + +.. image:: images/mesh_info_1.png + :align: center + +La fenêtre de choix s'affiche. + +.. image:: images/mesh_info_2.png + :align: center + +Le nom du cas +------------- +Un nom de cas est proposé automatiquement : Case_1, Case_2, etc. Ce nom peut être modifié. Il ne doit pas avoir déjà été utilisé pour un autre cas. + +Le répertoire +------------- +Le répertoire est celui qui contiendra les fichiers produits par l'information. Par défaut, rien n'est proposé. Le choix est fait, soit en tapant le nom dans la zone de texte, soit en activant la fonction de recherche. C'est dans ce répertoire que seront exportés les fichiers d'information de nom ``Liste.log`` et ``info_av.00.bilan``. Ces fichiers seront visibles dans l'arbre d'études. + +.. image:: images/create_case_2.png + :align: center + +.. index:: single: maillage;initial +.. index:: single: MED + +Le maillage à analyser +---------------------- +Le maillage à analyser doit se trouver dans un fichier au format MED. Le nom du fichier peut être fourni, soit en tapant le nom dans la zone de texte, soit en activant la fonction de recherche. + +.. image:: images/create_case_3.png + :align: center + +.. note:: + Le fichier ne doit contenir qu'un seul maillage. + +.. warning:: + Le maillage ne doit pas être lui-même le produit d'une adaptation de maillage par HOMARD, sous peine de perdre l'analyse des différents niveaux de raffinement/déraffinement + +Options d'analyse +----------------- +L'analyse est faite selon les options cochées. + - qualité des mailles + - diamètre des mailles + - connexité du domaine ; en un seul morceau, combien de trous, etc. + - tailles des constituants du domaine, groupe par groupe + - interpénétration des mailles, par dimension + +Le résultat de l'analyse est contenu dans le fichier ``info_av.00.bilan`` ; ce fichier est à consulter en l'affichant après sa désignation avec "*Afficher le fichier*" dans le menu HOMARD ou à la souris. + +L'arbre d'étude +--------------- +A l'issue de cette demande d'information, l'arbre d'études a été enrichi de ce nouveau cas. On y trouve l'itération initiale, identifiée par le nom du maillage qui a été lu dans le fichier fourni, et les deux fichiers d'information de nom ``Liste.log`` et ``info_av.00.bilan``. + +.. image:: images/mesh_info_3.png + :align: center + + +Itération calculée +"""""""""""""""""" + +Pour analyser le maillage produit par une itération d'adaptation de maillage, on désigne à la souris cette itération dans l'arbre d'études et on lance l'analyse. On retrouve le menu similaire au cas initial : + +.. image:: images/mesh_info_4.png + :align: center + +Comme pour un maillage importé, l'arbre d'études a été enrichi avec les deux fichiers d'information de nom ``Liste.log`` et ``info_ap.xx.bilan``, où xx est le numéro de l'itération dans le cas. + +.. image:: images/mesh_info_5.png + :align: center + + + +Méthodes python correspondantes +""""""""""""""""""""""""""""""" +Consulter :ref:`tui_create_case` et :ref:`tui_create_iteration` + diff --git a/doc/gui_usage.rst b/doc/gui_usage.rst index 81e7bf59..e3654810 100644 --- a/doc/gui_usage.rst +++ b/doc/gui_usage.rst @@ -35,4 +35,5 @@ Mode d'emploi de la saisie des donn gui_create_zone gui_create_boundary gui_homard + gui_mesh_info diff --git a/doc/images/intro_37.png b/doc/images/intro_37.png index c6f7943d..f04c5122 100644 Binary files a/doc/images/intro_37.png and b/doc/images/intro_37.png differ diff --git a/doc/images/intro_40.png b/doc/images/intro_40.png index 36c447a0..88f3077e 100644 Binary files a/doc/images/intro_40.png and b/doc/images/intro_40.png differ diff --git a/doc/images/lancement_1.png b/doc/images/lancement_1.png index 03b76a9d..5a7e6cf7 100644 Binary files a/doc/images/lancement_1.png and b/doc/images/lancement_1.png differ diff --git a/doc/images/lancement_2.png b/doc/images/lancement_2.png index d5713d51..9655bcb1 100644 Binary files a/doc/images/lancement_2.png and b/doc/images/lancement_2.png differ diff --git a/doc/images/lancement_3.png b/doc/images/lancement_3.png index bd1eb644..aef0b242 100644 Binary files a/doc/images/lancement_3.png and b/doc/images/lancement_3.png differ diff --git a/doc/images/mesh_info_1.png b/doc/images/mesh_info_1.png new file mode 100644 index 00000000..044f8dcc Binary files /dev/null and b/doc/images/mesh_info_1.png differ diff --git a/doc/images/mesh_info_2.png b/doc/images/mesh_info_2.png new file mode 100644 index 00000000..9f77229f Binary files /dev/null and b/doc/images/mesh_info_2.png differ diff --git a/doc/images/mesh_info_3.png b/doc/images/mesh_info_3.png new file mode 100644 index 00000000..04193271 Binary files /dev/null and b/doc/images/mesh_info_3.png differ diff --git a/doc/images/mesh_info_4.png b/doc/images/mesh_info_4.png new file mode 100644 index 00000000..ea3ec0c4 Binary files /dev/null and b/doc/images/mesh_info_4.png differ diff --git a/doc/images/mesh_info_5.png b/doc/images/mesh_info_5.png new file mode 100644 index 00000000..e885f4c6 Binary files /dev/null and b/doc/images/mesh_info_5.png differ diff --git a/doc/intro.rst b/doc/intro.rst index c1337911..0eff3eac 100644 --- a/doc/intro.rst +++ b/doc/intro.rst @@ -95,7 +95,12 @@ La premi .. image:: images/homard_1.png :align: center -Une fois le module HOMARD activé, on crée un cas par le choix "*Nouveau cas*" dans le menu HOMARD. La fenêtre suivante apparaît : +Une fois le module HOMARD activé, on crée un cas par le choix "*Nouveau cas*" dans le menu HOMARD. + +.. image:: images/homard_2.png + :align: center + +La fenêtre suivante apparaît : .. image:: images/intro_31.png :align: center @@ -168,13 +173,10 @@ SALOME VERSION 7.1 : - En TUI, choix du dernier instant comme instant de pilotage par SetTimeStepRankLast (voir :ref:`tui_create_iteration`) - Possibilité de détruire les objets (GUI et TUI) - Modification des fonctions TUI pour qu'elles agissent sur les objets et non plus sur les noms : - homard.AssociateIterHypo(iter_name,hypo_name) devient iter.AssociateHypo(hypo_name) - - homard.AssociateHypoZone(hypo_name,zone_name,type_use) devient hypo.AssociateHypo(zone_name,type_use) - - homard.CreateIteration(iter_name,iter_parent_name) devient iter.NextIteration(iter_name) ou case.NextIteration(iter_name) + ``homard.AssociateIterHypo(iter_name,hypo_name)`` devient ``iter.AssociateHypo(hypo_name)``, ``homard.AssociateHypoZone(hypo_name,zone_name,type_use)`` devient ``hypo.AssociateHypo(zone_name,type_use)``, ``homard.CreateIteration(iter_name,iter_parent_name)`` devient ``iter.NextIteration(iter_name)`` ou ``case.NextIteration(iter_name)`` - Ajout de fonctions : - cas.LastIteration() : retourne la dernière itération de la descendance du cas (voir :ref:`tui_create_iteration`) + ``cas.LastIteration()`` : retourne la dernière itération de la descendance du cas (voir :ref:`tui_create_iteration`) + - Analyse de maillages (voir :ref:`gui_mesh_info`) diff --git a/doc/tui_create_case.rst b/doc/tui_create_case.rst index 21b6950d..f1e0c291 100644 --- a/doc/tui_create_case.rst +++ b/doc/tui_create_case.rst @@ -143,6 +143,27 @@ Les options avanc | présentes dans le maillage initial | +---------------------------------------------------------------+ +Informations sur le maillage initial +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------------------------------------------------------------+ ++---------------------------------------------------------------+ +| .. module:: MeshInfo | +| | +| **MeshInfo(Qual, Diam, Conn, Tail, Inte)** | +| Donne des informations sur le maillage. Pour chaque | +| option, le choix 0 correspond à ne rien faire, alors que | +| le choix 1 active l'option. | +| | +| - ``Qual`` : qualité des mailles | +| - ``Diam`` : diamètre des mailles | +| - ``Conn`` : connexité du domaine ; en un seul morceau, | +| combien de trous, etc. | +| - ``Tail`` : tailles des constituants du domaine, groupe | +| par groupe | +| - ``Inte`` : interpénétration des mailles, par dimension | ++---------------------------------------------------------------+ + Exemple """"""" diff --git a/doc/tui_create_iteration.rst b/doc/tui_create_iteration.rst index 9a9a1bd8..96db65ff 100644 --- a/doc/tui_create_iteration.rst +++ b/doc/tui_create_iteration.rst @@ -144,6 +144,17 @@ G | - ``0`` : itération non calculée | | - ``1`` : itération calculée correctement | +---------------------------------------------------------------+ +| .. module:: GetLogFile | +| | +| **GetLogFile()** | +| Retourne le nom du fichier retraçant le déroulement de | +| l'exécuion de HOMARD | ++---------------------------------------------------------------+ +| .. module:: GetFileInfo | +| | +| **GetFileInfo()** | +| Retourne le nom du fichier contenant l'abalyse du maillage| ++---------------------------------------------------------------+ | .. index:: single: Delete | | | | **Delete()** | @@ -185,6 +196,21 @@ Informations sur les maillages | **GetMeshFile()** | | Retourne le nom du fichier du maillage produit | +---------------------------------------------------------------+ +| .. module:: MeshInfo | +| | +| **MeshInfo(Qual, Diam, Conn, Tail, Inte)** | +| Donne des informations sur le maillage. Pour chaque | +| option, le choix 0 correspond à ne rien faire, alors que | +| le choix 1 active l'option. | +| | +| - ``Qual`` : qualité des mailles | +| - ``Diam`` : diamètre des mailles | +| - ``Conn`` : connexité du domaine ; en un seul morceau, | +| combien de trous, etc. | +| - ``Tail`` : tailles des constituants du domaine, groupe | +| par groupe | +| - ``Inte`` : interpénétration des mailles, par dimension | ++---------------------------------------------------------------+ Informations sur le champ ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/idl/HOMARD_Cas.idl b/idl/HOMARD_Cas.idl index 4dd2c3a7..d226341e 100644 --- a/idl/HOMARD_Cas.idl +++ b/idl/HOMARD_Cas.idl @@ -75,6 +75,9 @@ module HOMARD void SetPyram(in long Pyram) raises (SALOME::SALOME_Exception); long GetPyram() raises (SALOME::SALOME_Exception); + void MeshInfo(in long Qual, in long Diam, in long Conn, in long Tail, in long Inte) + raises (SALOME::SALOME_Exception); + // Liens avec les autres structures string GetIter0Name () raises (SALOME::SALOME_Exception); HOMARD_Iteration GetIter0 () raises (SALOME::SALOME_Exception); diff --git a/idl/HOMARD_Gen.idl b/idl/HOMARD_Gen.idl index 5780c428..85602cda 100644 --- a/idl/HOMARD_Gen.idl +++ b/idl/HOMARD_Gen.idl @@ -110,6 +110,9 @@ module HOMARD listeIterations GetAllIterationsName() raises (SALOME::SALOME_Exception); listeZones GetAllZonesName() raises (SALOME::SALOME_Exception); + void MeshInfo(in string CaseName, in string MeshName, in string FileName, in string DirName, in long Qual, in long Diam, in long Conn, in long Tail, in long Inte ) + raises (SALOME::SALOME_Exception); + HOMARD_Iteration LastIteration(in string CaseName) raises (SALOME::SALOME_Exception); // // A.3. L'etude @@ -146,7 +149,8 @@ module HOMARD void DissociateHypoZone(in string HypoName, in string ZoneName) raises (SALOME::SALOME_Exception); - long Compute (in string IterName, in long CleanOption) raises (SALOME::SALOME_Exception); + long Compute (in string IterName, in long CleanOption, in long modeHOMARD, in long Option) + raises (SALOME::SALOME_Exception); boolean VerifieDir (in string IterName) raises (SALOME::SALOME_Exception); diff --git a/idl/HOMARD_Iteration.idl b/idl/HOMARD_Iteration.idl index a41739d6..f5fd7ef5 100644 --- a/idl/HOMARD_Iteration.idl +++ b/idl/HOMARD_Iteration.idl @@ -71,11 +71,19 @@ module HOMARD long GetTimeStep() raises (SALOME::SALOME_Exception); long GetRank() raises (SALOME::SALOME_Exception); - void SetMessFile(in string MessFile) raises (SALOME::SALOME_Exception); - string GetMessFile() raises (SALOME::SALOME_Exception); + void SetLogFile(in string LogFile) raises (SALOME::SALOME_Exception); + string GetLogFile() raises (SALOME::SALOME_Exception); long Compute(in long etatMenage) raises (SALOME::SALOME_Exception); + void MeshInfo(in long Qual, in long Diam, in long Conn, in long Tail, in long Inte) + raises (SALOME::SALOME_Exception); + void MeshInfoOption(in long Qual, in long Diam, in long Conn, in long Tail, in long Inte, in long Option) + raises (SALOME::SALOME_Exception); + + void SetFileInfo(in string FileInfo) raises (SALOME::SALOME_Exception); + string GetFileInfo() raises (SALOME::SALOME_Exception); + // Liens avec les autres iterations HOMARD_Iteration NextIteration(in string NomIter) raises (SALOME::SALOME_Exception); diff --git a/resources/Makefile.am b/resources/Makefile.am index d2a60218..5c8decf0 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -21,6 +21,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am dist_salomeres_DATA = \ $(top_builddir)/resources/SalomeApp.xml \ + advanced_mesh_info.png \ boxdxy.png \ boxdxy_2.png \ boxdxyz.png \ diff --git a/resources/advanced_mesh_info.png b/resources/advanced_mesh_info.png new file mode 100644 index 00000000..6e5b3176 Binary files /dev/null and b/resources/advanced_mesh_info.png differ diff --git a/src/HOMARD/HOMARD_DriverTools.cxx b/src/HOMARD/HOMARD_DriverTools.cxx index 4bcc8146..b6211887 100644 --- a/src/HOMARD/HOMARD_DriverTools.cxx +++ b/src/HOMARD/HOMARD_DriverTools.cxx @@ -156,7 +156,7 @@ namespace HOMARD os << separator() << iteration.GetEtat(); os << separator() << iteration.GetNumber(); os << separator() << iteration.GetMeshFile(); - os << separator() << iteration.GetMessFile(); + os << separator() << iteration.GetLogFile(); os << separator() << iteration.GetMeshName(); os << separator() << iteration.GetFieldFile(); os << separator() << iteration.GetTimeStep(); @@ -432,7 +432,7 @@ namespace HOMARD iteration.SetMeshFile( chunk.c_str() ); chunk = getNextChunk( stream, start, ok ); if ( !ok ) return false; - iteration.SetMessFile( chunk.c_str() ); + iteration.SetLogFile( chunk.c_str() ); chunk = getNextChunk( stream, start, ok ); if ( !ok ) return false; iteration.SetMeshName( chunk.c_str() ); diff --git a/src/HOMARD/HOMARD_Iteration.cxx b/src/HOMARD/HOMARD_Iteration.cxx index 922a5a2a..2efd2f94 100644 --- a/src/HOMARD/HOMARD_Iteration.cxx +++ b/src/HOMARD/HOMARD_Iteration.cxx @@ -44,9 +44,10 @@ HOMARD_Iteration::HOMARD_Iteration(): _NumIter( -1 ), _NomMesh( "" ), _MeshFile( "" ), _FieldFile( "" ), _TimeStep( -1 ), _Rank( -1 ), - _MessFile( "" ), + _LogFile( "" ), _IterParent( "" ), - _NomHypo( "" ), _NomCas( "" ), _NomDir( "" ) + _NomHypo( "" ), _NomCas( "" ), _NomDir( "" ), + _FileInfo( "" ) { MESSAGE("HOMARD_Iter"); } @@ -210,14 +211,24 @@ int HOMARD_Iteration::GetRank() const return _Rank; } //============================================================================= -void HOMARD_Iteration::SetMessFile( const char* MessFile ) +void HOMARD_Iteration::SetLogFile( const char* LogFile ) { - _MessFile = std::string( MessFile ); + _LogFile = std::string( LogFile ); } //============================================================================= -std::string HOMARD_Iteration::GetMessFile() const +std::string HOMARD_Iteration::GetLogFile() const { - return _MessFile; + return _LogFile; +} +//============================================================================= +void HOMARD_Iteration::SetFileInfo( const char* FileInfo ) +{ + _FileInfo = std::string( FileInfo ); +} +//============================================================================= +std::string HOMARD_Iteration::GetFileInfo() const +{ + return _FileInfo; } //============================================================================= //============================================================================= diff --git a/src/HOMARD/HOMARD_Iteration.hxx b/src/HOMARD/HOMARD_Iteration.hxx index 542da90a..1a772358 100644 --- a/src/HOMARD/HOMARD_Iteration.hxx +++ b/src/HOMARD/HOMARD_Iteration.hxx @@ -72,8 +72,11 @@ public: int GetTimeStep() const; int GetRank() const; - void SetMessFile( const char* MessFile ); - std::string GetMessFile() const; + void SetLogFile( const char* LogFile ); + std::string GetLogFile() const; + + void SetFileInfo( const char* FileInfo ); + std::string GetFileInfo() const; // Liens avec les autres iterations void LinkNextIteration( const char* NomIteration ); @@ -100,12 +103,13 @@ private: std::string _FieldFile; int _TimeStep; int _Rank; - std::string _MessFile; + std::string _LogFile; std::string _IterParent; std::string _NomHypo; std::string _NomCas; std::string _NomDir; std::list _mesIterFilles; + std::string _FileInfo; }; #endif diff --git a/src/HOMARD/HomardDriver.cxx b/src/HOMARD/HomardDriver.cxx index ac6d4ca5..1cfa5f32 100644 --- a/src/HOMARD/HomardDriver.cxx +++ b/src/HOMARD/HomardDriver.cxx @@ -31,7 +31,7 @@ //============================================================================= HomardDriver::HomardDriver(const std::string siter, const std::string siterp1): _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ), - _NomFichierConf( "" ), _siter( "" ), _siterp1( "" ), + _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ), _Texte( "" ), _bLu( false ) { // Memorisation du nom complet de l'executable HOMARD @@ -59,28 +59,56 @@ HomardDriver::~HomardDriver() { } -////============================================================================= -void HomardDriver::TexteInit( const std::string DirCompute, const std::string DirComputePa, const std::string MessFile ) +//=============================================================================== +void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile ) { - MESSAGE("TexteInit, MessFile ="<show(); break; @@ -276,7 +282,7 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) if (monIter == QString("")) break; try { - homardGen->Compute(monIter.toStdString().c_str(), 0); + homardGen->Compute(monIter.toStdString().c_str(), 0, 1, -1); } catch( SALOME::SALOME_Exception& S_ex ) { @@ -288,6 +294,16 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) break; } + case 1121: // Information sur le maillage de l'iteration + { + MESSAGE("command " << theCommandID << " activated"); + QString IterName=HOMARD_QT_COMMUN::SelectionArbreEtude(QString("IterationHomard"), 0); + MESSAGE("IterName " << IterName.toStdString().c_str() << " choisi dans arbre"); + MonIterInfo *IterDlg = new MonIterInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), IterName ) ; + IterDlg->show(); + break; + } + case 1201: // Edition d'un objet { MESSAGE("command " << theCommandID << " activated"); @@ -317,21 +333,21 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) // Edition d'une zone else if (HOMARD_UTILS::isZone(obj)) { - MonEditZone *aDlg = new MonEditZone(0, TRUE, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + MonEditZone *aDlg = new MonEditZone(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; aDlg->show(); } // Edition d'une frontiere discrete else if (HOMARD_UTILS::isBoundaryDi(obj)) { MESSAGE(".. Lancement de MonEditBoundaryDi" ); - MonEditBoundaryDi *aDlg = new MonEditBoundaryDi(0, TRUE, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + MonEditBoundaryDi *aDlg = new MonEditBoundaryDi(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; aDlg->show(); } // Edition d'une frontiere analytique else if (HOMARD_UTILS::isBoundaryAn(obj)) { MESSAGE(".. Lancement de MonEditBoundaryAn" ); - MonEditBoundaryAn *aDlg = new MonEditBoundaryAn(0, TRUE, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + MonEditBoundaryAn *aDlg = new MonEditBoundaryAn(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; aDlg->show(); } } @@ -415,11 +431,20 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) break; } - case 1301: // Affichage du fichier mess + case 1301: // Information sur un maillage + { + MESSAGE("etape 1301") + MESSAGE("command " << theCommandID << " activated"); + MonMeshInfo *aDlg = new MonMeshInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ; + aDlg->show(); + break; + } + + case 1302: // Affichage du fichier mess { MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); _PTR(SObject) obj = chercheMonObjet(); - if ((obj) and ((HOMARD_UTILS::isFileMess(obj) or HOMARD_UTILS::isFileSummary(obj)))) + if ((obj) and ((HOMARD_UTILS::isFilelog(obj) or HOMARD_UTILS::isFileSummary(obj)))) { MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ; aDlg->show(); @@ -560,7 +585,9 @@ void HOMARDGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& t pix = resMgr->loadPixmap( "HOMARD", "iter_next.png" ); menu->addAction(QIcon(pix), tr(QString("HOM_MEN_NEW_ITERATION").toLatin1().data()), this,SLOT(NextIter())); QPixmap pix2 = resMgr->loadPixmap( "HOMARD", "mesh_compute.png" ); - menu->addAction(QIcon(pix2), tr(QString("HOM_MEN_COMPUTE").toLatin1().data()), this,SLOT(LanceCalcul())); + menu->addAction(QIcon(pix2), tr(QString("HOM_MEN_COMPUTE").toLatin1().data()), this, SLOT(LanceCalcul())); + pix2 = resMgr->loadPixmap( "HOMARD", "advanced_mesh_info.png" ); + menu->addAction(QIcon(pix2), tr(QString("HOM_MEN_MESH_INFO").toLatin1().data()), this, SLOT(IterInfo())); EditObject = true ; DeleteObject = true ; } @@ -569,7 +596,7 @@ void HOMARDGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& t EditObject = true ; DeleteObject = true ; } - else if ( HOMARD_UTILS::isFileMess(obj) or HOMARD_UTILS::isFileSummary(obj) ) + else if ( HOMARD_UTILS::isFilelog(obj) or HOMARD_UTILS::isFileSummary(obj) ) { pix = resMgr->loadPixmap( "HOMARD", "texte.png" ); menu->addAction(QIcon(pix), tr(QString("HOM_MEN_EDIT_MESS_FILE").toLatin1().data()), this,SLOT(EditAsciiFile())); @@ -599,6 +626,11 @@ void HOMARDGUI::LanceCalcul() this->OnGUIEvent(1111); } +void HOMARDGUI::IterInfo() +{ + this->OnGUIEvent(1121); +} + void HOMARDGUI::Edit() { this->OnGUIEvent(1201); @@ -609,9 +641,14 @@ void HOMARDGUI::Delete() this->OnGUIEvent(1211); } +// void HOMARDGUI::EditAsciiFile() +// { +// this->OnGUIEvent(1301); +// } + void HOMARDGUI::EditAsciiFile() { - this->OnGUIEvent(1301); + this->OnGUIEvent(1302); } // diff --git a/src/HOMARDGUI/HOMARDGUI.h b/src/HOMARDGUI/HOMARDGUI.h index 610571f8..31101477 100644 --- a/src/HOMARDGUI/HOMARDGUI.h +++ b/src/HOMARDGUI/HOMARDGUI.h @@ -63,6 +63,7 @@ private slots: void OnGUIEvent(); void EditAsciiFile(); void LanceCalcul(); + void IterInfo(); void NextIter(); void Edit(); void Delete(); diff --git a/src/HOMARDGUI/HOMARDGUI_Utils.cxx b/src/HOMARDGUI/HOMARDGUI_Utils.cxx index 91e47210..fc1398ad 100644 --- a/src/HOMARDGUI/HOMARDGUI_Utils.cxx +++ b/src/HOMARDGUI/HOMARDGUI_Utils.cxx @@ -254,9 +254,9 @@ bool HOMARD_UTILS::isCase(_PTR(SObject) MonObj) //================================================================ // Retourne vrai si l objet est un fichier de messages //================================================================ -bool HOMARD_UTILS::isFileMess(_PTR(SObject) MonObj) +bool HOMARD_UTILS::isFilelog(_PTR(SObject) MonObj) { - return isObject( MonObj, QString("Mess"), 0 ) ; + return isObject( MonObj, QString("log"), 0 ) ; } //================================================================ // Retourne vrai si l objet est un fichier de bilan diff --git a/src/HOMARDGUI/HOMARDGUI_Utils.h b/src/HOMARDGUI/HOMARDGUI_Utils.h index f202cadb..52bb4177 100644 --- a/src/HOMARDGUI/HOMARDGUI_Utils.h +++ b/src/HOMARDGUI/HOMARDGUI_Utils.h @@ -79,7 +79,7 @@ namespace HOMARD_UTILS { bool isHypo(_PTR(SObject) MonObj); bool isIter(_PTR(SObject) MonObj); bool isCase(_PTR(SObject) MonObj); - bool isFileMess(_PTR(SObject) MonObj); + bool isFilelog(_PTR(SObject) MonObj); bool isFileSummary(_PTR(SObject) MonObj); bool isObject(_PTR(SObject) MonObj, QString TypeObject, int option ); diff --git a/src/HOMARDGUI/HOMARD_msg_en.ts b/src/HOMARDGUI/HOMARD_msg_en.ts index d740bb40..89aca2f5 100644 --- a/src/HOMARDGUI/HOMARD_msg_en.ts +++ b/src/HOMARDGUI/HOMARD_msg_en.ts @@ -35,6 +35,10 @@ HOM_MEN_DELETE Delete + + HOM_MEN_MESH_INFO + Mesh analysis + HOM_MEN_EDIT_MESS_FILE Show the file @@ -303,5 +307,17 @@ HOM_GROU_EDIT_WINDOW_TITLE Selected groups + + HOM_MESH_INFO_0 + Mesh analysis + + + HOM_MESH_INFO_1 + Select at least one option. + + + HOM_MESH_INFO_2 + Analysis in the object browser, file + diff --git a/src/HOMARDGUI/HOMARD_msg_fr.ts b/src/HOMARDGUI/HOMARD_msg_fr.ts index a4cb3ae1..3a63a413 100644 --- a/src/HOMARDGUI/HOMARD_msg_fr.ts +++ b/src/HOMARDGUI/HOMARD_msg_fr.ts @@ -35,6 +35,10 @@ HOM_MEN_DELETE Supprimer + + HOM_MEN_MESH_INFO + Analyse de maillage + HOM_MEN_EDIT_MESS_FILE Afficher le fichier @@ -647,6 +651,18 @@ HOM_GROU_EDIT_WINDOW_TITLE Groupes choisis + + HOM_MESH_INFO_0 + Analyse de maillage + + + HOM_MESH_INFO_1 + Choisir au moins une option. + + + HOM_MESH_INFO_2 + Bilan de l'analyse dans l'arbre d'études, fichier + Filtering with groups Filtrage par les groupes @@ -663,6 +679,30 @@ Group Groupe + + Information on a mesh + Analyse d'un maillage + + + Group size + Taille des domaines + + + Quality + Qualité + + + Connection + Connexité + + + Diametre + Diamètre + + + Entanglement + Interpénétration + Edit a file Affichage d'un fichier diff --git a/src/HOMARDGUI/IterInfo.h b/src/HOMARDGUI/IterInfo.h new file mode 100644 index 00000000..452a9dab --- /dev/null +++ b/src/HOMARDGUI/IterInfo.h @@ -0,0 +1,156 @@ +/******************************************************************************** +** Form generated from reading UI file 'IterInfo.ui' +** +** Created: Wed Feb 20 17:10:38 2013 +** by: Qt User Interface Compiler version 4.6.3 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef ITERINFO_H +#define ITERINFO_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_IterInfo +{ +public: + QGridLayout *gridLayout_2; + QGroupBox *GBOptions; + QGridLayout *gridLayout; + QCheckBox *CBQuality; + QCheckBox *CBConnection; + QCheckBox *CBDiametre; + QCheckBox *CBBlockSize; + QCheckBox *CBEntanglement; + QGroupBox *GroupButtons; + QGridLayout *gridLayout1; + QPushButton *buttonHelp; + QPushButton *buttonApply; + QPushButton *buttonOk; + QPushButton *buttonCancel; + + void setupUi(QDialog *IterInfo) + { + if (IterInfo->objectName().isEmpty()) + IterInfo->setObjectName(QString::fromUtf8("IterInfo")); + IterInfo->resize(420, 220); + QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(IterInfo->sizePolicy().hasHeightForWidth()); + IterInfo->setSizePolicy(sizePolicy); + IterInfo->setAutoFillBackground(true); + gridLayout_2 = new QGridLayout(IterInfo); + gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); + GBOptions = new QGroupBox(IterInfo); + GBOptions->setObjectName(QString::fromUtf8("GBOptions")); + gridLayout = new QGridLayout(GBOptions); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + CBQuality = new QCheckBox(GBOptions); + CBQuality->setObjectName(QString::fromUtf8("CBQuality")); + + gridLayout->addWidget(CBQuality, 0, 0, 1, 1); + + CBConnection = new QCheckBox(GBOptions); + CBConnection->setObjectName(QString::fromUtf8("CBConnection")); + + gridLayout->addWidget(CBConnection, 0, 1, 1, 1); + + CBDiametre = new QCheckBox(GBOptions); + CBDiametre->setObjectName(QString::fromUtf8("CBDiametre")); + + gridLayout->addWidget(CBDiametre, 1, 0, 1, 1); + + CBBlockSize = new QCheckBox(GBOptions); + CBBlockSize->setObjectName(QString::fromUtf8("CBBlockSize")); + + gridLayout->addWidget(CBBlockSize, 1, 1, 1, 1); + + CBEntanglement = new QCheckBox(GBOptions); + CBEntanglement->setObjectName(QString::fromUtf8("CBEntanglement")); + + gridLayout->addWidget(CBEntanglement, 2, 0, 1, 2); + + + gridLayout_2->addWidget(GBOptions, 0, 0, 2, 2); + + GroupButtons = new QGroupBox(IterInfo); + GroupButtons->setObjectName(QString::fromUtf8("GroupButtons")); + gridLayout1 = new QGridLayout(GroupButtons); +#ifndef Q_OS_MAC + gridLayout1->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout1->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + buttonHelp = new QPushButton(GroupButtons); + buttonHelp->setObjectName(QString::fromUtf8("buttonHelp")); + buttonHelp->setAutoDefault(false); + + gridLayout1->addWidget(buttonHelp, 0, 4, 1, 1); + + buttonApply = new QPushButton(GroupButtons); + buttonApply->setObjectName(QString::fromUtf8("buttonApply")); + buttonApply->setAutoDefault(false); + + gridLayout1->addWidget(buttonApply, 0, 1, 1, 1); + + buttonOk = new QPushButton(GroupButtons); + buttonOk->setObjectName(QString::fromUtf8("buttonOk")); + buttonOk->setAutoDefault(false); + + gridLayout1->addWidget(buttonOk, 0, 0, 1, 1); + + buttonCancel = new QPushButton(GroupButtons); + buttonCancel->setObjectName(QString::fromUtf8("buttonCancel")); + buttonCancel->setAutoDefault(false); + + gridLayout1->addWidget(buttonCancel, 0, 2, 1, 1); + + + gridLayout_2->addWidget(GroupButtons, 2, 0, 1, 2); + + + retranslateUi(IterInfo); + + QMetaObject::connectSlotsByName(IterInfo); + } // setupUi + + void retranslateUi(QDialog *IterInfo) + { + IterInfo->setWindowTitle(QApplication::translate("IterInfo", "Information on a mesh", 0, QApplication::UnicodeUTF8)); + GBOptions->setTitle(QApplication::translate("IterInfo", "Options", 0, QApplication::UnicodeUTF8)); + CBQuality->setText(QApplication::translate("IterInfo", "Quality", 0, QApplication::UnicodeUTF8)); + CBConnection->setText(QApplication::translate("IterInfo", "Connection", 0, QApplication::UnicodeUTF8)); + CBDiametre->setText(QApplication::translate("IterInfo", "Diametre", 0, QApplication::UnicodeUTF8)); + CBBlockSize->setText(QApplication::translate("IterInfo", "Group size", 0, QApplication::UnicodeUTF8)); + CBEntanglement->setText(QApplication::translate("IterInfo", "Entanglement", 0, QApplication::UnicodeUTF8)); + GroupButtons->setTitle(QString()); + buttonHelp->setText(QApplication::translate("IterInfo", "Help", 0, QApplication::UnicodeUTF8)); + buttonApply->setText(QApplication::translate("IterInfo", "Apply", 0, QApplication::UnicodeUTF8)); + buttonOk->setText(QApplication::translate("IterInfo", "OK", 0, QApplication::UnicodeUTF8)); + buttonCancel->setText(QApplication::translate("IterInfo", "Cancel", 0, QApplication::UnicodeUTF8)); + } // retranslateUi + +}; + +namespace Ui { + class IterInfo: public Ui_IterInfo {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // ITERINFO_H diff --git a/src/HOMARDGUI/IterInfo.ui b/src/HOMARDGUI/IterInfo.ui new file mode 100644 index 00000000..04b2664a --- /dev/null +++ b/src/HOMARDGUI/IterInfo.ui @@ -0,0 +1,129 @@ + + + IterInfo + + + + 0 + 0 + 420 + 220 + + + + + 0 + 0 + + + + Information on a mesh + + + true + + + + + + Options + + + + + + Quality + + + + + + + Connection + + + + + + + Diametre + + + + + + + Group size + + + + + + + Entanglement + + + + + + + + + + + + + + 9 + + + 6 + + + + + Help + + + false + + + + + + + Apply + + + false + + + + + + + OK + + + false + + + + + + + Cancel + + + false + + + + + + + + + + + diff --git a/src/HOMARDGUI/Makefile.am b/src/HOMARDGUI/Makefile.am index ae5f5bc7..5eab8cfa 100644 --- a/src/HOMARDGUI/Makefile.am +++ b/src/HOMARDGUI/Makefile.am @@ -45,6 +45,10 @@ salomeinclude_HEADERS = \ MonCreateIteration.h \ CreateIteration.h \ MonEditIteration.h \ + MonMeshInfo.h \ + MeshInfo.h \ + MonIterInfo.h \ + IterInfo.h \ HOMARDGUI.h \ HOMARDGUI_Utils.h \ EditFile.h \ @@ -59,19 +63,21 @@ dist_libHOMARD_la_SOURCES = \ HOMARDGUI.cxx \ HOMARDGUI_Utils.cxx \ MonCreateBoundaryAn.cxx \ - MonEditBoundaryAn.cxx \ + MonEditBoundaryAn.cxx \ MonCreateBoundaryDi.cxx \ - MonEditBoundaryDi.cxx \ + MonEditBoundaryDi.cxx \ MonCreateCase.cxx \ MonEditCase.cxx \ MonCreateHypothesis.cxx \ MonEditHypothesis.cxx \ - MonCreateListGroup.cxx \ - MonEditListGroup.cxx \ + MonCreateListGroup.cxx \ + MonEditListGroup.cxx \ MonCreateIteration.cxx \ MonEditIteration.cxx \ MonCreateZone.cxx \ MonEditZone.cxx \ + MonMeshInfo.cxx \ + MonIterInfo.cxx \ MonEditFile.cxx \ HomardQtCommun.cxx @@ -92,6 +98,8 @@ MOC_FILES = \ MonEditListGroup_moc.cxx \ MonCreateIteration_moc.cxx \ MonEditIteration_moc.cxx \ + MonMeshInfo_moc.cxx \ + MonIterInfo_moc.cxx \ MonEditFile_moc.cxx nodist_libHOMARD_la_SOURCES = $(MOC_FILES) @@ -133,11 +141,13 @@ nodist_salomeres_DATA = \ UI_FILES = \ CreateBoundaryAn.ui \ CreateBoundaryDi.ui \ -CreateCase.ui \ +CreateCase.ui \ CreateHypothesis.ui \ -CreateIteration.ui \ -CreateListGroup.ui \ -CreateZone.ui \ +CreateIteration.ui \ +CreateListGroup.ui \ +CreateZone.ui \ +MeshInfo.ui \ +IterInfo.ui \ EditFile.ui EXTRA_DIST += $(UI_FILES) diff --git a/src/HOMARDGUI/MeshInfo.h b/src/HOMARDGUI/MeshInfo.h new file mode 100644 index 00000000..95dc88bf --- /dev/null +++ b/src/HOMARDGUI/MeshInfo.h @@ -0,0 +1,270 @@ +/******************************************************************************** +** Form generated from reading UI file 'MeshInfo.ui' +** +** Created: Tue Feb 19 10:05:35 2013 +** by: Qt User Interface Compiler version 4.6.3 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef MESHINFO_H +#define MESHINFO_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_MeshInfo +{ +public: + QGridLayout *gridLayout_2; + QHBoxLayout *hboxLayout; + QLabel *Name; + QLineEdit *LECaseName; + QHBoxLayout *hboxLayout1; + QLabel *Directory; + QPushButton *PushDir; + QLineEdit *LEDirName; + QSpacerItem *spacerItem; + QHBoxLayout *hboxLayout2; + QLabel *Mesh_2; + QPushButton *PushFichier; + QLineEdit *LEFileName; + QSpacerItem *spacerItem1; + QGroupBox *GBOptions; + QGridLayout *gridLayout; + QCheckBox *CBQuality; + QCheckBox *CBConnection; + QCheckBox *CBDiametre; + QCheckBox *CBBlockSize; + QCheckBox *CBEntanglement; + QSpacerItem *verticalSpacer; + QGroupBox *GroupButtons; + QGridLayout *gridLayout1; + QPushButton *buttonHelp; + QPushButton *buttonApply; + QPushButton *buttonOk; + QPushButton *buttonCancel; + QSpacerItem *spacer_2; + + void setupUi(QDialog *MeshInfo) + { + if (MeshInfo->objectName().isEmpty()) + MeshInfo->setObjectName(QString::fromUtf8("MeshInfo")); + MeshInfo->resize(536, 372); + QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(MeshInfo->sizePolicy().hasHeightForWidth()); + MeshInfo->setSizePolicy(sizePolicy); + MeshInfo->setAutoFillBackground(true); + gridLayout_2 = new QGridLayout(MeshInfo); + gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); + hboxLayout = new QHBoxLayout(); +#ifndef Q_OS_MAC + hboxLayout->setSpacing(6); +#endif +#ifndef Q_OS_MAC + hboxLayout->setContentsMargins(0, 0, 0, 0); +#endif + hboxLayout->setObjectName(QString::fromUtf8("hboxLayout")); + Name = new QLabel(MeshInfo); + Name->setObjectName(QString::fromUtf8("Name")); + + hboxLayout->addWidget(Name); + + LECaseName = new QLineEdit(MeshInfo); + LECaseName->setObjectName(QString::fromUtf8("LECaseName")); + LECaseName->setMinimumSize(QSize(382, 21)); + + hboxLayout->addWidget(LECaseName); + + + gridLayout_2->addLayout(hboxLayout, 0, 0, 1, 2); + + hboxLayout1 = new QHBoxLayout(); +#ifndef Q_OS_MAC + hboxLayout1->setSpacing(6); +#endif + hboxLayout1->setContentsMargins(0, 0, 0, 0); + hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1")); + Directory = new QLabel(MeshInfo); + Directory->setObjectName(QString::fromUtf8("Directory")); + + hboxLayout1->addWidget(Directory); + + PushDir = new QPushButton(MeshInfo); + PushDir->setObjectName(QString::fromUtf8("PushDir")); + PushDir->setAutoDefault(false); + + hboxLayout1->addWidget(PushDir); + + LEDirName = new QLineEdit(MeshInfo); + LEDirName->setObjectName(QString::fromUtf8("LEDirName")); + LEDirName->setMinimumSize(QSize(382, 21)); + + hboxLayout1->addWidget(LEDirName); + + + gridLayout_2->addLayout(hboxLayout1, 1, 0, 1, 2); + + spacerItem = new QSpacerItem(20, 18, QSizePolicy::Minimum, QSizePolicy::Expanding); + + gridLayout_2->addItem(spacerItem, 2, 0, 1, 1); + + hboxLayout2 = new QHBoxLayout(); +#ifndef Q_OS_MAC + hboxLayout2->setSpacing(6); +#endif + hboxLayout2->setContentsMargins(0, 0, 0, 0); + hboxLayout2->setObjectName(QString::fromUtf8("hboxLayout2")); + Mesh_2 = new QLabel(MeshInfo); + Mesh_2->setObjectName(QString::fromUtf8("Mesh_2")); + + hboxLayout2->addWidget(Mesh_2); + + PushFichier = new QPushButton(MeshInfo); + PushFichier->setObjectName(QString::fromUtf8("PushFichier")); + PushFichier->setAutoDefault(false); + + hboxLayout2->addWidget(PushFichier); + + LEFileName = new QLineEdit(MeshInfo); + LEFileName->setObjectName(QString::fromUtf8("LEFileName")); + LEFileName->setMinimumSize(QSize(382, 21)); + + hboxLayout2->addWidget(LEFileName); + + + gridLayout_2->addLayout(hboxLayout2, 3, 0, 1, 2); + + spacerItem1 = new QSpacerItem(20, 1, QSizePolicy::Minimum, QSizePolicy::Expanding); + + gridLayout_2->addItem(spacerItem1, 4, 0, 1, 1); + + GBOptions = new QGroupBox(MeshInfo); + GBOptions->setObjectName(QString::fromUtf8("GBOptions")); + gridLayout = new QGridLayout(GBOptions); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + CBQuality = new QCheckBox(GBOptions); + CBQuality->setObjectName(QString::fromUtf8("CBQuality")); + + gridLayout->addWidget(CBQuality, 0, 0, 1, 1); + + CBConnection = new QCheckBox(GBOptions); + CBConnection->setObjectName(QString::fromUtf8("CBConnection")); + + gridLayout->addWidget(CBConnection, 0, 1, 1, 1); + + CBDiametre = new QCheckBox(GBOptions); + CBDiametre->setObjectName(QString::fromUtf8("CBDiametre")); + + gridLayout->addWidget(CBDiametre, 1, 0, 1, 1); + + CBBlockSize = new QCheckBox(GBOptions); + CBBlockSize->setObjectName(QString::fromUtf8("CBBlockSize")); + + gridLayout->addWidget(CBBlockSize, 1, 1, 1, 1); + + CBEntanglement = new QCheckBox(GBOptions); + CBEntanglement->setObjectName(QString::fromUtf8("CBEntanglement")); + + gridLayout->addWidget(CBEntanglement, 2, 0, 1, 2); + + + gridLayout_2->addWidget(GBOptions, 5, 0, 1, 1); + + verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + + gridLayout_2->addItem(verticalSpacer, 6, 0, 1, 1); + + GroupButtons = new QGroupBox(MeshInfo); + GroupButtons->setObjectName(QString::fromUtf8("GroupButtons")); + gridLayout1 = new QGridLayout(GroupButtons); +#ifndef Q_OS_MAC + gridLayout1->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout1->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + buttonHelp = new QPushButton(GroupButtons); + buttonHelp->setObjectName(QString::fromUtf8("buttonHelp")); + buttonHelp->setAutoDefault(false); + + gridLayout1->addWidget(buttonHelp, 0, 4, 1, 1); + + buttonApply = new QPushButton(GroupButtons); + buttonApply->setObjectName(QString::fromUtf8("buttonApply")); + buttonApply->setAutoDefault(false); + + gridLayout1->addWidget(buttonApply, 0, 1, 1, 1); + + buttonOk = new QPushButton(GroupButtons); + buttonOk->setObjectName(QString::fromUtf8("buttonOk")); + buttonOk->setAutoDefault(false); + + gridLayout1->addWidget(buttonOk, 0, 0, 1, 1); + + buttonCancel = new QPushButton(GroupButtons); + buttonCancel->setObjectName(QString::fromUtf8("buttonCancel")); + buttonCancel->setAutoDefault(false); + + gridLayout1->addWidget(buttonCancel, 0, 2, 1, 1); + + + gridLayout_2->addWidget(GroupButtons, 7, 0, 1, 1); + + spacer_2 = new QSpacerItem(128, 25, QSizePolicy::Fixed, QSizePolicy::Minimum); + + gridLayout_2->addItem(spacer_2, 7, 1, 1, 1); + + + retranslateUi(MeshInfo); + + QMetaObject::connectSlotsByName(MeshInfo); + } // setupUi + + void retranslateUi(QDialog *MeshInfo) + { + MeshInfo->setWindowTitle(QApplication::translate("MeshInfo", "Information on a mesh", 0, QApplication::UnicodeUTF8)); + Name->setText(QApplication::translate("MeshInfo", "Name", 0, QApplication::UnicodeUTF8)); + Directory->setText(QApplication::translate("MeshInfo", "Directory", 0, QApplication::UnicodeUTF8)); + PushDir->setText(QString()); + Mesh_2->setText(QApplication::translate("MeshInfo", "Mesh", 0, QApplication::UnicodeUTF8)); + PushFichier->setText(QString()); + GBOptions->setTitle(QApplication::translate("MeshInfo", "Options", 0, QApplication::UnicodeUTF8)); + CBQuality->setText(QApplication::translate("MeshInfo", "Quality", 0, QApplication::UnicodeUTF8)); + CBConnection->setText(QApplication::translate("MeshInfo", "Connection", 0, QApplication::UnicodeUTF8)); + CBDiametre->setText(QApplication::translate("MeshInfo", "Diametre", 0, QApplication::UnicodeUTF8)); + CBBlockSize->setText(QApplication::translate("MeshInfo", "Group size", 0, QApplication::UnicodeUTF8)); + CBEntanglement->setText(QApplication::translate("MeshInfo", "Entanglement", 0, QApplication::UnicodeUTF8)); + GroupButtons->setTitle(QString()); + buttonHelp->setText(QApplication::translate("MeshInfo", "Help", 0, QApplication::UnicodeUTF8)); + buttonApply->setText(QApplication::translate("MeshInfo", "Apply", 0, QApplication::UnicodeUTF8)); + buttonOk->setText(QApplication::translate("MeshInfo", "OK", 0, QApplication::UnicodeUTF8)); + buttonCancel->setText(QApplication::translate("MeshInfo", "Cancel", 0, QApplication::UnicodeUTF8)); + } // retranslateUi + +}; + +namespace Ui { + class MeshInfo: public Ui_MeshInfo {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // MESHINFO_H diff --git a/src/HOMARDGUI/MeshInfo.ui b/src/HOMARDGUI/MeshInfo.ui new file mode 100644 index 00000000..c3e55aa0 --- /dev/null +++ b/src/HOMARDGUI/MeshInfo.ui @@ -0,0 +1,285 @@ + + + MeshInfo + + + + 0 + 0 + 536 + 372 + + + + + 0 + 0 + + + + Information on a mesh + + + true + + + + + + 6 + + + 0 + + + + + Name + + + + + + + + 382 + 21 + + + + + + + + + + 6 + + + 0 + + + + + Directory + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + Qt::Vertical + + + + 20 + 18 + + + + + + + + 6 + + + 0 + + + + + Mesh + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + + + + + Options + + + + + + Quality + + + + + + + Connection + + + + + + + Diametre + + + + + + + Group size + + + + + + + Entanglement + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 9 + + + 6 + + + + + Help + + + false + + + + + + + Apply + + + false + + + + + + + OK + + + false + + + + + + + Cancel + + + false + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 128 + 25 + + + + + + + + + diff --git a/src/HOMARDGUI/MonIterInfo.cxx b/src/HOMARDGUI/MonIterInfo.cxx new file mode 100644 index 00000000..4709685e --- /dev/null +++ b/src/HOMARDGUI/MonIterInfo.cxx @@ -0,0 +1,196 @@ +// Copyright (C) 2011-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +using namespace std; + +#include "MonIterInfo.h" + +#include +#include +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + + +// ----------------------------------------------------------------------------------------- +MonIterInfo::MonIterInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString IterName) +// ----------------------------------------------------------------------------------------- +/* Constructs a MonIterInfo + * Inherits from CasHomard + * Sets attributes to default values + */ + : + Ui_IterInfo(), + _IterName(IterName), + _aCaseName(""), + _BlockSize(0), + _Connection(0), + _Diametre(0), + _Entanglement(0), + _Quality(0), + _Option(-1) +{ + MESSAGE("appel de _duplicate"); + _myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen); + setupUi(this); + setModal(modal); + InitConnect(); + + adjustSize(); +} + +// ------------------------------------------------------------------------ +MonIterInfo::~MonIterInfo() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonIterInfo::InitConnect() +// ------------------------------------------------------------------------ +{ + MESSAGE("InitConnect"); + connect( CBBlockSize, SIGNAL(stateChanged(int)), this, SLOT(SetBlockSize())); + connect( CBConnection, SIGNAL(stateChanged(int)), this, SLOT(SetConnection())); + connect( CBDiametre, SIGNAL(stateChanged(int)), this, SLOT(SetDiametre())); + connect( CBEntanglement, SIGNAL(stateChanged(int)), this, SLOT(SetEntanglement())); + connect( CBQuality, SIGNAL(stateChanged(int)), this, SLOT(SetQuality())); + + connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK())); + connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply())); + connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close())); + connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp())); +} +// ------------------------------- +bool MonIterInfo::PushOnApply() +// -------------------------------- +{ + MESSAGE("PushOnApply"); + + // Au moins une option a ete choisie + if ( ( _Quality == 0 ) and ( _Diametre == 0 ) and ( _Connection == 0 ) and ( _BlockSize == 0 ) and ( _Entanglement == 0 ) ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MESH_INFO_1") ); + return false; + } + + // Recuperation de l'iteration + aIter = _myHomardGen->GetIteration(_IterName.toStdString().c_str()) ; + + // Lancement de l'analyse + try + { + aIter->MeshInfoOption( _Quality, _Diametre, _Connection, _BlockSize, _Entanglement, _Option ); + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QString(CORBA::string_dup(S_ex.details.text)) ); + return false; + } + + // Le bilan de l'analyse a afficher + QString aFileName = aIter->GetFileInfo() ; +// // Creation de l'objet fichier QT associe +// QFile file( aFileName ); +// // Ouverture +// bool bOpen = file.open( QIODevice::ReadOnly | QIODevice::Text ) ; +// // +// if ( bOpen ) +// { +// Ui_EditFile() ; +// // Lecture +// // Remarque : il serait plus clair de tout lire d'un coup mais cela ne marche pas ! +// // alors on fait ligne par ligne et on cumule en ajoutant un saut de ligne. +// QTextStream stream( &file ); +// QString tout; +// while ( !stream.atEnd() ) +// { +// tout = tout + stream.readLine() + "\n" ; +// } +// QTBEditFile->setPlainText( tout ); +// QMessageBox::information( 0, QObject::tr("HOM_MESH_INFO_0"), +// tout ); +// } + + // Message simple en attendant de savoir faire + QMessageBox::information( 0, QObject::tr("HOM_MESH_INFO_0"), + QObject::tr("HOM_MESH_INFO_2")+aFileName ); + + HOMARD_UTILS::updateObjBrowser(); + return true; +} +// --------------------------- +void MonIterInfo::PushOnOK() +// --------------------------- +{ + bool bOK = PushOnApply(); + if ( bOK ) this->close(); +} +//------------------------------ +void MonIterInfo::PushOnHelp() +//------------------------------- +{ + HOMARD_UTILS::PushOnHelp(QString("gui_mesh_info.html")); +} +// ------------------------------------------------------------------------ +void MonIterInfo::SetBlockSize() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetBlockSize "); + if ( CBBlockSize->isChecked() ) { _BlockSize = 1 ; } + else { _BlockSize = 0 ; } +} +// ------------------------------------------------------------------------ +void MonIterInfo::SetConnection() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetConnection "); + if ( CBConnection->isChecked() ) { _Connection = 1 ; } + else { _Connection = 0 ; } +} +// ------------------------------------------------------------------------ +void MonIterInfo::SetDiametre() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetDiametre "); + if ( CBDiametre->isChecked() ) { _Diametre = 1 ; } + else { _Diametre = 0 ; } +} +// ------------------------------------------------------------------------ +void MonIterInfo::SetEntanglement() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetEntanglement "); + if ( CBEntanglement->isChecked() ) { _Entanglement = 1 ; } + else { _Entanglement = 0 ; } +} +// ------------------------------------------------------------------------ +void MonIterInfo::SetQuality() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetQuality "); + if ( CBQuality->isChecked() ) { _Quality = 1 ; } + else { _Quality = 0 ; } +} diff --git a/src/HOMARDGUI/MonIterInfo.h b/src/HOMARDGUI/MonIterInfo.h new file mode 100644 index 00000000..a0d21d1d --- /dev/null +++ b/src/HOMARDGUI/MonIterInfo.h @@ -0,0 +1,77 @@ +// Copyright (C) 2011-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_ITERINFO_H +#define MON_ITERINFO_H + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Cas) + +#include +#include +#include +#include "EditFile.h" + +class QListBox; + +class MonIterInfo : public QDialog, public Ui_IterInfo +{ + Q_OBJECT + +public: + MonIterInfo( QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString IterName); + ~MonIterInfo(); + +protected : + MonIterInfo( QWidget* parent, HOMARD::HOMARD_Gen_var myHomardGen, QString IterName ); + + QString _IterName; + QString _aCaseName; + + int _BlockSize; + int _Connection; + int _Diametre; + int _Entanglement; + int _Quality; + int _Option; + + HOMARD::HOMARD_Iteration_var aIter ; + HOMARD::HOMARD_Gen_var _myHomardGen; + + virtual void InitConnect(); + +public slots: + + virtual void SetBlockSize(); + virtual void SetConnection(); + virtual void SetEntanglement(); + virtual void SetDiametre(); + virtual void SetQuality(); + + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +#endif // MON_ITERINFO_H diff --git a/src/HOMARDGUI/MonMeshInfo.cxx b/src/HOMARDGUI/MonMeshInfo.cxx new file mode 100644 index 00000000..ffffad6e --- /dev/null +++ b/src/HOMARDGUI/MonMeshInfo.cxx @@ -0,0 +1,263 @@ +// Copyright (C) 2011-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +using namespace std; + +#include "MonMeshInfo.h" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + + +// ----------------------------------------------------------------------------------------- +MonMeshInfo::MonMeshInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen) +// ----------------------------------------------------------------------------------------- +/* Constructs a MonMeshInfo + * Inherits from CasHomard + * Sets attributes to default values + */ + : + Ui_MeshInfo(), + _aCaseName(""),_aDirName(""), + _BlockSize(0), + _Connection(0), + _Diametre(0), + _Entanglement(0), + _Quality(0) +{ + _myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen); + setupUi(this); + setModal(modal); + InitConnect(); + + SetNewCaseName() ; + adjustSize(); +} + +// ------------------------------------------------------------------------ +MonMeshInfo::~MonMeshInfo() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonMeshInfo::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( LECaseName, SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged())); + connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName())); + connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetFileName())); + + connect( CBBlockSize, SIGNAL(stateChanged(int)), this, SLOT(SetBlockSize())); + connect( CBConnection, SIGNAL(stateChanged(int)), this, SLOT(SetConnection())); + connect( CBDiametre, SIGNAL(stateChanged(int)), this, SLOT(SetDiametre())); + connect( CBEntanglement, SIGNAL(stateChanged(int)), this, SLOT(SetEntanglement())); + connect( CBQuality, SIGNAL(stateChanged(int)), this, SLOT(SetQuality())); + + connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK())); + connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply())); + connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close())); + connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp())); +} +// ------------------------------- +bool MonMeshInfo::PushOnApply() +// -------------------------------- +{ + MESSAGE("PushOnApply"); + QString aCaseName=LECaseName->text().trimmed(); + if ( aCaseName == "" ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_NAME") ); + return false; + } + + QString aDirName=LEDirName->text().trimmed(); + if (aDirName == QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_1") ); + return false; + } + if ((aDirName != _aDirName) and (_myHomardGen->VerifieDir( aDirName.toStdString().c_str()) == false)) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_2") ); + return false; + } + if (chdir(aDirName.toStdString().c_str()) != 0) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_3") ); + return false; + } + + QString aFileName=LEFileName->text().trimmed(); + if (aFileName ==QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_MESH") ); + return false; + } + + QString aMeshName = HOMARD_QT_COMMUN::LireNomMaillage(aFileName); + if (aMeshName == "" ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_2") ); + return false; + } + if ( ( _Quality == 0 ) and ( _Diametre == 0 ) and ( _Connection == 0 ) and ( _BlockSize == 0 ) and ( _Entanglement == 0 ) ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MESH_INFO") ); + return false; + } + + if (aCaseName != _aCaseName ) + { + _aCaseName = aCaseName; + try + { + _myHomardGen->MeshInfo( \ + CORBA::string_dup(_aCaseName.toStdString().c_str()), \ + CORBA::string_dup(aMeshName.toStdString().c_str()), \ + CORBA::string_dup(aFileName.toStdString().c_str()), \ + CORBA::string_dup(aDirName.toStdString().c_str()), \ + _Quality, _Diametre, _Connection, _BlockSize, _Entanglement ); + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QString(CORBA::string_dup(S_ex.details.text)) ); + return false; + } + } + + HOMARD_UTILS::updateObjBrowser(); + return true; +} +// --------------------------- +void MonMeshInfo::PushOnOK() +// --------------------------- +{ + bool bOK = PushOnApply(); + if ( bOK ) this->close(); +} +//------------------------------ +void MonMeshInfo::PushOnHelp() +//------------------------------- +{ + HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html")); +} +// --------------------------------- +void MonMeshInfo::SetNewCaseName() +// ------------------------------ +{ + HOMARD::listeCases_var MyCases = _myHomardGen->GetAllCasesName(); + int num = 0; QString aCaseName=""; + while (aCaseName=="" ) + { + aCaseName.setNum(num+1) ; + aCaseName.insert(0, QString("Case_")) ; + for ( int i=0; ilength(); i++) + { + if ( aCaseName == QString((MyCases)[i])) + { + num=num+1; + aCaseName=""; + break; + } + } + } + LECaseName->clear() ; + LECaseName->insert(aCaseName); +} + +// ------------------------------------------------------------------------ +void MonMeshInfo::SetDirName() +// ------------------------------------------------------------------------ +{ + QString aDirName=QFileDialog::getExistingDirectory (); + if (!(aDirName.isEmpty()))LEDirName->setText(aDirName); +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetFileName() +// ------------------------------------------------------------------------ +{ + QString fileName0 = LEFileName->text().trimmed(); + QString fileName = HOMARD_QT_COMMUN::PushNomFichier(); + if (fileName.isEmpty()) fileName = fileName0 ; + LEFileName->setText(fileName); +} +// ------------------------------------------------------------------------ +void MonMeshInfo::CaseNameChanged() +// ------------------------------------------------------------------------ +{ + if (_aCaseName != LECaseName->text().trimmed()) + { + LEFileName->setReadOnly(false); + PushFichier->show(); + } +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetBlockSize() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetBlockSize "); + if ( CBBlockSize->isChecked() ) { _BlockSize = 1 ; } + else { _BlockSize = 0 ; } +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetConnection() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetConnection "); + if ( CBConnection->isChecked() ) { _Connection = 1 ; } + else { _Connection = 0 ; } +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetDiametre() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetDiametre "); + if ( CBDiametre->isChecked() ) { _Diametre = 1 ; } + else { _Diametre = 0 ; } +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetEntanglement() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetEntanglement "); + if ( CBEntanglement->isChecked() ) { _Entanglement = 1 ; } + else { _Entanglement = 0 ; } +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetQuality() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetQuality "); + if ( CBQuality->isChecked() ) { _Quality = 1 ; } + else { _Quality = 0 ; } +} diff --git a/src/HOMARDGUI/MonMeshInfo.h b/src/HOMARDGUI/MonMeshInfo.h new file mode 100644 index 00000000..5892ba51 --- /dev/null +++ b/src/HOMARDGUI/MonMeshInfo.h @@ -0,0 +1,74 @@ +// Copyright (C) 2011-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_MESHINFO_H +#define MON_MESHINFO_H + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Cas) + +#include +#include + +class MonMeshInfo : public QDialog, public Ui_MeshInfo +{ + Q_OBJECT + +public: + MonMeshInfo( QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen); + ~MonMeshInfo(); + +protected : + QString _aCaseName; + QString _aDirName; + + int _BlockSize; + int _Connection; + int _Diametre; + int _Entanglement; + int _Quality; + + HOMARD::HOMARD_Cas_var aCase ; + HOMARD::HOMARD_Gen_var _myHomardGen; + + virtual void InitConnect(); + virtual void SetNewCaseName(); + +public slots: + virtual void SetDirName(); + virtual void SetFileName(); + + virtual void SetBlockSize(); + virtual void SetConnection(); + virtual void SetEntanglement(); + virtual void SetDiametre(); + virtual void SetQuality(); + + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + + virtual void CaseNameChanged(); +}; + +#endif // MON_MESHINFO_H diff --git a/src/HOMARD_I/HOMARD_Cas_i.cxx b/src/HOMARD_I/HOMARD_Cas_i.cxx index 8e456ec3..ec75d436 100755 --- a/src/HOMARD_I/HOMARD_Cas_i.cxx +++ b/src/HOMARD_I/HOMARD_Cas_i.cxx @@ -185,7 +185,6 @@ void HOMARD_Cas_i::SetGroups( const HOMARD::ListGroupType& ListGroup ) { ListString.push_back(std::string(ListGroup[i])); } - myHomardCas->SetGroups( ListString ); } //============================================================================= @@ -259,6 +258,26 @@ CORBA::Long HOMARD_Cas_i::GetPyram() return myHomardCas->GetPyram(); } //============================================================================= +void HOMARD_Cas_i::MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte) +{ + MESSAGE ( "MeshInfo : information sur le maillage initial du cas" ); + ASSERT( myHomardCas ); +// +// Nom de l'iteration + char* IterName = GetIter0Name() ; + CORBA::Long etatMenage = -1 ; + CORBA::Long modeHOMARD = 7 ; + CORBA::Long Option = 1 ; + if ( Qual != 0 ) { modeHOMARD = modeHOMARD*5 ; } + if ( Diam != 0 ) { modeHOMARD = modeHOMARD*19 ; } + if ( Conn != 0 ) { modeHOMARD = modeHOMARD*11 ; } + if ( Tail != 0 ) { modeHOMARD = modeHOMARD*13 ; } + if ( Inte != 0 ) { modeHOMARD = modeHOMARD*3 ; } + CORBA::Long codret = _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option) ; + MESSAGE ( "MeshInfo : codret = " << codret ); + return ; +} +//============================================================================= //============================================================================= // Liens avec les autres structures //============================================================================= diff --git a/src/HOMARD_I/HOMARD_Cas_i.hxx b/src/HOMARD_I/HOMARD_Cas_i.hxx index 740e2eef..27355f2a 100644 --- a/src/HOMARD_I/HOMARD_Cas_i.hxx +++ b/src/HOMARD_I/HOMARD_Cas_i.hxx @@ -85,6 +85,8 @@ public: void SetPyram( CORBA::Long Pyram ); CORBA::Long GetPyram(); + void MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte); + // Liens avec les autres structures char* GetIter0Name(); HOMARD::HOMARD_Iteration_ptr GetIter0() ; diff --git a/src/HOMARD_I/HOMARD_Gen_i.cxx b/src/HOMARD_I/HOMARD_Gen_i.cxx index 3f54b8d5..6aba5456 100755 --- a/src/HOMARD_I/HOMARD_Gen_i.cxx +++ b/src/HOMARD_I/HOMARD_Gen_i.cxx @@ -499,29 +499,6 @@ void HOMARD_Gen_i::InvalideBoundary(const char* BoundaryName) }; } //============================================================================= -void HOMARD_Gen_i::InvalideZone(const char* ZoneName) -{ - MESSAGE( "InvalideZone : ZoneName = " << ZoneName ); - HOMARD::HOMARD_Zone_var myZone = myContextMap[GetCurrentStudyID()]._mesZones[ZoneName]; - if (CORBA::is_nil(myZone)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid Zone "; - throw SALOME::SALOME_Exception(es); - return ; - }; - HOMARD::listeHypo* maListe = myZone->GetHypo(); - int numberOfHypo = maListe->length(); - MESSAGE( ".. numberOfHypo = " << numberOfHypo ); - for (int NumeHypo = 0; NumeHypo< numberOfHypo; NumeHypo++) - { - std::string nomHypo = std::string((*maListe)[NumeHypo]); - MESSAGE( ".. nomHypo = " << nomHypo ); - InvalideHypo(nomHypo.c_str()); - } -} -//============================================================================= void HOMARD_Gen_i::InvalideHypo(const char* nomHypo) { MESSAGE( "InvalideHypo : nomHypo = " << nomHypo ); @@ -597,11 +574,12 @@ void HOMARD_Gen_i::InvalideIter(const char* nomIter) throw SALOME::SALOME_Exception(es); return ; }; - const char* dirParent = myCase->GetDirName(); + const char* dirCase = myCase->GetDirName(); const char* nomDir = myIteration->GetDirName(); const char* nomFichier = myIteration->GetMeshFile(); - std::string commande= "rm -rf " + std::string(dirParent) + "/" + std::string(nomDir); + std::string commande= "rm -rf " + std::string(dirCase) + "/" + std::string(nomDir); commande = commande + ";rm -rf " + std::string(nomFichier); + MESSAGE ( "commande = " << commande ); if ((system(commande.c_str())) != 0) { SALOME::ExceptionStruct es; @@ -617,6 +595,85 @@ void HOMARD_Gen_i::InvalideIter(const char* nomIter) } //============================================================================= +void HOMARD_Gen_i::InvalideIterInfo(const char* nomIter) +{ + MESSAGE("InvalideIterInfo : nomIter = " << nomIter); + HOMARD::HOMARD_Iteration_var myIteration = myContextMap[GetCurrentStudyID()]._mesIterations[nomIter]; + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid Iteration "; + throw SALOME::SALOME_Exception(es); + return ; + }; + + SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myCurrentStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + SALOMEDS::ChildIterator_var aIter = myCurrentStudy->NewChildIterator(aIterSO); + for (; aIter->More(); aIter->Next()) + { + SALOMEDS::SObject_var so = aIter->Value(); + SALOMEDS::GenericAttribute_var anAttr; + if (!so->FindAttribute(anAttr, "AttributeComment")) continue; + SALOMEDS::AttributeComment_var aCommentAttr = SALOMEDS::AttributeComment::_narrow(anAttr); + std::string value (aCommentAttr->Value()); +/* MESSAGE("... value = " << value);*/ + if( (value == std::string("logInfo")) or ( value == std::string("SummaryInfo")) ) + { + SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder(); + aStudyBuilder->RemoveObject(so); + } + } + + const char * nomCas = myIteration->GetCaseName(); + HOMARD::HOMARD_Cas_var myCase = myContextMap[GetCurrentStudyID()]._mesCas[nomCas]; + if (CORBA::is_nil(myCase)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid Case Context "; + throw SALOME::SALOME_Exception(es); + return ; + }; + const char* dirCase = myCase->GetDirName(); + const char* nomDir = myIteration->GetDirName(); + std::string commande = "rm -f " + std::string(dirCase) + "/" + std::string(nomDir) + "/info* " ; + commande += std::string(dirCase) + "/" + std::string(nomDir) + "/Liste.*info" ; +/* MESSAGE ( "commande = " << commande );*/ + if ((system(commande.c_str())) != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Menage du repertoire de calcul impossible" ; + throw SALOME::SALOME_Exception(es); + return ; + } + +} +//============================================================================= +void HOMARD_Gen_i::InvalideZone(const char* ZoneName) +{ + MESSAGE( "InvalideZone : ZoneName = " << ZoneName ); + HOMARD::HOMARD_Zone_var myZone = myContextMap[GetCurrentStudyID()]._mesZones[ZoneName]; + if (CORBA::is_nil(myZone)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid Zone "; + throw SALOME::SALOME_Exception(es); + return ; + }; + HOMARD::listeHypo* maListe = myZone->GetHypo(); + int numberOfHypo = maListe->length(); + MESSAGE( ".. numberOfHypo = " << numberOfHypo ); + for (int NumeHypo = 0; NumeHypo< numberOfHypo; NumeHypo++) + { + std::string nomHypo = std::string((*maListe)[NumeHypo]); + MESSAGE( ".. nomHypo = " << nomHypo ); + InvalideHypo(nomHypo.c_str()); + } +} +//============================================================================= //============================================================================= // //============================================================================= @@ -909,6 +966,28 @@ HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::GetBoundary(const char* nomBoundary) //============================================================================= //============================================================================= +//============================================================================= +//============================================================================= +// Informations +//============================================================================= +//============================================================================= +void HOMARD_Gen_i::MeshInfo(const char* nomCas, const char* MeshName, const char* MeshFile, const char* DirName, CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte) +{ + MESSAGE ( "MeshInfo : nomCas = " << nomCas << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile ); + MESSAGE ( "Qual = " << Qual << ", Diam = " << Diam << ", Conn = " << Conn << ", Tail = " << Tail << ", Inte = " << Inte ); + IsValidStudy () ; + +// Creation du cas + HOMARD::HOMARD_Cas_ptr myCase = CreateCase(nomCas, MeshName, MeshFile) ; + myCase->SetDirName(DirName) ; +// Analyse + myCase->MeshInfo(Qual, Diam, Conn, Tail, Inte) ; + + return ; +} +//============================================================================= +//============================================================================= + //============================================================================= //============================================================================= // Recuperation des structures par le contexte @@ -1042,7 +1121,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase(const char* nomCas, const char* HOMARD::HOMARD_Iteration_var anIter = newIteration(); myContextMap[GetCurrentStudyID()]._mesIterations[NomIteration] = anIter; std::ostringstream DirName; - DirName << "I_00"; + DirName << "I00"; anIter->SetDirName(DirName.str().c_str()); anIter->SetName(NomIteration.c_str()); @@ -1413,20 +1492,215 @@ HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneDiskWithHole(const char* ZoneNam //============================================================================= //============================================================================= -// Calcul d'une iteration +// Traitement d'une iteration +// etatMenage = 1 : destruction du repertoire d'execution +// modeHOMARD = 1 : adaptation +// != 1 : information avec les options modeHOMARD +// Option >0 : appel depuis python +// <0 : appel depuis GUI //============================================================================= //============================================================================= -CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMenage) +CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMenage, CORBA::Long modeHOMARD, CORBA::Long Option) { - MESSAGE ( "Compute : calcul de " << NomIteration ); + MESSAGE ( "Compute : traitement de " << NomIteration << ", avec modeHOMARD = " << modeHOMARD << ", avec Option = " << Option ); + + // A. Prealable + int codret = 0; -// A. Prealable -// A.1. La base + // A.1. L'objet iteration HOMARD::HOMARD_Iteration_var myIteration = myContextMap[GetCurrentStudyID()]._mesIterations[NomIteration]; ASSERT(!CORBA::is_nil(myIteration)); -// A.2. On ne calcule pas l iteration 0 + // A.2. Numero de l'iteration + // siterp1 : numero de l'iteration a traiter + // Si adaptation : + // siter : numero de l'iteration parent, ou 0 si deja au debut mais cela ne servira pas ! + // Ou si information : + // siter = siterp1 + int NumeIter = myIteration->GetNumber(); + std::string siterp1 ; + std::stringstream saux1 ; + saux1 << NumeIter ; + siterp1 = saux1.str() ; + if (NumeIter < 10) { siterp1 = "0" + siterp1 ; } + + std::string siter ; + if ( modeHOMARD==1 ) + { + std::stringstream saux0 ; + int iaux = max(0, NumeIter-1) ; + saux0 << iaux ; + siter = saux0.str() ; + if (NumeIter < 11) { siter = "0" + siter ; } + } + else + { siter = siterp1 ; } + + // A.3. Le cas + const char* nomCas = myIteration->GetCaseName(); + HOMARD::HOMARD_Cas_var myCase = myContextMap[GetCurrentStudyID()]._mesCas[nomCas]; + ASSERT(!CORBA::is_nil(myCase)); + + // B. Les repertoires + // B.1. Le repertoire courant + char* nomDirWork = getenv("PWD") ; + // B.2. Le sous-repertoire de l'iteration a traiter + char* DirCompute = ComputeDir(myCase, myIteration, etatMenage); + MESSAGE( ". DirCompute = " << DirCompute ); + + // C. Le fichier des messages + // C.1. Le deroulement de l'execution de HOMARD + std::string LogFile = DirCompute ; + LogFile += "/Liste" ; + if ( modeHOMARD == 1 ) { LogFile += "." + siter + ".vers." + siterp1 ; } + LogFile += ".log" ; + MESSAGE (". LogFile = " << LogFile); + if ( modeHOMARD == 1 ) { myIteration->SetLogFile(LogFile.c_str()); } + // C.2. Le bilan de l'analyse du maillage + std::string FileInfo = DirCompute ; + FileInfo += "/" ; + if ( modeHOMARD == 1 ) { FileInfo += "apad" ; } + else + { if ( NumeIter == 0 ) { FileInfo += "info_av" ; } + else { FileInfo += "info_ap" ; } + } + FileInfo += "." + siterp1 + ".bilan" ; + myIteration->SetFileInfo(FileInfo.c_str()); + + // D. On passe dans le repertoire de l'iteration a calculer + MESSAGE ( ". On passe dans DirCompute = " << DirCompute ); + chdir(DirCompute) ; + + // E. Les donnees de l'execution HOMARD + // E.1. L'objet du texte du fichier de configuration + HomardDriver* myDriver = new HomardDriver(siter, siterp1); + myDriver->TexteInit(DirCompute, LogFile); + + // E.2. Le maillage associe a l'iteration + const char* NomMesh = myIteration->GetMeshName(); + MESSAGE ( ". NomMesh = " << NomMesh ); + const char* MeshFile = myIteration->GetMeshFile(); + MESSAGE ( ". MeshFile = " << MeshFile ); + + // E.3. Les donnees du traitement HOMARD + int iaux ; + if ( modeHOMARD == 1 ) + { + iaux = 1 ; + myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ) ; + myDriver->TexteMaillage(NomMesh, MeshFile, 1); + codret = ComputeAdap(myCase, myIteration, etatMenage, myDriver, Option) ; + } + else + { + InvalideIterInfo(NomIteration); + myDriver->TexteInfo( modeHOMARD, NumeIter ) ; + iaux = 0 ; + myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ) ; + myDriver->TexteMaillage(NomMesh, MeshFile, 0); + myDriver->CreeFichierDonn(); + } + + // E.4. Ajout des informations liees a l'eventuel suivi de frontiere + DriverTexteBoundary(myCase, myDriver) ; + + // E.5. Ecriture du texte dans le fichier + if (codret == 0) + { myDriver->CreeFichier(); } + +// G. Execution +// + int codretexec = 12 ; + if (codret == 0) + { + codretexec = myDriver->ExecuteHomard(Option); +// + MESSAGE ( "Erreur en executant HOMARD : " << codretexec ); + if ( modeHOMARD == 1 ) + { + if (codretexec == 0) { SetEtatIter(NomIteration,true); } + else { SetEtatIter(NomIteration,false); } + // GERALD -- QMESSAGE BOX + } + } + + // H. Gestion des resultats + if (codret == 0) + { + std::string Commentaire ; + // H.1. Le fichier des messages, dans tous les cas + Commentaire = "log" ; + if ( modeHOMARD == 1 ) { Commentaire += " " + siterp1 ; } + else { Commentaire += "Info" ; } + PublishFileUnderIteration(NomIteration, LogFile.c_str(), Commentaire.c_str()); + + // H.2. Si tout s'est bien passe : + if (codretexec == 0) + { + // H.2.1. Le fichier de bilan + Commentaire = "Summary" ; + if ( modeHOMARD == 1 ) { Commentaire += " " + siterp1 ; } + else { Commentaire += "Info" ; } + PublishFileUnderIteration(NomIteration, FileInfo.c_str(), Commentaire.c_str()); + // H.2.2. Le fichier de maillage obtenu + if ( modeHOMARD == 1 ) + { + std::stringstream saux0 ; + Commentaire = "Iteration" ; + Commentaire += " " + siter ; + PublishFileUnderIteration(NomIteration, MeshFile, Commentaire.c_str()); + PublishResultInSmesh(MeshFile, 1); + } + } + // H.3 Message d'erreur en cas de probleme + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "Error during the adaptation.\n" ; + try + { + ifstream fichier(LogFile.c_str(), ios::in); + string ligne; + while(getline(fichier, ligne) and (ligne != "===== HOMARD ===== STOP =====")); + while (getline(fichier, ligne)) { text += ligne+ "\n";}; + } + catch (...) { + text += "no log file ...."; + } + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + } + + // I. Menage et retour dans le repertoire du cas + if (codret == 0) + { + delete myDriver; + MESSAGE ( ". On retourne dans nomDirWork = " << nomDirWork ); + chdir(nomDirWork); + } + + return codretexec ; +} +//============================================================================= +// Calcul d'une iteration : partie specifique a l'adaptation +//============================================================================= +CORBA::Long HOMARD_Gen_i::ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option) +{ + MESSAGE ( "ComputeAdap" ); + + // A. Prealable + // A.1. Bases + int codret = 0; + // Numero de l'iteration int NumeIter = myIteration->GetNumber(); + std::stringstream saux0 ; + saux0 << NumeIter-1 ; + std::string siter = saux0.str() ; + if (NumeIter < 11) { siter = "0" + siter ; } + + // A.2. On ne calcule pas l iteration 0 if ( NumeIter == 0 ) { SALOME::ExceptionStruct es; @@ -1436,7 +1710,7 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena return 1; }; -// A.3. On verifie qu il y a une hypothese (erreur improbable); + // A.3. On verifie qu il y a une hypothese (erreur improbable); const char* nomHypo = myIteration->GetHypoName(); if (std::string(nomHypo) == std::string("")) { @@ -1445,17 +1719,19 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena es.text= "This iteration does not have any associated hypothesis."; throw SALOME::SALOME_Exception(es); return 2; - } + }; HOMARD::HOMARD_Hypothesis_var myHypo = myContextMap[GetCurrentStudyID()]._mesHypotheses[nomHypo]; ASSERT(!CORBA::is_nil(myHypo)); - // A.4. L'iteration parent + // B. L'iteration parent const char* nomIterationParent = myIteration->GetIterParentName(); HOMARD::HOMARD_Iteration_var myIterationParent = myContextMap[GetCurrentStudyID()]._mesIterations[nomIterationParent]; ASSERT(!CORBA::is_nil(myIterationParent)); + // Si l'iteration parent n'est pas calculee, on le fait (recursivite amont) if ( ! myIterationParent->GetEtat() ) { - int codret = Compute(nomIterationParent, etatMenage); + int iaux = 1 ; + int codret = Compute(nomIterationParent, etatMenage, iaux, Option); if (codret != 0) { // GERALD -- QMESSAGE BOX @@ -1463,167 +1739,52 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena } }; - // A.5. Le cas - const char* nomCas = myIteration->GetCaseName(); - HOMARD::HOMARD_Cas_var myCase = myContextMap[GetCurrentStudyID()]._mesCas[nomCas]; - ASSERT(!CORBA::is_nil(myCase)); - - // A.6. Les numeros d'iterations - int codret = 0; - std::stringstream saux0 ; - saux0 << NumeIter - 1 ; - std::string siter = saux0.str() ; - if (NumeIter < 11) { siter = "0" + siter ; } -// - std::stringstream saux1 ; - saux1 << NumeIter ; - std::string siterp1 = saux1.str() ; - if (NumeIter < 10) { siterp1 = "0" + siterp1 ; } - - // B. Les repertoires - // B.1. Le repertoire courant - char* nomDirWork = getenv("PWD") ; - // B.2. Le repertoire du cas - const char* nomDirCase = myCase->GetDirName(); - MESSAGE ( ". nomDirCase = " << nomDirCase ); + // C. Le sous-repertoire de l'iteration precedente + char* DirComputePa = ComputeDirPa(myCase, myIteration); + MESSAGE( ". DirComputePa = " << DirComputePa ); - // B.3. Le sous-repertoire de l'iteration a calculer, puis le repertoire complet a creer - // B.3.1. Le nom du sous-repertoire - const char* nomDirIt = myIteration->GetDirName(); + // D. Les donnees de l'adaptation HOMARD + // D.1. Le type de conformite + int ConfType = myCase->GetConfType(); + MESSAGE ( ". ConfType = " << ConfType ); - // B.3.2. Le nom complet du sous-repertoire - std::stringstream DirCompute ; - DirCompute << nomDirCase << "/" << nomDirIt; - MESSAGE (". DirCompute = " << DirCompute.str() ); + // D.2. Le maillage de depart + const char* NomMeshParent = myIterationParent->GetMeshName(); + MESSAGE ( ". NomMeshParent = " << NomMeshParent ); + const char* MeshFileParent = myIterationParent->GetMeshFile(); + MESSAGE ( ". MeshFileParent = " << MeshFileParent ); - // B.3.3. Si le sous-repertoire n'existe pas, on le cree - // Si le sous-repertoire existe : - // etatMenage = 0 : on sort en erreur si le repertoire n'est pas vide - // etatMenage = 1 : on fait le menage du repertoire - if (chdir(DirCompute.str().c_str()) != 0) + // D.3. Le maillage associe a l'iteration + const char* MeshFile = myIteration->GetMeshFile(); + MESSAGE ( ". MeshFile = " << MeshFile ); + FILE *file = fopen(MeshFile,"r"); + if (file != NULL) { -// Creation du repertoire car il n'existe pas : - if (mkdir(DirCompute.str().c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) + fclose(file); + if (etatMenage == 0) { - // GERALD -- QMESSAGE BOX - std::cerr << "Pb Creation du repertoire DirCompute = " << DirCompute.str() << std::endl; - ASSERT("Pb a la creation du repertoire" == 0); + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "MeshFile : " + std::string(MeshFile) + " already exists "; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + return 4; } - } - else - { -// Le repertoire existe -// On demande de faire le menage de son contenu : - if (etatMenage != 0) - { - MESSAGE (". Menage du repertoire DirCompute = " << DirCompute.str()); - std::string commande= "rm -rf " + DirCompute.str()+"/*" ; - int codret = system(commande.c_str()); - if (codret != 0) - { - // GERALD -- QMESSAGE BOX - std::cerr << ". Menage du repertoire de calcul" << DirCompute.str() << std::endl; - ASSERT("Pb au menage du repertoire de calcul" == 0); - } - } -// On n'a pas demande de faire le menage de son contenu : on sort en erreur : else { - DIR *dp; - struct dirent *dirp; - dp = opendir(DirCompute.str().c_str()); - bool result = true; - while ((dirp = readdir(dp)) != NULL && result ) - { - std::string file_name(dirp->d_name); - result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false - } - closedir(dp); - if ( result == false) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - std::string text = "Directory : " + DirCompute.str() + "is not empty"; - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - return 3; - } - } - } - - // B.4. Le sous-repertoire de l'iteration precedente - const char* nomDirItPa ; - std::stringstream DirComputePa ; - if (NumeIter == 1) - { - nomDirItPa = nomDirIt; - DirComputePa << DirCompute.str(); - } - else - { - nomDirItPa = myIterationParent->GetDirName(); - DirComputePa << nomDirCase << "/" << nomDirItPa; - } - MESSAGE( ". nomDirItPa = " << nomDirItPa); - MESSAGE( ". DirComputePa = " << DirComputePa.str() ); - - // B.5. Le fichier des messages - std::string MessFile = DirCompute.str() + "/Liste." + siter + ".vers." + siterp1 ; - MESSAGE (". MessFile = " << MessFile); - myIteration->SetMessFile(MessFile.c_str()); - - // C. On passe dans le repertoire de l'iteration a calculer - MESSAGE ( ". On passe dans DirCompute = " << DirCompute.str() ); - chdir(DirCompute.str().c_str()) ; - - // D. Les donnees du calcul HOMARD - // D.1. Le type de conformite - int ConfType = myCase->GetConfType(); - MESSAGE ( ". ConfType = " << ConfType ); - - // D.2. Le maillage n - const char* NomMeshParent = myIterationParent->GetMeshName(); - MESSAGE ( ". NomMeshParent = " << NomMeshParent ); - const char* MeshFileParent = myIterationParent->GetMeshFile(); - MESSAGE ( ". MeshFileParent = " << MeshFileParent ); - - // D.3. Le maillage n+1 - const char* NomMesh = myIteration->GetMeshName(); - MESSAGE ( ". NomMesh = " << NomMesh ); - const char* MeshFile = myIteration->GetMeshFile(); - MESSAGE ( ". MeshFile = " << MeshFile ); - FILE *file = fopen(MeshFile,"r"); - if (file != NULL) - { - fclose(file); - if (etatMenage == 0) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - std::string text = "MeshFile : " + std::string(MeshFile) + " already exists "; - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - return 4; - } - else - { - std::string commande = "rm -f " + std::string(MeshFile); - codret = system(commande.c_str()); - if (codret != 0) - { + std::string commande = "rm -f " + std::string(MeshFile); + codret = system(commande.c_str()); + if (codret != 0) + { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; std::string text = "PB with meshfile destruction "; es.text = CORBA::string_dup(text.c_str()); throw SALOME::SALOME_Exception(es); return 5; - } + } } } - else - { - codret = 0 ; - }; // D.4. Les types de raffinement et de deraffinement // Les appels corba sont lourds, il vaut mieux les grouper @@ -1633,119 +1794,256 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena int TypeRaff = (*ListTypes)[1]; int TypeDera = (*ListTypes)[2]; - // D.5. L'option d'interpolation des champs - int TypeFieldInterp = myHypo->GetTypeFieldInterp(); - // E. Texte du fichier de configuration // E.1. Incontournables du texte - HomardDriver* myDriver = new HomardDriver(siter, siterp1); - myDriver->TexteInit(DirCompute.str(), DirComputePa.str(),MessFile); + myDriver->TexteAdap(); + int iaux = 0 ; + myDriver->TexteMaillageHOMARD( DirComputePa, siter, iaux ) ; myDriver->TexteMaillage(NomMeshParent, MeshFileParent, 0); - myDriver->TexteMaillage(NomMesh, MeshFile, 1); myDriver->TexteConfRaffDera(ConfType, TypeAdap, TypeRaff, TypeDera); // E.2. Ajout des informations liees aux zones eventuelles - if (TypeAdap == 0) + if ( TypeAdap == 0 ) + { DriverTexteZone(myHypo, myDriver) ; } + + // E.3. Ajout des informations liees aux champs eventuels + if ( TypeAdap == 1 ) + { DriverTexteField(myIteration, myHypo, myDriver) ; } + + // E.4. Ajout des informations liees au filtrage eventuel par les groupes + HOMARD::ListGroupType* listeGroupes = myHypo->GetGroups(); + int numberOfGroups = listeGroupes->length(); + MESSAGE( ". Filtrage par " << numberOfGroups << " groupes"); + if (numberOfGroups > 0) { - HOMARD::listeZonesHypo* ListZone = myHypo->GetZones(); - int numberOfZonesx2 = ListZone->length(); - int NumZone ; + for (int NumGroup = 0; NumGroup< numberOfGroups; NumGroup++) + { + std::string GroupName = std::string((*listeGroupes)[NumGroup]); + MESSAGE( "... GroupName = " << GroupName ); + myDriver->TexteGroup(GroupName); + } + } - for (int iaux = 0; iaux< numberOfZonesx2; iaux++) + // E.5. Ajout des informations liees a l'eventuelle interpolation des champs + DriverTexteFieldInterp(myIteration, myHypo, myDriver) ; + + // E.6. Ajout des options avancees + int Pyram = myCase->GetPyram(); + MESSAGE ( ". Pyram = " << Pyram ); + int NivMax = myHypo->GetNivMax(); + MESSAGE ( ". NivMax = " << NivMax ); + double DiamMin = myHypo->GetDiamMin() ; + MESSAGE ( ". DiamMin = " << DiamMin ); + int AdapInit = myHypo->GetAdapInit(); + MESSAGE ( ". AdapInit = " << AdapInit ); + int LevelOutput = myHypo->GetLevelOutput(); + MESSAGE ( ". LevelOutput = " << LevelOutput ); + myDriver->TexteAdvanced(Pyram, NivMax, DiamMin, AdapInit, LevelOutput); + + return codret ; +} +//============================================================================= +// Calcul d'une iteration : gestion du repertoire de calcul +// Si le sous-repertoire existe : +// etatMenage = 0 : on sort en erreur si le repertoire n'est pas vide +// etatMenage = 1 : on fait le menage du repertoire +// etatMenage = -1 : on ne fait rien +//============================================================================= +char* HOMARD_Gen_i::ComputeDir(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage) +{ + MESSAGE ( "ComputeDir : repertoires pour le calcul" ); + // B.2. Le repertoire du cas + const char* nomDirCase = myCase->GetDirName(); + MESSAGE ( ". nomDirCase = " << nomDirCase ); + + // B.3. Le sous-repertoire de l'iteration a calculer, puis le repertoire complet a creer + // B.3.1. Le nom du sous-repertoire + const char* nomDirIt = myIteration->GetDirName(); + + // B.3.2. Le nom complet du sous-repertoire + std::stringstream DirCompute ; + DirCompute << nomDirCase << "/" << nomDirIt; + MESSAGE (". DirCompute = " << DirCompute.str() ); + + // B.3.3. Si le sous-repertoire n'existe pas, on le cree + if (chdir(DirCompute.str().c_str()) != 0) + { +// Creation du repertoire car il n'existe pas : + if (mkdir(DirCompute.str().c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) { - std::string ZoneName = std::string((*ListZone)[iaux]); - MESSAGE ( "... ZoneName = " << ZoneName); - HOMARD::HOMARD_Zone_var myZone = myContextMap[GetCurrentStudyID()]._mesZones[ZoneName]; - ASSERT(!CORBA::is_nil(myZone)); - - int ZoneType = myZone->GetType(); - std::string TypeUsestr = std::string((*ListZone)[iaux+1]); - int TypeUse = atoi( TypeUsestr.c_str() ); - MESSAGE ( "... ZoneType = " << ZoneType << ", TypeUse = "<GetCoords(); - if ( ZoneType == 2 or ( ZoneType>=11 and ZoneType <=13 ) ) // Cas d un parallelepipede ou d'un rectangle - { - myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], 0., 0., 0.); - } - else if ( ZoneType == 4 ) // Cas d une sphere - { - myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], 0., 0., 0., 0., 0.); - } - else if ( ZoneType == 5 or ( ZoneType>=31 and ZoneType <=33 ) ) // Cas d un cylindre ou d'un disque - { - myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], (*zone)[6], (*zone)[7], 0.); - } - else if ( ZoneType == 7 or ( ZoneType>=61 and ZoneType <=63 ) ) // Cas d un tuyau ou disque perce + // GERALD -- QMESSAGE BOX + std::cerr << "Pb Creation du repertoire DirCompute = " << DirCompute.str() << std::endl; + ASSERT("Pb a la creation du repertoire" == 0); + } + } + else + { +// Le repertoire existe +// On demande de faire le menage de son contenu : + if (etatMenage == 1) + { + MESSAGE (". Menage du repertoire DirCompute = " << DirCompute.str()); + std::string commande= "rm -rf " + DirCompute.str()+"/*" ; + int codret = system(commande.c_str()); + if (codret != 0) + { + // GERALD -- QMESSAGE BOX + std::cerr << ". Menage du repertoire de calcul" << DirCompute.str() << std::endl; + ASSERT("Pb au menage du repertoire de calcul" == 0); + } + } +// On n'a pas demande de faire le menage de son contenu : on sort en erreur : + else + { + if (etatMenage == 0) { - myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], (*zone)[6], (*zone)[7], (*zone)[8]); + DIR *dp; + struct dirent *dirp; + dp = opendir(DirCompute.str().c_str()); + bool result = true; + while ((dirp = readdir(dp)) != NULL && result ) + { + std::string file_name(dirp->d_name); + result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false + } + closedir(dp); + if ( result == false) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "Directory : " + DirCompute.str() + "is not empty"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + ASSERT("Directory is not empty" == 0); + } } - else { ASSERT("ZoneType est incorrect." == 0) ; } - iaux += 1 ; } } - // E.3. Ajout des informations liees aux champs eventuels - if (TypeAdap == 1) + + return CORBA::string_dup( DirCompute.str().c_str() ); +} +//============================================================================= +// Calcul d'une iteration : gestion du repertoire de calcul de l'iteration parent +//============================================================================= +char* HOMARD_Gen_i::ComputeDirPa(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration) +{ + MESSAGE ( "ComputeDirPa : repertoires pour le calcul" ); + // Le repertoire du cas + const char* nomDirCase = myCase->GetDirName(); + MESSAGE ( ". nomDirCase = " << nomDirCase ); + + // Le sous-repertoire de l'iteration precedente + + const char* nomIterationParent = myIteration->GetIterParentName(); + HOMARD::HOMARD_Iteration_var myIterationParent = myContextMap[GetCurrentStudyID()]._mesIterations[nomIterationParent]; + const char* nomDirItPa = myIterationParent->GetDirName(); + std::stringstream DirComputePa ; + DirComputePa << nomDirCase << "/" << nomDirItPa; + MESSAGE( ". nomDirItPa = " << nomDirItPa); + MESSAGE( ". DirComputePa = " << DirComputePa.str() ); + + return CORBA::string_dup( DirComputePa.str().c_str() ); +} +//============================================================================= +// Calcul d'une iteration : ecriture des zones dans le fichier de configuration +//============================================================================= +void HOMARD_Gen_i::DriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver) +{ + MESSAGE ( "... DriverTexteZone" ); + HOMARD::listeZonesHypo* ListZone = myHypo->GetZones(); + int numberOfZonesx2 = ListZone->length(); + int NumZone ; + + for (int iaux = 0; iaux< numberOfZonesx2; iaux++) { -// Le fichier du champ - char* FieldFile = myIteration->GetFieldFile(); - MESSAGE ( ". FieldFile = " << FieldFile ); - if (strlen(FieldFile) == 0) + std::string ZoneName = std::string((*ListZone)[iaux]); + MESSAGE ( "... ZoneName = " << ZoneName); + HOMARD::HOMARD_Zone_var myZone = myContextMap[GetCurrentStudyID()]._mesZones[ZoneName]; + ASSERT(!CORBA::is_nil(myZone)); + + int ZoneType = myZone->GetType(); + std::string TypeUsestr = std::string((*ListZone)[iaux+1]); + int TypeUse = atoi( TypeUsestr.c_str() ); + MESSAGE ( "... ZoneType = " << ZoneType << ", TypeUse = "<GetCoords(); + if ( ZoneType == 2 or ( ZoneType>=11 and ZoneType <=13 ) ) // Cas d un parallelepipede ou d'un rectangle { - // GERALD -- QMESSAGE BOX - std::cerr << "Le fichier du champ n'a pas ete fourni." << std::endl; - ASSERT("The file for the field is not given." == 0); + myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], 0., 0., 0.); } + else if ( ZoneType == 4 ) // Cas d une sphere + { + myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], 0., 0., 0., 0., 0.); + } + else if ( ZoneType == 5 or ( ZoneType>=31 and ZoneType <=33 ) ) // Cas d un cylindre ou d'un disque + { + myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], (*zone)[6], (*zone)[7], 0.); + } + else if ( ZoneType == 7 or ( ZoneType>=61 and ZoneType <=63 ) ) // Cas d un tuyau ou disque perce + { + myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], (*zone)[6], (*zone)[7], (*zone)[8]); + } + else { ASSERT("ZoneType est incorrect." == 0) ; } + iaux += 1 ; + } + return ; +} +//============================================================================= +// Calcul d'une iteration : ecriture des champs dans le fichier de configuration +//============================================================================= +void HOMARD_Gen_i::DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver) +{ + MESSAGE ( "... DriverTexteField" ); +// Le fichier du champ + char* FieldFile = myIteration->GetFieldFile(); + MESSAGE ( ". FieldFile = " << FieldFile ); + if (strlen(FieldFile) == 0) + { + // GERALD -- QMESSAGE BOX + std::cerr << "Le fichier du champ n'a pas ete fourni." << std::endl; + ASSERT("The file for the field is not given." == 0); + } // Les caracteristiques d'instants - int TimeStep = myIteration->GetTimeStep(); - MESSAGE( ". TimeStep = " << TimeStep ); - int Rank = myIteration->GetRank(); - MESSAGE( ". Rank = " << Rank ); + int TimeStep = myIteration->GetTimeStep(); + MESSAGE( ". TimeStep = " << TimeStep ); + int Rank = myIteration->GetRank(); + MESSAGE( ". Rank = " << Rank ); // Les informations sur les champ - HOMARD::InfosHypo* aInfosHypo = myHypo->GetField(); + HOMARD::InfosHypo* aInfosHypo = myHypo->GetField(); // Le nom - const char* FieldName = aInfosHypo->FieldName; + const char* FieldName = aInfosHypo->FieldName; // Les seuils - int TypeThR = aInfosHypo->TypeThR; - double ThreshR = aInfosHypo->ThreshR; - int TypeThC = aInfosHypo->TypeThC; - double ThreshC = aInfosHypo->ThreshC; + int TypeThR = aInfosHypo->TypeThR; + double ThreshR = aInfosHypo->ThreshR; + int TypeThC = aInfosHypo->TypeThC; + double ThreshC = aInfosHypo->ThreshC; // Saut entre mailles ou non ? - int UsField = aInfosHypo->UsField; - MESSAGE( ". UsField = " << UsField ); + int UsField = aInfosHypo->UsField; + MESSAGE( ". UsField = " << UsField ); // L'usage des composantes - int UsCmpI = aInfosHypo->UsCmpI; - MESSAGE( ". UsCmpI = " << UsCmpI ); + int UsCmpI = aInfosHypo->UsCmpI; + MESSAGE( ". UsCmpI = " << UsCmpI ); // - myDriver->TexteField(FieldName, FieldFile, TimeStep, Rank, TypeThR, ThreshR, TypeThC, ThreshC, UsField, UsCmpI); + myDriver->TexteField(FieldName, FieldFile, TimeStep, Rank, TypeThR, ThreshR, TypeThC, ThreshC, UsField, UsCmpI); // // Les composantes - HOMARD::listeComposantsHypo* mescompo = myHypo->GetListComp(); - int numberOfCompos = mescompo->length(); - MESSAGE( ". numberOfCompos = " << numberOfCompos ); - for (int NumeComp = 0; NumeComp< numberOfCompos; NumeComp++) - { - std::string nomCompo = std::string((*mescompo)[NumeComp]); - MESSAGE( "... nomCompo = " << nomCompo ); - myDriver->TexteCompo(NumeComp, nomCompo); - } - } - // E.4. Ajout des informations liees au filtrage eventuel par les groupes - HOMARD::ListGroupType* listeGroupes = myHypo->GetGroups(); - int numberOfGroups = listeGroupes->length(); - MESSAGE( ". numberOfGroups = " << numberOfGroups ); - if (numberOfGroups > 0) + HOMARD::listeComposantsHypo* mescompo = myHypo->GetListComp(); + int numberOfCompos = mescompo->length(); + MESSAGE( ". numberOfCompos = " << numberOfCompos ); + for (int NumeComp = 0; NumeComp< numberOfCompos; NumeComp++) { - - for (int NumGroup = 0; NumGroup< numberOfGroups; NumGroup++) - { - std::string GroupName = std::string((*listeGroupes)[NumGroup]); - MESSAGE( "... GroupName = " << GroupName ); - myDriver->TexteGroup(GroupName); - } + std::string nomCompo = std::string((*mescompo)[NumeComp]); + MESSAGE( "... nomCompo = " << nomCompo ); + myDriver->TexteCompo(NumeComp, nomCompo); } - - // E.5. Ajout des informations liees a l'eventuel suivi de frontiere + return ; +} +//============================================================================= +// Calcul d'une iteration : ecriture des frontieres dans le fichier de configuration +//============================================================================= +void HOMARD_Gen_i::DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver) +{ + MESSAGE ( "... DriverTexteBoundary" ); // On ecrit d'abord la definition des frontieres, puis les liens avec les groupes std::list ListeBoundaryTraitees ; HOMARD::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup(); @@ -1822,9 +2120,15 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena } } myDriver->TexteBoundaryOption(BoundaryOption); - - // E.6. Ajout des informations liees a l'eventuelle interpolation des champs - MESSAGE( "... TypeFieldInterp = " << TypeFieldInterp ); + return ; +} +//============================================================================= +// Calcul d'une iteration : ecriture des interpolations dans le fichier de configuration +//============================================================================= +void HOMARD_Gen_i::DriverTexteFieldInterp(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver) +{ + MESSAGE ( "... DriverTexteFieldInterp" ); + int TypeFieldInterp = myHypo->GetTypeFieldInterp(); if (TypeFieldInterp != 0) { // Le fichier des champs @@ -1836,14 +2140,15 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena std::cerr << "Le fichier du champ n'a pas ete fourni." << std::endl; ASSERT("The file for the field is not given." == 0); } -// Les caracteristiques d'instants + // Les caracteristiques d'instants int TimeStep = myIteration->GetTimeStep(); MESSAGE( ". TimeStep = " << TimeStep ); int Rank = myIteration->GetRank(); MESSAGE( ". Rank = " << Rank ); -// + // + const char* MeshFile = myIteration->GetMeshFile(); myDriver->TexteFieldInterp(TypeFieldInterp, FieldFile, MeshFile, TimeStep, Rank); -// Les champs + // Les champs if (TypeFieldInterp == 2) { HOMARD::listFieldInterpHypo* meschamps = myHypo->GetListFieldInterp(); @@ -1857,98 +2162,11 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena } } } - // E.7. Ajout des options avancees - int Pyram = myCase->GetPyram(); - MESSAGE ( ". Pyram = " << Pyram ); - int NivMax = myHypo->GetNivMax(); - MESSAGE ( ". NivMax = " << NivMax ); - double DiamMin = myHypo->GetDiamMin() ; - MESSAGE ( ". DiamMin = " << DiamMin ); - int AdapInit = myHypo->GetAdapInit(); - MESSAGE ( ". AdapInit = " << AdapInit ); - int LevelOutput = myHypo->GetLevelOutput(); - MESSAGE ( ". LevelOutput = " << LevelOutput ); - myDriver->TexteAdvanced(Pyram, NivMax, DiamMin, AdapInit, LevelOutput); - - // F. Ecriture du texte dans le fichier - if (codret == 0) - { - myDriver->CreeFichier(); - } - -// G. Execution -// - int codretexec = 12 ; - if (codret == 0) - { - codretexec = myDriver->ExecuteHomard(); -// - MESSAGE ( "Erreur en executant HOMARD : " << codretexec ); - if (codretexec == 0) - { - SetEtatIter(NomIteration,true); - } - else - { - // GERALD -- QMESSAGE BOX - SetEtatIter(NomIteration,false); - } - } - - // H. Gestion des resultats - if (codret == 0) - { - // H.1. Le fichier des messages, dans tous les cas - std::stringstream saux1 ; - saux1 << "Mess " << NumeIter ; - PublishFileUnderIteration(NomIteration, MessFile.c_str(), saux1.str().c_str()); - - // H.2. Si tout s'est bien passe : - if (codretexec == 0) - { - // H.2.1. Le fichier de bilan - std::stringstream saux2 ; - saux2 << "Summary " << NumeIter ; - std::string SummaryFile = DirCompute.str() + "/apad." + siterp1 + ".bilan" ; - PublishFileUnderIteration(NomIteration, SummaryFile.c_str(), saux2.str().c_str()); - // H.2.2. Le fichier de maillage obtenu - std::stringstream saux0 ; - saux0 <<"Iteration " << NumeIter ; - PublishFileUnderIteration(NomIteration, MeshFile, saux0.str().c_str()); - PublishResultInSmesh(MeshFile, 1); - } - // H.3 Message d'erreur en cas de probleme - else - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - std::string text = "Error during the adaptation.\n" ; - try - { - ifstream fichier(MessFile.c_str(), ios::in); - string ligne; - while(getline(fichier, ligne) and (ligne != "===== HOMARD ===== STOP =====")); - while (getline(fichier, ligne)) { text += ligne+ "\n";}; - } - catch (...) { - text += "no log file ...."; - } - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - } - } - - // I. Menage et retour dans le repertoire du cas - if (codret == 0) - { - delete myDriver; - MESSAGE ( ". On retourne dans nomDirWork = " << nomDirWork ); - chdir(nomDirWork); - } - - return codretexec ; + return ; } //=========================================================================== +//=========================================================================== + //=========================================================================== //=========================================================================== @@ -2317,7 +2535,6 @@ void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long IconeTy } } } - } // On enregistre le fichier @@ -2401,6 +2618,7 @@ void HOMARD_Gen_i::DeleteResultInSmesh(const char* NomFich, const char* MeshName //============================================================================= void HOMARD_Gen_i::PublishFileUnderIteration(const char* NomIter, const char* NomFich, const char* Commentaire) { +// MESSAGE (" PublishFileUnderIteration pour l'iteration " << NomIter << " du fichier " << NomFich << " avec le commentaire " << Commentaire ); if (CORBA::is_nil(myCurrentStudy)) { SALOME::ExceptionStruct es; diff --git a/src/HOMARD_I/HOMARD_Gen_i.hxx b/src/HOMARD_I/HOMARD_Gen_i.hxx index 5d9033f4..20ae2135 100644 --- a/src/HOMARD_I/HOMARD_Gen_i.hxx +++ b/src/HOMARD_I/HOMARD_Gen_i.hxx @@ -31,6 +31,7 @@ #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) #include "HOMARD_Gen.hxx" +#include "HomardDriver.hxx" #include "SALOME_Component_i.hxx" #include "SALOME_NamingService.hxx" #include "Utils_CorbaException.hxx" @@ -114,6 +115,10 @@ public: HOMARD::listeIterations* GetAllIterationsName(); HOMARD::listeZones* GetAllZonesName(); + void MeshInfo (const char* nomCas, + const char* MeshName, const char* FileName, const char* DirName, + CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte); + HOMARD::HOMARD_Iteration_ptr LastIteration (const char* nomCas); // L'etude @@ -125,6 +130,7 @@ public: void InvalideBoundary(const char* nomBoundary); void InvalideHypo(const char* nomHypo); void InvalideIter(const char* nomIter); + void InvalideIterInfo(const char* nomIter); void InvalideZone(const char* nomZone); CORBA::Long DeleteBoundary(const char* nomBoundary); @@ -144,7 +150,15 @@ public: void SetEtatIter(const char* nomIter,const CORBA::Boolean EtatCalcul); - CORBA::Long Compute(const char* nomIteration, CORBA::Long etatMenage); + CORBA::Long Compute(const char* nomIteration, CORBA::Long etatMenage, CORBA::Long modeHOMARD, CORBA::Long Option); + CORBA::Long ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option); + char* ComputeDir(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage); + char* ComputeDirPa(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration); + void DriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver); + void DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver); + void DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver); + void DriverTexteFieldInterp(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver); + CORBA::Boolean VerifieDir(const char* nomDir); void PublishResultInSmesh(const char* NomFich, CORBA::Long IconeType); diff --git a/src/HOMARD_I/HOMARD_Iteration_i.cxx b/src/HOMARD_I/HOMARD_Iteration_i.cxx index a29d2b3a..222dd663 100644 --- a/src/HOMARD_I/HOMARD_Iteration_i.cxx +++ b/src/HOMARD_I/HOMARD_Iteration_i.cxx @@ -210,27 +210,73 @@ CORBA::Long HOMARD_Iteration_i::GetRank() return CORBA::Long( myHomardIteration->GetRank() ); } //============================================================================= -void HOMARD_Iteration_i::SetMessFile( const char* MessFile ) +void HOMARD_Iteration_i::SetLogFile( const char* LogFile ) { ASSERT( myHomardIteration ); - myHomardIteration->SetMessFile( MessFile ); + myHomardIteration->SetLogFile( LogFile ); } //============================================================================= -char* HOMARD_Iteration_i::GetMessFile() +char* HOMARD_Iteration_i::GetLogFile() { ASSERT( myHomardIteration ); - return CORBA::string_dup( myHomardIteration->GetMessFile().c_str() ); + return CORBA::string_dup( myHomardIteration->GetLogFile().c_str() ); } //============================================================================= -CORBA::Long HOMARD_Iteration_i::Compute(CORBA::Long etatMenage) +CORBA::Long HOMARD_Iteration_i::Compute(CORBA::Long etatMenage) { MESSAGE ( "Compute : calcul d'une iteration" ); ASSERT( myHomardIteration ); // // Nom de l'iteration char* IterName = GetName() ; + CORBA::Long modeHOMARD = 1 ; + CORBA::Long Option = 1 ; MESSAGE ( "Compute : calcul de l'teration " << IterName ); - return _gen_i->Compute(IterName, etatMenage) ; + return _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option) ; +} +//============================================================================= +void HOMARD_Iteration_i::MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte) +{ + MESSAGE ( "MeshInfo : information sur le maillage associe a une iteration" ); + ASSERT( myHomardIteration ); +// + int Option = 1 ; + MeshInfoOption( Qual, Diam, Conn, Tail, Inte, Option ) ; +// + return ; +} +//============================================================================= +void HOMARD_Iteration_i::MeshInfoOption(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte, CORBA::Long Option) +{ + MESSAGE ( "MeshInfoOption : information sur le maillage associe a une iteration" ); + ASSERT( myHomardIteration ); +// +// Nom de l'iteration + char* IterName = GetName() ; + CORBA::Long etatMenage = -1 ; + CORBA::Long modeHOMARD = 7 ; + if ( Qual != 0 ) { modeHOMARD = modeHOMARD*5 ; } + if ( Diam != 0 ) { modeHOMARD = modeHOMARD*19 ; } + if ( Conn != 0 ) { modeHOMARD = modeHOMARD*11 ; } + if ( Tail != 0 ) { modeHOMARD = modeHOMARD*13 ; } + if ( Inte != 0 ) { modeHOMARD = modeHOMARD*3 ; } + MESSAGE ( "MeshInfoOption : information sur le maillage de l'iteration " << IterName ); + CORBA::Long codret = _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option) ; + MESSAGE ( "MeshInfoOption : codret = " << codret ); +// + return ; +} +//============================================================================= +void HOMARD_Iteration_i::SetFileInfo( const char* FileInfo ) +{ + ASSERT( myHomardIteration ); + myHomardIteration->SetFileInfo( FileInfo ); +} +//============================================================================= +char* HOMARD_Iteration_i::GetFileInfo() +{ + ASSERT( myHomardIteration ); + return CORBA::string_dup( myHomardIteration->GetFileInfo().c_str() ); } //============================================================================= //============================================================================= diff --git a/src/HOMARD_I/HOMARD_Iteration_i.hxx b/src/HOMARD_I/HOMARD_Iteration_i.hxx index 91ce9fdc..103a5163 100644 --- a/src/HOMARD_I/HOMARD_Iteration_i.hxx +++ b/src/HOMARD_I/HOMARD_Iteration_i.hxx @@ -87,12 +87,19 @@ public: CORBA::Long GetTimeStep(); CORBA::Long GetRank(); - void SetMessFile( const char* MessFile ); - char* GetMessFile(); + void SetLogFile( const char* LogFile ); + char* GetLogFile(); CORBA::Long Compute(CORBA::Long etatMenage); -// Liens avec les autres iterations + void MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte); + + void MeshInfoOption(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte, CORBA::Long Option); + + void SetFileInfo( const char* FileInfo ); + char* GetFileInfo(); + + // Liens avec les autres iterations HOMARD::HOMARD_Iteration_ptr NextIteration( const char* Name) ; void LinkNextIteration( const char* NomIteration );