# 'dolfinx.cpp.mesh.Topology' object has no attribute 'cell\_type'

**URL:** <https://fenicsproject.discourse.group/t/dolfinx-cpp-mesh-topology-object-has-no-attribute-cell-type/12734>\
**Category:** General\
**Created:** [November 13, 2023, 9:01am UTC](https://fenicsproject.discourse.group/t/dolfinx-cpp-mesh-topology-object-has-no-attribute-cell-type/12734 "2023-11-13T09:01:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anupama](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@anupama](https://fenicsproject.discourse.group/u/anupama)\
**Post date:** [November 13, 2023, 9:01am UTC](https://fenicsproject.discourse.group/t/dolfinx-cpp-mesh-topology-object-has-no-attribute-cell-type/12734/1 "2023-11-13T09:01:29Z")

</div>

I am trying to run [Von Mises elasto-plasticity — FEniCSx Fracture Mechanics](https://newfrac.github.io/fenicsx-fracture/notebooks/plasticity/plasticity.html) tutorial.  
and I am getting this error

```auto

AttributeError: 'dolfinx.cpp.mesh.Topology' object has no attribute 'cell_type'

```

(My dolfinx version is : 0.7.1)

Can anyone help me resolve this issue?

Anupama

---

<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:** [November 13, 2023, 4:19pm UTC](https://fenicsproject.discourse.group/t/dolfinx-cpp-mesh-topology-object-has-no-attribute-cell-type/12734/2 "2023-11-13T16:19:02Z")

</div>

As we are preparing DOLFINx to support mixed cell meshes, `dolfinx.cpp.mesh.Topology.cell_type` has been renamed  
`dolfinx.cpp.mehs.Topology.cell_types` to reflect that we might have multiple types of cells in a mesh. This returns a list of cells in the mesh (currently it is an array with one entry).

---

<div class="post-metadata">

**Author:** ![anupama](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@anupama](https://fenicsproject.discourse.group/u/anupama)\
**Post date:** [November 15, 2023, 6:52am UTC](https://fenicsproject.discourse.group/t/dolfinx-cpp-mesh-topology-object-has-no-attribute-cell-type/12734/3 "2023-11-15T06:52:09Z")

</div>

Thank you, Where can I find the documentation for

> dolfinx.cpp.mesh.Topology.cell\_types  
> ?

---

<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:** [November 15, 2023, 9:41am UTC](https://fenicsproject.discourse.group/t/dolfinx-cpp-mesh-topology-object-has-no-attribute-cell-type/12734/4 "2023-11-15T09:41:32Z")

</div>

[https://docs.fenicsproject.org/dolfinx/v0.7.0.post0/python/generated/dolfinx.cpp.mesh.html#dolfinx.cpp.mesh.Topology.cell\_types](https://docs.fenicsproject.org/dolfinx/v0.7.0.post0/python/generated/dolfinx.cpp.mesh.html#dolfinx.cpp.mesh.Topology.cell_types)  
As this is a binding directly to C++, the docs are a bit tricky to find, But they are usually directly mirrors of the C++ docs: [Mesh (dolfinx::mesh) — DOLFINx 0.3.1 documentation](https://docs.fenicsproject.org/dolfinx/v0.7.0.post0/cpp/mesh.html#_CPPv4NK7dolfinx4mesh8Topology10cell_typesEv)

---

<div class="post-metadata">

**Author:** ![anupama](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@anupama](https://fenicsproject.discourse.group/u/anupama)\
**Post date:** [November 15, 2023, 11:45am UTC](https://fenicsproject.discourse.group/t/dolfinx-cpp-mesh-topology-object-has-no-attribute-cell-type/12734/5 "2023-11-15T11:45:15Z")

</div>

Thanks again; the following function from the specified tutorial still gives me back error after changing to cell\_types

```auto
def interpolate_quadrature(ufl_expr, fem_func:fem.Function):
    q_dim = fem_func.function_space._ufl_element.degree()
    mesh = fem_func.ufl_function_space().mesh
    
    basix_celltype = getattr(basix.CellType, mesh.topology.cell_type.name)
    quadrature_points, weights = basix.make_quadrature(basix_celltype, q_dim)
    map_c = mesh.topology.index_map(mesh.topology.dim)
    num_cells = map_c.size_local + map_c.num_ghosts
    cells = np.arange(0, num_cells, dtype=np.int32)

    expr_expr = fem.Expression(ufl_expr, quadrature_points)
    expr_eval = expr_expr.eval(cells)
    fem_func.x.array[:] = expr_eval.flatten()[:]

```

Is there anything else that has been changed in this version?

Also is there a preferred version of dolfinx for this particular tutorial ([Von Mises elasto-plasticity — FEniCSx Fracture Mechanics](https://newfrac.github.io/fenicsx-fracture/notebooks/plasticity/plasticity.html)) ?

---

<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:** [November 15, 2023, 1:18pm UTC](https://fenicsproject.discourse.group/t/dolfinx-cpp-mesh-topology-object-has-no-attribute-cell-type/12734/6 "2023-11-15T13:18:41Z")

</div>

The FEniCSx Fracture mechanics uses an old version of FEniCSx (i think it is 0.6.0).  
I cannot list everything that has changed.  
See: [Computational fracture mechanics examples with FEniCSx — FEniCSx Fracture Mechanics](https://newfrac.github.io/fenicsx-fracture/index.html#docker)  
for how they get dependencies
