mikaem / fenicstools

55 stars 36 forks source link

Update DofMapPlotter to recent FEniCS versions #15

Closed francesco-ballarin closed 8 years ago

francesco-ballarin commented 8 years ago

Dear fenicstools developers,

Today I was trying to use DofMapPlotter with a recent FEniCS version (commit 83a7cb4) but apparently dofmap.tabulate_coordinates was removed as of dolfin commit ad26cbc. I try to update fenicstools to the new FEniCS interface in this pull request. I have successfully tested the pull request with the examples on the wiki/DofMapPlotter page.

The third example on the wiki page should also be slightly updated. This is the version I tested

from dolfin import *
from fenicstools import DofMapPlotter

mesh = RectangleMesh(Point(0, 0), Point(1, 1), 4, 4)

V = VectorElement('CG', mesh.ufl_cell(), 2)
Q = FiniteElement('CG', mesh.ufl_cell(), 1)
M = FunctionSpace(mesh, MixedElement([V, Q]))

dmp = DofMapPlotter(M)
dmp.plot()       # All dofs of M
dmp.plot(sub=0)  # Dofs of M that belong to V
dmp.plot(sub=1)  # Dofs of M that belong to Q
dmp.show()

Thanks for your efforts, Francesco

mikaem commented 8 years ago

Thanks a lot for the PR. Looks good.