← Back to team overview

dolfin team mailing list archive

Re: Further work on python interface

 

On Fri, Nov 07, 2008 at 11:57:08PM +0100, Johan Hake wrote:
> Hello.
> 
> I have added a function for compilation of single function, based on Martins 
> previous work. It is now coupled to the Function class and should work. See 
> poisson demo.

I'm having problems with finding ufc.h when running this demo:

"Unable to find 'ufc.h'"

> I got trouble with the dolfin::pow function that is defined for 
> pow(double,uint) and pow(double,double). When we define a c++ function 
> pow(x[0]-0.5,2) we get an ambigous overloading that do not compile, see e.g. 
> in the poisson demo. 
> 
> I have fixed it with a hack in compile_function, by adding 'std::' infront of 
> every pow statement. Any other way to solve it?

Seems like a good solution to me.

> Next on the list whould be the assemble.py file. Here I think we need to do 
> some work in the c++ interface. The Assembler.assemble function we previously 
> used took an ufc::form, now we need to send in a dolfin::Form. This cannot be 
> instantiated as dolfin::Form is an abstract base class.

Would it be enough to add a constructor to dolfin::Form that takes a ufc::form?

The definition of the Source function in the demo looks nice, but
would it be possible to avoid having to create a class just to define
one single instance of it?

It would be nice if we could do things like

  f = Function(cppexpr="sin(x[0])")

What would be the optimal/simplest way to define a Function by an
expression? I guess if we imported x as a symbol from either Swiginac
or SymPy, we could do

  f = sin(x)

-- 
Anders

> We also need to make Data more attractive to python. The simple_array wrapping 
> of x and v during function calls need to be reimplemented, or something 
> similare.
> 
> Now the test and trial functions are only ffc functions. If we, as also 
> previously discussed, let a dolfin.BaseFunction inherit ffc.BaseFunction, we 
> could easier instantiate the dolfin::Form during assembly. What was the 
> issues with this Martin?
> 
> Johan
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev

Attachment: signature.asc
Description: Digital signature


Follow ups

References