12eac72dbSBarry Smith /* 237f753daSBarry Smith Defines the vector component of PETSc. Vectors generally represent 337f753daSBarry Smith degrees of freedom for finite element/finite difference functions 484cb2905SBarry Smith on a grid. They have more mathematical structure then simple arrays. 52eac72dbSBarry Smith */ 62eac72dbSBarry Smith 70a835dfdSSatish Balay #ifndef __PETSCVEC_H 80a835dfdSSatish Balay #define __PETSCVEC_H 90a835dfdSSatish Balay #include "petscis.h" 105f5f199fSBarry Smith 11e9fa29b7SSatish Balay PETSC_EXTERN_CXX_BEGIN 122eac72dbSBarry Smith 1309321671SBarry Smith /*S 1409321671SBarry Smith Vec - Abstract PETSc vector object 1509321671SBarry Smith 1609321671SBarry Smith Level: beginner 1709321671SBarry Smith 1809321671SBarry Smith Concepts: field variables, unknowns, arrays 1909321671SBarry Smith 2009321671SBarry Smith .seealso: VecCreate(), VecType, VecSetType() 2109321671SBarry Smith S*/ 22f09e8eb9SSatish Balay typedef struct _p_Vec* Vec; 2309321671SBarry Smith 2409321671SBarry Smith /*S 2509321671SBarry Smith VecScatter - Object used to manage communication of data 2609321671SBarry Smith between vectors in parallel. Manages both scatters and gathers 2709321671SBarry Smith 2809321671SBarry Smith Level: beginner 2909321671SBarry Smith 3009321671SBarry Smith Concepts: scatter 3109321671SBarry Smith 3209321671SBarry Smith .seealso: VecScatterCreate(), VecScatterBegin(), VecScatterEnd() 3309321671SBarry Smith S*/ 34f09e8eb9SSatish Balay typedef struct _p_VecScatter* VecScatter; 3509321671SBarry Smith 3609321671SBarry Smith /*E 37398c84b2SBarry Smith ScatterMode - Determines the direction of a scatter 38398c84b2SBarry Smith 39398c84b2SBarry Smith Level: beginner 40398c84b2SBarry Smith 41398c84b2SBarry Smith .seealso: VecScatter, VecScatterBegin(), VecScatterEnd() 42398c84b2SBarry Smith E*/ 43398c84b2SBarry Smith typedef enum {SCATTER_FORWARD=0, SCATTER_REVERSE=1, SCATTER_FORWARD_LOCAL=2, SCATTER_REVERSE_LOCAL=3, SCATTER_LOCAL=2} ScatterMode; 44398c84b2SBarry Smith 45398c84b2SBarry Smith /*MC 46398c84b2SBarry Smith SCATTER_FORWARD - Scatters the values as dictated by the VecScatterCreate() call 47398c84b2SBarry Smith 48398c84b2SBarry Smith Level: beginner 49398c84b2SBarry Smith 50398c84b2SBarry Smith .seealso: VecScatter, ScatterMode, VecScatterCreate(), VecScatterBegin(), VecScatterEnd(), SCATTER_REVERSE, SCATTER_FORWARD_LOCAL, 51398c84b2SBarry Smith SCATTER_REVERSE_LOCAL 52398c84b2SBarry Smith 53398c84b2SBarry Smith M*/ 54398c84b2SBarry Smith 55398c84b2SBarry Smith /*MC 56398c84b2SBarry Smith SCATTER_REVERSE - Moves the values in the opposite direction then the directions indicated in 57398c84b2SBarry Smith in the VecScatterCreate() 58398c84b2SBarry Smith 59398c84b2SBarry Smith Level: beginner 60398c84b2SBarry Smith 61398c84b2SBarry Smith .seealso: VecScatter, ScatterMode, VecScatterCreate(), VecScatterBegin(), VecScatterEnd(), SCATTER_FORWARD, SCATTER_FORWARD_LOCAL, 62398c84b2SBarry Smith SCATTER_REVERSE_LOCAL 63398c84b2SBarry Smith 64398c84b2SBarry Smith M*/ 65398c84b2SBarry Smith 66398c84b2SBarry Smith /*MC 67398c84b2SBarry Smith SCATTER_FORWARD_LOCAL - Scatters the values as dictated by the VecScatterCreate() call except NO parallel communication 68398c84b2SBarry Smith is done. Any variables that have be moved between processes are ignored 69398c84b2SBarry Smith 70398c84b2SBarry Smith Level: developer 71398c84b2SBarry Smith 72398c84b2SBarry Smith .seealso: VecScatter, ScatterMode, VecScatterCreate(), VecScatterBegin(), VecScatterEnd(), SCATTER_REVERSE, SCATTER_FORWARD, 73398c84b2SBarry Smith SCATTER_REVERSE_LOCAL 74398c84b2SBarry Smith 75398c84b2SBarry Smith M*/ 76398c84b2SBarry Smith 77398c84b2SBarry Smith /*MC 78398c84b2SBarry Smith SCATTER_REVERSE_LOCAL - Moves the values in the opposite direction then the directions indicated in 79398c84b2SBarry Smith in the VecScatterCreate() except NO parallel communication 80398c84b2SBarry Smith is done. Any variables that have be moved between processes are ignored 81398c84b2SBarry Smith 82398c84b2SBarry Smith Level: developer 83398c84b2SBarry Smith 84398c84b2SBarry Smith .seealso: VecScatter, ScatterMode, VecScatterCreate(), VecScatterBegin(), VecScatterEnd(), SCATTER_FORWARD, SCATTER_FORWARD_LOCAL, 85398c84b2SBarry Smith SCATTER_REVERSE 86398c84b2SBarry Smith 87398c84b2SBarry Smith M*/ 88398c84b2SBarry Smith 8976bdecfbSBarry Smith /*J 9009321671SBarry Smith VecType - String with the name of a PETSc vector or the creation function 9109321671SBarry Smith with an optional dynamic library name, for example 9209321671SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:myveccreate() 9309321671SBarry Smith 9409321671SBarry Smith Level: beginner 9509321671SBarry Smith 9609321671SBarry Smith .seealso: VecSetType(), Vec 9776bdecfbSBarry Smith J*/ 98a313700dSBarry Smith #define VecType char* 990676abe4SMatthew Knepley #define VECSEQ "seq" 1000676abe4SMatthew Knepley #define VECMPI "mpi" 101f48c50deSBarry Smith #define VECSTANDARD "standard" /* seq on one process and mpi on several */ 1020676abe4SMatthew Knepley #define VECSHARED "shared" 103765467adSMatthew Knepley #define VECSIEVE "sieve" 1048154be41SBarry Smith #define VECSEQCUSP "seqcusp" 1058154be41SBarry Smith #define VECMPICUSP "mpicusp" 1068154be41SBarry Smith #define VECCUSP "cusp" /* seqcusp on one process and mpicusp on several */ 1071aae2881SJed Brown #define VECNEST "nest" 1081bf2b38bSKerry Stevens #define VECSEQPTHREAD "seqpthread" 109*4b71561bSShri Abhyankar #define VECMPIPTHREAD "mpipthread" 110bf2c1783SBarry Smith #define VECPTHREAD "pthread" /* seqpthread on one process and mpipthread on several */ 1112eac72dbSBarry Smith 112*4b71561bSShri Abhyankar 113fd487807SMatthew Knepley /* Logging support */ 1140700a824SBarry Smith #define VEC_FILE_CLASSID 1211214 1157087cfbeSBarry Smith extern PetscClassId VEC_CLASSID; 1167087cfbeSBarry Smith extern PetscClassId VEC_SCATTER_CLASSID; 1178ba1e511SMatthew Knepley 11845b63f25SDmitry Karpeev 1197087cfbeSBarry Smith extern PetscErrorCode VecInitializePackage(const char[]); 1207087cfbeSBarry Smith extern PetscErrorCode VecFinalizePackage(void); 121fd487807SMatthew Knepley 1227087cfbeSBarry Smith extern PetscErrorCode VecCreate(MPI_Comm,Vec*); 123045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecCreate,(Vec *x),(PETSC_COMM_SELF,x)) 1247087cfbeSBarry Smith extern PetscErrorCode VecCreateSeq(MPI_Comm,PetscInt,Vec*); 125045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecCreateSeq,(PetscInt n,Vec *x),(PETSC_COMM_SELF,n,x)) 1267087cfbeSBarry Smith extern PetscErrorCode VecCreateMPI(MPI_Comm,PetscInt,PetscInt,Vec*); 127045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecCreateMPI,(PetscInt n,PetscInt N,Vec *x),(PETSC_COMM_WORLD,n,N,x)) 1287087cfbeSBarry Smith extern PetscErrorCode VecCreateSeqWithArray(MPI_Comm,PetscInt,const PetscScalar[],Vec*); 129045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecCreateSeqWithArray,(PetscInt n,PetscScalar s[],Vec *x),(PETSC_COMM_SELF,n,s,x)) 1307087cfbeSBarry Smith extern PetscErrorCode VecCreateMPIWithArray(MPI_Comm,PetscInt,PetscInt,const PetscScalar[],Vec*); 131045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecCreateMPIWithArray,(PetscInt n,PetscInt N,PetscScalar s[],Vec *x),(PETSC_COMM_WORLD,n,N,s,x)) 1327087cfbeSBarry Smith extern PetscErrorCode VecCreateShared(MPI_Comm,PetscInt,PetscInt,Vec*); 1337087cfbeSBarry Smith extern PetscErrorCode VecSetFromOptions(Vec); 1347087cfbeSBarry Smith extern PetscErrorCode VecSetUp(Vec); 1356bf464f9SBarry Smith extern PetscErrorCode VecDestroy(Vec*); 1367087cfbeSBarry Smith extern PetscErrorCode VecZeroEntries(Vec); 1377087cfbeSBarry Smith extern PetscErrorCode VecSetOptionsPrefix(Vec,const char[]); 1387087cfbeSBarry Smith extern PetscErrorCode VecAppendOptionsPrefix(Vec,const char[]); 1397087cfbeSBarry Smith extern PetscErrorCode VecGetOptionsPrefix(Vec,const char*[]); 140f69a0ea3SMatthew Knepley 1417087cfbeSBarry Smith extern PetscErrorCode VecSetSizes(Vec,PetscInt,PetscInt); 142fd487807SMatthew Knepley 1437087cfbeSBarry Smith extern PetscErrorCode VecDotNorm2(Vec,Vec,PetscScalar*,PetscScalar*); 1447087cfbeSBarry Smith extern PetscErrorCode VecDot(Vec,Vec,PetscScalar*); 145fcd5dd21SSatish Balay PetscPolymorphicFunction(VecDot,(Vec x,Vec y),(x,y,&s),PetscScalar,s) 1467087cfbeSBarry Smith extern PetscErrorCode VecTDot(Vec,Vec,PetscScalar*); 147fcd5dd21SSatish Balay PetscPolymorphicFunction(VecTDot,(Vec x,Vec y),(x,y,&s),PetscScalar,s) 1487087cfbeSBarry Smith extern PetscErrorCode VecMDot(Vec,PetscInt,const Vec[],PetscScalar[]); 1497087cfbeSBarry Smith extern PetscErrorCode VecMTDot(Vec,PetscInt,const Vec[],PetscScalar[]); 1507087cfbeSBarry Smith extern PetscErrorCode VecGetSubVector(Vec,IS,Vec*); 1517087cfbeSBarry Smith extern PetscErrorCode VecRestoreSubVector(Vec,IS,Vec*); 152cddf8d76SBarry Smith 15309321671SBarry Smith /*E 15409321671SBarry Smith NormType - determines what type of norm to compute 15509321671SBarry Smith 15609321671SBarry Smith Level: beginner 15709321671SBarry Smith 15809321671SBarry Smith .seealso: VecNorm(), VecNormBegin(), VecNormEnd(), MatNorm() 15909321671SBarry Smith E*/ 1609dcbbd2bSBarry Smith typedef enum {NORM_1=0,NORM_2=1,NORM_FROBENIUS=2,NORM_INFINITY=3,NORM_1_AND_2=4} NormType; 1619dcbbd2bSBarry Smith extern const char *NormTypes[]; 162cddf8d76SBarry Smith #define NORM_MAX NORM_INFINITY 16309321671SBarry Smith 1649b250c83SBarry Smith /*MC 1659b250c83SBarry Smith NORM_1 - the one norm, ||v|| = sum_i | v_i |. ||A|| = max_j || v_*j ||, maximum column sum 1669b250c83SBarry Smith 1679b250c83SBarry Smith Level: beginner 1689b250c83SBarry Smith 1699b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_2, NORM_FROBENIUS, 1709b250c83SBarry Smith NORM_INFINITY, NORM_1_AND_2 1719b250c83SBarry Smith 1729b250c83SBarry Smith M*/ 1739b250c83SBarry Smith 1749b250c83SBarry Smith /*MC 1759b250c83SBarry Smith NORM_2 - the two norm, ||v|| = sqrt(sum_i (v_i)^2) (vectors only) 1769b250c83SBarry Smith 1779b250c83SBarry Smith Level: beginner 1789b250c83SBarry Smith 1799b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_FROBENIUS, 1809b250c83SBarry Smith NORM_INFINITY, NORM_1_AND_2 1819b250c83SBarry Smith 1829b250c83SBarry Smith M*/ 1839b250c83SBarry Smith 1849b250c83SBarry Smith /*MC 1859b250c83SBarry Smith NORM_FROBENIUS - ||A|| = sqrt(sum_ij (A_ij)^2), same as NORM_2 for vectors 1869b250c83SBarry Smith 1879b250c83SBarry Smith Level: beginner 1889b250c83SBarry Smith 1899b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_2, 1909b250c83SBarry Smith NORM_INFINITY, NORM_1_AND_2 1919b250c83SBarry Smith 1929b250c83SBarry Smith M*/ 1939b250c83SBarry Smith 1949b250c83SBarry Smith /*MC 1959b250c83SBarry Smith NORM_INFINITY - ||v|| = max_i |v_i|. ||A|| = max_i || v_i* ||, maximum row sum 1969b250c83SBarry Smith 1979b250c83SBarry Smith Level: beginner 1989b250c83SBarry Smith 1999b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_2, 2009b250c83SBarry Smith NORM_FROBINIUS, NORM_1_AND_2 2019b250c83SBarry Smith 2029b250c83SBarry Smith M*/ 2039b250c83SBarry Smith 2049b250c83SBarry Smith /*MC 2059b250c83SBarry Smith NORM_1_AND_2 - computes both the 1 and 2 norm of a vector 2069b250c83SBarry Smith 2079b250c83SBarry Smith Level: beginner 2089b250c83SBarry Smith 2099b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_2, 2109b250c83SBarry Smith NORM_FROBINIUS, NORM_INFINITY 2119b250c83SBarry Smith 2129b250c83SBarry Smith M*/ 2139b250c83SBarry Smith 2149b250c83SBarry Smith /*MC 2159b250c83SBarry Smith NORM_MAX - see NORM_INFINITY 2169b250c83SBarry Smith 217d41222bbSBarry Smith Level: beginner 218d41222bbSBarry Smith 2199b250c83SBarry Smith M*/ 2209b250c83SBarry Smith 2217087cfbeSBarry Smith extern PetscErrorCode VecNorm(Vec,NormType,PetscReal *); 2227087cfbeSBarry Smith extern PetscErrorCode VecNormAvailable(Vec,NormType,PetscBool *,PetscReal *); 223045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecNorm,(Vec x,PetscReal *r),(x,NORM_2,r)) 224c714d2d0SBarry Smith PetscPolymorphicFunction(VecNorm,(Vec x,NormType t),(x,t,&r),PetscReal,r) 225c714d2d0SBarry Smith PetscPolymorphicFunction(VecNorm,(Vec x),(x,NORM_2,&r),PetscReal,r) 2267087cfbeSBarry Smith extern PetscErrorCode VecNormalize(Vec,PetscReal *); 2277087cfbeSBarry Smith extern PetscErrorCode VecSum(Vec,PetscScalar*); 2287087cfbeSBarry Smith extern PetscErrorCode VecMax(Vec,PetscInt*,PetscReal *); 229045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecMax,(Vec x,PetscReal *r),(x,PETSC_NULL,r)) 2307087cfbeSBarry Smith extern PetscErrorCode VecMin(Vec,PetscInt*,PetscReal *); 231045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecMin,(Vec x,PetscReal *r),(x,PETSC_NULL,r)) 2327087cfbeSBarry Smith extern PetscErrorCode VecScale(Vec,PetscScalar); 2337087cfbeSBarry Smith extern PetscErrorCode VecCopy(Vec,Vec); 2347087cfbeSBarry Smith extern PetscErrorCode VecSetRandom(Vec,PetscRandom); 2357087cfbeSBarry Smith extern PetscErrorCode VecSet(Vec,PetscScalar); 2367087cfbeSBarry Smith extern PetscErrorCode VecSwap(Vec,Vec); 2377087cfbeSBarry Smith extern PetscErrorCode VecAXPY(Vec,PetscScalar,Vec); 2387087cfbeSBarry Smith extern PetscErrorCode VecAXPBY(Vec,PetscScalar,PetscScalar,Vec); 2397087cfbeSBarry Smith extern PetscErrorCode VecMAXPY(Vec,PetscInt,const PetscScalar[],Vec[]); 2407087cfbeSBarry Smith extern PetscErrorCode VecAYPX(Vec,PetscScalar,Vec); 2417087cfbeSBarry Smith extern PetscErrorCode VecWAXPY(Vec,PetscScalar,Vec,Vec); 2427087cfbeSBarry Smith extern PetscErrorCode VecAXPBYPCZ(Vec,PetscScalar,PetscScalar,PetscScalar,Vec,Vec); 2437087cfbeSBarry Smith extern PetscErrorCode VecPointwiseMax(Vec,Vec,Vec); 2440190745aSSatish Balay PetscPolymorphicSubroutine(VecPointwiseMax,(Vec x,Vec y),(x,y,y)) 2457087cfbeSBarry Smith extern PetscErrorCode VecPointwiseMaxAbs(Vec,Vec,Vec); 2460190745aSSatish Balay PetscPolymorphicSubroutine(VecPointwiseMaxAbs,(Vec x,Vec y),(x,y,y)) 2477087cfbeSBarry Smith extern PetscErrorCode VecPointwiseMin(Vec,Vec,Vec); 2480190745aSSatish Balay PetscPolymorphicSubroutine(VecPointwiseMin,(Vec x,Vec y),(x,y,y)) 2497087cfbeSBarry Smith extern PetscErrorCode VecPointwiseMult(Vec,Vec,Vec); 250b2587007SBarry Smith PetscPolymorphicSubroutine(VecPointwiseMult,(Vec x,Vec y),(x,x,y)) 2517087cfbeSBarry Smith extern PetscErrorCode VecPointwiseDivide(Vec,Vec,Vec); 252b2587007SBarry Smith PetscPolymorphicSubroutine(VecPointwiseDivide,(Vec x,Vec y),(x,x,y)) 2537087cfbeSBarry Smith extern PetscErrorCode VecMaxPointwiseDivide(Vec,Vec,PetscReal*); 2547087cfbeSBarry Smith extern PetscErrorCode VecShift(Vec,PetscScalar); 2557087cfbeSBarry Smith extern PetscErrorCode VecReciprocal(Vec); 2567087cfbeSBarry Smith extern PetscErrorCode VecPermute(Vec, IS, PetscBool ); 2577087cfbeSBarry Smith extern PetscErrorCode VecSqrtAbs(Vec); 2587087cfbeSBarry Smith extern PetscErrorCode VecLog(Vec); 2597087cfbeSBarry Smith extern PetscErrorCode VecExp(Vec); 2607087cfbeSBarry Smith extern PetscErrorCode VecAbs(Vec); 2617087cfbeSBarry Smith extern PetscErrorCode VecDuplicate(Vec,Vec*); 2627087cfbeSBarry Smith extern PetscErrorCode VecDuplicateVecs(Vec,PetscInt,Vec*[]); 263574deadeSBarry Smith extern PetscErrorCode VecDestroyVecs(PetscInt, Vec*[]); 2647087cfbeSBarry Smith extern PetscErrorCode VecStrideNormAll(Vec,NormType,PetscReal[]); 2657087cfbeSBarry Smith extern PetscErrorCode VecStrideMaxAll(Vec,PetscInt [],PetscReal []); 2667087cfbeSBarry Smith extern PetscErrorCode VecStrideMinAll(Vec,PetscInt [],PetscReal []); 26789981eeeSJed Brown extern PetscErrorCode VecStrideScaleAll(Vec,const PetscScalar[]); 2684a560884SBarry Smith 2697087cfbeSBarry Smith extern PetscErrorCode VecStrideNorm(Vec,PetscInt,NormType,PetscReal*); 270fcd5dd21SSatish Balay PetscPolymorphicFunction(VecStrideNorm,(Vec x,PetscInt i),(x,i,NORM_2,&r),PetscReal,r) 271fcd5dd21SSatish Balay PetscPolymorphicFunction(VecStrideNorm,(Vec x,PetscInt i,NormType t),(x,i,t,&r),PetscReal,r) 2727087cfbeSBarry Smith extern PetscErrorCode VecStrideMax(Vec,PetscInt,PetscInt *,PetscReal *); 273fcd5dd21SSatish Balay PetscPolymorphicFunction(VecStrideMax,(Vec x,PetscInt i),(x,i,PETSC_NULL,&r),PetscReal,r) 2747087cfbeSBarry Smith extern PetscErrorCode VecStrideMin(Vec,PetscInt,PetscInt *,PetscReal *); 275fcd5dd21SSatish Balay PetscPolymorphicFunction(VecStrideMin,(Vec x,PetscInt i),(x,i,PETSC_NULL,&r),PetscReal,r) 2767087cfbeSBarry Smith extern PetscErrorCode VecStrideScale(Vec,PetscInt,PetscScalar); 277717e37fcSBarry Smith extern PetscErrorCode VecStrideSet(Vec,PetscInt,PetscScalar); 278954b3ec6SBarry Smith 279954b3ec6SBarry Smith 2807087cfbeSBarry Smith extern PetscErrorCode VecStrideGather(Vec,PetscInt,Vec,InsertMode); 2817087cfbeSBarry Smith extern PetscErrorCode VecStrideScatter(Vec,PetscInt,Vec,InsertMode); 2827087cfbeSBarry Smith extern PetscErrorCode VecStrideGatherAll(Vec,Vec[],InsertMode); 2837087cfbeSBarry Smith extern PetscErrorCode VecStrideScatterAll(Vec[],Vec,InsertMode); 284d2655a18SBarry Smith 2857087cfbeSBarry Smith extern PetscErrorCode VecSetValues(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 2867087cfbeSBarry Smith extern PetscErrorCode VecGetValues(Vec,PetscInt,const PetscInt[],PetscScalar[]); 2877087cfbeSBarry Smith extern PetscErrorCode VecAssemblyBegin(Vec); 2887087cfbeSBarry Smith extern PetscErrorCode VecAssemblyEnd(Vec); 2897087cfbeSBarry Smith extern PetscErrorCode VecStashSetInitialSize(Vec,PetscInt,PetscInt); 2907087cfbeSBarry Smith extern PetscErrorCode VecStashView(Vec,PetscViewer); 2917087cfbeSBarry Smith extern PetscErrorCode VecStashGetInfo(Vec,PetscInt*,PetscInt*,PetscInt*,PetscInt*); 29262dc5420SSatish Balay 29330de9b25SBarry Smith /*MC 29430de9b25SBarry Smith VecSetValue - Set a single entry into a vector. 29530de9b25SBarry Smith 29630de9b25SBarry Smith Synopsis: 297d360dc6fSBarry Smith PetscErrorCode VecSetValue(Vec v,int row,PetscScalar value, InsertMode mode); 29830de9b25SBarry Smith 29930de9b25SBarry Smith Not Collective 30030de9b25SBarry Smith 30130de9b25SBarry Smith Input Parameters: 30230de9b25SBarry Smith + v - the vector 30330de9b25SBarry Smith . row - the row location of the entry 30430de9b25SBarry Smith . value - the value to insert 30530de9b25SBarry Smith - mode - either INSERT_VALUES or ADD_VALUES 30630de9b25SBarry Smith 30730de9b25SBarry Smith Notes: 30830de9b25SBarry Smith For efficiency one should use VecSetValues() and set several or 30930de9b25SBarry Smith many values simultaneously if possible. 31030de9b25SBarry Smith 3111d73ed98SBarry Smith These values may be cached, so VecAssemblyBegin() and VecAssemblyEnd() 3121d73ed98SBarry Smith MUST be called after all calls to VecSetValues() have been completed. 3131d73ed98SBarry Smith 3141d73ed98SBarry Smith VecSetValues() uses 0-based indices in Fortran as well as in C. 3151d73ed98SBarry Smith 3161d73ed98SBarry Smith Level: beginner 3171d73ed98SBarry Smith 3181d73ed98SBarry Smith .seealso: VecSetValues(), VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesBlockedLocal(), VecSetValueLocal() 3191d73ed98SBarry Smith M*/ 32050755921SBarry Smith PETSC_STATIC_INLINE PetscErrorCode VecSetValue(Vec v,PetscInt i,PetscScalar va,InsertMode mode) {return VecSetValues(v,1,&i,&va,mode);} 3211d73ed98SBarry Smith 32230de9b25SBarry Smith 3237087cfbeSBarry Smith extern PetscErrorCode VecSetBlockSize(Vec,PetscInt); 3247087cfbeSBarry Smith extern PetscErrorCode VecGetBlockSize(Vec,PetscInt*); 325fcd5dd21SSatish Balay PetscPolymorphicFunction(VecGetBlockSize,(Vec x),(x,&i),PetscInt,i) 3267087cfbeSBarry Smith extern PetscErrorCode VecSetValuesBlocked(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 3278ed539a5SBarry Smith 328fd487807SMatthew Knepley /* Dynamic creation and loading functions */ 329fd487807SMatthew Knepley extern PetscFList VecList; 330ace3abfcSBarry Smith extern PetscBool VecRegisterAllCalled; 3317087cfbeSBarry Smith extern PetscErrorCode VecSetType(Vec, const VecType); 3327087cfbeSBarry Smith extern PetscErrorCode VecGetType(Vec, const VecType *); 3337087cfbeSBarry Smith extern PetscErrorCode VecRegister(const char[],const char[],const char[],PetscErrorCode (*)(Vec)); 3347087cfbeSBarry Smith extern PetscErrorCode VecRegisterAll(const char []); 3357087cfbeSBarry Smith extern PetscErrorCode VecRegisterDestroy(void); 33630de9b25SBarry Smith 33730de9b25SBarry Smith /*MC 33830de9b25SBarry Smith VecRegisterDynamic - Adds a new vector component implementation 33930de9b25SBarry Smith 34030de9b25SBarry Smith Synopsis: 3411890ba74SBarry Smith PetscErrorCode VecRegisterDynamic(const char *name, const char *path, const char *func_name, PetscErrorCode (*create_func)(Vec)) 34230de9b25SBarry Smith 34330de9b25SBarry Smith Not Collective 34430de9b25SBarry Smith 34530de9b25SBarry Smith Input Parameters: 34630de9b25SBarry Smith + name - The name of a new user-defined creation routine 34730de9b25SBarry Smith . path - The path (either absolute or relative) of the library containing this routine 34830de9b25SBarry Smith . func_name - The name of routine to create method context 34930de9b25SBarry Smith - create_func - The creation routine itself 35030de9b25SBarry Smith 35130de9b25SBarry Smith Notes: 35230de9b25SBarry Smith VecRegisterDynamic() may be called multiple times to add several user-defined vectors 35330de9b25SBarry Smith 35430de9b25SBarry Smith If dynamic libraries are used, then the fourth input argument (routine_create) is ignored. 35530de9b25SBarry Smith 35630de9b25SBarry Smith Sample usage: 35730de9b25SBarry Smith .vb 35830de9b25SBarry Smith VecRegisterDynamic("my_vec","/home/username/my_lib/lib/libO/solaris/libmy.a", "MyVectorCreate", MyVectorCreate); 35930de9b25SBarry Smith .ve 36030de9b25SBarry Smith 36130de9b25SBarry Smith Then, your vector type can be chosen with the procedural interface via 36230de9b25SBarry Smith .vb 36330de9b25SBarry Smith VecCreate(MPI_Comm, Vec *); 36430de9b25SBarry Smith VecSetType(Vec,"my_vector_name"); 36530de9b25SBarry Smith .ve 36630de9b25SBarry Smith or at runtime via the option 36730de9b25SBarry Smith .vb 36830de9b25SBarry Smith -vec_type my_vector_name 36930de9b25SBarry Smith .ve 37030de9b25SBarry Smith 371ab901514SBarry Smith Notes: $PETSC_ARCH occuring in pathname will be replaced with appropriate values. 37230de9b25SBarry Smith If your function is not being put into a shared library then use VecRegister() instead 37330de9b25SBarry Smith 37430de9b25SBarry Smith Level: advanced 37530de9b25SBarry Smith 37630de9b25SBarry Smith .keywords: Vec, register 37730de9b25SBarry Smith .seealso: VecRegisterAll(), VecRegisterDestroy(), VecRegister() 37830de9b25SBarry Smith M*/ 379aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 380f1af5d2fSBarry Smith #define VecRegisterDynamic(a,b,c,d) VecRegister(a,b,c,0) 38188d459dfSBarry Smith #else 382f1af5d2fSBarry Smith #define VecRegisterDynamic(a,b,c,d) VecRegister(a,b,c,d) 38388d459dfSBarry Smith #endif 38488d459dfSBarry Smith 38509321671SBarry Smith 3867087cfbeSBarry Smith extern PetscErrorCode VecScatterCreate(Vec,IS,Vec,IS,VecScatter *); 387fcd5dd21SSatish Balay PetscPolymorphicFunction(VecScatterCreate,(Vec x,IS is1,Vec y,IS is2),(x,is1,y,is2,&s),VecScatter,s) 3880190745aSSatish Balay PetscPolymorphicSubroutine(VecScatterCreate,(Vec x,IS is,Vec y,VecScatter *s),(x,is,y,PETSC_NULL,s)) 389fcd5dd21SSatish Balay PetscPolymorphicFunction(VecScatterCreate,(Vec x,IS is,Vec y),(x,is,y,PETSC_NULL,&s),VecScatter,s) 3900190745aSSatish Balay PetscPolymorphicSubroutine(VecScatterCreate,(Vec x,Vec y,IS is,VecScatter *s),(x,PETSC_NULL,y,is,s)) 391fcd5dd21SSatish Balay PetscPolymorphicFunction(VecScatterCreate,(Vec x,Vec y,IS is),(x,PETSC_NULL,y,is,&s),VecScatter,s) 3927087cfbeSBarry Smith extern PetscErrorCode VecScatterCreateEmpty(MPI_Comm,VecScatter *); 3937087cfbeSBarry Smith extern PetscErrorCode VecScatterCreateLocal(VecScatter,PetscInt,const PetscInt[],const PetscInt[],const PetscInt[],PetscInt,const PetscInt[],const PetscInt[],const PetscInt[],PetscInt); 3947087cfbeSBarry Smith extern PetscErrorCode VecScatterBegin(VecScatter,Vec,Vec,InsertMode,ScatterMode); 3957087cfbeSBarry Smith extern PetscErrorCode VecScatterEnd(VecScatter,Vec,Vec,InsertMode,ScatterMode); 396fcfd50ebSBarry Smith extern PetscErrorCode VecScatterDestroy(VecScatter*); 3977087cfbeSBarry Smith extern PetscErrorCode VecScatterCopy(VecScatter,VecScatter *); 3987087cfbeSBarry Smith extern PetscErrorCode VecScatterView(VecScatter,PetscViewer); 3997087cfbeSBarry Smith extern PetscErrorCode VecScatterRemap(VecScatter,PetscInt *,PetscInt*); 4007087cfbeSBarry Smith extern PetscErrorCode VecScatterGetMerged(VecScatter,PetscBool *); 4012195c698SBarry Smith 4027087cfbeSBarry Smith extern PetscErrorCode VecGetArray4d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]); 4037087cfbeSBarry Smith extern PetscErrorCode VecRestoreArray4d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]); 4047087cfbeSBarry Smith extern PetscErrorCode VecGetArray3d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar***[]); 4057087cfbeSBarry Smith extern PetscErrorCode VecRestoreArray3d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar***[]); 4067087cfbeSBarry Smith extern PetscErrorCode VecGetArray2d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar**[]); 4077087cfbeSBarry Smith extern PetscErrorCode VecRestoreArray2d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar**[]); 4087087cfbeSBarry Smith extern PetscErrorCode VecGetArray1d(Vec,PetscInt,PetscInt,PetscScalar *[]); 4097087cfbeSBarry Smith extern PetscErrorCode VecRestoreArray1d(Vec,PetscInt,PetscInt,PetscScalar *[]); 410ab360428SBarry Smith 4117087cfbeSBarry Smith extern PetscErrorCode VecPlaceArray(Vec,const PetscScalar[]); 4127087cfbeSBarry Smith extern PetscErrorCode VecResetArray(Vec); 4137087cfbeSBarry Smith extern PetscErrorCode VecReplaceArray(Vec,const PetscScalar[]); 4147087cfbeSBarry Smith extern PetscErrorCode VecGetArrays(const Vec[],PetscInt,PetscScalar**[]); 4157087cfbeSBarry Smith extern PetscErrorCode VecRestoreArrays(const Vec[],PetscInt,PetscScalar**[]); 41684cb2905SBarry Smith 4177087cfbeSBarry Smith extern PetscErrorCode VecView(Vec,PetscViewer); 4187087cfbeSBarry Smith extern PetscErrorCode VecViewFromOptions(Vec, const char *); 4197087cfbeSBarry Smith extern PetscErrorCode VecEqual(Vec,Vec,PetscBool *); 420ace3abfcSBarry Smith PetscPolymorphicFunction(VecEqual,(Vec x,Vec y),(x,y,&s),PetscBool ,s) 4217087cfbeSBarry Smith extern PetscErrorCode VecLoad(Vec, PetscViewer); 4228ed539a5SBarry Smith 4237087cfbeSBarry Smith extern PetscErrorCode VecGetSize(Vec,PetscInt*); 424fcd5dd21SSatish Balay PetscPolymorphicFunction(VecGetSize,(Vec x),(x,&s),PetscInt,s) 4257087cfbeSBarry Smith extern PetscErrorCode VecGetLocalSize(Vec,PetscInt*); 426fcd5dd21SSatish Balay PetscPolymorphicFunction(VecGetLocalSize,(Vec x),(x,&s),PetscInt,s) 4277087cfbeSBarry Smith extern PetscErrorCode VecGetOwnershipRange(Vec,PetscInt*,PetscInt*); 4287087cfbeSBarry Smith extern PetscErrorCode VecGetOwnershipRanges(Vec,const PetscInt *[]); 4298ed539a5SBarry Smith 4307087cfbeSBarry Smith extern PetscErrorCode VecSetLocalToGlobalMapping(Vec,ISLocalToGlobalMapping); 4317087cfbeSBarry Smith extern PetscErrorCode VecSetValuesLocal(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 43288b03592SBarry Smith 43388b03592SBarry Smith /*MC 43488b03592SBarry Smith VecSetValueLocal - Set a single entry into a vector using the local numbering 43588b03592SBarry Smith 43688b03592SBarry Smith Synopsis: 43788b03592SBarry Smith PetscErrorCode VecSetValueLocal(Vec v,int row,PetscScalar value, InsertMode mode); 43888b03592SBarry Smith 43988b03592SBarry Smith Not Collective 44088b03592SBarry Smith 44188b03592SBarry Smith Input Parameters: 44288b03592SBarry Smith + v - the vector 44388b03592SBarry Smith . row - the row location of the entry 44488b03592SBarry Smith . value - the value to insert 44588b03592SBarry Smith - mode - either INSERT_VALUES or ADD_VALUES 44688b03592SBarry Smith 44788b03592SBarry Smith Notes: 44888b03592SBarry Smith For efficiency one should use VecSetValues() and set several or 44988b03592SBarry Smith many values simultaneously if possible. 45088b03592SBarry Smith 45188b03592SBarry Smith These values may be cached, so VecAssemblyBegin() and VecAssemblyEnd() 45288b03592SBarry Smith MUST be called after all calls to VecSetValues() have been completed. 45388b03592SBarry Smith 45488b03592SBarry Smith VecSetValues() uses 0-based indices in Fortran as well as in C. 45588b03592SBarry Smith 45688b03592SBarry Smith Level: beginner 45788b03592SBarry Smith 45888b03592SBarry Smith .seealso: VecSetValues(), VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesBlockedLocal(), VecSetValue() 45988b03592SBarry Smith M*/ 46088b03592SBarry Smith PETSC_STATIC_INLINE PetscErrorCode VecSetValueLocal(Vec v,PetscInt i,PetscScalar va,InsertMode mode) {return VecSetValuesLocal(v,1,&i,&va,mode);} 46188b03592SBarry Smith 4627087cfbeSBarry Smith extern PetscErrorCode VecSetLocalToGlobalMappingBlock(Vec,ISLocalToGlobalMapping); 4637087cfbeSBarry Smith extern PetscErrorCode VecSetValuesBlockedLocal(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 464dcb12a5bSJed Brown extern PetscErrorCode VecGetLocalToGlobalMappingBlock(Vec,ISLocalToGlobalMapping*); 465dcb12a5bSJed Brown extern PetscErrorCode VecGetLocalToGlobalMapping(Vec,ISLocalToGlobalMapping*); 46690f02eecSBarry Smith 4677087cfbeSBarry Smith extern PetscErrorCode VecDotBegin(Vec,Vec,PetscScalar *); 468ba966639SSatish Balay PetscPolymorphicSubroutine(VecDotBegin,(Vec x,Vec y),(x,y,PETSC_NULL)) 4697087cfbeSBarry Smith extern PetscErrorCode VecDotEnd(Vec,Vec,PetscScalar *); 470fcd5dd21SSatish Balay PetscPolymorphicFunction(VecDotEnd,(Vec x,Vec y),(x,y,&s),PetscScalar,s) 4717087cfbeSBarry Smith extern PetscErrorCode VecTDotBegin(Vec,Vec,PetscScalar *); 472ba966639SSatish Balay PetscPolymorphicSubroutine(VecTDotBegin,(Vec x,Vec y),(x,y,PETSC_NULL)) 4737087cfbeSBarry Smith extern PetscErrorCode VecTDotEnd(Vec,Vec,PetscScalar *); 474fcd5dd21SSatish Balay PetscPolymorphicFunction(VecTDotEnd,(Vec x,Vec y),(x,y,&s),PetscScalar,s) 4757087cfbeSBarry Smith extern PetscErrorCode VecNormBegin(Vec,NormType,PetscReal *); 476ba966639SSatish Balay PetscPolymorphicSubroutine(VecNormBegin,(Vec x,NormType t),(x,t,PETSC_NULL)) 477ba966639SSatish Balay PetscPolymorphicSubroutine(VecNormBegin,(Vec x),(x,NORM_2,PETSC_NULL)) 4787087cfbeSBarry Smith extern PetscErrorCode VecNormEnd(Vec,NormType,PetscReal *); 479fcd5dd21SSatish Balay PetscPolymorphicFunction(VecNormEnd,(Vec x,NormType t),(x,t,&s),PetscReal,s) 480fcd5dd21SSatish Balay PetscPolymorphicFunction(VecNormEnd,(Vec x),(x,NORM_2,&s),PetscReal,s) 481d3c178dbSBarry Smith 4827087cfbeSBarry Smith extern PetscErrorCode VecMDotBegin(Vec,PetscInt,const Vec[],PetscScalar[]); 4837087cfbeSBarry Smith extern PetscErrorCode VecMDotEnd(Vec,PetscInt,const Vec[],PetscScalar[]); 4847087cfbeSBarry Smith extern PetscErrorCode VecMTDotBegin(Vec,PetscInt,const Vec[],PetscScalar[]); 4857087cfbeSBarry Smith extern PetscErrorCode VecMTDotEnd(Vec,PetscInt,const Vec[],PetscScalar[]); 486a751f32aSSatish Balay 487a751f32aSSatish Balay 4889533e83fSBarry Smith typedef enum {VEC_IGNORE_OFF_PROC_ENTRIES,VEC_IGNORE_NEGATIVE_INDICES} VecOption; 4897087cfbeSBarry Smith extern PetscErrorCode VecSetOption(Vec,VecOption,PetscBool ); 49090f02eecSBarry Smith 491ebe3b25bSBarry Smith /* 492ebe3b25bSBarry Smith Expose VecGetArray()/VecRestoreArray() to users. Allows this to work without any function 493ebe3b25bSBarry Smith call overhead on any 'native' Vecs. 494ebe3b25bSBarry Smith */ 495e1fa1e0fSSatish Balay 4961d8d5f9aSSatish Balay #include "private/vecimpl.h" 497ebe3b25bSBarry Smith 4987087cfbeSBarry Smith extern PetscErrorCode VecContourScale(Vec,PetscReal,PetscReal); 499522c5e43SBarry Smith 50015091d37SBarry Smith /* 50115091d37SBarry Smith These numbers need to match the entries in 5023c94ec11SBarry Smith the function table in vecimpl.h 50315091d37SBarry Smith */ 5042dcb2ebcSBarry Smith typedef enum { VECOP_VIEW = 33, VECOP_LOAD = 41, VECOP_DUPLICATE = 0} VecOperation; 5057087cfbeSBarry Smith extern PetscErrorCode VecSetOperation(Vec,VecOperation,void(*)(void)); 506b19c1e4cSBarry Smith 507e182c471SBarry Smith /* 508e182c471SBarry Smith Routines for dealing with ghosted vectors: 509e182c471SBarry Smith vectors with ghost elements at the end of the array. 510e182c471SBarry Smith */ 5117087cfbeSBarry Smith extern PetscErrorCode VecCreateGhost(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Vec*); 5127087cfbeSBarry Smith extern PetscErrorCode VecCreateGhostWithArray(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscScalar[],Vec*); 5137087cfbeSBarry Smith extern PetscErrorCode VecCreateGhostBlock(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Vec*); 5147087cfbeSBarry Smith extern PetscErrorCode VecCreateGhostBlockWithArray(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscScalar[],Vec*); 5157087cfbeSBarry Smith extern PetscErrorCode VecGhostGetLocalForm(Vec,Vec*); 516ba966639SSatish Balay PetscPolymorphicFunction(VecGhostGetLocalForm,(Vec x),(x,&s),Vec,s) 5177087cfbeSBarry Smith extern PetscErrorCode VecGhostRestoreLocalForm(Vec,Vec*); 5187087cfbeSBarry Smith extern PetscErrorCode VecGhostUpdateBegin(Vec,InsertMode,ScatterMode); 5197087cfbeSBarry Smith extern PetscErrorCode VecGhostUpdateEnd(Vec,InsertMode,ScatterMode); 520e182c471SBarry Smith 5217087cfbeSBarry Smith extern PetscErrorCode VecConjugate(Vec); 52234233285SBarry Smith 5237087cfbeSBarry Smith extern PetscErrorCode VecScatterCreateToAll(Vec,VecScatter*,Vec*); 5247087cfbeSBarry Smith extern PetscErrorCode VecScatterCreateToZero(Vec,VecScatter*,Vec*); 525bba1ac68SSatish Balay 5267087cfbeSBarry Smith extern PetscErrorCode PetscViewerMathematicaGetVector(PetscViewer, Vec); 5277087cfbeSBarry Smith extern PetscErrorCode PetscViewerMathematicaPutVector(PetscViewer, Vec); 5287dbadf16SMatthew Knepley 529d59c15a7SBarry Smith /*S 530d59c15a7SBarry Smith Vecs - Collection of vectors where the data for the vectors is stored in 531759e7b9cSHong Zhang one contiguous memory 532d59c15a7SBarry Smith 533d59c15a7SBarry Smith Level: advanced 534d59c15a7SBarry Smith 535d59c15a7SBarry Smith Notes: 536d59c15a7SBarry Smith Temporary construct for handling multiply right hand side solves 537d59c15a7SBarry Smith 538d59c15a7SBarry Smith This is faked by storing a single vector that has enough array space for 539d59c15a7SBarry Smith n vectors 540d59c15a7SBarry Smith 541d59c15a7SBarry Smith Concepts: parallel decomposition 542d59c15a7SBarry Smith 543d59c15a7SBarry Smith S*/ 54495fbd943SSatish Balay struct _n_Vecs {PetscInt n; Vec v;}; 54595fbd943SSatish Balay typedef struct _n_Vecs* Vecs; 546fcfd50ebSBarry Smith #define VecsDestroy(x) (VecDestroy(&(x)->v) || PetscFree(x)) 54795fbd943SSatish Balay #define VecsCreateSeq(comm,p,m,x) (PetscNew(struct _n_Vecs,x) || VecCreateSeq(comm,p*m,&(*(x))->v) || (-1 == ((*(x))->n = (m)))) 54895fbd943SSatish Balay #define VecsCreateSeqWithArray(comm,p,m,a,x) (PetscNew(struct _n_Vecs,x) || VecCreateSeqWithArray(comm,p*m,a,&(*(x))->v) || (-1 == ((*(x))->n = (m)))) 54995fbd943SSatish Balay #define VecsDuplicate(x,y) (PetscNew(struct _n_Vecs,y) || VecDuplicate(x->v,&(*(y))->v) || (-1 == ((*(y))->n = (x)->n))) 550e9fa29b7SSatish Balay 5518154be41SBarry Smith #if defined(PETSC_HAVE_CUSP) 552a5891931SBarry Smith typedef struct _p_PetscCUSPIndices* PetscCUSPIndices; 553a5891931SBarry Smith extern PetscErrorCode PetscCUSPIndicesCreate(PetscInt,const PetscInt*,PetscCUSPIndices*); 554fcfd50ebSBarry Smith extern PetscErrorCode PetscCUSPIndicesDestroy(PetscCUSPIndices*); 5558154be41SBarry Smith extern PetscErrorCode VecCUSPCopyToGPUSome_Public(Vec,PetscCUSPIndices); 5568154be41SBarry Smith extern PetscErrorCode VecCUSPCopyFromGPUSome_Public(Vec,PetscCUSPIndices); 55790c53902SBarry Smith 55890c53902SBarry Smith extern PetscErrorCode VecCreateSeqCUSP(MPI_Comm,PetscInt,Vec*); 55990c53902SBarry Smith extern PetscErrorCode VecCreateMPICUSP(MPI_Comm,PetscInt,PetscInt,Vec*); 560a5891931SBarry Smith #endif 561e9fa29b7SSatish Balay 562054b7196SShri Abhyankar #if defined(PETSC_HAVE_PTHREADCLASSES) 56353d58530SShri Abhyankar extern PetscErrorCode VecSeqPThreadSetNThreads(Vec,PetscInt); 564054b7196SShri Abhyankar extern PetscErrorCode VecCreateSeqPThread(MPI_Comm,PetscInt,PetscInt,Vec*); 565054b7196SShri Abhyankar #endif 566054b7196SShri Abhyankar 5677087cfbeSBarry Smith extern PetscErrorCode VecNestGetSubVecs(Vec,PetscInt*,Vec**); 5687087cfbeSBarry Smith extern PetscErrorCode VecNestGetSubVec(Vec,PetscInt,Vec*); 5697087cfbeSBarry Smith extern PetscErrorCode VecCreateNest(MPI_Comm,PetscInt,IS*,Vec*,Vec*); 5707087cfbeSBarry Smith extern PetscErrorCode VecNestGetSize(Vec,PetscInt*); 57145b63f25SDmitry Karpeev 572e9fa29b7SSatish Balay PETSC_EXTERN_CXX_END 5732eac72dbSBarry Smith #endif 5742b82984cSSatish Balay 575