Actual source code: taovec_petsc.h

      1: #ifndef TAOPETSCVECTOR_H
      2: #define TAOPETSCVECTOR_H

     4:  #include taovec.h
      5: #include "petscksp.h"

      8: class TaoVecPetsc: public TaoVec{

     10:  protected:

     12:   Vec pv;
     13:   PetscViewer pvecviewer;

     15:  public:

     17:   TaoVecPetsc( Vec);
     18:   ~TaoVecPetsc();

     20:   inline Vec GetVec(){return pv;}
     21:   int SetVec(Vec);
     22:   int SetPetscViewer(PetscViewer);

     24:   /*
     25:      The following methods are implementations of
     26:      the virtual method in the base class
     27:   */
     28:   int Clone(TaoVec**);
     29:
     30:   int Compatible (TaoVec *v, TaoTruth*);

     32:   int SetToZero();
     33:   int SetToConstant( double );
     34:   int Norm1(double *);
     35:   int Norm2(double *);
     36:   int Norm2squared(double *);
     37:   int NormInfinity(double *);
     38:   int Dot( TaoVec*, double *);

     40:   int CopyFrom( TaoVec* );
     41:   int ScaleCopyFrom( double, TaoVec* );
     42:   int Scale( double );
     43:   int AddConstant( double );
     44:   int Negate();
     45:   int Reciprocal();

     47:   int GetDimension(int *);

     49:   int Axpy( double, TaoVec* );
     50:   int Aypx( double, TaoVec* );
     51:   int Axpby( double , TaoVec*, double  );

     53:   int Waxpby( double , TaoVec*, double , TaoVec* );

     55:   int AbsoluteValue( );
     56:   int MinElement(double*);

     58:   int PointwiseMultiply( TaoVec*, TaoVec* );
     59:   int PointwiseDivide( TaoVec*, TaoVec* );

     61:   int PointwiseMinimum( TaoVec*, TaoVec* );
     62:   int PointwiseMaximum( TaoVec*, TaoVec* );
     63:   int Median( TaoVec* , TaoVec*, TaoVec* );

     65:   int Fischer(TaoVec *, TaoVec *, TaoVec *, TaoVec *);
     66:   int SFischer(TaoVec *, TaoVec *, TaoVec *, TaoVec *, double);

     68:   int View();
     69:   int StepMax( TaoVec* , double* );
     70:   int StepMax2( TaoVec* , TaoVec* , TaoVec* , double* );
     71:   int StepBoundInfo(TaoVec* ,TaoVec*,TaoVec*,double*,double*,double*);

     73:   int BoundGradientProjection(TaoVec*,TaoVec*,TaoVec*, TaoVec*);

     75:   int GetArray(TaoScalar **, int*);
     76:   int RestoreArray(TaoScalar **, int*);

     79:   int CreateIndexSet(TaoIndexSet**S);

     81:   int SetReducedVec(TaoVec*, TaoIndexSet*);
     82:   int ReducedCopyFromFull(TaoVec*, TaoIndexSet*);
     83:   int ReducedXPY(TaoVec*, TaoIndexSet*);

     85: };

     87: #endif