← Back to team overview

libadjoint team mailing list archive

Re: r379

 

> Why are we going to drop Constants?
Maybe the words "likely to be dropped" was too strong here. However
there a few reasons against allowing Constant to be a parameter in
doflin_adjoint:

- Constant can be fully replaced by a function over a 'Real' functionspace.
- The API interface to Constant is somewhat limited. For example, it
does not allow to directly access the float values of a vector valued
Constant (in particular there is no Constant.vector()). The only way
to access this data is to call eval() on a random point.
- The word 'constant' implies that the value is fixed, hence allowing
to compute its sensitivity or even optimising a fixed value could be
misleading.

Another issue that I came across (but haven't fully verified it yet):
As far as I know, in contrast to Functions, Constants are not passed
by reference into python functions. That means that one has to be
really careful with dolfin_adjoint to never pass the Constant into a
function to not loose the original reference.


Follow ups

References