Ces classes proxy sont conçues pour être le lieu d'implémentation de
l'interprétation des commandes utilisateur et donc de l'ergonomie
de manipulation des champs au niveau l'interface textuelle. Ce point
- est développé :ref:`plus bas <develguide_execFieldOperation>`.
+ est développé :ref:`plus bas <develguide_execFieldOperation-fr>`.
Programmation de l'interface textuelle
--------------------------------------
.. |IMG_SELECT| image:: ../images/medop-gui-selectfield_scale.png
.. |IMG_ALIAS| image:: ../images/medop-gui-aliasfield_scale.png
- +---------------+---------------+
- | |IMG_SELECT| | |IMG_ALIAS| |
- +---------------+---------------+
+ +--------------+-------------+
+ | |IMG_SELECT| | |IMG_ALIAS| |
+ +--------------+-------------+
L'image de gauche montre la sélection du pas de temps, l'image de
droite la boîte de dialogue qui permet la saisie de l'alias avec
``SALOME_MED::MEDOP`` créé sur demande par le servant
``SALOME_MED::MED``, voir la fonction ``getFieldFromMed(...)``).
- .. _develguide_execFieldOperation:
+ .. _develguide_execFieldOperation-fr:
Exécution des opérations sur le champs
--------------------------------------
.. |IMG_VISU| image:: ../images/medop-gui-visufield_scale.png
.. |IMG_RESULT| image:: ../images/medop-gui-result_scale.png
- +---------------+---------------+
- | |IMG_VISU| | |IMG_RESULT| |
- +---------------+---------------+
+ +------------+--------------+
+ | |IMG_VISU| | |IMG_RESULT| |
+ +------------+--------------+
Cette fonction répond au besoin de contrôle interactif des résultats
produits par les opérations de manipulation de champs.
import VISU
visuComp = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
- visuComp.SetCurrentStudy(salome.myStudy)
# Then we can import the specified field in the VISU module. This
# creates an study entry in the VISU folder.
- #!/usr/bin/env python
- # -*- coding: iso-8859-1 -*-
+ #!/usr/bin/env python3
# Copyright (C) 2007-2016 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
__import__(corbaModule)
factory=salome.lcc.FindOrLoadComponent(containerType,componentName)
# This is not the main CORBA component of the SALOME module MED
-# (i.e. the engine associated to the active study), but the CORBA
+# (i.e. the engine associated to the study), but the CORBA
# entry point for MED fields operations (i.e. a CORBA component
# reachable throughout the LifeCycleCORBA). This entry point is used to
# get the other SALOME CORBA components required for MED field
try:
MED_ROOT_DIR=os.environ["MED_ROOT_DIR"]
- except KeyError, e:
+ except KeyError as e:
raise RuntimeError("MED_ROOT_DIR should be defined to load the test data")
RESDIR=os.path.join(MED_ROOT_DIR,"share","salome","resources","med","medcalc_testfiles")
dataManager = factory.getDataManager()
datasource = dataManager.loadDatasource(testFilePath)
if datasource.name != testFileName:
- print "ERR: datasource.name=%s (should be %s)"%(datasource.name,testFilePath)
+ print("ERR: datasource.name=%s (should be %s)"%(datasource.name,testFilePath))
return False
# We try to load the file twice. It should not load twice and
sourceid_ref = datasource.id
datasource = dataManager.loadDatasource(testFilePath)
if datasource.id != sourceid_ref:
- print "ERR: datasource.id=%s (should be %s)"%(datasource.id,sourceid_ref)
+ print("ERR: datasource.id=%s (should be %s)"%(datasource.id,sourceid_ref))
return False
return True
fieldHandlerList = dataManager.getFieldHandlerList()
fieldHandler0 = fieldHandlerList[0]
- print dataManager.getFieldRepresentation(fieldHandler0.id)
+ print(dataManager.getFieldRepresentation(fieldHandler0.id))
return True
def TEST_updateFieldMetadata():
fieldHandler0.source)
fieldHandlerModified = dataManager.getFieldHandler(fieldid)
- print fieldHandlerModified
+ print(fieldHandlerModified)
if fieldHandlerModified.fieldname != newname:
- print "ERR: the name is %s (should be %s)"%(fieldHandlerModified.fieldname,newname)
+ print("ERR: the name is %s (should be %s)"%(fieldHandlerModified.fieldname,newname))
return False
return True
fieldIdList = [fieldHandler0.id]
filepath = "/tmp/test_xmed_saveFields.med"
- print "fieldIdList = %s"%fieldIdList
- print "filepath = %s"%filepath
+ print("fieldIdList = %s"%fieldIdList)
+ print("filepath = %s"%filepath)
dataManager.saveFields(filepath,fieldIdList)
# We just control that the file exists. But we should reload the
# contents to check the fields
import os
if not os.path.exists(filepath):
- print "ERR: the file %s does not exist"%(filepath)
+ print("ERR: the file %s does not exist"%(filepath))
return False
return True
dataManager = factory.getDataManager()
datasourceHandler = dataManager.loadDatasource(testFilePath)
meshHandlerList = dataManager.getMeshList(datasourceHandler.id)
- print meshHandlerList
+ print(meshHandlerList)
if len(meshHandlerList) == 0:
return False
for mRef in meshHandlerList:
meshId = mRef.id
mRes = dataManager.getMesh(meshId)
- print mRes
+ print(mRes)
if ( mRes.name != mRef.name ) or ( mRes.sourceid != mRef.sourceid):
return False
return True
# We look for the fieldseries defined on the first mesh of the list
meshId = meshHandlerList[0].id
fieldseriesList = dataManager.getFieldseriesListOnMesh(meshId)
- print fieldseriesList
+ print(fieldseriesList)
if len(fieldseriesList) == 0:
return False
# i.e. the time steps for this field.
fieldseriesId = fieldseriesList[0].id
fieldList = dataManager.getFieldListInFieldseries(fieldseriesId)
- print fieldList
+ print(fieldList)
if len(fieldList) == 0:
return False
# Try to operate on the two first fields
fieldHandler0 = fieldHandlerList[0]
fieldHandler1 = fieldHandlerList[1]
- print fieldHandler0
- print fieldHandler1
+ print(fieldHandler0)
+ print(fieldHandler1)
calculator = factory.getCalculator()
add = calculator.add(fieldHandler0, fieldHandler1)
- print add
+ print(add)
sub = calculator.sub(fieldHandler0, fieldHandler1)
- print sub
+ print(sub)
mul = calculator.mul(fieldHandler0, fieldHandler1)
- print mul
+ print(mul)
div = calculator.div(fieldHandler0, fieldHandler1)
- print div
+ print(div)
#power = calculator.pow(fieldHandler0, 2)
- #print power
+ # print(power)
linear = calculator.lin(fieldHandler0, 3,2)
- print linear
+ print(linear)
return True
import MEDCALC
nbResultingComponent = MEDCALC.NBCOMP_DEFAULT
res = calculator.fct(fieldHandler,"abs(u)",nbResultingComponent);
- print res
+ print(res)
# In this example, "a" stands for the first component
nbResultingComponent = 1
res = calculator.fct(fieldHandler,"a+2",nbResultingComponent)
- print res
+ print(res)
return True
dataManager.savePersistentFields(filepath)
import os
if not os.path.exists(filepath):
- print "ERR: the file %s does not exist"%(filepath)
+ print("ERR: the file %s does not exist"%(filepath))
return False
return True