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 with open('dummy.cas', 'w') as f:
30 f.write('/Dummy steering file')
32 if module == 'TELEMAC2D':
33 from telapy.api.t2d import Telemac2d
34 model = Telemac2d('dummy.cas')
35 elif module == 'TELEMAC3D':
36 from telapy.api.t3d import Telemac3d
37 model = Telemac3d('dummy.cas')
38 elif module == 'SISYPHE':
39 from telapy.api.sis import Sisyphe
40 model = Sisyphe('dummy.cas')
42 return ['No variable available']
44 varnames = list(model.variables.keys())
46 return sorted(varnames)
49 def __init__(self,ntuple):
52 def __convert__(self,valeur):
53 if type(valeur) == bytes:
55 if len(valeur) != self.ntuple:
60 return "Tuple de %s elements" % self.ntuple
65 JdC = JDC_CATA(regles = (UN_PARMI('TELEMAC2D',)),
71 nom = "TELEMAC2D", op = None,
72 fr = "Définition d'un cas d'étude Telemac2D",
73 ang = "Definition of a Telemac2D study case",
74 STEERING_FILE = SIMP(statut = "o", typ = 'Fichier',
75 fr = "Fichier de description du cas",
76 ang = "Case description file",
78 USER_FORTRAN = SIMP(statut = "f", typ = 'FichierOuRepertoire',
79 fr = "Fichier Fortran utilisateur",
80 ang = "Fortran user file",
82 WORKING_DIRECTORY = SIMP(statut = "o", typ = 'Repertoire',
84 fr = "Repertoire de travail",
85 ang = "Working directory user file",
87 RESULT_DIRECTORY = SIMP(statut = "f", typ = 'Repertoire',
88 fr = "Repertoire de travail",
89 ang = "Working directory user file",
91 RESULTS_FILE_NAME = SIMP(statut = "f", typ = 'TXM',
92 fr = "Fichier des resultats (Ecrasera celui dans le fichier cas)",
93 ang = "Results file (Will replace the one in the steering file)"
95 Consigne = SIMP(statut ="o", homo="information", typ="TXM",
96 defaut = "All index are in Python numbering (Starting from 0)",
98 INPUT_VARIABLE = FACT(statut = 'f', max = '**',
99 fr = "Variable d'entrée du calcul",
100 ang = "Computation input variable",
102 NAME = SIMP(statut = "o", typ = 'TXM',
103 fr = "Nom de la variable (format Python)",
104 ang = "Variable name (Python format)"
106 VAR_INFO = FACT(statut = "o",
107 fr = 'Variable du modèle Telemac2D',
108 ang = 'Telemac2D model variable',
110 VAR_NAME = SIMP(statut = "o", typ = 'TXM',
111 intoSug = get_list_var_api('TELEMAC2D'),
112 fr = 'Nom de la variable du modèle (ex: "MODEL.DEBIT")',
113 ang = 'Model variable name (ex: "MODEL.DEBIT")'
115 DEFAULT_VALUE = SIMP(statut = "o", typ = 'TXM',
116 fr = 'Valeur par défaut',
117 ang = 'Default value',
119 ZONE_DEF = FACT(statut = "o",
120 ang = 'Variable definition area',
121 fr = 'Zone de définition de la variable',
123 TYPE = SIMP(statut = "o", typ = 'TXM',
124 into = ['INDEX', 'RANGE', 'POLYGON', 'POLYGON_FILE'],
125 fenetreIhm="menuDeroulant",
126 fr = 'Type de definition de la variable',
127 ang = 'Type of definition for the variable',
130 b_INDEX = BLOC(condition = "TYPE == 'INDEX'",
131 INDEX = SIMP(statut = "o", typ = Tuple(3),
133 ang = "Index of the variable",
134 fr = "Indice de la variable",
135 validators = VerifTypeTuple(('I', 'I', 'I')),
138 b_RANGE = BLOC(condition = "TYPE == 'RANGE'",
139 RANGE = SIMP(statut = "o", typ = 'TXM',
140 fr = "Liste d'index pour des tableaux à une dimension ex: [1,3:8,666]",
141 ang = "Range of index for one dimension arrays ex: [1,3:8,666]",
143 Consigne = SIMP(statut ="o", homo="information", typ="TXM",
144 defaut = "Format [0,2:8,50:88,666]",
147 b_POLYGON = BLOC(condition = "TYPE == 'POLYGON'",
148 POLYGON = SIMP(statut = "o",
151 fr = "Liste des sommets (coordonnées X,Y) du "
152 "polygone définissant le contour de la zone",
153 ang = "List of points (X,Y coordinates) of the "
154 "polygon defining the border of the area",
155 validators = VerifTypeTuple(('R', 'R')),
158 b_POLYGON_FILE = BLOC(condition = "TYPE == 'POLYGON_FILE'",
159 POLYGON_FILE = FACT(statut = "o",
160 fr = "Polygon dans un fichier",
161 ang = "Polygone in a file",
162 FILE_NAME = SIMP(statut = "o", typ = 'Fichier',
163 fr = "Fichier contenant les info du polygone",
164 ang = "File containing the polygon info",
166 SEPARATOR = SIMP(statut = "o", typ = 'TXM',
168 fr = "Separateur pour le fichier de polygone",
169 ang = "Separator for the polygon file",
176 OUTPUT_VARIABLE = FACT(statut = 'f', max = '**',
177 fr = "Variable de sortie du calcul",
178 ang = "Computation output variable",
179 NAME = SIMP(statut = "o", typ = 'TXM',
180 fr = "Nom de la variable",
181 ang = "Variable name",
183 VAR_INFO = FACT(statut = "o",
184 fr = 'Variable du modèle Telemac2D',
185 ang = 'Telemac2D model variable',
186 VAR_NAME = SIMP(statut = "o", typ = 'TXM',
187 intoSug = get_list_var_api('TELEMAC2D'),
188 fr = 'Nom de la variable du modèle (ex: "MODEL.DEBIT")',
189 ang = 'Model variable name (ex: "MODEL.DEBIT")',
191 ZONE_DEF = FACT(statut = "o",
192 ang = 'Variable definition area',
193 fr = 'Zone de définition de la variable',
194 INDEX = SIMP(statut = "o", typ = Tuple(3),
195 defaut = (0, 0, 0, ),
196 ang = "Index of the point / border",
197 fr = "Indice du point ou de la frontière",
198 validators = VerifTypeTuple(('I', 'I', 'I')),
205 TEXTE_NEW_JDC="TELEMAC2D()"