GMSH + dolfin-convert [http://geuz.org/gmsh]
mesh = Mesh("yourdomain.xml")
cell_function = MeshFunction("size_t", mesh, "yourdomain_physical_region.xml")
facet_function = MeshFunction("size_t", mesh, "yourdomain_facet_region.xml")
markers = CellFunction("bool", mesh)
markers.set_all(False)
for c in cells(mesh):
# Mark cells with facet midpoints near y == 1.0
for f in facets(c):
if near(f.midpoint()[1], 1.0):
markers[c] = True
mesh = refine(mesh, markers, redistribute=False)
This will create new mesh object. For adaptivity see adaptive Poisson demo and adapt method reference.