Salome HOME
[fix] Error in catalog intoSug -> into
[modules/hydrosolver.git] / src / salome_hydro / telemac2d / eficas / telemac2d_V6_cata.py
index 6d372554d070c7ffa3d37e4635c8c1a6bd4f83ac..da9ff2b3aa9bdcdd77757262fd99ec28e7d7b100 100644 (file)
 import types
 from Accas import *
 
+def get_list_var_api(module):
+    """
+    Returns the list of variables avaialable throught the API for module
+
+    @param One of the modules of TELEMAC-MASCARET
+    """
+    if module == 'TELEMAC2D':
+        from TelApy.api.t2d import Telemac2d
+        model = Telemac2d('dummy.cas')
+    elif module == 'TELEMAC3D':
+        from TelApy.api.t3d import Telemac3d
+        model = Telemac3d('dummy.cas')
+    elif module == 'SISYPHE':
+        from TelApy.api.sis import Sisyphe
+        model = Sisyphe('dummy.cas')
+    else:
+        return ['No variable available']
+
+    varnames, _ = model.list_variables()
+    del(model)
+    return sorted(varnames)
+
 class Tuple:
   def __init__(self,ntuple):
     self.ntuple=ntuple
@@ -40,68 +62,140 @@ class Tuple:
 JdC = JDC_CATA(regles = (UN_PARMI('TELEMAC2D',)),
                         )
 
+
+
 TELEMAC2D = PROC(
     nom = "TELEMAC2D", op = None,
     fr = u"Définition d'un cas d'étude Telemac2D",
     ang = u"Definition of a Telemac2D study case",
-    FICHIER_CAS = SIMP(statut = "o", typ = 'Fichier',
+    STEERING_FILE = SIMP(statut = "o", typ = 'Fichier',
                        fr = u"Fichier de description du cas",
-                       ang = u"Case description file"),
-    FICHIER_GEOMETRIE = SIMP(statut = "f", typ = 'Fichier',
-                             fr = u"Fichier de géométrie",
-                             ang = u"Geometry file"),
-    FICHIER_CONDITIONS_LIMITES = SIMP(statut = "f", typ = 'Fichier',
-                                      fr = u"Fichier de conditions limites",
-                                      ang = u"Boundary conditions file"),
-    FICHIER_DICO = SIMP(statut = "f", typ = 'Fichier',
-                        fr = "Fichier Dico",
-                        ang = u"Dictionary file"),
-    FICHIER_FORTRAN_UTILISATEUR = SIMP(statut = "f", typ = 'Fichier',
-                                       fr = "Fichier Fortran utilisateur",
-                                       ang = u"Fortran user file"),
-    RESULTAT = SIMP(statut = "f", typ = ('Fichier', 'Tous les fichiers (*)', "Sauvegarde"),
-                    fr = u"Fichier de résultat",
-                    ang = u"Result file"),
-    VARIABLE_SORTIE = FACT(statut = 'f', max = '**',
+                       ang = u"Case description file",
+    ),
+    USER_FORTRAN = SIMP(statut = "f", typ = 'FichierOuRepertoire',
+                        fr = "Fichier Fortran utilisateur",
+                        ang = u"Fortran user file",
+    ),
+    WORKING_DIRECTORY = SIMP(statut = "o", typ = 'Repertoire',
+                             defaut = '/tmp',
+                             fr = "Repertoire de travail",
+                             ang = u"Working directory user file",
+    ),
+    RESULT_DIRECTORY = SIMP(statut = "f", typ = 'Repertoire',
+                            fr = "Repertoire de travail",
+                            ang = u"Working directory user file",
+    ),
+    RESULTS_FILE_NAME = SIMP(statut = "f", typ = 'TXM',
+                             fr = u"Fichier des resultats (Ecrasera celui dans le fichier cas)",
+                             ang = u"Results file (Will replace the one in the steering file)"
+    ),
+    Consigne = SIMP(statut ="o", homo="information", typ="TXM",
+                    defaut = "All index are in Python numbering (Starting from 0)",
+    ),
+    INPUT_VARIABLE = FACT(statut = 'f', max = '**',
+                          fr = u"Variable d'entrée du calcul",
+                          ang = u"Computation input variable",
+
+        NAME = SIMP(statut = "o", typ = 'TXM',
+                    fr = u"Nom de la variable (format Python)",
+                    ang = u"Variable name (Python format)"
+        ),
+        VAR_INFO = FACT(statut = "o",
+                        fr = u'Variable du modèle Telemac2D',
+                        ang = u'Telemac2D model variable',
+
+            VAR_NAME = SIMP(statut = "o", typ = 'TXM',
+                            into = get_list_var_api('TELEMAC2D'),
+                            fr = u'Nom de la variable du modèle (ex: "MODEL.DEBIT")',
+                            ang = u'Model variable name (ex: "MODEL.DEBIT")'
+            ),
+            DEFAULT_VALUE = SIMP(statut = "o", typ = 'TXM',
+                                 fr = u'Valeur par défaut',
+                                 ang = u'Default value',
+            ),
+            ZONE_DEF = FACT(statut = "o",
+                            ang = u'Variable definition area',
+                            fr = u'Zone de définition de la variable',
+
+                TYPE = SIMP(statut = "o", typ = 'TXM',
+                            into = ['INDEX', 'RANGE', 'POLYGON', 'POLYGON_FILE'],
+                            fr = u'Type de definition de la variable',
+                            ang = u'Type of definition for the variable',
+                ),
+
+                b_INDEX = BLOC(condition = "TYPE == 'INDEX'",
+                    INDEX = SIMP(statut = "o", typ = Tuple(3),
+                                 defaut = (0, 0, 0),
+                                 ang = "Index of the variable",
+                                 fr = u"Indice de la variable",
+                                 validators = VerifTypeTuple(('I', 'I', 'I')),
+                    ),
+                ),
+                b_RANGE = BLOC(condition = "TYPE == 'RANGE'",
+                    RANGE = SIMP(statut = "o", typ = 'TXM',
+                                 fr = u"Liste d'index pour des tableaux à une dimension ex: [1,3:8,666]",
+                                 ang = "Range of index for one dimension arrays ex: [1,3:8,666]",
+                    ),
+                    Consigne = SIMP(statut ="o", homo="information", typ="TXM",
+                                    defaut = "Format [0,2:8,50:88,666]",
+                    ),
+                ),
+                b_POLYGON = BLOC(condition = "TYPE == 'POLYGON'",
+                    POLYGON = SIMP(statut = "o",
+                                   typ = Tuple(2),
+                                   max = '**',
+                                   fr = u"Liste des sommets (coordonnées X,Y) du "
+                                        u"polygone définissant le contour de la zone",
+                                   ang = "List of points (X,Y coordinates) of the "
+                                         "polygon defining the border of the area",
+                                   validators = VerifTypeTuple(('R', 'R')),
+                    ),
+                ),
+                b_POLYGON_FILE = BLOC(condition = "TYPE == 'POLYGON_FILE'",
+                    POLYGON_FILE = FACT(statut = "o",
+                                        fr = u"Polygon dans un fichier",
+                                        ang = "Polygone in a file",
+                        FILE_NAME = SIMP(statut = "o", typ = 'Fichier',
+                                         fr = u"Fichier contenant les info du polygone",
+                                         ang = "File containing the polygon info",
+                        ),
+                        SEPARATOR = SIMP(statut = "o", typ = 'TXM',
+                                         defaut = ',',
+                                         fr = u"Separateur pour le fichier de polygone",
+                                         ang = "Separator for the polygon file",
+                        ),
+                    ),
+                ),
+            ),
+        ),
+    ),
+    OUTPUT_VARIABLE = FACT(statut = 'f', max = '**',
                            fr = u"Variable de sortie du calcul",
                            ang = u"Computation output variable",
-        NOM = SIMP(statut = "o", typ = 'TXM',
+        NAME = SIMP(statut = "o", typ = 'TXM',
                    fr = u"Nom de la variable",
-                   ang = u"Variable name"),
-        VARIABLE_T2D = SIMP(statut = "o", typ = 'TXM',
-                            fr = u'Variable Telemac2D (ex : "MODEL.VELOCITYU(2443)")',
-                            ang = u'Telemac2D variable (ex : "MODEL.VELOCITYU(2443)")'),
-                          ),
-    VARIABLE_ENTREE = FACT(statut = 'f', max = '**',
-                           fr = u"Variable d'entrée du calcul",
-                           ang = u"Computation input variable",
-        NOM = SIMP(statut = "o", typ = 'TXM',
-                   fr = u"Nom de la variable",
-                   ang = u"Variable name"),
-        VARIABLE_MODELE_T2D = FACT(statut = "o",
-                                   fr = u'Variable du modèle Telemac2D',
-                                   ang = u'Telemac2D model variable',
-            NOM_VARIABLE_MODELE = SIMP(statut = "o", typ = 'TXM',
-                                       fr = u'Nom de la variable du modèle (ex: "MODEL.DEBIT")',
-                                       ang = u'Model variable name (ex: "MODEL.DEBIT")'),
-            ZONE_DE_DEFINITION = FACT(statut = "o",
-                                      ang = u'Variable definition area',
-                                      fr = u'Zone de définition de la variable',
-                                      regles = (UN_PARMI('INDICE', 'POLYGONE')),
-                INDICE = SIMP(statut = "f", typ = "I",
-                              ang = "Index of the point / border",
-                              fr = u"Indice du point ou de la frontière",
-                             ),
-                POLYGONE = SIMP(statut = "f",
-                                typ = Tuple(2),
-                                max = '**', 
-                                fr = u"Liste des sommets (coordonnées X,Y) du "
-                                     u"polygone définissant le contour de la zone",
-                                ang = "List of points (X,Y coordinates) of the "
-                                      "polygon defining the border of the area",
-                                validators = VerifTypeTuple(('R', 'R')),
-                               ),
-                                      ),
-                           ),
-                          ),
+                   ang = u"Variable name",
+        ),
+        VAR_INFO = FACT(statut = "o",
+                        fr = u'Variable du modèle Telemac2D',
+                        ang = u'Telemac2D model variable',
+            VAR_NAME = SIMP(statut = "o", typ = 'TXM',
+                            into = get_list_var_api('TELEMAC2D'),
+                            fr = u'Nom de la variable du modèle (ex: "MODEL.DEBIT")',
+                            ang = u'Model variable name (ex: "MODEL.DEBIT")',
+            ),
+            ZONE_DEF = FACT(statut = "o",
+                            ang = u'Variable definition area',
+                            fr = u'Zone de définition de la variable',
+                INDEX = SIMP(statut = "o", typ = Tuple(3),
+                             defaut = (0, 0, 0, ),
+                             ang = "Index of the point / border",
+                             fr = u"Indice du point ou de la frontière",
+                             validators = VerifTypeTuple(('I', 'I', 'I')),
+                ),
+            ),
+        ),
+    ),
 )
+
+TEXTE_NEW_JDC="TELEMAC2D()"