compute_gradient yields wrong results for multiple parameters
Affects  Status  Importance  Assigned to  Milestone  

dolfinadjoint 
Fix Committed

Undecided

Simon Funke 
Bug Description
The helper function compute_gradient returns in some cases None instead of the correct gradient.
This occurs for pScalarParameters which are part of the functional definition only (i.e. do not show up in the forward annotation) and if the gradient of 2 or more parameters is to be computed.
For example:
J = Functional(
m1 = [ScalarParamete
m2 = [ScalarParamete
dJdm1 = compute_gradient(J, m1, forget=False) # => Constant(...)
dJdm2 = compute_gradient(J, m2, forget=False) # => Constant(...)
dJdm = compute_gradient(J, m1 + m2, forget=False) # => [Constant(...), None] (!!!!!)
A full code demonstration is attached.
This is now fixed in commit 784.