This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Problem with MeshFunction in dolfin 1.0.0

0 votes

Hello,

The following code produces the attached picture.
I was expecting the contant value 1 in the whole domain.

from dolfin import *

nex, ney =  20, 20
l        =  2.
h        =  1.

mesh = Rectangle(0,0,l,h,nex,ney)

boundary_parts = MeshFunction("uint", mesh, mesh.topology().dim()-1)
boundary_parts.set_all(1)

plot(boundary_parts)
interactive()

http://pix.toile-libre.org/?img=1373554169.png

asked Jul 11, 2013 by micdup FEniCS User (1,120 points)
edited Jul 11, 2013 by micdup

1 Answer

+1 vote
 
Best answer

There is probably this bug

--- viper/viper_dolfin.py     2011-12-07 12:56:29.000000000 +0100
+++ viper/viper_dolfin.py     2013-07-11 21:55:21.000000000 +0200
@@ -269,7 +269,7 @@
                 vertex_values = vertices.array()
                 vertex_values[:] = 0
                 con20 = self.mesh.topology()(dim,0)
-                for facet in xrange(self.mesh.num_faces()):
+                for facet in xrange(self.mesh.num_facets()):
                     if values[facet]:
                         vertex_values[con20(facet)] = values[facet]
                 self.plot_meshfunction(vertices, *args, **kwargs)

But I can't test it on my machine. Viper is not maintained anymore and FEniCS with Viper won't be released. So you can apply it locally.

answered Jul 11, 2013 by Jan Blechta FEniCS Expert (51,420 points)
selected Jul 19, 2013 by Jan Blechta
...