How to get the mesh/geometry function space?

In our optimization codes, we have been differentiating with respect to the geometry degrees of freedom. This was accomplished by:

 c_el = domain.ufl_domain().ufl_coordinate_element()
 meshFunctionSpace = fem.FunctionSpace(domain, c_el)

However this code does not run with newer versions, giving the error:

FunctionSpace.__init__() missing 1 required positional argument: 'cppV'

What is the current accepted method/best practice to get such function space?

This is an API update from v0.7.x to v0.8.x.
You should use dolfinx.fem.functionspace(domain, c_el).

1 Like

Many thanks, works great!