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
> [email protected]
> http://www.fenics.org/mailman/listinfo/dolfin-dev
_______________________________________________
DOLFIN-dev mailing list
[email protected]
http://www.fenics.org/mailman/listinfo/dolfin-dev