← Back to team overview

dolfin team mailing list archive

Re: Pydolfin, builtin functions

 

Although it is a neat idea, I'm slightly worried about this approach,
since it ties FFC very close to PyDOLFIN. I worry that it can create
difficulties when using SFC (SyFi) instead of FFC in DOLFIN. Maybe if
we create this infamous UFL and inherit from that instead of FFC, that
can be a solution, but I'm planning on using DOLFIN and SFC together
sooner than we'll likely finish UFL. Anyway, I'll let you know if I
hit any real problems when I get that far.

-- 
Martin


2007/9/27, Anders Logg <logg@xxxxxxxxx>:
> The problem is the Functions AvgMeshSize and FacetNormal. Right now,
> they are wrapped dolfin::Function(s) (C++). They also need to be
> ffc.Function(s).
>
> The idea is: a Function in PyDOLFIN should be both a DOLFIN Function (so
> it can be plotted, saved to file, have values etc) and a FFC Function
> (so it can be used in expressions).
>
> This can be fixed by adding renames cpp_AvgMeshSize and cpp_FacetNormal
> in dolfin_function_pre.i, renaming the corresponding FFC functions in
> assembly.py, and then finally adding new classes in assembly.py that
> inherit from both.
>
> The idea is: rename both the DOLFIN and FFC functions and then create
> something new that inherits from both.
>
> I can take a look when I get the chance, but feel free to try it out.
>
> /Anders
>
>
> Kristian Oelgaard wrote:
> >
> > Hi,
> >
> > I have some problems using the Python interface to DOLFIN.
> >
> > The two following form will not compile
> >
> > element = FiniteElement("Discontinuous Lagrange", "triangle", 1)
> > mesh = UnitSquare(2,2)
> > v = TestFunction(element)
> > u = TrialFunction(element)
> >
> > h = AvgMeshSize(mesh)
> > n = FacetNormal(mesh)
> >
> > a = 1.0/h*dot(v('+'),u('-'))*dS
> >
> > error:
> > Traceback (most recent call last):
> >   File "demo.py", line 70, in <module>
> >     a0 = 1.0/h*dot(v('+'),u('-'))*dS
> > TypeError: unsupported operand type(s) for /: 'float' and 'AvgMeshSize'
> >
> > and
> > a = dot(jump(v,n),jump(u,n))*dS
> >
> > error:
> > Traceback (most recent call last):
> >   File "demo.py", line 71, in <module>
> >     a1 = dot(jump(v,n),jump(u,n))*dS
> >   File "/home/oelgaard/fenics/ffc/src/ffc/compiler/language/operators.py", line
> > 228, in jump
> >     raise FormError, ((v, n), "Jump operator with respect to normal vector does
> > not support tensors of this rank.")
> > ffc.common.exceptions.FormError
> >
> > Should I use the interface differently?
> >
> > Kristian
> >
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/mailman/listinfo/dolfin-dev
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
>


Follow ups

References