Suppression de la partie mascaret.
Renommage de pytel en run_study.
telemac2d en param_study.
Pour param_study utilisation du catalogue en local.
Ajout des bouttons/menu pour Liquid boundaries, breaches et generate
interpolks.py
Changement des icones en passant aussi.
# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
SET(HYDROSOLVER_RESOURCES_FILES
- HYDROSOLVERCatalog.xml
- icon_variables.png
HYDRO.png
+ HYDROSOLVERCatalog.xml
HYDRO_small.png
+ SalomeApp.xml.in
case1d.png
case2d.png
case_couplage.png
create_case1d.png
- create_case2d.png
create_case_couplage.png
- log.png
- create_case_pytel.png
- case_pytel.png
+ create_study.png
+ create_param_study.png
+ create_telma_cas.png
define_boundary_conditions.png
edit_boundary_conditions_file.png
+ edit_breaches_file.png
+ edit_liquid_boundary_conditions_file.png
+ generate_interpolks_py.png
generate_interpolz_py.png
- english.png
- francais.png
+ icon_variables.png
+ log.png
+ study_file.png
+ telma_file.png
+ param_study_file.png
)
INSTALL(FILES ${HYDROSOLVER_RESOURCES_FILES} DESTINATION ${SALOME_HYDROSOLVER_INSTALL_RES_DATA})
import HYDROSOLVER_ORB
from salome.hydro.interpolz_gui import InterpolzDlg
-from salome.hydro.gui_utils import HSGUIException, wait_cursor, get_and_check_selected_file_path
+from salome.hydro.gui_utils import HSGUIException, wait_cursor, \
+ get_and_check_selected_file_path
import salome.hydro.study as hydro_study
-from salome.hydro.mascaret.eficas.appli import EficasForMascaretAppli
-from salome.hydro.telemac2d.eficas.appli import EficasForTelemac2DAppli
-from salome.hydro.pytel.gui import create_case_pytel, run_selected_case_pytel, edit_selected_case_pytel, generate_job_for_selected_case_pytel
-#from salome.hydro.boundary_conditions.eficas.appli import EficasForBoundaryConditionsAppli
+from salome.hydro.run_study.eficas.appli import EficasForRunStudyAppli
+from salome.hydro.param_study.eficas.appli import EficasForParamStudyAppli
+from salome.hydro.telma.eficas.appli import EficasForTelmaAppli
+from salome.hydro.run_study.gui import create_case_study, \
+ run_selected_case_study, \
+ edit_selected_case_study, \
+ generate_job_for_selected_case_study
from eficasSalome import runEficas
import BndConditionsDialog
class GUIcontext:
# menus/toolbars/actions IDs
HYDRO_MENU_ID = 90
- CREATE_MASCARET_CASE_ID = 941
- RUN_MASCARET_ID = 942
- EDIT_MASCARET_CASE_ID = 943
- SHOW_LOG_ID = 944
- CREATE_TELEMAC2D_CASE_ID = 945
- OPEN_SCHEMA_IN_YACS_ID = 950
- CREATE_PYTEL_CASE_ID = 951
- RUN_PYTEL_ID = 952
- EDIT_PYTEL_CASE_ID = 953
- GENERATE_JOB = 954
- #DEFINE_BOUNDARY_CONDITIONS_ID = 955
- DEFINE_CAS_FILE_EN = 955
- EDIT_BOUNDARY_CONDITIONS_FILE_ID = 956
- GENERATE_INTERPOLZ_PY_ID = 957
- GEN_TELEMAC2D_PYTHON_ID = 958
- GEN_TELEMAC2D_YACS_ID = 959
- DEFINE_CAS_FILE_FR = 960
-
- def __init__( self ):
- # create top-level menu
- mid = sgPyQt.createMenu( "Hydro", -1, GUIcontext.HYDRO_MENU_ID, sgPyQt.defaultMenuGroup() )
- # create toolbar
- tid = sgPyQt.createTool( "Hydro" )
- # create actions and fill menu and toolbar with actions
- a = sgPyQt.createAction( GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID,
- "Edit boundary conditions file", "Edit boundary conditions file",
- "Create/edit the boundary conditions file for Telemac",
- "edit_boundary_conditions_file.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
-
-
- a = sgPyQt.createAction( GUIcontext.CREATE_MASCARET_CASE_ID,
- "Create Mascaret case", "Create Mascaret case",
- "Create a new Mascaret case", "create_case1d.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
+ CREATE_STUDY_ID = 951
+ EDIT_STUDY_ID = 952
+ RUN_STUDY_ID = 953
+ GEN_STUDY_BATCH_ID = 954
- a = sgPyQt.createAction( GUIcontext.CREATE_TELEMAC2D_CASE_ID,
- "Create Telemac2D case", "Create Telemac2D case",
- "Create a new Telemac2D case", "create_case2d.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
+ CREATE_TELMA_CAS_ID = 955
+ EDIT_TELMA_CAS_ID = 956
- a = sgPyQt.createSeparator()
-
- a = sgPyQt.createAction( GUIcontext.CREATE_PYTEL_CASE_ID,
- "Create case for Pytel execution", "Create case for Pytel execution",
- "Create a new case for Pytel execution", "create_case_pytel.png" )
-
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
-
- a = sgPyQt.createAction( GUIcontext.EDIT_PYTEL_CASE_ID,
- "Edit case for Pytel execution", "Edit case for Pytel execution",
- "Edit a new case for Pytel execution", "case_pytel.png" )
-
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
-
- a = sgPyQt.createSeparator()
+ GENERATE_INTERPOLZ_PY_ID = 957
+ GENERATE_INTERPOLKS_PY_ID = 958
- a = sgPyQt.createAction( GUIcontext.GENERATE_INTERPOLZ_PY_ID,
- "Generate interpolz.py", "Generate interpolz.py",
- "Generate interpolation script from the template", "generate_interpolz_py.png" )
+ # TODO Add create and edit ?
+ EDIT_BOUNDARY_CONDITIONS_FILE_ID = 959
+ EDIT_LIQUID_BOUNDARY_FILE_ID = 960
+ EDIT_BREACHES_FILE_ID = 961
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
+ CREATE_PARAM_STUDY_ID = 962
+ EDIT_PARAM_STUDY_ID = 963
+ GEN_PARAM_STUDY_PYTHON_ID = 964
+ GEN_PARAM_STUDY_YACS_ID = 965
- a = sgPyQt.createSeparator()
- a = sgPyQt.createAction( GUIcontext.DEFINE_CAS_FILE_EN,
- "Edit cas file (English)", "Edit cas file (English)",
- "Create/edit a .cas file for Telemac (English)",
- "english.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
+ def __init__(self):
+ # create top-level menu
+ mid = sgPyQt.createMenu("Hydro", -1, GUIcontext.HYDRO_MENU_ID,
+ sgPyQt.defaultMenuGroup())
+ # create toolbar
+ tid = sgPyQt.createTool("Hydro")
+ # create actions and fill menu and toolbar with actions
+ act = sgPyQt.createAction(\
+ GUIcontext.GENERATE_INTERPOLZ_PY_ID,
+ "Generate interpolz.py",
+ "Generate interpolz.py",
+ "Generate interpolation script from the template",
+ "generate_interpolz_py.png")
- a = sgPyQt.createSeparator()
- a = sgPyQt.createAction( GUIcontext.DEFINE_CAS_FILE_FR,
- "Edit cas file (French)", "Edit cas file (French)",
- "Create/edit a .cas file for Telemac (French)",
- "francais.png" )
- sgPyQt.createMenu( a, mid )
- sgPyQt.createTool( a, tid )
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+ # create actions and fill menu and toolbar with actions
+ act = sgPyQt.createAction(\
+ GUIcontext.GENERATE_INTERPOLKS_PY_ID,
+ "Generate interpolks.py",
+ "Generate interpolks.py",
+ "Generate friction coef script from the template",
+ "generate_interpolks_py.png")
+
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createSeparator()
+
+ act = sgPyQt.createAction(\
+ GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID,
+ "Edit boundary conditions file",
+ "Edit boundary conditions file",
+ "Create/edit the boundary conditions file for Telemac",
+ "edit_boundary_conditions_file.png")
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createAction(\
+ GUIcontext.EDIT_LIQUID_BOUNDARY_FILE_ID,
+ "Edit liquid boundary conditions file",
+ "Edit liquid boundary conditions file",
+ "Create/edit the liquid boundary conditions file for Telemac",
+ "edit_liquid_boundary_conditions_file.png")
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createAction(\
+ GUIcontext.EDIT_BREACHES_FILE_ID,
+ "Edit breaches file",
+ "Edit breaches file",
+ "Create/edit the breaches file for Telemac",
+ "edit_breaches_file.png")
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createAction(\
+ GUIcontext.CREATE_TELMA_CAS_ID,
+ "Edit cas file (English)",
+ "Edit cas file (English)",
+ "Create/edit act .cas file for Telemac (English)",
+ "create_telma_cas.png")
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createAction(\
+ GUIcontext.CREATE_STUDY_ID,
+ "Execute a steering file",
+ "Execute a steering file",
+ "Fill formular for a normal execution",
+ "create_study.png")
+
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createAction(\
+ GUIcontext.CREATE_PARAM_STUDY_ID,
+ "Create Parameter Study",
+ "Create Parameter Study",
+ "Create act new Parameter Study",
+ "create_param_study.png")
+ sgPyQt.createMenu(act, mid)
+ sgPyQt.createTool(act, tid)
+
+ act = sgPyQt.createSeparator()
# the following action are used in context popup
- sgPyQt.createAction( GUIcontext.RUN_MASCARET_ID, "Compute case", "Compute case",
- "Run Mascaret solver to compute the case" )
- sgPyQt.createAction( GUIcontext.EDIT_MASCARET_CASE_ID, "Edit case", "Edit case",
- "Edit the selected Mascaret case" )
- sgPyQt.createAction( GUIcontext.SHOW_LOG_ID, "Show log", "Show log",
- "Show the log for the selected variable" )
-
- sgPyQt.createAction( GUIcontext.GEN_TELEMAC2D_PYTHON_ID, "Generate Python script",
- "Generate Python script",
- "Generate a Python script from the eficas date" )
- sgPyQt.createAction( GUIcontext.GEN_TELEMAC2D_YACS_ID, "Generate YACS script",
- "Generate YACS script",
- "Generate a YACS script from the eficas date" )
-
- sgPyQt.createAction( GUIcontext.RUN_PYTEL_ID, "Compute case", "Compute case",
- "Run Pytel launcher to compute the case" )
- sgPyQt.createAction( GUIcontext.EDIT_PYTEL_CASE_ID, "Edit case", "Edit case",
- "Edit the selected Pytel case" )
- sgPyQt.createAction( GUIcontext.GENERATE_JOB, "Generate batch job", "Generate batch job",
- "Generate a batch job to run the selected case")
-
- sgPyQt.createAction( GUIcontext.DEFINE_CAS_FILE_EN, "Edit .cas file", "Edit .cas file",
- "Edit .cas file")
- sgPyQt.createAction( GUIcontext.DEFINE_CAS_FILE_FR, "Edit .cas file (French)", "Edit .cas file (French)",
- "Edit .cas file (French)")
+
+ sgPyQt.createAction(\
+ GUIcontext.EDIT_PARAM_STUDY_ID,
+ "Edit param study",
+ "Edit param study",
+ "Edit study using python launcher")
+ sgPyQt.createAction(\
+ GUIcontext.GEN_PARAM_STUDY_PYTHON_ID,
+ "Generate Python script",
+ "Generate Python script",
+ "Generate act Python script from the eficas date")
+ sgPyQt.createAction(\
+ GUIcontext.GEN_PARAM_STUDY_YACS_ID,
+ "Generate YACS script",
+ "Generate YACS script",
+ "Generate act YACS script from the eficas date")
+
+ sgPyQt.createAction(\
+ GUIcontext.RUN_STUDY_ID,
+ "Compute study",
+ "Compute study",
+ "Compute study using python launcher")
+ sgPyQt.createAction(\
+ GUIcontext.EDIT_STUDY_ID,
+ "Edit study",
+ "Edit study",
+ "Edit the selected study")
+ sgPyQt.createAction(\
+ GUIcontext.GEN_STUDY_BATCH_ID,
+ "Generate batch job",
+ "Generate batch job",
+ "Generate a batch job to run the selected study")
+
+ sgPyQt.createAction(\
+ GUIcontext.EDIT_TELMA_CAS_ID,
+ "Edit Steering file",
+ "Edit Steering file",
+ "Edit a Telemac-Mascaret steering file")
################################################
################################################
# study-to-context map
-__study2context__ = {}
+__study2context__ = {}
# current context
__current_context__ = None
# object counter
###
def _getStudy():
studyId = _getStudyId()
- study = getStudyManager().GetStudyByID( studyId )
+ study = getStudyManager().GetStudyByID(studyId)
return study
###
# returns True if object has children
###
-def _hasChildren( sobj ):
+def _hasChildren(sobj):
if sobj:
study = _getStudy()
- iter = study.NewChildIterator( sobj )
+ iter = study.NewChildIterator(sobj)
while iter.More():
name = iter.Value().GetName()
if name:
# set and return current GUI context
# study ID is passed as parameter
###
-def _setContext( studyID ):
+def _setContext(studyID):
global __study2context__, __current_context__
if not __study2context__.has_key(studyID):
__study2context__[studyID] = GUIcontext()
###
# increment object counter in the map
###
-def _incObjToMap( m, id ):
+def _incObjToMap(m, id):
if id not in m: m[id] = 0
m[id] += 1
pass
# called when module is activated
# returns True if activating is successfull and False otherwise
def activate():
- ctx = _setContext( _getStudyId() )
+ ctx = _setContext(_getStudyId())
return True
# called when module is deactivated
# called when active study is changed
# active study ID is passed as parameter
-def activeStudyChanged( studyID ):
- ctx = _setContext( _getStudyId() )
+def activeStudyChanged(studyID):
+ ctx = _setContext(_getStudyId())
pass
# called when popup menu is invoked
# one object is selected
sobj = ed.study.FindObjectID(salome.sg.getSelected(0))
selectedType = ed.getTypeId(sobj)
- if selectedType == hydro_study.MASCARET_CASE_TYPE_ID:
- popup.addAction(sgPyQt.action(GUIcontext.EDIT_MASCARET_CASE_ID))
- popup.addAction(sgPyQt.action(GUIcontext.RUN_MASCARET_ID))
- elif selectedType == hydro_study.TELEMAC2D_CASE_TYPE_ID:
- popup.addAction(sgPyQt.action(GUIcontext.GEN_TELEMAC2D_PYTHON_ID))
- popup.addAction(sgPyQt.action(GUIcontext.GEN_TELEMAC2D_YACS_ID))
- elif selectedType == hydro_study.LOG_TYPE_ID:
- popup.addAction(sgPyQt.action(GUIcontext.SHOW_LOG_ID))
- elif selectedType == hydro_study.PYTEL_CASE_TYPE_ID:
- popup.addAction(sgPyQt.action(GUIcontext.EDIT_PYTEL_CASE_ID))
- popup.addAction(sgPyQt.action(GUIcontext.RUN_PYTEL_ID))
- popup.addAction(sgPyQt.action(GUIcontext.GENERATE_JOB))
+ if selectedType == hydro_study.TELMA_TYPE_ID:
+ popup.addAction(sgPyQt.action(GUIcontext.EDIT_TELMA_CAS_ID))
+ elif selectedType == hydro_study.PARAM_STUDY_TYPE_ID:
+ popup.addAction(sgPyQt.action(GUIcontext.EDIT_PARAM_STUDY_ID))
+ popup.addAction(sgPyQt.action(GUIcontext.GEN_PARAM_STUDY_PYTHON_ID))
+ popup.addAction(sgPyQt.action(GUIcontext.GEN_PARAM_STUDY_YACS_ID))
+ elif selectedType == hydro_study.STUDY_TYPE_ID:
+ popup.addAction(sgPyQt.action(GUIcontext.EDIT_STUDY_ID))
+ popup.addAction(sgPyQt.action(GUIcontext.RUN_STUDY_ID))
+ popup.addAction(sgPyQt.action(GUIcontext.GEN_STUDY_BATCH_ID))
# called when GUI action is activated
# action ID is passed as parameter
-def OnGUIEvent( commandID ):
+def OnGUIEvent(commandID):
try:
dict_command[commandID]()
except HSGUIException, exc:
msgBox = QMessageBox(QMessageBox.Critical,
QApplication.translate("OnGUIEvent", "Error"),
msg,
- parent = sgPyQt.getDesktop())
+ parent=sgPyQt.getDesktop())
msgBox.setDetailedText(traceback.format_exc())
msgBox.exec_()
# GUI actions implementation
################################################
-# --------------------------------------------------------------------------------------- #
-# Dialog box for text display (deprecated, it was only used in the calcium coupling test) #
-# --------------------------------------------------------------------------------------- #
-"""
-from TextDisplayDialog import Ui_TextDisplayDialog
-
-class MyTextDisplayDialog(Ui_TextDisplayDialog, QDialog):
-
- def __init__(self, parent = None, modal = 0):
- QDialog.__init__(self, parent)
- Ui_TextDisplayDialog.__init__(self)
- self.setupUi(self)
- (self.closeButton.clicked.connect(self.close)
-
- def set_log(self, log):
- self.contentTextEdit.setPlainText(log)
- self.setWindowTitle("Coupling log")
-"""
-
-###
-# Open Eficas for Mascaret to create a new case
-###
-def create_mascaret_case():
- EficasForMascaretAppli()
-
-###
-# Open Eficas for Mascaret to edit the selected case
-###
-def edit_mascaret_case():
- EficasForMascaretAppli(get_and_check_selected_file_path())
-
-# Run Mascaret on selected case
-def run_mascaret():
- try:
- with wait_cursor:
- ed = hydro_study.HydroStudyEditor()
- sobj = ed.editor.study.FindObjectID(salome.sg.getSelected(0))
- (file_list, lig_file, input_vars, output_vars) = ed.get_mascaret_params_from_case(sobj)
- var_names = [var["NOM"].strip() for var in output_vars]
- mascaret_vars = [var["VARIABLE_MASCARET"].strip() for var in output_vars]
- engine = salome.lcc.FindOrLoadComponent("FactoryServer", "MASCARET")
- logger.debug("Calling MASCARET.Compute(%s, %s, %s)" %
- (file_list, lig_file, mascaret_vars))
- output_values = engine.Compute(file_list, lig_file, mascaret_vars)
- ed.add_results_to_mascaret_case(sobj, var_names, output_values)
- salome.sg.updateObjBrowser( 0 )
- except SALOME.SALOME_Exception, exc:
- salome.sg.updateObjBrowser( 0 )
- msg = unicode(QApplication.translate("run_mascaret",
- "An error happened while trying to run Mascaret:"))
- msg += "\n" + exc.details.text
- raise HSGUIException(msg)
-
-# Display selected log (deprecated, it was only used in the calcium coupling test)
-def show_log():
- ed = hydro_study.HydroStudyEditor()
- sobj = ed.editor.study.FindObjectID(salome.sg.getSelected(0))
- if sobj is not None:
- (found, attr) = getStudyEditor().builder.FindAttribute(
- sobj, "AttributeParameter")
- log = attr.GetString("log")
- dialog = MyTextDisplayDialog(sgPyQt.getDesktop())
- dialog.set_log(log)
- dialog.show()
-
###
-# Open Eficas for Telemac2D to create a new case
+# Open Eficas for a new parametric study
###
-def create_telemac2d_case():
- EficasForTelemac2DAppli()
-
+def create_param_study():
+ EficasForParamStudyAppli()
###
-# Open Eficas for Telemac2D to edit the selected case
+# Open Eficas to edit a new parametric study
###
-def edit_telemac2d_case():
- EficasForTelemac2DAppli(get_and_check_selected_file_path())
+def edit_param_study():
+ EficasForParamStudyAppli(get_and_check_selected_file_path())
###
# Generate a python script from the eficas file
###
-def generate_telemac2d_python():
+def generate_param_study_python():
try:
with wait_cursor:
ed = hydro_study.HydroStudyEditor()
sobj = get_and_check_selected_file_path()
ed.generate_study_script(sobj)
except SALOME.SALOME_Exception, exc:
- salome.sg.updateObjBrowser( 0 )
+ salome.sg.updateObjBrowser(0)
msg = unicode(QApplication.translate("generate_telemac2d_python",
"An error happened while trying to generate telemac2d Python script:"))
msg += "\n" + exc.details.text
###
# Generate a python script from the eficas file
###
-def generate_telemac2d_yacs():
+def generate_param_study_yacs():
try:
with wait_cursor:
ed = hydro_study.HydroStudyEditor()
sobj = get_and_check_selected_file_path()
ed.generate_study_yacs(sobj)
except SALOME.SALOME_Exception, exc:
- salome.sg.updateObjBrowser( 0 )
+ salome.sg.updateObjBrowser(0)
msg = unicode(QApplication.translate("generate_telemac2d_yacs",
"An error happened while trying to generate telemac2d Python script:"))
msg += "\n" + exc.details.text
yg = salome.ImportComponentGUI("YACS")
yg.loadSchema(filename)
-###
-# Open Eficas for boundary conditions definition
-###
-#def define_boundary_conditions():
-# EficasForBoundaryConditionsAppli()
-
###
# Open dialog for boundary conditions edition
###
dlg = BndConditionsDialog.BoundaryConditionsDialog(desktop)
dlg.exec_()
+###
+# Open dialog for liquid boundary conditions edition
+###
+def edit_liquid_boundary_file():
+ # TODO: Implement gui
+ QMessageBox.warning(sgPyQt.getDesktop(),
+ "",
+ "Liquid boundary file handling not implemented yet")
+ return
+
+###
+# Open dialog for breaches file edition
+###
+def edit_breaches_file():
+ # TODO: Implement gui
+ QMessageBox.warning(sgPyQt.getDesktop(),
+ "",
+ "Breaches file handling not implemented yet")
+ return
+
###
# Open dialog for interpolz.py script generation
###
dlg.show()
###
-# Open dialog for boundary conditions edition
+# Open dialog for interpolks.py script generation
###
-def eficas_for_cas_Telemac2D_fr():
- EficasForTelemac2DAppli(code='TELEMAC', lang = 'fr')
+def generate_interpolks_py():
+ QMessageBox.warning(sgPyQt.getDesktop(),
+ "",
+ "Generation of interpolks.py not implemented yet")
+ return
-def eficas_for_cas_Telemac2D_en():
- EficasForTelemac2DAppli(code='TELEMAC', lang = 'en')
+###
+# Open dialog for creation of steering file
+###
+def create_telma_cas():
+ EficasForTelmaAppli(code='TELEMAC', lang='en')
+
+###
+# Open dialog for edition of steering file
+###
+def edit_telma_cas():
+ # TODO: See how to detect module
+ EficasForTelmaAppli(fichier=get_and_check_selected_file_path(),
+ code='TELEMAC', lang='en')
###
# Commands dictionary
###
dict_command = {
- GUIcontext.CREATE_MASCARET_CASE_ID: create_mascaret_case,
- GUIcontext.RUN_MASCARET_ID: run_mascaret,
- GUIcontext.EDIT_MASCARET_CASE_ID: edit_mascaret_case,
- GUIcontext.SHOW_LOG_ID: show_log,
- GUIcontext.CREATE_TELEMAC2D_CASE_ID: create_telemac2d_case,
- GUIcontext.GEN_TELEMAC2D_PYTHON_ID: generate_telemac2d_python,
- GUIcontext.GEN_TELEMAC2D_YACS_ID: generate_telemac2d_yacs,
- GUIcontext.OPEN_SCHEMA_IN_YACS_ID: open_schema_in_yacs,
- GUIcontext.CREATE_PYTEL_CASE_ID: create_case_pytel,
- GUIcontext.RUN_PYTEL_ID: run_selected_case_pytel,
- GUIcontext.EDIT_PYTEL_CASE_ID: edit_selected_case_pytel,
- GUIcontext.GENERATE_JOB: generate_job_for_selected_case_pytel,
- #GUIcontext.DEFINE_BOUNDARY_CONDITIONS_ID: define_boundary_conditions,
- GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID: edit_boundary_conditions_file,
+ GUIcontext.CREATE_STUDY_ID: create_case_study,
+ GUIcontext.EDIT_STUDY_ID: edit_selected_case_study,
+ GUIcontext.RUN_STUDY_ID: run_selected_case_study,
+ GUIcontext.GEN_STUDY_BATCH_ID: generate_job_for_selected_case_study,
+ GUIcontext.CREATE_TELMA_CAS_ID: create_telma_cas,
+ GUIcontext.EDIT_TELMA_CAS_ID: edit_telma_cas,
GUIcontext.GENERATE_INTERPOLZ_PY_ID: generate_interpolz_py,
- GUIcontext.DEFINE_CAS_FILE_EN: eficas_for_cas_Telemac2D_en,
- GUIcontext.DEFINE_CAS_FILE_FR: eficas_for_cas_Telemac2D_fr,
+ GUIcontext.GENERATE_INTERPOLKS_PY_ID: generate_interpolks_py,
+ GUIcontext.EDIT_LIQUID_BOUNDARY_FILE_ID: edit_liquid_boundary_file,
+ GUIcontext.EDIT_BOUNDARY_CONDITIONS_FILE_ID: edit_boundary_conditions_file,
+ GUIcontext.EDIT_BREACHES_FILE_ID: edit_breaches_file,
+ GUIcontext.CREATE_PARAM_STUDY_ID: create_param_study,
+ GUIcontext.EDIT_PARAM_STUDY_ID: edit_param_study,
+ GUIcontext.GEN_PARAM_STUDY_PYTHON_ID: generate_param_study_python,
+ GUIcontext.GEN_PARAM_STUDY_YACS_ID: generate_param_study_yacs,
}
# You should have received a copy of the GNU General Public License
# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-ADD_SUBDIRECTORY(mascaret)
-ADD_SUBDIRECTORY(telemac2d)
-ADD_SUBDIRECTORY(pytel)
+ADD_SUBDIRECTORY(telma)
+ADD_SUBDIRECTORY(param_study)
+ADD_SUBDIRECTORY(run_study)
ADD_SUBDIRECTORY(boundary_conditions)
# --- Python files ---
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-ADD_SUBDIRECTORY(eficas)
-
-# --- Python files ---
-
-SET(PYFILES
- __init__.py
-)
-
-# --- rules ---
-
-SALOME_INSTALL_SCRIPTS("${PYFILES}" ${SALOME_INSTALL_PYTHON}/salome/hydro/mascaret)
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-# --- Python files ---
-
-SET(PYFILES
- __init__.py
- appli.py
- configuration_mascaret.py
- prefs_mascaret.py
- prefs.py
- mascaret_V7_cata.py
-)
-
-# --- rules ---
-
-SALOME_INSTALL_SCRIPTS("${PYFILES}" ${SALOME_INSTALL_PYTHON}/salome/hydro/mascaret/eficas)
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import sys
-import re
-
-from PyQt5.QtWidgets import QMessageBox , QScrollArea, QGridLayout
-
-
-import salome
-import SalomePyQt
-sgPyQt = SalomePyQt.SalomePyQt()
-
-from salome.kernel.logger import Logger
-from salome.kernel import termcolor
-logger = Logger("salome.hydro.mascaret.eficas.appli",
- color = termcolor.GREEN_FG)
-
-import eficasSalome
-
-from salome.hydro.study import HydroStudyEditor
-
-class EficasForMascaretAppli(eficasSalome.MyEficas):
- """
- This class launches Eficas and adds entries for the created files in
- MASCARET component in the study tree. The messages in this class are in
- french because they are displayed in Eficas interface.
-
- :type fichier: string
- :param fichier: path of an Eficas file to open
-
- """
- def __init__(self, fichier = None, version = None):
- self.ed = HydroStudyEditor()
- self.codedir = os.path.dirname(__file__)
- sys.path[:0] = [self.codedir]
- area = QScrollArea(SalomePyQt.SalomePyQt().getDesktop());
- eficasSalome.MyEficas.__init__(self, area,
- "mascaret",
- fichier, version = version)
- gridLayout = QGridLayout(area)
- gridLayout.addWidget(self)
- area.setWidgetResizable(1)
- sgPyQt.createView("Eficas Mascaret", self)
-
- def addJdcInSalome(self, jdcPath):
- """
- Add the newly created file in Salome study
- """
- try:
- self.ed.find_or_create_mascaret_case(jdcPath)
- except Exception, exc:
- msgError = "Can't add file to Salome study tree"
- logger.exception(msgError)
- QMessageBox.warning(self, self.tr("Warning"),
- self.tr("%s. Reason:\n%s\n\nSee logs for "
- "more details." % (msgError, exc)))
- salome.sg.updateObjBrowser(0)
-
- def closeEvent(self, event):
- while self.codedir in sys.path:
- sys.path.remove(self.codedir)
- eficasSalome.MyEficas.closeEvent(self, event)
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-
-from Editeur.catadesc import CatalogDescription
-from InterfaceQT4.configuration import configBase
-
-class CONFIG(configBase):
-
- def __init__(self, appli, repIni):
- """
- This class stores the configuration parameters for Eficas
- """
- configBase.__init__(self, appli, repIni)
-
- # Configuration parameters
- self.savedir = os.getenv("HOME")
- self.catalogues = (CatalogDescription("mascaret_V7",
- os.path.join(repIni, "mascaret_V7_cata.py")),)
- self.lang = 'fr'
-
- def save_params(self):
- pass
-
-def make_config(appli, rep):
- return CONFIG(appli, rep)
-
-def make_config_style(appli, rep):
- return None
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-from Accas import *
-
-JdC = JDC_CATA(regles = (UN_PARMI('MASCARET',)),
- )
-
-MASCARET = PROC(
- nom = "MASCARET", op = None,
- fr = u"Définition d'un cas d'étude Mascaret",
- ang = u"Definition of a Mascaret study case",
- FICHIER_DICO = SIMP(statut = "o", typ = 'Fichier',
- fr = u"Fichier Dictionnaire",
- ang = u"Dictionary file"),
- FICHIER_MOT_CLE = SIMP(statut = "o",
- typ = ('Fichier', 'Fichiers CAS (*.cas);;Tous les fichiers (*)',),
- fr = u"Fichier Mot Clé",
- ang = u"Keyword file"),
- FICHIER_GEOMETRIE = SIMP(statut = "f",
- typ = ('Fichier', 'Fichiers GEO (*.geo);;Tous les fichiers (*)',),
- fr = u"Fichier de géométrie",
- ang = u"Geometry file"),
- FICHIER_LOI = FACT(statut = 'f', max = '**',
- NOM = SIMP(statut = "o",
- typ = ('Fichier', 'Fichiers LOI (*.loi);;Tous les fichiers (*)',),
- fr = u"Fichier de lois",
- ang = u"Laws file"),
- ),
- FICHIER_ABAQUES = SIMP(statut = "f",
- typ = ('Fichier', 'Tous les fichiers (*)',),
- fr = u"Fichier abaques",
- ang = u"Abacus file"),
- FICHIER_CASIER = SIMP(statut = "f",
- typ = ('Fichier', 'Tous les fichiers (*)',),
- fr = u"Fichier casier",
- ang = u"Compartment file"),
- FICHIER_DAMOCLE = SIMP(statut = "f",
- typ = ('Fichier', 'Tous les fichiers (*)',),
- fr = u"Fichier damocle",
- ang = u"Damocle file"),
- FICHIER_LIG = SIMP(statut = "o",
- typ = ('Fichier', 'Fichiers LIG (*.lig);;Tous les fichiers (*)',),
- fr = u"Fichier LIG",
- ang = u"LIG file"),
- LISTING = SIMP(statut = "f",
- typ = ('Fichier', 'Tous les fichiers (*)', "Sauvegarde"),
- fr = u"Fichier de listing",
- ang = u"Listing file"),
- LISTING_CASIER = SIMP(statut = "f",
- typ = ('Fichier', 'Tous les fichiers (*)', "Sauvegarde"),
- fr = u"Fichier de listing casier",
- ang = u"Compartment listing file"),
- LISTING_LIAISON = SIMP(statut = "f",
- typ = ('Fichier', 'Tous les fichiers (*)', "Sauvegarde"),
- fr = u"Fichier de listing liaison",
- ang = u"Link listing file"),
- RESULTAT = SIMP(statut = "f",
- typ = ('Fichier', 'Tous les fichiers (*)', "Sauvegarde"),
- fr = u"Fichier de résultat",
- ang = u"Result file"),
- RESULTAT_CASIER = SIMP(statut = "f",
- typ = ('Fichier', 'Tous les fichiers (*)', "Sauvegarde"),
- fr = u"Fichier de résultat casier",
- ang = u"Compartment result file"),
- RESULTAT_LIAISON = SIMP(statut = "f",
- typ = ('Fichier', 'Tous les fichiers (*)', "Sauvegarde"),
- fr = u"Fichier de résultat liaison",
- ang = u"Link result file"),
- VARIABLE_SORTIE = FACT(statut = 'f', max = '**',
- fr = u"Variable de sortie du calcul",
- ang = u"Computation output variable",
- NOM = SIMP(statut = "o", typ = 'TXM',
- fr = u"Nom de la variable",
- ang = u"Variable name"),
- VARIABLE_MASCARET = SIMP(statut = "o", typ = 'TXM',
- fr = u'Variable Mascaret (ex : "Etat.Z(1,0,0)")',
- ang = u'Mascaret variable (ex : "Etat.Z(1,0,0)")'),
- ),
- 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_MASCARET = SIMP(statut = "o", typ = 'TXM',
- fr = u'Variable Mascaret (ex : "Modele.Lois.Debit(1,1-2,0)")',
- ang = u'Mascaret variable (ex : "Modele.Lois.Debit(1,1-2,0)")'),
- ),
-)
-TEXTE_NEW_JDC="MASCARET()"
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-code = "mascaret"
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import sys
-
-repIni = os.path.dirname(__file__)
-INSTALLDIR = os.getenv("EFICAS_ROOT")
-closeAutreCommande=True
-closeFrameRechercheCommande=True
-closeArbre=True
-closeCopier=True
-suiteTelemac=True
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+# --- Python files ---
+
+SET(PYFILES
+ __init__.py
+)
+
+SET(INSTALL_DIR ${SALOME_INSTALL_PYTHON}/salome/hydro/param_study)
+
+# --- rules ---
+
+SALOME_INSTALL_SCRIPTS("${PYFILES}" ${INSTALL_DIR})
+
+ADD_SUBDIRECTORY(eficas)
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+# --- Python files ---
+
+SET(PYFILES
+ __init__.py
+ configuration_telemac2d.py
+ prefs_telemac2d.py
+ prefs.py
+ appli.py
+ param_study_cata.py
+)
+
+# --- rules ---
+
+SALOME_INSTALL_SCRIPTS("${PYFILES}" ${SALOME_INSTALL_PYTHON}/salome/hydro/param_study/eficas)
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import sys
+import re
+
+from PyQt5.QtWidgets import QMessageBox , QScrollArea, QGridLayout
+
+
+import salome
+import SalomePyQt
+sgPyQt = SalomePyQt.SalomePyQt()
+
+from salome.kernel.logger import Logger
+from salome.kernel import termcolor
+logger = Logger("salome.hydro.param_study.eficas.appli",
+ color = termcolor.GREEN_FG)
+
+import eficasSalome
+
+from salome.hydro.study import HydroStudyEditor
+
+def importFirst():
+ """
+ Horrible hack to allow a correct load of a Telemac case file when done after
+ some other edition, such as create case for Pytel execution.
+ """
+ eficasTelemacPath = os.path.join(eficasSalome.eficasConfig.eficasPath,'Telemac')
+ sys.path.insert(0, eficasTelemacPath)
+ from telemac2d_enum_auto import TelemacdicoEn
+ sys.path.pop(0)
+
+importFirst()
+
+class EficasForParamStudyAppli(eficasSalome.MyEficas):
+ """
+ This class launches Eficas and adds entries for the created files in
+ HYDRO component in the study tree. The messages in this class are in
+ french because they are displayed in Eficas interface.
+
+ :type fichier: string
+ :param fichier: path of an Eficas file to open
+
+ """
+ def __init__(self, code="telemac2d", fichier=None, version=None, lang=None):
+ self.ed = HydroStudyEditor()
+ self.codedir = os.path.dirname(__file__)
+ sys.path[:0] = [self.codedir]
+ area = QScrollArea(SalomePyQt.SalomePyQt().getDesktop());
+ eficasSalome.MyEficas.__init__(self, area,
+ code=code, fichier=fichier,
+ version=version, lang=lang)
+ gridLayout = QGridLayout(area)
+ gridLayout.addWidget(self)
+ area.setWidgetResizable(1)
+ sgPyQt.createView("Eficas Telemac2D", self)
+ if fichier == None:
+ self.fileNew()
+ else:
+ self.addJdcInSalome(fichier)
+
+ def addJdcInSalome(self, jdcPath):
+ """
+ Add the newly created file in Salome study
+ """
+ try:
+ self.ed.find_or_create_param_study(jdcPath)
+ except Exception, exc:
+ msgError = "Can't add file to Salome study tree"
+ logger.exception(msgError)
+ QMessageBox.warning(self, self.tr("Warning"),
+ self.tr("%s. Reason:\n%s\n\nSee logs for "
+ "more details." % (msgError, exc)))
+ salome.sg.updateObjBrowser(0)
+
+ def closeEvent(self, event):
+ while self.codedir in sys.path:
+ sys.path.remove(self.codedir)
+ eficasSalome.MyEficas.closeEvent(self, event)
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+
+from Editeur.catadesc import CatalogDescription
+from InterfaceQT4.configuration import configBase
+
+class CONFIG(configBase):
+
+ def __init__(self, appli, repIni):
+ """
+ This class stores the configuration parameters for Eficas
+ """
+ configBase.__init__(self, appli, repIni)
+
+ # Configuration parameters
+ self.savedir = os.getenv("HOME")
+ self.catalogues = (CatalogDescription("param_study",
+ os.path.join(repIni, "param_study_cata.py")),)
+ self.lang = 'fr'
+
+ def save_params(self):
+ pass
+
+def make_config(appli, rep):
+ return CONFIG(appli, rep)
+
+def make_config_style(appli, rep):
+ return None
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+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
+
+ def __convert__(self,valeur):
+ if type(valeur) == types.StringType:
+ return None
+ if len(valeur) != self.ntuple:
+ return None
+ return valeur
+
+ def info(self):
+ return "Tuple de %s elements" % self.ntuple
+
+ __repr__=info
+ __str__=info
+
+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",
+ STEERING_FILE = SIMP(statut = "o", typ = 'Fichier',
+ fr = u"Fichier de description du cas",
+ 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',
+ intoSug = 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'],
+ fenetreIhm="menuDeroulant",
+ 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",
+ NAME = SIMP(statut = "o", typ = 'TXM',
+ fr = u"Nom de la variable",
+ 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',
+ intoSug = 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()"
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+code = "telemac2d"
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import sys
+
+repIni = os.path.dirname(__file__)
+INSTALLDIR = os.getenv("EFICAS_ROOT")
+closeAutreCommande=True
+closeFrameRechercheCommande=True
+closeArbre=True
+closeCopier=True
+suiteTelemac=True
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-ADD_SUBDIRECTORY(eficas)
-
-INCLUDE(UsePyQt)
-
-# --- Python files ---
-
-SET(PYFILES
- __init__.py
- genjob.py
- genjobwindow.py
- launcher.py
- gui.py
-)
-
-# uic files / to be processed by pyuic
-SET(UIFILES
- genjobwindow.ui
-)
-
-# scripts / pyuic wrappings
-PYQT_WRAP_UIC(_pyuic_SCRIPTS ${UIFILES})
-
-# --- rules ---
-
-# scripts / pyuic wrappings
-
-SALOME_INSTALL_SCRIPTS("${PYFILES}" ${SALOME_INSTALL_PYTHON}/salome/hydro/pytel)
-INSTALL( FILES ${_pyuic_SCRIPTS} DESTINATION ${SALOME_INSTALL_PYTHON}/salome/hydro/pytel)
-
-
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-# --- Python files ---
-
-SET(PYFILES
- __init__.py
- configuration_pytel.py
- prefs_pytel.py
- prefs.py
- pytel_cata.py
- appli.py
-)
-
-# --- rules ---
-
-SALOME_INSTALL_SCRIPTS("${PYFILES}" ${SALOME_INSTALL_PYTHON}/salome/hydro/pytel/eficas)
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import sys
-
-from PyQt5.QtWidgets import QMessageBox , QScrollArea, QGridLayout
-
-
-import salome
-import SalomePyQt
-sgPyQt = SalomePyQt.SalomePyQt()
-
-from salome.kernel.logger import Logger
-from salome.kernel import termcolor
-logger = Logger("salome.hydro.pytel.eficas.appli",
- color = termcolor.GREEN_FG)
-
-import eficasSalome
-
-from salome.hydro.study import HydroStudyEditor
-
-class EficasForPytelAppli(eficasSalome.MyEficas):
- """
- This class launches Eficas and adds entries for the created files in
- HYDRO component in the study tree.
-
- :type fichier: string
- :param fichier: path of an Eficas file to open
-
- """
- def __init__(self, fichier = None, version = None):
- self.ed = HydroStudyEditor()
- self.codedir = os.path.dirname(__file__)
- sys.path[:0] = [self.codedir]
- area = QScrollArea(SalomePyQt.SalomePyQt().getDesktop());
- eficasSalome.MyEficas.__init__(self, area, "pytel",
- fichier, version = version)
- gridLayout = QGridLayout(area)
- gridLayout.addWidget(self)
- area.setWidgetResizable(1)
- sgPyQt.createView("Eficas Pytel", self)
- if fichier == None : self.fileNew()
- else : self.addJdcInSalome(fichier)
-
- def addJdcInSalome(self, jdcPath):
- """
- Add the newly created file in Salome study
- """
- try:
- self.ed.find_or_create_pytel_case(jdcPath)
- except Exception, exc:
- msgError = "Can't add file to Salome study tree"
- logger.exception(msgError)
- QMessageBox.warning(self, self.tr("Warning"),
- self.tr("%s. Reason:\n%s\n\nSee logs for more details." % (msgError, exc)))
- salome.sg.updateObjBrowser(0)
-
- def closeEvent(self, event):
- while self.codedir in sys.path:
- sys.path.remove(self.codedir)
- eficasSalome.MyEficas.closeEvent(self, event)
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-
-from Editeur.catadesc import CatalogDescription
-from InterfaceQT4.configuration import configBase
-
-class CONFIG(configBase):
-
- def __init__(self, appli, repIni):
- """
- This class stores the configuration parameters for Eficas
- """
- configBase.__init__(self, appli, repIni)
-
- # Configuration parameters
- self.savedir = os.getenv("HOME")
- self.catalogues = (CatalogDescription("pytel", os.path.join(repIni, "pytel_cata.py")),)
- self.labels_eficas=['lang','rep_cata','catalogues','closeAutreCommande','closeFrameRechercheCommande','closeEntete','closeArbre']
- self.lang = 'fr'
-
- def save_params(self):
- pass
-
-def make_config(appli, rep):
- return CONFIG(appli, rep)
-
-def make_config_style(appli, rep):
- return None
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-code = "pytel"
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import sys
-
-repIni = os.path.dirname(__file__)
-INSTALLDIR = os.getenv("EFICAS_ROOT")
-closeAutreCommande=True
-closeFrameRechercheCommande=True
-closeArbre=True
-closeCopier=True
-suiteTelemac=True
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-from Accas import *
-
-codelist = ("artemis", "estel3d", "postel3d", "sisyphe", "stbtel", "telemac2d", "telemac3d", "tomawac", "mascaret")
-
-JdC = JDC_CATA(regles = (UN_PARMI('PYTEL',)),
- )
-PYTEL = PROC(
- nom = "PYTEL", op = None,
- fr = u"Définition d'un cas pour le lanceur Pytel",
- ang = u"Definition of a case for the Pytel launcher",
- CODE = SIMP(statut = "o", typ = "TXM", into = codelist, defaut = "telemac2d",
- fr = u"Code à exécuter",
- ang = u"Code to run"),
- FICHIER_CAS = SIMP(statut = "o", typ = 'Fichier',
- fr = u"Fichier de description du cas",
- ang = u"Case description file"),
- REPERTOIRE_TRAVAIL = SIMP(statut = "f", typ = 'Repertoire',
- fr = u"Répertoire de travail",
- ang = u"Working directory"),
-)
-
-TEXTE_NEW_JDC="PYTEL()"
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import tempfile
-from datetime import datetime
-import glob
-
-import salome
-
-job_script_template = """#!/bin/sh
-
-. %(env_file)s
-runcode.py %(code)s %(cas)s --ncsize %(nbcore)d
-"""
-
-def generate_job(pytel_params, resource, telemac_root_dir, telemac_env_file,
- nbcore, input_data_dir, result_dir):
- """
- Create a Launcher job using the parameters specified by the user.
- """
- # Generate job script
- basename = os.path.basename(pytel_params["FICHIER_CAS"])
- job_script = job_script_template % {"env_file": telemac_env_file,
- "code": pytel_params["CODE"],
- "cas": basename,
- "nbcore": nbcore}
-
-
- (fd, job_script_file) = tempfile.mkstemp(prefix = "job_" + basename + "_", suffix = ".sh")
- os.close(fd)
- f = open(job_script_file, "w")
- f.write(job_script)
- f.close()
-
- # Define job parameters
- job_params = salome.JobParameters()
- job_params.job_name = basename
- job_params.job_type = "command"
- job_params.job_file = job_script_file
- input_files = glob.glob(os.path.join(input_data_dir, "*")) + [pytel_params["FICHIER_CAS"]]
- input_files = list(set(input_files)) # Remove duplicates
- job_params.in_files = input_files
- job_params.out_files = []
- job_params.result_directory = result_dir
-
- # Define resource parameters
- job_params.resource_required = salome.ResourceParameters()
- job_params.resource_required.name = resource
- job_params.resource_required.nb_proc = nbcore
-
- # Generate name for the working directory
- res_manager = salome.naming_service.Resolve("/ResourcesManager")
- res_definition = res_manager.GetResourceDefinition(resource)
- res_work_dir = res_definition.working_directory
- if res_work_dir != "":
- timestr = datetime.now().ctime()
- timestr = timestr.replace('/', '_')
- timestr = timestr.replace('-', '_')
- timestr = timestr.replace(':', '_')
- timestr = timestr.replace(' ', '_')
- work_dir = res_work_dir + "/" + job_params.job_name + "_" + timestr
- job_params.work_directory = work_dir
-
- # Create Launcher job
- launcher = salome.naming_service.Resolve('/SalomeLauncher')
- launcher.createJob(job_params)
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-from PyQt5.QtWidgets import QDialog , QFileDialog
-
-import salome
-from salome.hydro.pytel.genjob import generate_job
-from genjobwindow_ui import Ui_GenJobDialog
-
-
-class GenJobDialog(QDialog, Ui_GenJobDialog):
-
- def __init__(self, parent, pytel_params):
- QDialog.__init__(self, parent)
- self.setupUi(self)
- self.dialogButtonBox.accepted.connect(self.validate)
- self.dialogButtonBox.rejected.connect( self.close)
- self.chooseInputDataDirectoryButton.clicked.connect( self.choose_input_dir)
- self.chooseResultDirectoryButton.clicked.connect(self.choose_result_dir)
-
- self.telemacRootDirLE.setText("/projets/systel/V7P2")
- self.telemacEnvFileLE.setText("/projets/systel/V7P2/config/pysource.eole.intel.sh")
- casedir = os.path.dirname(pytel_params["FICHIER_CAS"])
- self.inputDataDirectoryLE.setText(casedir)
- self.resultDirectoryLE.setText(casedir)
-
- # Populate resource combo box
- res_manager = salome.naming_service.Resolve("/ResourcesManager")
- res_params = salome.ResourceParameters()
- res_list = res_manager.GetFittingResources(res_params)
- self.resourceCB.addItems(res_list)
-
- self.pytel_params = pytel_params
-
- def choose_input_dir(self):
- directory = QFileDialog.getExistingDirectory(self,
- directory = self.inputDataDirectoryLE.text(),
- options = QFileDialog.ShowDirsOnly)
- if not directory.isNull():
- self.inputDataDirectoryLE.setText(directory)
-
- def choose_result_dir(self):
- directory = QFileDialog.getExistingDirectory(self,
- directory = self.resultDirectoryLE.text(),
- options = QFileDialog.ShowDirsOnly)
- if not directory.isNull():
- self.resultDirectoryLE.setText(directory)
-
- def validate(self):
- generate_job(self.pytel_params,
- str(self.resourceCB.currentText()),
- str(self.telemacRootDirLE.text()),
- str(self.telemacEnvFileLE.text()),
- self.nbCoreSB.value(),
- str(self.inputDataDirectoryLE.text()),
- str(self.resultDirectoryLE.text()))
- self.close()
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>GenJobDialog</class>
- <widget class="QDialog" name="GenJobDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>636</width>
- <height>280</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Generate Job</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Resource</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="resourceCB"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Telemac remote root directory</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="telemacRootDirLE"/>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Telemac environment file</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="telemacEnvFileLE"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>Number of cores</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QSpinBox" name="nbCoreSB">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>100000</number>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Input data directory</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QLineEdit" name="inputDataDirectoryLE">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="chooseInputDataDirectoryButton">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Result directory</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLineEdit" name="resultDirectoryLE">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="chooseResultDirectoryButton">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>43</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="dialogButtonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import SalomePyQt
-sgPyQt = SalomePyQt.SalomePyQt()
-
-from salome.hydro.gui_utils import get_and_check_selected_file_path
-from salome.hydro.study import jdc_to_dict
-
-from salome.hydro.pytel.eficas.appli import EficasForPytelAppli
-from launcher import run_pytel
-from genjobwindow import GenJobDialog
-
-from PyQt5.QtWidgets import QFileDialog
-
-def create_case_pytel():
- EficasForPytelAppli()
-
-def edit_selected_case_pytel():
- file=get_and_check_selected_file_path()
- if file == None :
- file, filt = QFileDialog.getOpenFileName(sgPyQt.getDesktop(), "Open Pytel file", "", )
- EficasForPytelAppli(fichier=file)
-
-def get_params_from_selected_case():
- """
- Get the parameters dict from the selected case in Salome study
- """
- jdcpath = get_and_check_selected_file_path()
- with open(jdcpath) as jdcfile:
- jdc = jdcfile.read()
- param_dict = jdc_to_dict(jdc, ["PYTEL", "_F"])
- return param_dict
-
-def run_selected_case_pytel():
- param_dict = get_params_from_selected_case()
- run_pytel(param_dict)
-
-def generate_job_for_selected_case_pytel():
- param_dict = get_params_from_selected_case()
- dialog = GenJobDialog(sgPyQt.getDesktop(), param_dict)
- dialog.exec_()
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import subprocess
-import tempfile
-
-from salome.kernel.logger import Logger
-from salome.kernel import termcolor
-logger = Logger("salome.hydro.pytel.launcher", color = termcolor.BLUE)
-#logger.setLevel(logging.ERROR)
-
-def run_pytel(param_dict):
- """
- Run the Python Telemac launching script (pytel), eventually preceded and
- followed by data conversion scripts.
- """
- interm_files = [] # Intermediate files that can eventually be deleted in the end
-
- # Get and eventually create working directory
- if "REPERTOIRE_TRAVAIL" in param_dict:
- wrkdir = param_dict["REPERTOIRE_TRAVAIL"]
- if not os.path.exists(wrkdir):
- os.makedirs(wrkdir)
- else:
- wrkdir = tempfile.mkdtemp(prefix = "tel-")
- interm_files += [wrkdir]
-
- # Read original steering file
- steering_filepath = param_dict["FICHIER_CAS"]
- steering_file_dir = os.path.dirname(steering_filepath)
- with open(steering_filepath) as f:
- orig_steering = f.read()
- orig_steering_lines = orig_steering.split("\n")
-
- cmd = "set -x ; "
-
- # Run the code itself
- code = param_dict["CODE"]
- cmd += "runcode.py -w %s %s %s" % \
- (wrkdir, code, steering_filepath)
- cmd += " ; rc=$?"
-
- # Cleanup intermediate files if the computation was successful
- cmd += " ; if test $rc -eq 0; then rm -rf %s ; fi" % " ".join(interm_files)
-
- cmd += ' ; echo "return code is $rc"'
-
- # Launch the command
- logger.debug("Running the following command in xterm: %s" % cmd)
- args = ["xterm", "-T", "Execution of Telemac", "-geo", "80x60", "-hold", "-l", "-e", cmd]
- if param_dict.has_key('batchExec'):
- if param_dict['batchExec'] == True:
- args = ["xterm", "-T", "Execution of Telemac", "-geo", "80x60", "+hold", "-l", "-e", cmd]
- subprocess.Popen(args, cwd = wrkdir)
-
-def check_file_or_create_link(filepath, dirpath, interm_file_list = None):
- """
- This utility function checks if the file *filepath* is in directory *dirpath*.
- If not, it creates a link with a unique name in *dirpath* to the file *filepath*
- and it prepends the link path to the list *interm_file_list* if it is not None.
- It returns the name of the link if a link was created, or the name of the file
- *filepath* otherwise.
- """
- filename = os.path.basename(filepath)
- if not os.path.samefile(dirpath, os.path.dirname(filepath)):
- name_wo_ext, ext = os.path.splitext(filename)
- linkpath = tempfile.mktemp(dir = dirpath, prefix = name_wo_ext + "_", suffix = ext)
- os.symlink(filepath, linkpath)
- filename = os.path.basename(linkpath)
- if interm_file_list is not None:
- interm_file_list[:0] = [linkpath]
- return filename
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+ADD_SUBDIRECTORY(eficas)
+
+INCLUDE(UsePyQt)
+
+# --- Python files ---
+
+SET(PYFILES
+ __init__.py
+ genjob.py
+ genjobwindow.py
+ launcher.py
+ gui.py
+)
+
+# uic files / to be processed by pyuic
+SET(UIFILES
+ genjobwindow.ui
+)
+
+# scripts / pyuic wrappings
+PYQT_WRAP_UIC(_pyuic_SCRIPTS ${UIFILES})
+
+# --- rules ---
+
+# scripts / pyuic wrappings
+
+SALOME_INSTALL_SCRIPTS("${PYFILES}" ${SALOME_INSTALL_PYTHON}/salome/hydro/run_study)
+INSTALL( FILES ${_pyuic_SCRIPTS} DESTINATION ${SALOME_INSTALL_PYTHON}/salome/hydro/run_study)
+
+
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+# --- Python files ---
+
+SET(PYFILES
+ __init__.py
+ configuration_run_study.py
+ prefs_run_study.py
+ prefs.py
+ run_study_cata.py
+ appli.py
+)
+
+# --- rules ---
+
+SALOME_INSTALL_SCRIPTS("${PYFILES}" ${SALOME_INSTALL_PYTHON}/salome/hydro/run_study/eficas)
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import sys
+
+from PyQt5.QtWidgets import QMessageBox, QScrollArea, QGridLayout
+
+
+import salome
+import SalomePyQt
+sgPyQt = SalomePyQt.SalomePyQt()
+
+from salome.kernel.logger import Logger
+from salome.kernel import termcolor
+logger = Logger("salome.hydro.run_study.eficas.appli",
+ color=termcolor.GREEN_FG)
+
+import eficasSalome
+
+from salome.hydro.study import HydroStudyEditor
+
+class EficasForRunStudyAppli(eficasSalome.MyEficas):
+ """
+ This class launches Eficas and adds entries for the created files in
+ HYDRO component in the study tree.
+
+ :type fichier: string
+ :param fichier: path of an Eficas file to open
+
+ """
+ def __init__(self, fichier=None, version=None):
+ self.ed = HydroStudyEditor()
+ self.codedir = os.path.dirname(__file__)
+ sys.path[:0] = [self.codedir]
+ area = QScrollArea(SalomePyQt.SalomePyQt().getDesktop());
+ eficasSalome.MyEficas.__init__(self, area, code="run_study",
+ fichier=fichier, version=version)
+ gridLayout = QGridLayout(area)
+ gridLayout.addWidget(self)
+ area.setWidgetResizable(1)
+ sgPyQt.createView("Eficas Run_Study", self)
+ if fichier == None:
+ self.fileNew()
+ else:
+ self.addJdcInSalome(fichier)
+
+ def addJdcInSalome(self, jdcPath):
+ """
+ Add the newly created file in Salome study
+ """
+ try:
+ self.ed.find_or_create_run_study(jdcPath)
+ except Exception, exc:
+ msgError = "Can't add file to Salome study tree"
+ logger.exception(msgError)
+ QMessageBox.warning(self, self.tr("Warning"),
+ self.tr("%s. Reason:\n%s\n\nSee logs for more details." % (msgError, exc)))
+ salome.sg.updateObjBrowser(0)
+
+ def closeEvent(self, event):
+ while self.codedir in sys.path:
+ sys.path.remove(self.codedir)
+ eficasSalome.MyEficas.closeEvent(self, event)
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+
+from Editeur.catadesc import CatalogDescription
+from InterfaceQT4.configuration import configBase
+
+class CONFIG(configBase):
+
+ def __init__(self, appli, repIni):
+ """
+ This class stores the configuration parameters for Eficas
+ """
+ configBase.__init__(self, appli, repIni)
+
+ # Configuration parameters
+ self.savedir = os.getenv("HOME")
+ self.catalogues = (CatalogDescription("run_study", os.path.join(repIni, "run_study_cata.py")),)
+ self.labels_eficas=['lang','rep_cata','catalogues','closeAutreCommande','closeFrameRechercheCommande','closeEntete','closeArbre']
+ self.lang = 'fr'
+
+ def save_params(self):
+ pass
+
+def make_config(appli, rep):
+ return CONFIG(appli, rep)
+
+def make_config_style(appli, rep):
+ return None
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+code = "run_study"
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import sys
+
+repIni = os.path.dirname(__file__)
+INSTALLDIR = os.getenv("EFICAS_ROOT")
+closeAutreCommande=True
+closeFrameRechercheCommande=True
+closeArbre=True
+closeCopier=True
+suiteTelemac=True
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+from Accas import *
+
+codelist = ("artemis", "postel3d", "sisyphe", "stbtel", "telemac2d", "telemac3d", "tomawac", "mascaret")
+
+JdC = JDC_CATA(regles = (UN_PARMI('RUN_STUDY',)),
+ )
+RUN_STUDY = PROC(
+ nom = "RUN_STUDY", op = None,
+ fr = u"Définition d'un cas pour le lanceur Python",
+ ang = u"Definition of a case for the Python launcher",
+ CODE = SIMP(statut = "o", typ = "TXM", into = codelist, defaut = "telemac2d",
+ fr = u"Code à exécuter",
+ ang = u"Code to run"),
+ FICHIER_CAS = SIMP(statut = "o", typ = 'Fichier',
+ fr = u"Fichier de description du cas",
+ ang = u"Case description file"),
+ REPERTOIRE_TRAVAIL = SIMP(statut = "f", typ = 'Repertoire',
+ fr = u"Répertoire de travail",
+ ang = u"Working directory"),
+)
+
+TEXTE_NEW_JDC="RUN_STUDY()"
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import tempfile
+from datetime import datetime
+import glob
+
+import salome
+
+job_script_template = """#!/bin/sh
+
+. %(env_file)s
+runcode.py %(code)s %(cas)s --ncsize %(nbcore)d
+"""
+
+def generate_job(study_params, resource, telemac_root_dir, telemac_env_file,
+ nbcore, input_data_dir, result_dir):
+ """
+ Create a Launcher job using the parameters specified by the user.
+ """
+ # Generate job script
+ basename = os.path.basename(study_params["FICHIER_CAS"])
+ job_script = job_script_template % {"env_file": telemac_env_file,
+ "code": study_params["CODE"],
+ "cas": basename,
+ "nbcore": nbcore}
+
+
+ (fd, job_script_file) = tempfile.mkstemp(prefix = "job_" + basename + "_", suffix = ".sh")
+ os.close(fd)
+ f = open(job_script_file, "w")
+ f.write(job_script)
+ f.close()
+
+ # Define job parameters
+ job_params = salome.JobParameters()
+ job_params.job_name = basename
+ job_params.job_type = "command"
+ job_params.job_file = job_script_file
+ input_files = glob.glob(os.path.join(input_data_dir, "*")) + [study_params["FICHIER_CAS"]]
+ input_files = list(set(input_files)) # Remove duplicates
+ job_params.in_files = input_files
+ job_params.out_files = []
+ job_params.result_directory = result_dir
+
+ # Define resource parameters
+ job_params.resource_required = salome.ResourceParameters()
+ job_params.resource_required.name = resource
+ job_params.resource_required.nb_proc = nbcore
+
+ # Generate name for the working directory
+ res_manager = salome.naming_service.Resolve("/ResourcesManager")
+ res_definition = res_manager.GetResourceDefinition(resource)
+ res_work_dir = res_definition.working_directory
+ if res_work_dir != "":
+ timestr = datetime.now().ctime()
+ timestr = timestr.replace('/', '_')
+ timestr = timestr.replace('-', '_')
+ timestr = timestr.replace(':', '_')
+ timestr = timestr.replace(' ', '_')
+ work_dir = res_work_dir + "/" + job_params.job_name + "_" + timestr
+ job_params.work_directory = work_dir
+
+ # Create Launcher job
+ launcher = salome.naming_service.Resolve('/SalomeLauncher')
+ launcher.createJob(job_params)
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+from PyQt5.QtWidgets import QDialog , QFileDialog
+
+import salome
+from salome.hydro.run_study.genjob import generate_job
+from genjobwindow_ui import Ui_GenJobDialog
+
+
+class GenJobDialog(QDialog, Ui_GenJobDialog):
+
+ def __init__(self, parent, study_params):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.dialogButtonBox.accepted.connect(self.validate)
+ self.dialogButtonBox.rejected.connect( self.close)
+ self.chooseInputDataDirectoryButton.clicked.connect( self.choose_input_dir)
+ self.chooseResultDirectoryButton.clicked.connect(self.choose_result_dir)
+
+ self.telemacRootDirLE.setText("/projets/systel/V8P0")
+ self.telemacEnvFileLE.setText("/projets/systel/V8P0/config/pysource.eole.intel.sh")
+ casedir = os.path.dirname(study_params["FICHIER_CAS"])
+ self.inputDataDirectoryLE.setText(casedir)
+ self.resultDirectoryLE.setText(casedir)
+
+ # Populate resource combo box
+ res_manager = salome.naming_service.Resolve("/ResourcesManager")
+ res_params = salome.ResourceParameters()
+ res_list = res_manager.GetFittingResources(res_params)
+ self.resourceCB.addItems(res_list)
+
+ self.study_params = study_params
+
+ def choose_input_dir(self):
+ directory = QFileDialog.getExistingDirectory(self,
+ directory = self.inputDataDirectoryLE.text(),
+ options = QFileDialog.ShowDirsOnly)
+ if not directory.isNull():
+ self.inputDataDirectoryLE.setText(directory)
+
+ def choose_result_dir(self):
+ directory = QFileDialog.getExistingDirectory(self,
+ directory = self.resultDirectoryLE.text(),
+ options = QFileDialog.ShowDirsOnly)
+ if not directory.isNull():
+ self.resultDirectoryLE.setText(directory)
+
+ def validate(self):
+ generate_job(self.study_params,
+ str(self.resourceCB.currentText()),
+ str(self.telemacRootDirLE.text()),
+ str(self.telemacEnvFileLE.text()),
+ self.nbCoreSB.value(),
+ str(self.inputDataDirectoryLE.text()),
+ str(self.resultDirectoryLE.text()))
+ self.close()
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>GenJobDialog</class>
+ <widget class="QDialog" name="GenJobDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>636</width>
+ <height>280</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Generate Job</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Resource</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="resourceCB"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Telemac remote root directory</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="telemacRootDirLE"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Telemac environment file</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="telemacEnvFileLE"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Number of cores</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QSpinBox" name="nbCoreSB">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>100000</number>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Input data directory</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLineEdit" name="inputDataDirectoryLE">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="chooseInputDataDirectoryButton">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Result directory</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLineEdit" name="resultDirectoryLE">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="chooseResultDirectoryButton">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>43</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="dialogButtonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import SalomePyQt
+sgPyQt = SalomePyQt.SalomePyQt()
+
+from salome.hydro.gui_utils import get_and_check_selected_file_path
+from salome.hydro.study import jdc_to_dict
+
+from salome.hydro.run_study.eficas.appli import EficasForRunStudyAppli
+from launcher import run_study
+from genjobwindow import GenJobDialog
+
+from PyQt5.QtWidgets import QFileDialog
+
+def create_case_study():
+ EficasForRunStudyAppli()
+
+def edit_selected_case_study():
+ file=get_and_check_selected_file_path()
+ if file == None:
+ file, filt = QFileDialog.getOpenFileName(sgPyQt.getDesktop(), "Open study file", "", )
+ EficasForRunStudyAppli(fichier=file)
+
+def get_params_from_selected_case():
+ """
+ Get the parameters dict from the selected case in Salome study
+ """
+ jdcpath = get_and_check_selected_file_path()
+ with open(jdcpath) as jdcfile:
+ jdc = jdcfile.read()
+ param_dict = jdc_to_dict(jdc, ["RUN_STUDY", "_F"])
+ return param_dict
+
+def run_selected_case_study():
+ param_dict = get_params_from_selected_case()
+ run_study(param_dict)
+
+def generate_job_for_selected_case_study():
+ param_dict = get_params_from_selected_case()
+ dialog = GenJobDialog(sgPyQt.getDesktop(), param_dict)
+ dialog.exec_()
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import subprocess
+import tempfile
+
+from salome.kernel.logger import Logger
+from salome.kernel import termcolor
+logger = Logger("salome.hydro.run_study.launcher", color = termcolor.BLUE)
+#logger.setLevel(logging.ERROR)
+
+def run_study(param_dict):
+ """
+ Run the Python Telemac launching script, eventually preceded and
+ followed by data conversion scripts.
+ """
+ interm_files = [] # Intermediate files that can eventually be deleted in the end
+
+ # Get and eventually create working directory
+ if "REPERTOIRE_TRAVAIL" in param_dict:
+ wrkdir = param_dict["REPERTOIRE_TRAVAIL"]
+ if not os.path.exists(wrkdir):
+ os.makedirs(wrkdir)
+ else:
+ wrkdir = tempfile.mkdtemp(prefix = "tel-")
+ interm_files += [wrkdir]
+
+ # Read original steering file
+ steering_filepath = param_dict["FICHIER_CAS"]
+ steering_file_dir = os.path.dirname(steering_filepath)
+ with open(steering_filepath) as f:
+ orig_steering = f.read()
+ orig_steering_lines = orig_steering.split("\n")
+
+ cmd = "set -x ; "
+
+ # Run the code itself
+ code = param_dict["CODE"]
+ cmd += "runcode.py -w %s %s %s" % \
+ (wrkdir, code, steering_filepath)
+ cmd += " ; rc=$?"
+
+ # Cleanup intermediate files if the computation was successful
+ cmd += " ; if test $rc -eq 0; then rm -rf %s ; fi" % " ".join(interm_files)
+
+ cmd += ' ; echo "return code is $rc"'
+
+ # Launch the command
+ logger.debug("Running the following command in xterm: %s" % cmd)
+ args = ["xterm", "-T", "Execution of Telemac", "-geo", "80x60", "-hold", "-l", "-e", cmd]
+ if param_dict.has_key('batchExec'):
+ if param_dict['batchExec'] == True:
+ args = ["xterm", "-T", "Execution of Telemac", "-geo", "80x60", "+hold", "-l", "-e", cmd]
+ subprocess.Popen(args, cwd = wrkdir)
+
+def check_file_or_create_link(filepath, dirpath, interm_file_list = None):
+ """
+ This utility function checks if the file *filepath* is in directory *dirpath*.
+ If not, it creates a link with a unique name in *dirpath* to the file *filepath*
+ and it prepends the link path to the list *interm_file_list* if it is not None.
+ It returns the name of the link if a link was created, or the name of the file
+ *filepath* otherwise.
+ """
+ filename = os.path.basename(filepath)
+ if not os.path.samefile(dirpath, os.path.dirname(filepath)):
+ name_wo_ext, ext = os.path.splitext(filename)
+ linkpath = tempfile.mktemp(dir = dirpath, prefix = name_wo_ext + "_", suffix = ext)
+ os.symlink(filepath, linkpath)
+ filename = os.path.basename(linkpath)
+ if interm_file_list is not None:
+ interm_file_list[:0] = [linkpath]
+ return filename
COMPONENT_NAME = "HydroSolver"
COMPONENT_ICON = "HYDRO_small.png"
-MASCARET_FILE_TYPE = "MASCARET_EFICAS_FILE"
-MASCARET_ICON = "case1d.png"
-MASCARET_CASE_TYPE_ID = 1
-
VARS_ICON = "icon_variables.png"
-LOG_ICON = "log.png"
-LOG_TYPE_ID = 2
-
-TELEMAC2D_FILE_TYPE = "TELEMAC2D_EFICAS_FILE"
-TELEMAC2D_ICON = "case2d.png"
-TELEMAC2D_CASE_TYPE_ID = 3
-
-PYTEL_FILE_TYPE = "PYTEL_EFICAS_FILE"
-PYTEL_ICON = "case_pytel.png"
-PYTEL_CASE_TYPE_ID = 5
-
-# Dictionary used to map Eficas parameters to Mascaret file types
-mascaretFileTypeDict = {"FICHIER_ABAQUES" : "abaques",
- "FICHIER_DICO" : "dico",
- "FICHIER_CASIER" : "casier",
- "FICHIER_GEOMETRIE" : "geo",
- "FICHIER_LOI" : "loi",
- "FICHIER_MOT_CLE" : "cas",
- "LISTING" : "listing",
- "FICHIER_DAMOCLE" : "damocle",
- "RESULTAT" : "res",
- "LISTING_CASIER" : "listing_casier",
- "LISTING_LIAISON" : "listing_liaison",
- "RESULTAT_CASIER" : "res_casier",
- "RESULTAT_LIAISON" : "res_liaison"
- }
+TELMA_FILE_TYPE = "TELMA_EFICAS_FILE"
+TELMA_ICON = "telma_file.png"
+TELMA_TYPE_ID = 1
+
+STUDY_FILE_TYPE = "STUDY_EFICAS_FILE"
+STUDY_ICON = "study_file.png"
+STUDY_TYPE_ID = 2
+
+PARAM_STUDY_FILE_TYPE = "PARAM_STUDY_EFICAS_FILE"
+PARAM_STUDY_ICON = "param_study_file.png"
+PARAM_STUDY_TYPE_ID = 3
def jdc_to_dict(jdc, command_list):
"""
COMPONENT_ICON)
return self.hydroComp
- def find_or_create_mascaret_case(self, filePath):
+ def find_or_create_telma(self, filePath):
+ self.find_or_create_hydro_component()
+ itemName = os.path.splitext(os.path.basename(filePath))[0]
+ sobj = self.editor.findOrCreateItem(self.hydroComp,
+ name=itemName,
+ fileType=TELMA_FILE_TYPE,
+ fileName=filePath,
+ icon=TELMA_ICON,
+ comment=str(filePath),
+ typeId=TELMA_TYPE_ID)
+
+ def find_or_create_param_study(self, filePath):
self.find_or_create_hydro_component()
itemName = os.path.splitext(os.path.basename(filePath))[0]
sobj = self.editor.findOrCreateItem(self.hydroComp,
- name = itemName,
- fileType = MASCARET_FILE_TYPE,
- fileName = filePath,
- icon = MASCARET_ICON,
- comment = str(filePath),
- typeId = MASCARET_CASE_TYPE_ID)
-
- def find_or_create_telemac2d_case(self, filePath):
+ name=itemName,
+ fileType=PARAM_STUDY_FILE_TYPE,
+ fileName=filePath,
+ icon=PARAM_STUDY_ICON,
+ comment=str(filePath),
+ typeId=PARAM_STUDY_TYPE_ID)
+
+ def find_or_create_run_study(self, filePath):
self.find_or_create_hydro_component()
itemName = os.path.splitext(os.path.basename(filePath))[0]
sobj = self.editor.findOrCreateItem(self.hydroComp,
- name = itemName,
- fileType = TELEMAC2D_FILE_TYPE,
- fileName = filePath,
- icon = TELEMAC2D_ICON,
- comment = str(filePath),
- typeId = TELEMAC2D_CASE_TYPE_ID)
+ name=itemName,
+ fileType=STUDY_FILE_TYPE,
+ fileName=filePath,
+ icon=STUDY_ICON,
+ comment=str(filePath),
+ typeId=STUDY_TYPE_ID)
def generate_study_script(self, filePath):
"""
# Computing name of the file (same as filePath)
file_dir, filename = os.path.split(filePath)
- root, sfx = os.path.splitext(filename)
- python_file = os.path.join(file_dir,root+".py")
+ root, _ = os.path.splitext(filename)
+ python_file = os.path.join(file_dir, root+".py")
# Writting to file
- with open(python_file,'w') as pfile:
+ with open(python_file, 'w') as pfile:
pfile.write(python_script)
def generate_study_yacs(self, filePath):
# Computing name of the file (same as filePath)
file_dir, filename = os.path.split(filePath)
- root, sfx = os.path.splitext(filename)
- yacs_file = os.path.join(file_dir,root+".xml")
+ root, _ = os.path.splitext(filename)
+ yacs_file = os.path.join(file_dir, root+".xml")
# Writting to file
yacs_scheme.saveSchema(yacs_file)
-
- def find_or_create_pytel_case(self, filePath):
- self.find_or_create_hydro_component()
- itemName = os.path.splitext(os.path.basename(filePath))[0]
- sobj = self.editor.findOrCreateItem(self.hydroComp,
- name = itemName,
- fileType = PYTEL_FILE_TYPE,
- fileName = filePath,
- icon = PYTEL_ICON,
- comment = str(filePath),
- typeId = PYTEL_CASE_TYPE_ID)
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-# --- Python files ---
-
-SET(PYFILES
- __init__.py
-)
-
-SET(INSTALL_DIR ${SALOME_INSTALL_PYTHON}/salome/hydro/telemac2d)
-
-# --- rules ---
-
-SALOME_INSTALL_SCRIPTS("${PYFILES}" ${INSTALL_DIR})
-
-ADD_SUBDIRECTORY(eficas)
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-# --- Python files ---
-
-SET(PYFILES
- __init__.py
- configuration_telemac2d.py
- prefs_telemac2d.py
- prefs.py
- appli.py
-)
-
-# --- rules ---
-
-SALOME_INSTALL_SCRIPTS("${PYFILES}" ${SALOME_INSTALL_PYTHON}/salome/hydro/telemac2d/eficas)
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import sys
-import re
-
-from PyQt5.QtWidgets import QMessageBox , QScrollArea, QGridLayout
-
-
-import salome
-import SalomePyQt
-sgPyQt = SalomePyQt.SalomePyQt()
-
-from salome.kernel.logger import Logger
-from salome.kernel import termcolor
-logger = Logger("salome.hydro.telemac2d.eficas.appli",
- color = termcolor.GREEN_FG)
-
-import eficasSalome
-
-from salome.hydro.study import HydroStudyEditor
-
-def importFirst():
- """
- Horrible hack to allow a correct load of a Telemac case file when done after
- some other edition, such as create case for Pytel execution.
- """
- eficasTelemacPath = os.path.join(eficasSalome.eficasConfig.eficasPath,'Telemac')
- sys.path.insert(0, eficasTelemacPath)
- from telemac2d_enum_auto import TelemacdicoEn
- sys.path.pop(0)
-
-importFirst()
-
-class EficasForTelemac2DAppli(eficasSalome.MyEficas):
- """
- This class launches Eficas and adds entries for the created files in
- HYDRO component in the study tree. The messages in this class are in
- french because they are displayed in Eficas interface.
-
- :type fichier: string
- :param fichier: path of an Eficas file to open
-
- """
- def __init__(self, code = "telemac2d", fichier = None, version = None, lang = None):
- self.ed = HydroStudyEditor()
- self.codedir = os.path.dirname(__file__)
- sys.path[:0] = [self.codedir]
- #eficasSalome.MyEficas.__init__(self, sgPyQt.getDesktop(),
- # code = code, fichier = fichier,
- # version = version, lang = lang)
- #area = QScrollArea(SalomePyQt.SalomePyQt().getDesktop());
- area = QScrollArea(SalomePyQt.SalomePyQt().getDesktop());
- eficasSalome.MyEficas.__init__(self, area,
- code = code, fichier = fichier,
- version = version, lang = lang)
- gridLayout = QGridLayout(area)
- gridLayout.addWidget(self)
- area.setWidgetResizable(1)
- sgPyQt.createView("Eficas Telemac2D", self)
-
-
-
-
- def addJdcInSalome(self, jdcPath):
- """
- Add the newly created file in Salome study
- """
- try:
- self.ed.find_or_create_telemac2d_case(jdcPath)
- except Exception, exc:
- msgError = "Can't add file to Salome study tree"
- logger.exception(msgError)
- QMessageBox.warning(self, self.tr("Warning"),
- self.tr("%s. Reason:\n%s\n\nSee logs for "
- "more details." % (msgError, exc)))
- salome.sg.updateObjBrowser(0)
-
- def closeEvent(self, event):
- while self.codedir in sys.path:
- sys.path.remove(self.codedir)
- eficasSalome.MyEficas.closeEvent(self, event)
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-
-from Editeur.catadesc import CatalogDescription
-from InterfaceQT4.configuration import configBase
-
-class CONFIG(configBase):
-
- def __init__(self, appli, repIni):
- """
- This class stores the configuration parameters for Eficas
- """
- configBase.__init__(self, appli, repIni)
-
- # Configuration parameters
- self.savedir = os.getenv("HOME")
- self.catalogues = (CatalogDescription("telemac2d_V6",
- os.path.join(repIni, "telemac2d_V6_cata.py")),)
- self.lang = 'fr'
-
- def save_params(self):
- pass
-
-def make_config(appli, rep):
- return CONFIG(appli, rep)
-
-def make_config_style(appli, rep):
- return None
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-code = "telemac2d"
+++ /dev/null
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import sys
-
-repIni = os.path.dirname(__file__)
-INSTALLDIR = os.getenv("EFICAS_ROOT")
-closeAutreCommande=True
-closeFrameRechercheCommande=True
-closeArbre=True
-closeCopier=True
-suiteTelemac=True
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-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
-
- def __convert__(self,valeur):
- if type(valeur) == types.StringType:
- return None
- if len(valeur) != self.ntuple:
- return None
- return valeur
-
- def info(self):
- return "Tuple de %s elements" % self.ntuple
-
- __repr__=info
- __str__=info
-
-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",
- STEERING_FILE = SIMP(statut = "o", typ = 'Fichier',
- fr = u"Fichier de description du cas",
- 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',
- intoSug = 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",
- NAME = SIMP(statut = "o", typ = 'TXM',
- fr = u"Nom de la variable",
- 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',
- intoSug = 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()"
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+# --- Python files ---
+
+SET(PYFILES
+ __init__.py
+)
+
+SET(INSTALL_DIR ${SALOME_INSTALL_PYTHON}/salome/hydro/telma)
+
+# --- rules ---
+
+SALOME_INSTALL_SCRIPTS("${PYFILES}" ${INSTALL_DIR})
+
+ADD_SUBDIRECTORY(eficas)
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+# --- Python files ---
+
+SET(PYFILES
+ __init__.py
+ configuration_telma.py
+ prefs_telma.py
+ prefs.py
+ appli.py
+)
+
+# --- rules ---
+
+SALOME_INSTALL_SCRIPTS("${PYFILES}" ${SALOME_INSTALL_PYTHON}/salome/hydro/telma/eficas)
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import sys
+import re
+
+from PyQt5.QtWidgets import QMessageBox, QScrollArea, QGridLayout
+
+
+import salome
+import SalomePyQt
+sgPyQt = SalomePyQt.SalomePyQt()
+
+from salome.kernel.logger import Logger
+from salome.kernel import termcolor
+logger = Logger("salome.hydro.telma.eficas.appli",
+ color = termcolor.GREEN_FG)
+
+import eficasSalome
+
+from salome.hydro.study import HydroStudyEditor
+
+def importFirst():
+ """
+ Horrible hack to allow a correct load of a Telemac case file when done after
+ some other edition, such as create case for Pytel execution.
+ """
+ eficasTelemacPath = os.path.join(eficasSalome.eficasConfig.eficasPath,'Telemac')
+ sys.path.insert(0, eficasTelemacPath)
+ from telemac2d_enum_auto import TelemacdicoEn
+ sys.path.pop(0)
+
+importFirst()
+
+class EficasForTelmaAppli(eficasSalome.MyEficas):
+ """
+ This class launches Eficas and adds entries for the created files in
+ HYDRO component in the study tree. The messages in this class are in
+ french because they are displayed in Eficas interface.
+
+ :type fichier: string
+ :param fichier: path of an Eficas file to open
+
+ """
+ def __init__(self, code="telemac", fichier=None, version=None, lang=None):
+ self.ed = HydroStudyEditor()
+ self.codedir = os.path.dirname(__file__)
+ sys.path[:0] = [self.codedir]
+ area = QScrollArea(SalomePyQt.SalomePyQt().getDesktop());
+ eficasSalome.MyEficas.__init__(self, area,
+ code=code, fichier=fichier,
+ version=version, lang=lang)
+ gridLayout = QGridLayout(area)
+ gridLayout.addWidget(self)
+ area.setWidgetResizable(1)
+ sgPyQt.createView("Eficas Telemac", self)
+
+
+
+
+ def addJdcInSalome(self, jdcPath):
+ """
+ Add the newly created file in Salome study
+ """
+ try:
+ self.ed.find_or_create_telma(jdcPath)
+ except Exception, exc:
+ msgError = "Can't add file to Salome study tree"
+ logger.exception(msgError)
+ QMessageBox.warning(self, self.tr("Warning"),
+ self.tr("%s. Reason:\n%s\n\nSee logs for "
+ "more details." % (msgError, exc)))
+ salome.sg.updateObjBrowser(0)
+
+ def closeEvent(self, event):
+ while self.codedir in sys.path:
+ sys.path.remove(self.codedir)
+ eficasSalome.MyEficas.closeEvent(self, event)
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+
+from Editeur.catadesc import CatalogDescription
+from InterfaceQT4.configuration import configBase
+
+class CONFIG(configBase):
+
+ def __init__(self, appli, repIni):
+ """
+ This class stores the configuration parameters for Eficas
+ """
+ configBase.__init__(self, appli, repIni)
+
+ # Configuration parameters
+ self.savedir = os.getenv("HOME")
+ self.lang = 'fr'
+
+ def save_params(self):
+ pass
+
+def make_config(appli, rep):
+ return CONFIG(appli, rep)
+
+def make_config_style(appli, rep):
+ return None
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+code = "TELEMAC"
--- /dev/null
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import sys
+
+repIni = os.path.dirname(__file__)
+INSTALLDIR = os.getenv("EFICAS_ROOT")
+closeAutreCommande=True
+closeFrameRechercheCommande=True
+closeArbre=True
+closeCopier=True
+suiteTelemac=True