Parsing of variables
The following code shows a problem, I am not sure which though.
I 'forgot' the use the '&' when referring to s1.nr. It seems to pick up the value rather than a reference, probably as intended. However, it does seem to do something strange later on, ie. when combined with a reference it cannot be converted into float unless another eval is used. We should make this consistent.
import finesse
base = finesse.Model()
base.parse("""
var nsilica 1.4
l l1 P=1
m m1 R=1 T=0
s s1 l1.p1 m1.p1 L=1 nr=&nsilica
var n1 s1.nr
var n2 &s1.L*s1.nr
""")
print(base.n1)
print(float(base.n1.value.eval()))
print(float(base.n1.value))
print(float(base.n2.value.eval()))
print(float(base.n2.value))
produces:
Variable('n1', value=1.4)
1.4
1.4
1.4
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-77-cbc39e0e7592> in <module>
13 print(float(base.n1.value))
14 print(float(base.n2.value.eval()))
---> 15 print(float(base.n2.value))
src/finesse/parameter.pyx in finesse.parameter.Parameter.__float__()
src/finesse/symbols.pyx in finesse.symbols.Symbol.__float__()
TypeError: Can't cast <class 'finesse.symbols.Operation'> into a single float value