NameError: name 'CellFunction' is not defined

Following the changelog, this function is deprecated, and the new usage should be:
materials = MeshFunction("size_t", mesh, mesh.topology().dim(), 0).
Note that there are several other changes, especially wrt. plotting. I would for instance use

import matplotlib.pyplot as plt
plot(materials)
plt.show()
3 Likes