1 # Copyright (C) 2015-2016 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # bug revealed by otgui on 8/2/16. Several lock/unlock session. test1.xml is Cogeneration.xml.
22 def buildScheme(fname):
25 SALOMERuntime.RuntimeSALOME.setRuntime()
26 r=SALOMERuntime.getSALOMERuntime()
28 cont=p.createContainer("MyWonderfulContainer","Salome")
29 td=p.createType("double","double")
30 n0=r.createScriptNode("Salome","PyScript0")
32 q=n0.edAddInputPort("q",td)
33 e=n0.edAddInputPort("e",td)
34 c=n0.edAddInputPort("c",td)
35 ep=n0.edAddOutputPort("ep",td)
36 n0.setScript("ep=1-(q/((e/((1-0.05)*0.54))+(c/0.8)))")
37 n0.setExecutionMode("remote")
44 session=evalyfx.YACSEvalSession()
47 efx=evalyfx.YACSEvalYFX.BuildFromFile(fname)
48 efx.setParallelizeStatus(False)
49 inps=efx.getFreeInputPorts()
50 outps=efx.getFreeOutputPorts()
52 inp.setSequenceOfValuesToEval([0.2,0.3])
53 efx.lockPortsForEvaluation(inps,outps)
54 rss=efx.giveResources()
55 rss[0][0].setWantedMachine("localhost")
56 assert(rss.isInteractive())
57 a,b=efx.run(session) ; assert(a)
59 for ii,inp in enumerate(inps):
60 inp.setSequenceOfValuesToEval([0.5,0.6,0.7])
61 efx.lockPortsForEvaluation(inps,outps)
62 a,b=efx.run(session) ; assert(a)
64 for ii,inp in enumerate(inps):
65 inp.setSequenceOfValuesToEval([0.5,0.6,0.7])
66 efx.lockPortsForEvaluation(inps,outps)
67 a,b=efx.run(session) ; assert(a)