Function::restrict() changed in FEniS 2018.1.0


95
views
1
7 weeks ago by
Dear community,

I'm running FEniCS 2018.1.0 (stable) with Python 3.6.5 on Arch Linux. It appears to me that Function::restrict() has changed, or rather, I think it's the pybind11 bindings for its arguments. Consider the following MWE:

from dolfin import *
import numpy as np

mesh = UnitSquareMesh(8,8)
W = FunctionSpace(mesh, 'CG', 1)
E = Function(W)

element = W.dolfin_element()
s_dim = element.space_dimension()
coefficients = np.zeros(s_dim)
cell = list(cells(mesh))[0]

E.restrict( coefficients,
            element,
            cell,
            cell.get_vertex_coordinates(),
            cell)​

This worked on FEniCS 2017.2.0 but not on 2018.1.0 (admittedly, I have simplified what comes before the restrict() call to make this MWE). I get:

Traceback (most recent call last):
  File "mwe_restrict.py", line 17, in <module>
    cell)
  File "/usr/lib/python3.6/site-packages/dolfin/function/function.py", line 500, in restrict
    self._cpp_object.restrict(w, element, cell, coordinate_dofs, ufc_cell)
TypeError: restrict(): incompatible function arguments. The following argument types are supported:
    1. (self: dolfin.cpp.function.Function, arg0: float, arg1: dolfin::FiniteElement, arg2: dolfin::Cell, arg3: float, arg4: dolfin.cpp.function.ufc_cell) -> None

Invoked with: <dolfin.cpp.function.Function object at 0x7fa0b8e72928>, array([0., 0., 0.]), <dolfin.cpp.fem.FiniteElement object at 0x7fa0b8e72a40>, <dolfin.cpp.mesh.Cell object at 0x7fa0b8e728b8>, [0.0, 0.0, 0.125, 0.0, 0.125, 0.125], <dolfin.cpp.mesh.Cell object at 0x7fa0b8e728b8>​


I suspect the error is in the last argument. It should have been of type ufc_cell according to the message. However, I have problem finding any documentation for how to cast it to ufc_cell, or how to make a new, correct ufc_cell variable. (Nor can I find good documentation of what this argument does, only that it should be ufc_cell). Where is the documentation for 2018.1.0 by the way?

Any help appreciated,

Sigvald

Community: FEniCS Project

1 Answer


2
7 weeks ago by
Indeed it's not working. I reported it: https://bitbucket.org/fenics-project/dolfin/issues/1020. Feel free to contribute a fix.
Please login to add an answer/comment or follow this question.

Similar posts:
Search »