parameters: (V: fem.FunctionSpace, entities=None)
return_statement: return topology.reshape(1, -1)[0], cell_types, V.tabulate_dof_coordinates()
docstring: Creates a VTK mesh topology (topology array and array of cell
      types) that is based on the degree-of-freedom coordinates. Note that
      this function supports Lagrange elements (continuous and
      discontinuous) only.
docstring_summary: Creates a VTK mesh topology (topology array and array of cell
      types) that is based on the degree-of-freedom coordinates. Note that
      this function supports Lagrange elements (continuous and
      discontinuous) only.
docstring_tokens: Creates a VTK mesh topology ( topology array and array of cell types ) that is based on the degree - of - freedom coordinates . Note that this function supports Lagrange elements ( continuous and discontinuous ) only .
function: def _(V: fem.FunctionSpace, entities=None):
      """Creates a VTK mesh topology (topology array and array of cell
      types) that is based on the degree-of-freedom coordinates. Note that
      this function supports Lagrange elements (continuous and
      discontinuous) only.
  
      """
      if not (V.ufl_element().family() in ['Discontinuous Lagrange', "Lagrange", "DQ", "Q"]):
          raise RuntimeError("Can only create meshes from continuous or discontinuous Lagrange spaces")
  
      degree = V.ufl_element().degree()
      if degree == 0:
          raise RuntimeError("Cannot create topology from cellwise constants.")
  
      # Use all local cells if not supplied
      msh = V.mesh
      tdim = msh.topology.dim
      if entities is None:
          entities = range(msh.topology.index_map(tdim).size_local)
  
      dofmap = V.dofmap
      num_dofs_per_cell = V.dofmap.dof_layout.num_dofs
      cell_type = msh.topology.cell_type
      perm = np.argsort(_cpp.io.perm_vtk(cell_type, num_dofs_per_cell))
  
      vtk_type = _first_order_vtk[cell_type] if degree == 1 else _cpp.io.get_vtk_cell_type(cell_type, tdim)
      cell_types = np.full(len(entities), vtk_type)
  
      topology = np.zeros((len(entities), num_dofs_per_cell + 1), dtype=np.int32)
      topology[:, 0] = num_dofs_per_cell
      dofmap_ = dofmap.list.array.reshape(dofmap.list.num_nodes, num_dofs_per_cell)
  
      topology[:, 1:] = dofmap_[:len(entities), perm]
      return topology.reshape(1, -1)[0], cell_types, V.tabulate_dof_coordinates()
function_tokens: def _ ( V : fem . FunctionSpace , entities = None ) : if not ( V . ufl_element ( ) . family ( ) in [ 'Discontinuous Lagrange' , "Lagrange" , "DQ" , "Q" ] ) : raise RuntimeError ( "Can only create meshes from continuous or discontinuous Lagrange spaces" ) degree = V . ufl_element ( ) . degree ( ) if degree == 0 : raise RuntimeError ( "Cannot create topology from cellwise constants." ) # Use all local cells if not supplied msh = V . mesh tdim = msh . topology . dim if entities is None : entities = range ( msh . topology . index_map ( tdim ) . size_local ) dofmap = V . dofmap num_dofs_per_cell = V . dofmap . dof_layout . num_dofs cell_type = msh . topology . cell_type perm = np . argsort ( _cpp . io . perm_vtk ( cell_type , num_dofs_per_cell ) ) vtk_type = _first_order_vtk [ cell_type ] if degree == 1 else _cpp . io . get_vtk_cell_type ( cell_type , tdim ) cell_types = np . full ( len ( entities ) , vtk_type ) topology = np . zeros ( ( len ( entities ) , num_dofs_per_cell + 1 ) , dtype = np . int32 ) topology [ : , 0 ] = num_dofs_per_cell dofmap_ = dofmap . list . array . reshape ( dofmap . list . num_nodes , num_dofs_per_cell ) topology [ : , 1 : ] = dofmap_ [ : len ( entities ) , perm ] return topology . reshape ( 1 , - 1 ) [ 0 ] , cell_types , V . tabulate_dof_coordinates ( )