/usr/lib/python2.7/dist-packages/dolfin/functions/ufc_functionspace.py is in python-dolfin 1.3.0+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import dolfin.cpp as cpp
__all__ = ["UFCFunctionSpace", "create_ufc_function_spaces"]
class UFCFunctionSpace(cpp.FunctionSpace):
def __init__(self, mesh, ufc_finite_element, ufc_dofmap):
self._mesh = mesh
self._finite_element = cpp.FiniteElement(ufc_finite_element)
self._dofmap = cpp.DofMap(ufc_dofmap, mesh)
self._ufc_finite_element = ufc_finite_element
self._ufc_dofmap = ufc_dofmap
cpp.FunctionSpace.__init__(self, mesh, finite_element, dofmap)
def create_ufc_function_spaces(mesh, ufc_form, cache=None):
functionspaces = []
if cache is None:
cache = {}
for i in range(ufc_form.rank() + ufc_form.num_coefficients()):
fe = ufc_form.create_finite_element(i)
fesig = fe.signature()
V = cache.get(fesig)
if V is None:
dm = ufc_form.create_dofmap(i)
V = UFCFunctionSpace(mesh, fe, dm)
cache[fesig] = V
functionspaces.append(V)
return functionspaces, cache
|