Questions about ufl_cell() and cpp.mesh

I am using Dolfinx and when I implement the codes in Fenicsx tutorial “component-wise dirichlet boundary condition”, I meet errors with these codes

domain=mesh.create_rectangle(MPI.COMM_WORLD,np.array([[0,0],[L,H]]),[30,30],cell_type=mesh.CellType.triangle)
element=VectorElement("CG",domain.ufl_cell(),1)
V=fem.FunctionSpace(mesh,element)

And errors are

File "/usr/lib/petsc/lib/python3/dist-packages/dolfinx/fem/function.py", line 450, in __init__
    super().__init__(mesh.ufl_domain(), element)
AttributeError: module 'dolfinx.mesh' has no attribute 'ufl_domain'

and I don’t know why.

In addition, I also look into the dolfinx/mesh.py on my computer and I see


the line with waves says that cpp.mesh cannot be resolved by pylance.So can I just change this to dolfinx.mesh ?

You have called your computational mesh domain, not mesh, as that is the module from DOLFINx.

should be

V=fem.FunctionSpace(domain, element)

Thank you.Its really a small typo :smiling_face_with_tear:.
And could you mind telling that is this right or wrong?

No, you should not change this import. This imports code from the DOLFINx C++ layer (which binds code using pybind11).

Really helps.Thanks a lot.