← Back to team overview

dolfin team mailing list archive

Re: bug in ConstantFunction

 

On Tue, May 01, 2007 at 02:52:28PM +0200, Garth N. Wells wrote:
> There appears to be a bug in
> 
> ConstantFunction::interpolate(real* coefficients,
>                                const ufc::cell& cell,
>                                const ufc::finite_element& finite_element)
> 
> as it always returns zeros. Should
> 
>   // Evaluate each dof to get coefficients for nodal basis expansion
>    for (uint i = 0; i < finite_element.space_dimension(); i++)
>      coefficients[i] = finite_element.evaluate_dof(i, *this, cell);
> 
> be
> 
>   // Evaluate each dof to get coefficients for nodal basis expansion
>    for (uint i = 0; i < finite_element.space_dimension(); i++)
>      coefficients[i] = value;
> 
> ?
> 
> Garth

No, it should be finite_element.evaluate_dof() since the constant
value is not always equal to the value of the dof (but it is for
Lagrange).

I'll take a look and see if I can find the problem as soon as I get a
chance.

The call to evaluate_dof() should generate a call to the overloaded
evaluate() function in ConstantFunction. (If you look in the code
generated by FFC for evaluate_dof(), it should contain a call to
evaluate().)

/Anders



Follow ups

References