On Wed, Jun 27, 2012 at 12:55 PM, Paul T. Bauman <[email protected]> wrote: > > > On Wed, Jun 27, 2012 at 1:44 PM, Andrew E Slaughter > <[email protected]> wrote: >> >> I was playing around with that, but the function still gets called for >> each >> variable. Essentially, doing the calculations twice or three times in 3D. >> This seems far to inefficient. Is there no way around this? > > > Internally, libMesh is calling the component method of AnalyticFunction. It > is virtual, so you can overload it to not compute the whole vector each > time.
Paul's right. Here's the comment for component() from function_base.h * Subclasses are recommended to overload this, since the default * implementation is based on a vector evaluation, which is usually * unnecessarily inefficient. I guess if your initial condition is super simple (like return 1;) you can avoid implementing component() and just do extra work. On the other hand, you can implement component() with a big if-block if computing the initial condition is very expensive... if (i==0) return 1; else return 2; -- John ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Libmesh-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-users
