← 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: 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 don' t know what the implications are for ufl and dolfin but maybe
this could be added to the ufl code.

---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.



Follow ups

References