On Mon, Jul 30, 2012 at 9:01 PM, Roy Stogner <roystgnr@ices.utexas.edu> wrote:

On Mon, 30 Jul 2012, Paul T. Bauman wrote:

3. I had to remove the calculate_dphi = true assignment in the
get_dphidxi, etc. calls, but I've at least left the asserts there.
The problem is that we may need dphidxi without actually needing
dphi. The only time this will break is if the user *only* calls
get_phi, but also calls get_dphidxi. Can anyone think of a case
where this would happen (I couldn't come up with one)?

Sure: any application code which only uses the component arrays
without using the gradient array will now be failing that assertion in
debug mode or probably accessing OOB memory in opt mode.

I don't follow: if the user calls get_dphidx, dphi and all the components will be calculated and everything is fine (calculate_dphi gets set to true in all those methods). This case will only break if get_dphi, get_dphidx, etc. are *not* called, but the user wants get_dphieta (*reference* shape function derivatives, changed to eta instead of xi for clarity). So if we really want to support this case, how do you want to support it? I need those functions to be public for the current implementation of the FETransformation object (I pass a const FEGenericBase& to get access to the shape function derivatives which were precomputed in init_shape_functions). Do we remove those methods and move the reference shape function derivative calculations out of init_shape_functions?
 
Why can't we set "calculate_dphi = true" there?  I'd rather take the
component arrays out entirely than leave them in there booby-trapped.

1. Performance - The reference shape function derivatives are needed for calculating the divergence and curl, as well as the gradient, but I may not need the gradients. The curl-curl model problem is an example of this. Thus, as it was, calling get_dphidxi in the FETransformation object would force dphi to be calculated when I didn't want it to be.

2. Laziness/time - I don't want to deal with the HCurl shape function gradient right now and with the assignment, my curl-curl example would fail with a libmesh_not_implemented() for the dphi calculation.