From: Benjamin Kirk <benjamin.kirk@na...>  20081107 17:31:17

> I'm not sure if this is a stupid question but I'm not entirely sure as > to how you would find the nonzeros per row in a DG discretization. > This is not obvious to me since in say an advection system, the flux > at the boundaries couple the dofs in one cell to the next. And hence, > the dof_map does not have any idea about this discretization or > coupling of variables. In the continuous FEM case, the dof_map does > provide the connectivity correctly since the mesh_nodes are the dofs > in the discretization. In DG discretizations the degrees of freedom in any given element are typically coupled to all the degrees of freedom in its faceneighbors. > Any ideas as to how I can possibly access the location of nonzeros per > row by just looking at the final assembled matrix ? I saw that there > is a update_sparsity_pattern routine in SparseMatrix but this is not > overloaded in PetscMatrix. I guess I am looking for something like the > sparsity_pattern object, or am I way off on my interpretation of what > this means ? The DofMap will add all face neighbor degrees of freedom to an element's coupled dofs if (1) all the variables in the system are discontinuous, or (2) the command line option 'implicit_neighbor_dofs' is specified. The role of the sparsity pattern is to define the graph structure of the system matrix. So, the DofMap builds this graph, and then passess it off to any associated matrices. It is then destroyed because it takes a fair bit of memory and, in theory, should not be needed after the matrices are reinitialized with the proper structure. In the case of PETSc it does not actually need the graph of the matrix  the number of on and offprocessor nonzeros per row will suffice. Of course, internal to the DofMap the sparsity pattern is computed anyway to get this information. If you look in the laspack and trilinos matrix implementations you will see where the sparsity pattern is actually used. Hope this helps, Ben 