← Back to team overview

ufl team mailing list archive

Re: Restriction syntax

 

On Thu, May 14, 2009 at 09:55:10AM +0200, Martin Sandve Alnæs wrote:
> On Thu, May 14, 2009 at 9:43 AM, Anders Logg <logg@xxxxxxxxx> wrote:
> > On Thu, May 14, 2009 at 08:40:41AM +0100, Garth N. Wells wrote:
> >>
> >>
> >> Martin Sandve Alnæs wrote:
> >> > Is there a mathematical difference?
> >> >
> >>
> >> Splitting hairs, I would say yes and that grad(u('+')) is correct and
> >> grad(u)('+') is not because grad(u) is not defined in a classical sense.
> >> I prefer grad(u('+')), but FFC used to use grad(u)('+'). My preference
> >> is however not strong.
> >>
> >> My immediate question is will the generated code differ for grad(u('+'))
> >> and grad(u)('+')?
> >>
> >> Garth
> >
> > No, since the restriction will be propagated to the leaves... :-)
> 
> The leaves are terminal expressions, that is literal constants,
> geometric quantities, functions and basis functions.
> "Propagating to the leaves" means modifying for example
> 
>   (grad(f) + grad(g))('+')
> to
>   (grad(f('+')) + grad(g('+')))
> 
> such that the restrictions apply directly to the terminal expressions.
> That will simplify the work of the form compilers, and allow
> for example taking the jump of anything.
> 
> Basically, I think the canonical representation after some algorithms should be
>   u('+').dx(i)
> and with indexing either
>   u('+').dx(i)[j]
> or
>   u('+')[j].dx(i)

I prefer this one:

  u('+')[j].dx(i)

Incidentally, the monomial extraction in FFC represents basis
functions or functions as

  class MonomialFactor:

      def __init__(self, arg=None):
          if isinstance(arg, MonomialFactor):
              self.function = arg.function
              self.components = arg.components
              self.derivatives = arg.derivatives
              self.restriction = arg.restriction
          ...

-- 
Anders


> If restrictions, (indexing) and derivatives are applied to a
> (non-scalar) function (terminal).
> Currently, both
>   u.dx(i)[j]
> and
>   u[j].dx(i)
> can occur, and restrictions are not handled.
> 
> Martin

Attachment: signature.asc
Description: Digital signature


References