With dolfin 1.4 the following code worked to create a restricted function space:
import dolfin as df
# Create a unit cube mesh
mesh = df.UnitCubeMesh(10, 10, 10)
# Create a cell function to mark a region
# consisting of the left half of the mesh
region_markers = df.CellFunction('size_t', mesh)
class Domain(df.SubDomain):
def inside(self, pt, on_boundary):
return pt[0] <= 0.5
subdomain = Domain()
subdomain.mark(region_markers, 1)
# Create a restricted function space
restriction = df.Restriction(region_markers, 1)
V_restr = df.VectorFunctionSpace(restriction, 'CG', 1, dim=3)
This fails with dolfin 1.5 with the following traceback:
AttributeError Traceback (most recent call last)
<ipython-input-26-90fabc673435> in <module>()
----> 1 V_restr = df.VectorFunctionSpace(restriction, 'CG', 1, dim=3)
/usr/lib/python2.7/dist-packages/dolfin/functions/functionspace.pyc in __init__(self, mesh, family, degree, dim, form_degree, constrained_domain, restriction)
626 # Initialize base class
627 FunctionSpaceBase.__init__(self, mesh, element,
--> 628 constrained_domain=constrained_domain)
629
630 class TensorFunctionSpace(FunctionSpaceBase):
/usr/lib/python2.7/dist-packages/dolfin/functions/functionspace.pyc in __init__(self, mesh, element, constrained_domain)
151
152 # JIT-compile element to get ufc_element and ufc_dofmap
--> 153 ufc_element, ufc_dofmap = jit(self._ufl_element, mpi_comm=mesh.mpi_comm())
154
155 # Instantiate DOLFIN FiniteElement and DofMap
AttributeError: 'Restriction' object has no attribute 'mpi_comm'
The docstring for df.Restriction
does not mention anything about MPI communicators, so I don't know how to pass a communicator when creating a Restriction. What is the right way to do this and fix the above piece of code for dolfin 1.5?