← Back to team overview

dolfin team mailing list archive

Re: [FFC-dev] bug in ConstantFunction

 

On Thu, May 03, 2007 at 11:24:05AM -0400, Garth N. Wells wrote:
> 
> 
> Anders Logg wrote:
> > 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().)
> >
> 
> The problem is that FFC is generating
> 
>    /// Evaluate linear functional for dof i on the function f
>    virtual double evaluate_dof(unsigned int i,
>                                const ufc::function& f,
>                                const ufc::cell& c) const
>    {
>      // Not implemented (only for Lagrange elements
>      return 0;
>    }
> 
> I'm using a discontinuous Lagrange element of order 0 for the time step 
> dt. Can this easily be fixed for discontinuous Lagrange elements?

Yes, I'll see if I can fix it.

> Also, could FFC generate an exception for functions which are not yet 
> implemented?
> 
> Garth

Sounds like a good idea.

/Anders


References