On 08/28/2018 08:24 AM, Robert Cimrman wrote:
On 08/28/2018 12:43 AM, Irwin Zaid wrote:
I'm happy to do pure Python or Cython. How would you suggest I proceed to get the complex numbers? Is there any way I can make this work with SfePy as it is now? I'd be willing to do PRs for SfePy in the near future if I am sure I can solve my problem within it -- which is why I'd like to work with it as it is now.
You would need to modify eval_complex() in sfepy/terms/terms.py so that it does not split the term arguments into the real and imaginary parts. For this, try using the term_mode argument. The call would then be something like:
val = problem.evaluate('your_term.i.Omega(E)', mode='eval', term_mode='complex')
and in eval_complex() you just check for term_mode == 'complex' and in that case just call
status = self.call_function(out, fargs)
I'll think of a cleaner way in the meantime (some other small changes in the term evaluation code might be needed - maybe adding 'ceval' to possible values of mode argument.
Well, I totally forgot to mention the most simple solution: you can define your own .eval_complex() in your term subclass that would override the standard one.