I added an issue for this. https://bitbucket.org/fenics-project/dolfin/issue/111/naming-of-dofmap-vertex_to_dof_map
Johan On Friday August 30 2013 15:47:28 Garth N. Wells wrote: > The functions GenericDofmap::vertex_to_dof_map and > GenericDofMap::dof_to_vertex_map are not properly documented (the doc > string is the same for both), and I think that they are back to front. > The docstring in DofMap has inconsistencies. I would expect that > > map0 = GenericDofmap::vertex_to_dof_map(...) > > would mean a map from vertex to dof, i.e. > > map0[vertex_index] -> dof index > > and that > > map1 = GenericDofmap::dof_to_vertex_map(...) > > would mean a map from dof index to > > map1[dof_index] -> vertex index > > Tests (see below code) and the return types also indicate that things > are back to front. Can someone clarify the situation? > > Garth > > > > from dolfin import * > > mesh = UnitSquareMesh(4, 4) > V = FunctionSpace(mesh, "Lagrange", 1) > > dof_to_vertex = V.dofmap().dof_to_vertex_map(mesh) > vertex_to_dof = V.dofmap().vertex_to_dof_map(mesh) > > for c in cells(mesh): > print "Cell index:", c.index() > > # Get cell dofs > dofs = V.dofmap().cell_dofs(c.index()) > print " Cell dofs:", dofs > > # Get vertices from cell > cell_vertices0 = sorted([v.index() for v in vertices(c)]) > print " Cell vertex indices (from cell):", cell_vertices0 > > # Get vertices from dof_to_vertex > cell_vertices1 = sorted([dof_to_vertex[dof] for dof in dofs]) > print " Cell vertex indices (from dof_to_vertex_map):", cell_vertices1 > > # Get vertices from vertex_to_dof_map > cell_vertices2 = sorted([vertex_to_dof[dof] for dof in dofs]) > print " Cell vertex indices (from vertex_to_dof_map):", cell_vertices2 > _______________________________________________ > fenics mailing list > [email protected] > http://fenicsproject.org/mailman/listinfo/fenics _______________________________________________ fenics mailing list [email protected] http://fenicsproject.org/mailman/listinfo/fenics
