# Questions about ufl\_cell() and cpp.mesh

**URL:** <https://fenicsproject.discourse.group/t/questions-about-ufl-cell-and-cpp-mesh/10458>\
**Category:** General\
**Created:** [February 17, 2023, 9:45am UTC](https://fenicsproject.discourse.group/t/questions-about-ufl-cell-and-cpp-mesh/10458 "2023-02-17T09:45:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Discoverer](https://avatars.discourse-cdn.com/v4/letter/d/b2d939/32.png) [@Discoverer](https://fenicsproject.discourse.group/u/Discoverer)\
**Post date:** [February 17, 2023, 9:45am UTC](https://fenicsproject.discourse.group/t/questions-about-ufl-cell-and-cpp-mesh/10458/1 "2023-02-17T09:45:13Z")

</div>

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

```auto
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

```auto
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

 ![屏幕截图 2023-02-17 174218](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/0/0702a537b1a647119c9533f789fa428b0c6455e8.png)  
the line with waves says that cpp.mesh cannot be resolved by pylance.So can I just change this to dolfinx.mesh ?

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [February 17, 2023, 9:57am UTC](https://fenicsproject.discourse.group/t/questions-about-ufl-cell-and-cpp-mesh/10458/2 "2023-02-17T09:57:37Z")

</div>

> [@Discoverer](#):
>
> ```auto
> 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)
> 
> ```

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

> [@Discoverer](#):
>
> `V=fem.FunctionSpace(mesh,element)`

should be

`V=fem.FunctionSpace(domain, element)`

---

<div class="post-metadata">

**Author:** ![Discoverer](https://avatars.discourse-cdn.com/v4/letter/d/b2d939/32.png) [@Discoverer](https://fenicsproject.discourse.group/u/Discoverer)\
**Post date:** [February 17, 2023, 10:16am UTC](https://fenicsproject.discourse.group/t/questions-about-ufl-cell-and-cpp-mesh/10458/3 "2023-02-17T10:16:26Z")

</div>

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

> [@Discoverer](#):
>
> So can I just change this to dolfinx.mesh ?

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [February 17, 2023, 10:19am UTC](https://fenicsproject.discourse.group/t/questions-about-ufl-cell-and-cpp-mesh/10458/4 "2023-02-17T10:19:31Z")

</div>

> [@Discoverer](#):
>
> So can I just change this to dolfinx.mesh ?

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

---

<div class="post-metadata">

**Author:** ![Discoverer](https://avatars.discourse-cdn.com/v4/letter/d/b2d939/32.png) [@Discoverer](https://fenicsproject.discourse.group/u/Discoverer)\
**Post date:** [February 17, 2023, 10:25am UTC](https://fenicsproject.discourse.group/t/questions-about-ufl-cell-and-cpp-mesh/10458/5 "2023-02-17T10:25:49Z")

</div>

Really helps.Thanks a lot.
