← Back to team overview

dolfin team mailing list archive

Re: [Question #154756]: grad f evaluation

 

Question #154756 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/154756

    Status: Open => Answered

Johan Hake proposed the following answer:
On Friday April 29 2011 12:39:00 Chaffra wrote:
> Question #154756 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/154756
> 
>     Status: Answered => Open
> 
> Chaffra is still having a problem:
> Thanks for the answer Johan, but don't you find it awkward that
> 
> f = Function(V)
> f.evaluate( x, {}, (), {}) returns the same object instead of f(x).
>
> I run into that problem for my application. To remedy I added the code
> below to ufl.terminal.evaluate. Of course this does not work yet when
> derivatives are present but at least i do not have to project all the
> time when I just want an evaluation.

I think you are expecting ufl to do stuff it was not built to do. Mixing ufl 
and dolfin has created enough headeach already...

> I don' t know what the implications are for ufl and dolfin but maybe
> this could be added to the ufl code.

My knowledge of ufl is limited so I cannot assist you there. But I suggest you 
to figure out what evaluate actually is ment to do. I am not sure actually ;) 
Martin Alnaes would know.

Johan

> ---added to ufl.terminal.evaluate
>  #try to use self as mapping
>             try:
>                 if callable(self):
>                     if derivatives:
>                         f = self(x, derivatives)
>                     else:
>                         f = self(x)
>                     return f
>             except Exception as e:
>                 print traceback.print_exc()
>                 raise e

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.