From: Derek Gaston <friedmud@gm...>  20080822 20:26:15

Ok  one thing I'm confused about is what should go into update_sparsity_pattern and what should go into init().... Will init() ever be called without calling update_sparsity_pattern() first? If not then I'm going to put both the Epetra_Map and Epetra_CrsGraph creation into update_sparsity_pattern() and only the creation of the Epetra_FECrsVector into init(). And update_sparsity_pattern() should call init() right? Derek On Aug 22, 2008, at 2:09 PM, Benjamin Kirk wrote: > Should the trilinos list get queried? Is that a bug?? > > >> What do you think Ben? Shouldn't be too hard right? After a bit >> of looking >> around it appears that the dof_map can generate the full sparsity >> pattern >> which shouldn't be too hard to translate into the CrsGraph that >> Epetra wants. > > Right. You need to overload the > SparseMatrix::need_full_sparsity_pattern() > to return true, and then implement the > SparseMatrix::update_sparsity_pattern() member (like is done in the > LaspackMatrix). > > The idea is as follows... > > (1) The DofMap constructs the graph of the sparse matrix when > assigning the > degrees of freedom, but it does not need to keep this around > > (2) for formats like petsc, the graph is not needed, only an > accurate (or > bounding) count on the number of nonzeros per row. > > (3) this thing is about the size of the local matrix, so once it is > constructed and no longer needed it can be thrown away. However, > before > throwing it away, the DofMap gives the SparseMatrix'es the option to > use it. > > In any case, see what you can do with it. It is really simple, the > SparsityPattern::Graph is simply a vectorofvectors, with > > sparsity_pattern.size() = n_local_rows > sparsity_pattern[row].size() = # of nonzeros on 'row' > sparsity_pattern[row][i] = col > (where row,col is the global matrix index for the ith nonzero entry > on this > row.) > > Ben > > 