← Back to team overview

dolfin team mailing list archive

Re: [HG dolfin] Fix configure and remove some functions from GenericMatrix.

 

On Mon, Apr 16, 2007 at 01:58:30PM +0200, Garth N. Wells wrote:
> 
> 
> Anders Logg wrote:
> > In GenericMatrix, we have the following functions in addition to the
> > GenericTensor interface (not counting the virtual functions add, get,
> > set that are specializations of the corresponding functions in
> > GenericTensor):
> > 
> >   /// Initialize M x N matrix with given maximum number of nonzeros in each row
> >   virtual void init(uint M, uint N, uint nzmax) = 0;
> >     
> >   /// Initialize M x N matrix with given number of nonzeros per row
> >   virtual void init(uint M, uint N, const uint nz[]) = 0;
> > 
> >   /// Set all entries to zero
> >   virtual void zero() = 0;
> > 
> >   /// Set given rows to identity matrix
> >   virtual void ident(const uint rows[], uint m) = 0;
> > 
> > Since we have init(SparsityPattern), it looks to me like the first two
> > could be removed.
> 
> We should design SparsityPattern such that it doesn't necessarily 
> contain the full layout, but perhaps just the maximum number of 
> non-zeroes. init(SparsityPattern sparsity_pattern) should then 
> initialise a matrix the best way it can with what information 
> sparsity_pattern has.

Sounds good.

> > 
> > How about zero() and ident(), do we need them for assembly?
> >
> > We could say that init() should zero out the matrix and use set()
> > instead of ident(). Or perhaps we should stick to ident() so we can
> > map it to MatZeroRowsIS(A, is, one) in PETSc?
> >
> 
> We should stick with ident() and use the PETsc function for this.
> 
> Ideally, init() will take an argument indicating whether or not the 
> matrix structure has changed,
> 
>    init(const SparsityPattern& sparsity_pattern, bool reset = true);
> 
> and reset the layout by default. If reset == false, then init() should 
> just zero the matrix and the function zero() can be removed.
> 
> Garth

Sounds good.

Should we do the same for init(M, N)? (bool reset = true)

/Anders


References