# Problem with Mesh Function

**URL:** <https://fenicsproject.discourse.group/t/problem-with-mesh-function/5934>\
**Category:** mesh\
**Created:** [June 2, 2021, 5:56am UTC](https://fenicsproject.discourse.group/t/problem-with-mesh-function/5934 "2021-06-02T05:56:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pratik](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@Pratik](https://fenicsproject.discourse.group/u/Pratik)\
**Post date:** [June 2, 2021, 5:56am UTC](https://fenicsproject.discourse.group/t/problem-with-mesh-function/5934/1 "2021-06-02T05:56:13Z")

</div>

Dear all,  
I am trying to solve a Poisson equation with different boundary conditions by creating a different subdomain for each boundary. It’s a problem in the tutorial.  
I ran the same code given in the tutorial but getting this error.  
‘MeshFunction type not recognized’  
I think this command is outdated. Please tell me what I can type instead of this.  
And also where can I find substitutes for outdated commands like this.

I am attaching the code and error snapshot here.

from dolfin import \*  
import numpy

#-------------- Preprocessing step -----------------

# Create mesh and define function space

mesh = UnitSquareMesh(3, 2)  
V = FunctionSpace(mesh, ‘Lagrange’, 1)

# Define boundary segments for Neumann, Robin and Dirichlet conditions

# Create mesh function over cell facets

boundary\_parts = MeshFunction(“uint”, mesh, mesh.topology().dim()-1)

 ![Capture6](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/c/c6570b2c732674d669ce16095eb8611da7a75b55.jpeg)

---

<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:** [June 2, 2021, 7:22am UTC](https://fenicsproject.discourse.group/t/problem-with-mesh-function/5934/2 "2021-06-02T07:22:52Z")

</div>

> [@Pratik](#):
>
> boundary\_parts = MeshFunction(“uint”, mesh, mesh.topology().dim()-1)

Replace `"uint"` with `"int"` or `"size_t"`.  
For further questions, I would suggest the following:

1. Link to the tutorial you are referring to
2. Format the code using 3x` encapsulation

In general, changes can be found in the Changelog: [Bitbucket](https://bitbucket.org/fenics-project/dolfin/src/master/ChangeLog.rst)  
And as you can see there, it says:

```auto
2016.1.0 [2016-06-23]

    Remove support for 'uint'-valued MeshFunction (replaced by 'size_t')

```

---

<div class="post-metadata">

**Author:** ![Pratik](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@Pratik](https://fenicsproject.discourse.group/u/Pratik)\
**Post date:** [June 2, 2021, 8:13am UTC](https://fenicsproject.discourse.group/t/problem-with-mesh-function/5934/3 "2021-06-02T08:13:00Z")

</div>

Ok, sir, I will do it.  
Thanks.
