Martin Sandve Alnæs wrote: > On Fri, Feb 27, 2009 at 4:08 PM, Garth N. Wells <[email protected]> wrote: >> >> Martin Sandve Alnæs wrote: >>> On Fri, Feb 27, 2009 at 4:03 PM, Garth N. Wells <[email protected]> wrote: >>>> Evan Lezar wrote: >>>>> Hi >>>>> >>>>> I am working on some electromagnetic problems that require I model the >>>>> electric field as a complex phasor. When compiling user-defined >>>>> functions I get an error message. >>>>> >>>>> For example, consider the following simple function: >>>>> >>>>> f = Function(V, '1.0j') >>>>> >>>>> >>>>> when calling the JIT compiler, the log shows the following error (in the >>>>> last couple of lines): >>>>> >>>>> dolfin_compile_function_934f16b21b1210d9244eba2ba7985a9a_wrap.cxx: In >>>>> member function ‘virtual void >>>>> dolfin::function_91ee55df622466fafbf3ba887ffb745e::eval(double*, const >>>>> double*) const’: >>>>> dolfin_compile_function_934f16b21b1210d9244eba2ba7985a9a_wrap.cxx:3221: >>>>> error: cannot convert ‘double __complex__’ to ‘double’ in assignment >>>>> error: command 'gcc' failed with exit status 1 >>>>> >>>>> Does dolfin support complex valued functions? >>>> No. >>>> >>>> If so, how do I go about >>>>> getting them working? And if not, how do I go about adding the >>>>> functionality. >>>>> >>>> It would be a big task to make it seamless. The starting point would be >>>> having FFC (or soon UFL) support complex functions. I thought about this >>>> a few years ago but never got around to it. >>>> >> Thinking about, it shouldn't be too hard to patch something together using >> mixed elements. > > Won't be as user-friendly as it could be though, but perhaps you > could define e.g. complex multiplication as python functions on top. >
Agree, it wouldn't be user friendly. Making it user friendly would require a lot of work on UFL/FFC/DOLFIN. Garth > >>>> UFL question: Does or will UFL support complex functions? >>> No. And I don't think making such an addition before it has stabilised >>> is an option, we can't change everything everywhere simultaneously. >>> >> OK. Would be good for the long-term goals list. > > Sure. I'll add it. > > Martin _______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
