1 # -*- coding: utf-8 -*-
3 # Copyright (C) 2012-2013 EDF
5 # This file is part of SALOME HYDRO module.
7 # SALOME HYDRO module is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # SALOME HYDRO module is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
23 def get_list_var_api(module):
25 Returns the list of variables avaialable throught the API for module
27 @param One of the modules of TELEMAC-MASCARET
29 if module == 'TELEMAC2D':
30 from TelApy.api.t2d import Telemac2d
31 model = Telemac2d('dummy.cas')
32 elif module == 'TELEMAC3D':
33 from TelApy.api.t3d import Telemac3d
34 model = Telemac3d('dummy.cas')
35 elif module == 'SISYPHE':
36 from TelApy.api.sis import Sisyphe
37 model = Sisyphe('dummy.cas')
39 return ['No variable available']
41 varnames, _ = model.list_variables()
43 return sorted(varnames)
46 def __init__(self,ntuple):
49 def __convert__(self,valeur):
50 if type(valeur) == types.StringType:
52 if len(valeur) != self.ntuple:
57 return "Tuple de %s elements" % self.ntuple
62 JdC = JDC_CATA(regles = (UN_PARMI('TELEMAC2D',)),
68 nom = "TELEMAC2D", op = None,
69 fr = u"Définition d'un cas d'étude Telemac2D",
70 ang = u"Definition of a Telemac2D study case",
71 STEERING_FILE = SIMP(statut = "o", typ = 'Fichier',
72 fr = u"Fichier de description du cas",
73 ang = u"Case description file",
75 USER_FORTRAN = SIMP(statut = "f", typ = 'FichierOuRepertoire',
76 fr = "Fichier Fortran utilisateur",
77 ang = u"Fortran user file",
79 WORKING_DIRECTORY = SIMP(statut = "o", typ = 'Repertoire',
81 fr = "Repertoire de travail",
82 ang = u"Working directory user file",
84 RESULT_DIRECTORY = SIMP(statut = "f", typ = 'Repertoire',
85 fr = "Repertoire de travail",
86 ang = u"Working directory user file",
88 RESULTS_FILE_NAME = SIMP(statut = "f", typ = 'TXM',
89 fr = u"Fichier des resultats (Ecrasera celui dans le fichier cas)",
90 ang = u"Results file (Will replace the one in the steering file)"
92 Consigne = SIMP(statut ="o", homo="information", typ="TXM",
93 defaut = "All index are in Python numbering (Starting from 0)",
95 INPUT_VARIABLE = FACT(statut = 'f', max = '**',
96 fr = u"Variable d'entrée du calcul",
97 ang = u"Computation input variable",
99 NAME = SIMP(statut = "o", typ = 'TXM',
100 fr = u"Nom de la variable (format Python)",
101 ang = u"Variable name (Python format)"
103 VAR_INFO = FACT(statut = "o",
104 fr = u'Variable du modèle Telemac2D',
105 ang = u'Telemac2D model variable',
107 VAR_NAME = SIMP(statut = "o", typ = 'TXM',
108 intoSug = get_list_var_api('TELEMAC2D'),
109 fr = u'Nom de la variable du modèle (ex: "MODEL.DEBIT")',
110 ang = u'Model variable name (ex: "MODEL.DEBIT")'
112 DEFAULT_VALUE = SIMP(statut = "o", typ = 'TXM',
113 fr = u'Valeur par défaut',
114 ang = u'Default value',
116 ZONE_DEF = FACT(statut = "o",
117 ang = u'Variable definition area',
118 fr = u'Zone de définition de la variable',
120 TYPE = SIMP(statut = "o", typ = 'TXM',
121 into = ['INDEX', 'RANGE', 'POLYGON', 'POLYGON_FILE'],
122 fr = u'Type de definition de la variable',
123 ang = u'Type of definition for the variable',
126 b_INDEX = BLOC(condition = "TYPE == 'INDEX'",
127 INDEX = SIMP(statut = "o", typ = Tuple(3),
129 ang = "Index of the variable",
130 fr = u"Indice de la variable",
131 validators = VerifTypeTuple(('I', 'I', 'I')),
134 b_RANGE = BLOC(condition = "TYPE == 'RANGE'",
135 RANGE = SIMP(statut = "o", typ = 'TXM',
136 fr = u"Liste d'index pour des tableaux à une dimension ex: [1,3:8,666]",
137 ang = "Range of index for one dimension arrays ex: [1,3:8,666]",
139 Consigne = SIMP(statut ="o", homo="information", typ="TXM",
140 defaut = "Format [0,2:8,50:88,666]",
143 b_POLYGON = BLOC(condition = "TYPE == 'POLYGON'",
144 POLYGON = SIMP(statut = "o",
147 fr = u"Liste des sommets (coordonnées X,Y) du "
148 u"polygone définissant le contour de la zone",
149 ang = "List of points (X,Y coordinates) of the "
150 "polygon defining the border of the area",
151 validators = VerifTypeTuple(('R', 'R')),
154 b_POLYGON_FILE = BLOC(condition = "TYPE == 'POLYGON_FILE'",
155 POLYGON_FILE = FACT(statut = "o",
156 fr = u"Polygon dans un fichier",
157 ang = "Polygone in a file",
158 FILE_NAME = SIMP(statut = "o", typ = 'Fichier',
159 fr = u"Fichier contenant les info du polygone",
160 ang = "File containing the polygon info",
162 SEPARATOR = SIMP(statut = "o", typ = 'TXM',
164 fr = u"Separateur pour le fichier de polygone",
165 ang = "Separator for the polygon file",
172 OUTPUT_VARIABLE = FACT(statut = 'f', max = '**',
173 fr = u"Variable de sortie du calcul",
174 ang = u"Computation output variable",
175 NAME = SIMP(statut = "o", typ = 'TXM',
176 fr = u"Nom de la variable",
177 ang = u"Variable name",
179 VAR_INFO = FACT(statut = "o",
180 fr = u'Variable du modèle Telemac2D',
181 ang = u'Telemac2D model variable',
182 VAR_NAME = SIMP(statut = "o", typ = 'TXM',
183 intoSug = get_list_var_api('TELEMAC2D'),
184 fr = u'Nom de la variable du modèle (ex: "MODEL.DEBIT")',
185 ang = u'Model variable name (ex: "MODEL.DEBIT")',
187 ZONE_DEF = FACT(statut = "o",
188 ang = u'Variable definition area',
189 fr = u'Zone de définition de la variable',
190 INDEX = SIMP(statut = "o", typ = Tuple(3),
191 defaut = (0, 0, 0, ),
192 ang = "Index of the point / border",
193 fr = u"Indice du point ou de la frontière",
194 validators = VerifTypeTuple(('I', 'I', 'I')),
201 TEXTE_NEW_JDC="TELEMAC2D()"