0+ComplexScalar(5+8j, Function()) should be a complex data object
Closed this issue · 4 comments
when gEx1 is complex
print("zero Area before",integrate(whereZero(length(g))))
g += whereZero(length(g))*1e-10
print("zero Area after",integrate(whereZero(length(g))))
Does not give a zero area for "zero Area after",
It is necessary to write
print("zero Area before",integrate(whereZero(length(g))))
g += (1+1j)*whereZero(length(g))*1e-10
print("zero Area after",integrate(whereZero(length(g))))
It should be possible to add a complex Scalar function to a real Scalar function to get a complex Scalar function.
This is an in-place addition. One can argue that an update of a real data object with complex numbers is not allowed (not necessarily saying it should not be possible) but an exception should be thrown if this is not allowed.
I am having some trouble replicating this bug. With the latest commit, the following code prints "x is complex" to the console.
from esys.escript import *
from esys.finley import Rectangle
domain=Rectangle(l0=1, l1=1, n0=10, n1=10)
x=0+ComplexScalar(5+8j, Function(domain))
if x.isComplex() is True:
print("x is complex")
Closing the issue as nobody can reproduce the bug.