If I have a MeshFunction over cells, representing (for example) thermal conductivity in the heat equation, how can I convert that into a Function object, and use it in a form?
mesh = Mesh("mymesh.xml.gz")
V = FunctionSpace(mesh, "Lagrange", 1)
u = Function(V)
tcond = MeshFunction("size_t", mesh, "materials.xml.gz")
I was going to try something like this, but the number of nodes != number of cells …
tcond_vals = (10., 100.)
helper = numpy.asarray(tcond.array(), dtype=numpy.int32)
tcond.vector()[:] = numpy.choose(helper, tcond_vals)