Dear John,
On Thu, 9 Oct 2008, John Peterson wrote:
>> I enclosed all my PETSc calles with "#if PETSC_VERSION_LESS_THAN(2,3,3)" and
>> added error messages in the "#else" case since I am not familiar with
>> PETSc's API history. Whenever somebody might need the shell matrix
>> functionality together with older PETSc versions, he might want to implement
>> that himself.
>
> OK, that may unnecessarily break your code when Petsc 2.3.4 (or
> whatever their next version will be) comes out though. I'd do
> instead:
>
> #if PETSC_VERSION_LESS_THAN(2,3,2)
> // suitable error or unimplemented message
> #else
> // your current code
> #endif
Well, that's actually almost what I did, except that I compared to
(2,3,3) rather than (2,3,2), since I concluded from other usages of
that macro that it is a "<" comparison rather than a "<=". (I agree
that my mail could lead to the assumption that I had done it the wrong
way around.)
>> I switched the user API for shell matrix usage from a callback function to a
>> class, which in fact seems to be much more sensible. I made an abstract
>> base class "ShellMatrix" and three derived classes. One of the derived
>> classes just wraps a SparseMatrix. I noticed that SparseMatrix apparently
>> did not have a method to compute a matrix-vector product, so I added this
>> functionality to SparseMatrix and PetscMatrix (whereas calling
>> libmesh_not_implemented() in LaspackMatrix).
>
> This functionality (matrix-vector product) is actually in the
> NumericVector class, it's the add_vector routine which takes a
> SparseMatrix. Enough people have been confused about this that we
> should probably implement it in SparseMatrix as well, but I'd vote for
> an implementation in terms of the existing NumericVector one (if
> possible) rather than duplicating code.
Okay, done. Also, I did the other way round for ShellMatrix, i.e. I
added NumericVector::add_vector(ShellMatrix,NumericVector) which is
implemented in terms of ShellMatrix::vector_mult_add().
My application that tests the shell matrix is still under
construction.
Best Regards,
Tim
--
Dr. Tim Kroeger Phone +49-421-218-7710
tim.kroeger@..., tim.kroeger@... Fax +49-421-218-4236
MeVis Research GmbH, Universitaetsallee 29, 28359 Bremen, Germany
Amtsgericht Bremen HRB 16222
Geschaeftsfuehrer: Prof. Dr. H.-O. Peitgen
|