← Back to team overview

dolfin team mailing list archive

Re: Python + interpolate

 

On Wed, Oct 07, 2009 at 09:08:53AM +0100, Garth N. Wells wrote:
> We seem to have a problem with Python and interpolating functions. When
> I try
>
>    P1 = FunctionSpace(mesh_post, "CG", 1)
>    u_post = interpolate(u, P1);
>
> I get the below error.
>
> Garth
>
>
> Traceback (most recent call last):
>    File "demo.py", line 128, in <module>
>      u_post = interpolate(u, P1);
>    File
> "/home/garth/code/fenics/dolfin/dolfin-all/local/lib/python2.6/site-packages/dolfin/interpolate.py",
> line 28, in interpolate
>      Pv.interpolate(v)
> RuntimeError: *** Error: Treating Function as UFC function. Is that correct?

Yes, it is correct.

I assume you are interpolating u from another space, possibly DG?

Then we should get to the else{} clause in the restrict() which
triggers the error. I added the error there temporarily so that we can
check that we only get to else{} when we should. Before the hash fix
yesterday, we got there all the time which works but is very
inefficient.

I have not had time yet to run more than a couple of demos. Feel free
to remove the error if you have checked that all demos run except the
few (doing interpolation) where the error should be triggered.

--
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups

References