On Dec 1, 2009, at 12:40 PM, Roy Stogner wrote:
On Tue, 1 Dec 2009, Derek Gaston wrote:
Personally though... if you're going to go this far with it... how
about fleshing out FunctionBase so that it has gradient() and
hessian() functions... and then making ExactSolution inherit from
that? We need to find _one_ way to specify "Function" objects in
This sounds like a very good idea.
A very flexible one, too. Those gradient and hessian functions could
default to finite-differencing implementations, for instance, but be
overridable with analytics. Or better yet, this could be the first
place we experient with Sacado integration...
BTW this is EXACTLY what I did with Encore at Sandia. Everything there was driven off of these generic "Functions"... we even represented solutions using functions (much like MeshFunction) in such a way that the input to all of our error indicator classes were Function objects... you could even pass in analytic functions to the error indicator objects... which can be useful for verifying error indicators.
Like you say... solution derived functions used shape functions to find their gradients... while analytic functions had an analytic representation. We had planned on doing _both_ finite differencing and Sacado to do automatic gradients as well... but I left before that work got completed (it might be there now though... I don't know).
I've often thought that libMesh needed this same type of capability... but never have found the time to do something about it (as is my general M.O.)....
Also... just to interject about the interface a bit... it can be handy to have the ability to query a function in cartesian space and time (like FunctionBase allows now) AND also allow querying them based on an element and a point within that element. For solution based functions this can be a HUGE speed up... for things like error indicators.
Of course I don't necessarily expect libMesh to go all the way with this concept like we did in Encore. I'm just putting out there what's possible with a configuration like this.