← Back to team overview

dolfin team mailing list archive

Re: Added operations to NewVector wrapper as well as a test for the new [...]

 

On Thu, Jan 13, 2005 at 04:53:38AM +0100, Johan Jansson wrote:

> > 2. Is the purpose of the class NewVector::Index that access and
> > assignment need to be handled differently? Same as Matrix::Element?
> 
> Yes. PETSc doesn't allow us to keep pointers into the data of a vector
> (in the parallel case it's not possible to get a pointer at all), so a
> vector has to be treated just as a sparse matrix.
> 
> Perhaps we can have a discussion on how much "syntactic sugar" we
> should put on the PETSc wrapper interface. I think we should keep it
> simple, but at least the standard indexing operations should be there.

We should keep the interface at a minimum for two reasons:

1. Easier to maintain a small interface and the full range of PETSc
operations is available through NewMatrix::mat() and NewVector::vec().

2. There might come a time when we move to PETSc 3.0 which will
already have a C++ interface that we can use.

We can just start with the basic operations and then add the things we
need to do assembly. In addition to what we have now, we might want to
put in

    real norm()

    const NewVector& operator=  (const NewVector& x);
    const NewVector& operator+= (const NewVector& x);
    const NewVector& operator-= (const NewVector& x);
    const NewVector& operator*= (real a);

    real operator*= (const NewVector& x);

> Ok, I wasn't aware of this. I'll do that instead.
> 
> By the way, I found out how to use the PETSc Krylov solvers by
> providing only the action of the operator:
> 
> http://www.epcc.ed.ac.uk/computing/services/cray_service/documents/local_libs/PETSC/manual.html#Node26
> 
> I don't think it's meaningful to wrap it, but that's what we need to
> use for the Newton solver in the ODE solver.

Thanks. I'll take a look.

/Anders



References