Deriving from class SubDomain with a constructor gives an error. What is the correct way
to specify an init function?
from dolfin import *
class PeriodicBoundary(SubDomain):
def __init__(self):
pass
def inside(self, x, on_boundary):
return x[0] < DOLFIN_EPS
def map(self, x, y):
y[0] = x[0] - 1.0
y[1] = x[1]
periodic_boundary = PeriodicBoundary()
pbc = PeriodicBoundaryComputation()
mesh = UnitSquareMesh(4, 4)
mf = pbc.masters_slaves(mesh, periodic_boundary, 0)
plot(mf, interactive=True)
Gives the error message:
File
"/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin/cpp/mesh.py",
line 5355, in masters_slaves
return _mesh.PeriodicBoundaryComputation_masters_slaves(*args) TypeError: in method 'PeriodicBoundaryComputation_masters_slaves',
argument 2 of type 'dolfin::SubDomain const &'
Without the init (which is needed in some cases) everything works fine.