Adapt function gives an error

Hey all

The adapt function gives the following error. I am on a mac, using Anaconda(conda 4.8, python 3.7.4, Fenics 2019.1.0). There are two similar posts proposing a workaround. Is there a more stable solution ?

many thanks


from fenics import *
from dolfin import *
from mshr import *

mesh = UnitSquareMesh(8, 8, “crossed”)
CG = FiniteElement(“CG”, mesh.ufl_cell(), 1)
Vh = FunctionSpace(mesh, CG)

H=Function(Vh);

H0=interpolate(Expression((‘exp(-2*(pow(x[0]-0.5,2)+pow(x[1]-0.5,2)))’),degree=6),Vh)

H.assign(H0);

mesh=refine(mesh)

H = adapt(H, mesh)


TypeError: adapt(): incompatible function arguments. The following argument types are supported:
1. (arg0: dolfin.cpp.mesh.Mesh) -> dolfin.cpp.mesh.Mesh
2. (arg0: dolfin.cpp.mesh.MeshFunctionSizet, arg1: dolfin.cpp.mesh.Mesh) -> dolfin.cpp.mesh.MeshFunctionSizet

Invoked with: Coefficient(FunctionSpace(Mesh(VectorElement(FiniteElement(‘Lagrange’, triangle, 1), dim=2), 199), FiniteElement(‘Lagrange’, triangle, 1)), 204), <dolfin.cpp.mesh.Mesh object at 0x133891cb0>

A more stable solution would be to add the pybind c++ code to the source code (dolfin/python/src/fem.cpp). To do do, fork dolfin, make a branch and create a PR with the changes.

do you know if this will be fixed in the next release of Fenics ?
many thanks for your reply !