1*7588ac45SBarry Smith /* $Id: vec.h,v 1.51 1996/08/04 23:14:42 bsmith Exp bsmith $ */ 22eac72dbSBarry Smith /* 3*7588ac45SBarry Smith This defines the abstract vector component of PETSc. 42eac72dbSBarry Smith */ 52eac72dbSBarry Smith 62eac72dbSBarry Smith #ifndef __VEC_PACKAGE 72eac72dbSBarry Smith #define __VEC_PACKAGE 82eac72dbSBarry Smith #include "is.h" 9bf5bf444SLois Curfman McInnes #include "sys.h" 102eac72dbSBarry Smith 119e25ed09SBarry Smith #define VEC_COOKIE PETSC_COOKIE+3 129e25ed09SBarry Smith #define VEC_SCATTER_COOKIE PETSC_COOKIE+4 139e25ed09SBarry Smith 14b56ba379SLois Curfman McInnes typedef enum { VECSAME=-1, VECSEQ, VECMPI } VecType; 15f0479e8cSBarry Smith 162eac72dbSBarry Smith typedef struct _Vec* Vec; 1708480c60SBarry Smith typedef struct _VecScatter* VecScatter; 182eac72dbSBarry Smith 19227d817aSBarry Smith 20de7da479SBarry Smith extern int VecCreateSeq(MPI_Comm,int,Vec*); 218ed539a5SBarry Smith extern int VecCreateMPI(MPI_Comm,int,int,Vec*); 226469c4f9SBarry Smith extern int VecCreate(MPI_Comm,int,Vec*); 232eac72dbSBarry Smith 244b0e389bSBarry Smith extern int VecDestroy(Vec); 254b0e389bSBarry Smith 268ed539a5SBarry Smith extern int VecDot(Vec,Vec,Scalar*); 278ed539a5SBarry Smith extern int VecTDot(Vec,Vec,Scalar*); 288ed539a5SBarry Smith extern int VecMDot(int,Vec,Vec*,Scalar*); 298ed539a5SBarry Smith extern int VecMTDot(int,Vec,Vec*,Scalar*); 30cddf8d76SBarry Smith 31cddf8d76SBarry Smith typedef enum {NORM_1=1,NORM_2=2,NORM_FROBENIUS=3,NORM_INFINITY=4} NormType; 32cddf8d76SBarry Smith #define NORM_MAX NORM_INFINITY 33cddf8d76SBarry Smith extern int VecNorm(Vec,NormType,double *); 34ee50ffe9SBarry Smith extern int VecSum(Vec,Scalar*); 357c16e1c9SBarry Smith extern int VecMax(Vec,int*,double*); 367c16e1c9SBarry Smith extern int VecMin(Vec,int*,double*); 378ed539a5SBarry Smith extern int VecScale(Scalar*,Vec); 388ed539a5SBarry Smith extern int VecCopy(Vec,Vec); 3977c4ece6SBarry Smith extern int VecSetRandom(PetscRandom,Vec); 408ed539a5SBarry Smith extern int VecSet(Scalar*,Vec); 418ed539a5SBarry Smith extern int VecSwap(Vec,Vec); 428ed539a5SBarry Smith extern int VecAXPY(Scalar*,Vec,Vec); 4377c4ece6SBarry Smith extern int VecAXPBY(Scalar*,Scalar *,Vec,Vec); 448ed539a5SBarry Smith extern int VecMAXPY(int,Scalar*,Vec,Vec*); 458ed539a5SBarry Smith extern int VecAYPX(Scalar*,Vec,Vec); 468ed539a5SBarry Smith extern int VecWAXPY(Scalar*,Vec,Vec,Vec); 4777c4ece6SBarry Smith extern int VecPointwiseMult(Vec,Vec,Vec); 4877c4ece6SBarry Smith extern int VecPointwiseDivide(Vec,Vec,Vec); 494b0e389bSBarry Smith extern int VecShift(Scalar*,Vec); 504b0e389bSBarry Smith extern int VecReciprocal(Vec); 514b0e389bSBarry Smith extern int VecAbs(Vec); 526469c4f9SBarry Smith extern int VecDuplicate(Vec,Vec*); 53afc8d9b6SBarry Smith extern int VecDuplicateVecs(Vec,int,Vec**); 544b0e389bSBarry Smith extern int VecDestroyVecs(Vec*,int); 552eac72dbSBarry Smith 5664119d58SLois Curfman McInnes typedef enum {NOT_SET_VALUES, INSERT_VALUES, ADD_VALUES} InsertMode; 5720563c6bSBarry Smith extern int VecSetValues(Vec,int,int*,Scalar*,InsertMode); 58ee50ffe9SBarry Smith extern int VecAssemblyBegin(Vec); 59ee50ffe9SBarry Smith extern int VecAssemblyEnd(Vec); 608ed539a5SBarry Smith 61c16cb8f2SBarry Smith typedef enum {SCATTER_REVERSE=1,SCATTER_ALL=8} ScatterMode; 6208480c60SBarry Smith extern int VecScatterBegin(Vec,Vec,InsertMode,ScatterMode,VecScatter); 6308480c60SBarry Smith extern int VecScatterEnd(Vec,Vec,InsertMode,ScatterMode,VecScatter); 6408480c60SBarry Smith extern int VecScatterCreate(Vec,IS,Vec,IS,VecScatter *); 6508480c60SBarry Smith extern int VecScatterDestroy(VecScatter); 6608480c60SBarry Smith extern int VecScatterCopy(VecScatter,VecScatter *); 6708480c60SBarry Smith extern int VecScatterView(VecScatter,Viewer); 68d6dfbf8fSBarry Smith 692195c698SBarry Smith extern int VecScatterRemap(VecScatter,int *,int*); 702195c698SBarry Smith 718ed539a5SBarry Smith extern int VecGetArray(Vec,Scalar**); 726b5873e3SBarry Smith extern int VecRestoreArray(Vec,Scalar**); 73afc8d9b6SBarry Smith extern int VecPlaceArray(Vec,Scalar*); 74707f76d8SBarry Smith extern int VecGetArrays(Vec*,int,Scalar***); 75707f76d8SBarry Smith extern int VecRestoreArrays(Vec*,int,Scalar***); 7677c4ece6SBarry Smith extern int VecValid(Vec,PetscTruth*); 778ed539a5SBarry Smith extern int VecView(Vec,Viewer); 785f52d6abSBarry Smith extern int VecLoad(Viewer,Vec*); 7913054869SSatish Balay extern int VecEqual( Vec,Vec,PetscTruth*); 808ed539a5SBarry Smith 818ed539a5SBarry Smith extern int VecGetSize(Vec,int*); 821dd0cb96SLois Curfman McInnes extern int VecGetType(Vec,VecType*,char**); 838ed539a5SBarry Smith extern int VecGetLocalSize(Vec,int*); 84d6dfbf8fSBarry Smith extern int VecGetOwnershipRange(Vec,int*,int*); 858ed539a5SBarry Smith 8634233285SBarry Smith #if defined(__DRAW_PACKAGE) 87d7e8b826SBarry Smith extern int DrawTensorContour(Draw,int,int,double *,double *,Vec); 8834233285SBarry Smith #endif 8934233285SBarry Smith 902eac72dbSBarry Smith #endif 912eac72dbSBarry Smith 922eac72dbSBarry Smith 93*7588ac45SBarry Smith 94