This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

ufl does not know FunctionAXPY

+2 votes

I noticed that UFL does not know FunctionAXPY.
In my code I have a c++ function that return a dolfin.cpp.function.Function f. But I cannot do things like,

plot(f+f)
project(f+f)

because f+f is a FunctionAXPY. I could do

g = Function(f)
plot(g+g)

but I was wondering how hard it would be to convert the FunctionAXPY* type to regular Function coefficient on the fly. I suppose this would have to happen in swig.

asked Feb 7, 2014 by chaffra FEniCS User (1,830 points)

1 Answer

+3 votes
 
Best answer

A Python Function is not the same as a C++ Function. You can convert your returned C++ Function to a Python Function with the trick shown in this link

The axpy will then work as expected.

answered Feb 9, 2014 by mikael-mortensen FEniCS Expert (29,340 points)
selected Feb 9, 2014 by johanhake
...