Skip to content

Instantly share code, notes, and snippets.

@funsim
Created December 16, 2013 10:23
Show Gist options
  • Save funsim/7984928 to your computer and use it in GitHub Desktop.
Save funsim/7984928 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
from dolfin import *
import sys
if len(sys.argv) < 2:
print "Usage: plot_mesh.py meshfile [facet_files]"
sys.exit(1)
mesh = Mesh(sys.argv[1])
print "Number of vertices: ", mesh.num_vertices()
print "Number of facets: ", mesh.num_facets()
print "Number of cells: ", mesh.num_cells()
print "hmin: ", mesh.hmin()
print "hmax: ", mesh.hmax()
plot(mesh, axes=True)
# Load boundary mesh if provided
if len(sys.argv) == 3:
boundary_mesh = MeshFunction('size_t', mesh, sys.argv[2])
plot(boundary_mesh, axes=True)
interactive()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment