Looks good. On 14 October 2014 11:22, Johan Hake <[email protected]> wrote:
> Ok. > > I can push this, but we also need a test. What with: > > def testCoefficient(): > v = Constant(triangle) > assert round(expand_derivatives(diff(v,v))-1.0, 7) == 0 > > in test_diff.py > > It fails with present master but not with the suggested fix. > > Johan > > > On Tue, Oct 14, 2014 at 11:07 AM, Martin Sandve Alnæs <[email protected]> > wrote: > >> Yes. >> >> On 14 October 2014 10:59, Johan Hake <[email protected]> wrote: >> >>> Yes, it looks like you are correct Miroslav. >>> >>> I suppose the line you link to should add a self check too. Changing >>> that line to >>> >>> if f._ufl_is_terminal_ and f != v: >>> >>> fixes the problem. >>> >>> Is this fix something we just can add Martin? >>> >>> Johan >>> >>> On Tue, Oct 14, 2014 at 10:14 AM, Miroslav Kuchta <[email protected]> >>> wrote: >>> >>>> Hi, this seems to be due the simplification made here >>>> <https://github.com/FEniCS/ufl/blob/master/ufl/differentiation.py#L87> >>>> >>>> from dolfin import * >>>> >>>> mesh = UnitSquareMesh(10, 10) >>>> V = FunctionSpace(mesh, "CG", 1) >>>> u = Function(V) >>>> >>>> # 0 >>>> print u._ufl_is_terminal_ >>>> print diff(u, u) >>>> >>>> # 1 >>>> print (Constant(1)*u)._ufl_is_terminal_ >>>> plot(diff(Constant(1)*u, u), mesh=mesh) >>>> >>>> # 1 >>>> u._ufl_is_terminal_ = False >>>> plot(diff(u, u), mesh=mesh) >>>> interactive() >>>> >>>> Regards, Miro >>>> >>>> On 10/13/2014 10:32 PM, Johan Hake wrote: >>>> >>>> from dolfin import * >>>> mesh = UnitSquareMesh(10, 10) >>>> V = FunctionSpace(mesh, "CG", 1) >>>> u = Function(V) >>>> print diff(u, u) >>>> >>>> >>>> >>> >>> _______________________________________________ >>> fenics mailing list >>> [email protected] >>> http://fenicsproject.org/mailman/listinfo/fenics >>> >>> >> >
_______________________________________________ fenics mailing list [email protected] http://fenicsproject.org/mailman/listinfo/fenics
