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" 100a835dfdSSatish Balay #include "petscsys.h" 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 3709321671SBarry Smith VecType - String with the name of a PETSc vector or the creation function 3809321671SBarry Smith with an optional dynamic library name, for example 3909321671SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:myveccreate() 4009321671SBarry Smith 4109321671SBarry Smith Level: beginner 4209321671SBarry Smith 4309321671SBarry Smith .seealso: VecSetType(), Vec 4409321671SBarry Smith E*/ 450676abe4SMatthew Knepley #define VECSEQ "seq" 460676abe4SMatthew Knepley #define VECMPI "mpi" 470676abe4SMatthew Knepley #define VECFETI "feti" 480676abe4SMatthew Knepley #define VECSHARED "shared" 49*765467adSMatthew Knepley #define VECSIEVE "sieve" 50f69a0ea3SMatthew Knepley #define VecType const char* 512eac72dbSBarry Smith 52fd487807SMatthew Knepley /* Logging support */ 53552e946dSBarry Smith #define VEC_FILE_COOKIE 1211214 540c735eedSKris Buschelman extern PETSCVEC_DLLEXPORT PetscCookie VEC_COOKIE; 550c735eedSKris Buschelman extern PETSCVEC_DLLEXPORT PetscCookie VEC_SCATTER_COOKIE; 568ba1e511SMatthew Knepley 570c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecInitializePackage(char *); 58fd487807SMatthew Knepley 590c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecCreate(MPI_Comm,Vec*); 60045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecCreate,(Vec *x),(PETSC_COMM_SELF,x)) 610c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecCreateSeq(MPI_Comm,PetscInt,Vec*); 62045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecCreateSeq,(PetscInt n,Vec *x),(PETSC_COMM_SELF,n,x)) 630c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecCreateMPI(MPI_Comm,PetscInt,PetscInt,Vec*); 64045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecCreateMPI,(PetscInt n,PetscInt N,Vec *x),(PETSC_COMM_WORLD,n,N,x)) 650c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecCreateSeqWithArray(MPI_Comm,PetscInt,const PetscScalar[],Vec*); 66045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecCreateSeqWithArray,(PetscInt n,PetscScalar s[],Vec *x),(PETSC_COMM_SELF,n,s,x)) 670c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecCreateMPIWithArray(MPI_Comm,PetscInt,PetscInt,const PetscScalar[],Vec*); 68045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecCreateMPIWithArray,(PetscInt n,PetscInt N,PetscScalar s[],Vec *x),(PETSC_COMM_WORLD,n,N,s,x)) 690c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecCreateShared(MPI_Comm,PetscInt,PetscInt,Vec*); 700c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetFromOptions(Vec); 710c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecPrintHelp(Vec); 72f69a0ea3SMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetUp(Vec); 730c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecDestroy(Vec); 74f1e08e49SBarry Smith EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecZeroEntries(Vec); 75f69a0ea3SMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetOptionsPrefix(Vec,const char[]); 76f69a0ea3SMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecAppendOptionsPrefix(Vec,const char[]); 77f69a0ea3SMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetOptionsPrefix(Vec,const char*[]); 78f69a0ea3SMatthew Knepley 790c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetSizes(Vec,PetscInt,PetscInt); 80fd487807SMatthew Knepley 810c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecDot(Vec,Vec,PetscScalar*); 82fcd5dd21SSatish Balay PetscPolymorphicFunction(VecDot,(Vec x,Vec y),(x,y,&s),PetscScalar,s) 830c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecTDot(Vec,Vec,PetscScalar*); 84fcd5dd21SSatish Balay PetscPolymorphicFunction(VecTDot,(Vec x,Vec y),(x,y,&s),PetscScalar,s) 858dbd3d1dSSatish Balay EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecMDot(Vec,PetscInt,const Vec[],PetscScalar*); 868dbd3d1dSSatish Balay EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecMTDot(Vec,PetscInt,const Vec[],PetscScalar*); 87cddf8d76SBarry Smith 8809321671SBarry Smith /*E 8909321671SBarry Smith NormType - determines what type of norm to compute 9009321671SBarry Smith 9109321671SBarry Smith Level: beginner 9209321671SBarry Smith 9309321671SBarry Smith .seealso: VecNorm(), VecNormBegin(), VecNormEnd(), MatNorm() 9409321671SBarry Smith E*/ 959dcbbd2bSBarry Smith typedef enum {NORM_1=0,NORM_2=1,NORM_FROBENIUS=2,NORM_INFINITY=3,NORM_1_AND_2=4} NormType; 969dcbbd2bSBarry Smith extern const char *NormTypes[]; 97cddf8d76SBarry Smith #define NORM_MAX NORM_INFINITY 9809321671SBarry Smith 999b250c83SBarry Smith /*MC 1009b250c83SBarry Smith NORM_1 - the one norm, ||v|| = sum_i | v_i |. ||A|| = max_j || v_*j ||, maximum column sum 1019b250c83SBarry Smith 1029b250c83SBarry Smith Level: beginner 1039b250c83SBarry Smith 1049b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_2, NORM_FROBENIUS, 1059b250c83SBarry Smith NORM_INFINITY, NORM_1_AND_2 1069b250c83SBarry Smith 1079b250c83SBarry Smith M*/ 1089b250c83SBarry Smith 1099b250c83SBarry Smith /*MC 1109b250c83SBarry Smith NORM_2 - the two norm, ||v|| = sqrt(sum_i (v_i)^2) (vectors only) 1119b250c83SBarry Smith 1129b250c83SBarry Smith Level: beginner 1139b250c83SBarry Smith 1149b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_FROBENIUS, 1159b250c83SBarry Smith NORM_INFINITY, NORM_1_AND_2 1169b250c83SBarry Smith 1179b250c83SBarry Smith M*/ 1189b250c83SBarry Smith 1199b250c83SBarry Smith /*MC 1209b250c83SBarry Smith NORM_FROBENIUS - ||A|| = sqrt(sum_ij (A_ij)^2), same as NORM_2 for vectors 1219b250c83SBarry Smith 1229b250c83SBarry Smith Level: beginner 1239b250c83SBarry Smith 1249b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_2, 1259b250c83SBarry Smith NORM_INFINITY, NORM_1_AND_2 1269b250c83SBarry Smith 1279b250c83SBarry Smith M*/ 1289b250c83SBarry Smith 1299b250c83SBarry Smith /*MC 1309b250c83SBarry Smith NORM_INFINITY - ||v|| = max_i |v_i|. ||A|| = max_i || v_i* ||, maximum row sum 1319b250c83SBarry Smith 1329b250c83SBarry Smith Level: beginner 1339b250c83SBarry Smith 1349b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_2, 1359b250c83SBarry Smith NORM_FROBINIUS, NORM_1_AND_2 1369b250c83SBarry Smith 1379b250c83SBarry Smith M*/ 1389b250c83SBarry Smith 1399b250c83SBarry Smith /*MC 1409b250c83SBarry Smith NORM_1_AND_2 - computes both the 1 and 2 norm of a vector 1419b250c83SBarry Smith 1429b250c83SBarry Smith Level: beginner 1439b250c83SBarry Smith 1449b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_2, 1459b250c83SBarry Smith NORM_FROBINIUS, NORM_INFINITY 1469b250c83SBarry Smith 1479b250c83SBarry Smith M*/ 1489b250c83SBarry Smith 1499b250c83SBarry Smith /*MC 1509b250c83SBarry Smith NORM_MAX - see NORM_INFINITY 1519b250c83SBarry Smith 152d41222bbSBarry Smith Level: beginner 153d41222bbSBarry Smith 1549b250c83SBarry Smith M*/ 1559b250c83SBarry Smith 1560c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecNorm(Vec,NormType,PetscReal *); 157045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecNorm,(Vec x,PetscReal *r),(x,NORM_2,r)) 158c714d2d0SBarry Smith PetscPolymorphicFunction(VecNorm,(Vec x,NormType t),(x,t,&r),PetscReal,r) 159c714d2d0SBarry Smith PetscPolymorphicFunction(VecNorm,(Vec x),(x,NORM_2,&r),PetscReal,r) 1600c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecNormalize(Vec,PetscReal *); 1610c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSum(Vec,PetscScalar*); 1620c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecMax(Vec,PetscInt*,PetscReal *); 163045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecMax,(Vec x,PetscReal *r),(x,PETSC_NULL,r)) 1640c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecMin(Vec,PetscInt*,PetscReal *); 165045ff3e0SBarry Smith PetscPolymorphicSubroutine(VecMin,(Vec x,PetscReal *r),(x,PETSC_NULL,r)) 1662dcb1b2aSMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScale(Vec v,PetscScalar a); 1670c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecCopy(Vec,Vec); 168abb0e124SMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetRandom(Vec,PetscRandom); 1692dcb1b2aSMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSet(Vec,PetscScalar); 1700c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSwap(Vec,Vec); 1712dcb1b2aSMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecAXPY(Vec,PetscScalar,Vec); 1722dcb1b2aSMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecAXPBY(Vec,PetscScalar,PetscScalar,Vec); 1732dcb1b2aSMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecMAXPY(Vec,PetscInt,const PetscScalar[],Vec*); 1742dcb1b2aSMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecAYPX(Vec,PetscScalar,Vec); 1752dcb1b2aSMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecWAXPY(Vec,PetscScalar,Vec,Vec); 1760c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecPointwiseMax(Vec,Vec,Vec); 1770190745aSSatish Balay PetscPolymorphicSubroutine(VecPointwiseMax,(Vec x,Vec y),(x,y,y)) 1780c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecPointwiseMaxAbs(Vec,Vec,Vec); 1790190745aSSatish Balay PetscPolymorphicSubroutine(VecPointwiseMaxAbs,(Vec x,Vec y),(x,y,y)) 1800c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecPointwiseMin(Vec,Vec,Vec); 1810190745aSSatish Balay PetscPolymorphicSubroutine(VecPointwiseMin,(Vec x,Vec y),(x,y,y)) 1820c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecPointwiseMult(Vec,Vec,Vec); 1830190745aSSatish Balay PetscPolymorphicSubroutine(VecPointwiseMult,(Vec x,Vec y),(x,y,y)) 1840c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecPointwiseDivide(Vec,Vec,Vec); 1850190745aSSatish Balay PetscPolymorphicSubroutine(VecPointwiseDivide,(Vec x,Vec y),(x,y,y)) 1860c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecMaxPointwiseDivide(Vec,Vec,PetscReal*); 1872dcb1b2aSMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecShift(Vec,PetscScalar); 1880c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecReciprocal(Vec); 1890c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecPermute(Vec, IS, PetscTruth); 1900c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSqrt(Vec); 1910c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecAbs(Vec); 1920c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecDuplicate(Vec,Vec*); 1930c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecDuplicateVecs(Vec,PetscInt,Vec*[]); 1940c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecDestroyVecs(Vec[],PetscInt); 1950c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStrideNormAll(Vec,NormType,PetscReal*); 1960c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStrideMaxAll(Vec,PetscInt *,PetscReal *); 1970c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStrideMinAll(Vec,PetscInt *,PetscReal *); 1980c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStrideScaleAll(Vec,PetscScalar*); 1994a560884SBarry Smith 2000c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStrideNorm(Vec,PetscInt,NormType,PetscReal*); 201fcd5dd21SSatish Balay PetscPolymorphicFunction(VecStrideNorm,(Vec x,PetscInt i),(x,i,NORM_2,&r),PetscReal,r) 202fcd5dd21SSatish Balay PetscPolymorphicFunction(VecStrideNorm,(Vec x,PetscInt i,NormType t),(x,i,t,&r),PetscReal,r) 2030c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStrideMax(Vec,PetscInt,PetscInt *,PetscReal *); 204fcd5dd21SSatish Balay PetscPolymorphicFunction(VecStrideMax,(Vec x,PetscInt i),(x,i,PETSC_NULL,&r),PetscReal,r) 2050c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStrideMin(Vec,PetscInt,PetscInt *,PetscReal *); 206fcd5dd21SSatish Balay PetscPolymorphicFunction(VecStrideMin,(Vec x,PetscInt i),(x,i,PETSC_NULL,&r),PetscReal,r) 2070c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStrideScale(Vec,PetscInt,PetscScalar*); 2082b7a858eSMatthew Knepley PetscPolymorphicScalar(VecStrideScale,(Vec x,PetscInt i,PetscScalar _val),(x,i,&_Val)) 209954b3ec6SBarry Smith 210954b3ec6SBarry Smith 2110c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStrideGather(Vec,PetscInt,Vec,InsertMode); 2120c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStrideScatter(Vec,PetscInt,Vec,InsertMode); 2130c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStrideGatherAll(Vec,Vec*,InsertMode); 2140c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStrideScatterAll(Vec*,Vec,InsertMode); 215d2655a18SBarry Smith 2160c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetValues(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 2170c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetValues(Vec,PetscInt,const PetscInt[],PetscScalar[]); 2180c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecAssemblyBegin(Vec); 2190c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecAssemblyEnd(Vec); 2200c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStashSetInitialSize(Vec,PetscInt,PetscInt); 2210c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStashView(Vec,PetscViewer); 2220c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecStashGetInfo(Vec,PetscInt*,PetscInt*,PetscInt*,PetscInt*); 22362dc5420SSatish Balay 22430de9b25SBarry Smith /*MC 22530de9b25SBarry Smith VecSetValue - Set a single entry into a vector. 22630de9b25SBarry Smith 22730de9b25SBarry Smith Synopsis: 228d360dc6fSBarry Smith PetscErrorCode VecSetValue(Vec v,int row,PetscScalar value, InsertMode mode); 22930de9b25SBarry Smith 23030de9b25SBarry Smith Not Collective 23130de9b25SBarry Smith 23230de9b25SBarry Smith Input Parameters: 23330de9b25SBarry Smith + v - the vector 23430de9b25SBarry Smith . row - the row location of the entry 23530de9b25SBarry Smith . value - the value to insert 23630de9b25SBarry Smith - mode - either INSERT_VALUES or ADD_VALUES 23730de9b25SBarry Smith 23830de9b25SBarry Smith Notes: 23930de9b25SBarry Smith For efficiency one should use VecSetValues() and set several or 24030de9b25SBarry Smith many values simultaneously if possible. 24130de9b25SBarry Smith 2421d73ed98SBarry Smith These values may be cached, so VecAssemblyBegin() and VecAssemblyEnd() 2431d73ed98SBarry Smith MUST be called after all calls to VecSetValues() have been completed. 2441d73ed98SBarry Smith 2451d73ed98SBarry Smith VecSetValues() uses 0-based indices in Fortran as well as in C. 2461d73ed98SBarry Smith 2471d73ed98SBarry Smith Level: beginner 2481d73ed98SBarry Smith 2491d73ed98SBarry Smith .seealso: VecSetValues(), VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesBlockedLocal(), VecSetValueLocal() 2501d73ed98SBarry Smith M*/ 25150755921SBarry Smith PETSC_STATIC_INLINE PetscErrorCode VecSetValue(Vec v,PetscInt i,PetscScalar va,InsertMode mode) {return VecSetValues(v,1,&i,&va,mode);} 2521d73ed98SBarry Smith 25330de9b25SBarry Smith 2540c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetBlockSize(Vec,PetscInt); 2550c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetBlockSize(Vec,PetscInt*); 256fcd5dd21SSatish Balay PetscPolymorphicFunction(VecGetBlockSize,(Vec x),(x,&i),PetscInt,i) 2570c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetValuesBlocked(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 2588ed539a5SBarry Smith 259fd487807SMatthew Knepley /* Dynamic creation and loading functions */ 260fd487807SMatthew Knepley extern PetscFList VecList; 261d772e1d7SMatthew Knepley extern PetscTruth VecRegisterAllCalled; 262f69a0ea3SMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetType(Vec, VecType); 2630c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetType(Vec, VecType *); 2640c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecRegister(const char[],const char[],const char[],PetscErrorCode (*)(Vec)); 2650c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecRegisterAll(const char []); 2660c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecRegisterDestroy(void); 26730de9b25SBarry Smith 26830de9b25SBarry Smith /*MC 26930de9b25SBarry Smith VecRegisterDynamic - Adds a new vector component implementation 27030de9b25SBarry Smith 27130de9b25SBarry Smith Synopsis: 272d360dc6fSBarry Smith PetscErrorCode VecRegisterDynamic(char *name, char *path, char *func_name, PetscErrorCode (*create_func)(Vec)) 27330de9b25SBarry Smith 27430de9b25SBarry Smith Not Collective 27530de9b25SBarry Smith 27630de9b25SBarry Smith Input Parameters: 27730de9b25SBarry Smith + name - The name of a new user-defined creation routine 27830de9b25SBarry Smith . path - The path (either absolute or relative) of the library containing this routine 27930de9b25SBarry Smith . func_name - The name of routine to create method context 28030de9b25SBarry Smith - create_func - The creation routine itself 28130de9b25SBarry Smith 28230de9b25SBarry Smith Notes: 28330de9b25SBarry Smith VecRegisterDynamic() may be called multiple times to add several user-defined vectors 28430de9b25SBarry Smith 28530de9b25SBarry Smith If dynamic libraries are used, then the fourth input argument (routine_create) is ignored. 28630de9b25SBarry Smith 28730de9b25SBarry Smith Sample usage: 28830de9b25SBarry Smith .vb 28930de9b25SBarry Smith VecRegisterDynamic("my_vec","/home/username/my_lib/lib/libO/solaris/libmy.a", "MyVectorCreate", MyVectorCreate); 29030de9b25SBarry Smith .ve 29130de9b25SBarry Smith 29230de9b25SBarry Smith Then, your vector type can be chosen with the procedural interface via 29330de9b25SBarry Smith .vb 29430de9b25SBarry Smith VecCreate(MPI_Comm, Vec *); 29530de9b25SBarry Smith VecSetType(Vec,"my_vector_name"); 29630de9b25SBarry Smith .ve 29730de9b25SBarry Smith or at runtime via the option 29830de9b25SBarry Smith .vb 29930de9b25SBarry Smith -vec_type my_vector_name 30030de9b25SBarry Smith .ve 30130de9b25SBarry Smith 302ab901514SBarry Smith Notes: $PETSC_ARCH occuring in pathname will be replaced with appropriate values. 30330de9b25SBarry Smith If your function is not being put into a shared library then use VecRegister() instead 30430de9b25SBarry Smith 30530de9b25SBarry Smith Level: advanced 30630de9b25SBarry Smith 30730de9b25SBarry Smith .keywords: Vec, register 30830de9b25SBarry Smith .seealso: VecRegisterAll(), VecRegisterDestroy(), VecRegister() 30930de9b25SBarry Smith M*/ 310aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 311f1af5d2fSBarry Smith #define VecRegisterDynamic(a,b,c,d) VecRegister(a,b,c,0) 31288d459dfSBarry Smith #else 313f1af5d2fSBarry Smith #define VecRegisterDynamic(a,b,c,d) VecRegister(a,b,c,d) 31488d459dfSBarry Smith #endif 31588d459dfSBarry Smith 31609321671SBarry Smith 3170c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScatterCreate(Vec,IS,Vec,IS,VecScatter *); 318fcd5dd21SSatish Balay PetscPolymorphicFunction(VecScatterCreate,(Vec x,IS is1,Vec y,IS is2),(x,is1,y,is2,&s),VecScatter,s) 3190190745aSSatish Balay PetscPolymorphicSubroutine(VecScatterCreate,(Vec x,IS is,Vec y,VecScatter *s),(x,is,y,PETSC_NULL,s)) 320fcd5dd21SSatish Balay PetscPolymorphicFunction(VecScatterCreate,(Vec x,IS is,Vec y),(x,is,y,PETSC_NULL,&s),VecScatter,s) 3210190745aSSatish Balay PetscPolymorphicSubroutine(VecScatterCreate,(Vec x,Vec y,IS is,VecScatter *s),(x,PETSC_NULL,y,is,s)) 322fcd5dd21SSatish Balay PetscPolymorphicFunction(VecScatterCreate,(Vec x,Vec y,IS is),(x,PETSC_NULL,y,is,&s),VecScatter,s) 323450faa77SMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScatterCreateEmpty(MPI_Comm,VecScatter *); 324450faa77SMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScatterCreateLocal_PtoS(int,int[],int[],int[],int,int[],int[],int[],PetscInt,VecScatter); 3250c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScatterBegin(Vec,Vec,InsertMode,ScatterMode,VecScatter); 3260c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScatterEnd(Vec,Vec,InsertMode,ScatterMode,VecScatter); 3270c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScatterDestroy(VecScatter); 3280c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScatterCopy(VecScatter,VecScatter *); 3290c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScatterView(VecScatter,PetscViewer); 3300c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScatterRemap(VecScatter,PetscInt *,PetscInt*); 3310c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScatterGetMerged(VecScatter,PetscTruth*); 3322195c698SBarry Smith 3330c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetArray_Private(Vec,PetscScalar*[]); 3340c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecRestoreArray_Private(Vec,PetscScalar*[]); 3350c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetArray4d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]); 3360c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecRestoreArray4d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]); 3370c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetArray3d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar***[]); 3380c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecRestoreArray3d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar***[]); 3390c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetArray2d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar**[]); 3400c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecRestoreArray2d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar**[]); 3410c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetArray1d(Vec,PetscInt,PetscInt,PetscScalar *[]); 3420c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecRestoreArray1d(Vec,PetscInt,PetscInt,PetscScalar *[]); 343ab360428SBarry Smith 3440c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecPlaceArray(Vec,const PetscScalar[]); 3450c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecResetArray(Vec); 3460c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecReplaceArray(Vec,const PetscScalar[]); 3470c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetArrays(const Vec[],PetscInt,PetscScalar**[]); 3480c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecRestoreArrays(const Vec[],PetscInt,PetscScalar**[]); 34984cb2905SBarry Smith 3500c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecValid(Vec,PetscTruth*); 3510c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecView(Vec,PetscViewer); 3520c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecViewFromOptions(Vec, char *); 3530c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecEqual(Vec,Vec,PetscTruth*); 354fcd5dd21SSatish Balay PetscPolymorphicFunction(VecEqual,(Vec x,Vec y),(x,y,&s),PetscTruth,s) 355f69a0ea3SMatthew Knepley EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecLoad(PetscViewer,VecType,Vec*); 3560c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecLoadIntoVector(PetscViewer,Vec); 3578ed539a5SBarry Smith 3580c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetSize(Vec,PetscInt*); 359fcd5dd21SSatish Balay PetscPolymorphicFunction(VecGetSize,(Vec x),(x,&s),PetscInt,s) 3600c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetLocalSize(Vec,PetscInt*); 361fcd5dd21SSatish Balay PetscPolymorphicFunction(VecGetLocalSize,(Vec x),(x,&s),PetscInt,s) 3620c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetOwnershipRange(Vec,PetscInt*,PetscInt*); 3638ed539a5SBarry Smith 3640c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetLocalToGlobalMapping(Vec,ISLocalToGlobalMapping); 3650c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetValuesLocal(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 36688b03592SBarry Smith 36788b03592SBarry Smith /*MC 36888b03592SBarry Smith VecSetValueLocal - Set a single entry into a vector using the local numbering 36988b03592SBarry Smith 37088b03592SBarry Smith Synopsis: 37188b03592SBarry Smith PetscErrorCode VecSetValueLocal(Vec v,int row,PetscScalar value, InsertMode mode); 37288b03592SBarry Smith 37388b03592SBarry Smith Not Collective 37488b03592SBarry Smith 37588b03592SBarry Smith Input Parameters: 37688b03592SBarry Smith + v - the vector 37788b03592SBarry Smith . row - the row location of the entry 37888b03592SBarry Smith . value - the value to insert 37988b03592SBarry Smith - mode - either INSERT_VALUES or ADD_VALUES 38088b03592SBarry Smith 38188b03592SBarry Smith Notes: 38288b03592SBarry Smith For efficiency one should use VecSetValues() and set several or 38388b03592SBarry Smith many values simultaneously if possible. 38488b03592SBarry Smith 38588b03592SBarry Smith These values may be cached, so VecAssemblyBegin() and VecAssemblyEnd() 38688b03592SBarry Smith MUST be called after all calls to VecSetValues() have been completed. 38788b03592SBarry Smith 38888b03592SBarry Smith VecSetValues() uses 0-based indices in Fortran as well as in C. 38988b03592SBarry Smith 39088b03592SBarry Smith Level: beginner 39188b03592SBarry Smith 39288b03592SBarry Smith .seealso: VecSetValues(), VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesBlockedLocal(), VecSetValue() 39388b03592SBarry Smith M*/ 39488b03592SBarry Smith PETSC_STATIC_INLINE PetscErrorCode VecSetValueLocal(Vec v,PetscInt i,PetscScalar va,InsertMode mode) {return VecSetValuesLocal(v,1,&i,&va,mode);} 39588b03592SBarry Smith 3960c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetLocalToGlobalMappingBlock(Vec,ISLocalToGlobalMapping); 3970c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetValuesBlockedLocal(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 39890f02eecSBarry Smith 3990c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecDotBegin(Vec,Vec,PetscScalar *); 400ba966639SSatish Balay PetscPolymorphicSubroutine(VecDotBegin,(Vec x,Vec y),(x,y,PETSC_NULL)) 4010c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecDotEnd(Vec,Vec,PetscScalar *); 402fcd5dd21SSatish Balay PetscPolymorphicFunction(VecDotEnd,(Vec x,Vec y),(x,y,&s),PetscScalar,s) 4030c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecTDotBegin(Vec,Vec,PetscScalar *); 404ba966639SSatish Balay PetscPolymorphicSubroutine(VecTDotBegin,(Vec x,Vec y),(x,y,PETSC_NULL)) 4050c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecTDotEnd(Vec,Vec,PetscScalar *); 406fcd5dd21SSatish Balay PetscPolymorphicFunction(VecTDotEnd,(Vec x,Vec y),(x,y,&s),PetscScalar,s) 4070c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecNormBegin(Vec,NormType,PetscReal *); 408ba966639SSatish Balay PetscPolymorphicSubroutine(VecNormBegin,(Vec x,NormType t),(x,t,PETSC_NULL)) 409ba966639SSatish Balay PetscPolymorphicSubroutine(VecNormBegin,(Vec x),(x,NORM_2,PETSC_NULL)) 4100c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecNormEnd(Vec,NormType,PetscReal *); 411fcd5dd21SSatish Balay PetscPolymorphicFunction(VecNormEnd,(Vec x,NormType t),(x,t,&s),PetscReal,s) 412fcd5dd21SSatish Balay PetscPolymorphicFunction(VecNormEnd,(Vec x),(x,NORM_2,&s),PetscReal,s) 413d3c178dbSBarry Smith 4148dbd3d1dSSatish Balay EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecMDotBegin(Vec,PetscInt,const Vec[],PetscScalar *); 4158dbd3d1dSSatish Balay EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecMDotEnd(Vec,PetscInt,const Vec[],PetscScalar *); 4168dbd3d1dSSatish Balay EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecMTDotBegin(Vec,PetscInt,const Vec[],PetscScalar *); 4178dbd3d1dSSatish Balay EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecMTDotEnd(Vec,PetscInt,const Vec[],PetscScalar *); 418a751f32aSSatish Balay 419a751f32aSSatish Balay 420fdbc4c26SBarry Smith typedef enum {VEC_IGNORE_OFF_PROC_ENTRIES,VEC_TREAT_OFF_PROC_ENTRIES} VecOption; 4210c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetOption(Vec,VecOption); 42290f02eecSBarry Smith 423ebe3b25bSBarry Smith /* 424ebe3b25bSBarry Smith Expose VecGetArray()/VecRestoreArray() to users. Allows this to work without any function 425ebe3b25bSBarry Smith call overhead on any 'native' Vecs. 426ebe3b25bSBarry Smith */ 427e1fa1e0fSSatish Balay 428e1fa1e0fSSatish Balay PETSC_EXTERN_CXX_END 4291d8d5f9aSSatish Balay #include "private/vecimpl.h" 430e1fa1e0fSSatish Balay PETSC_EXTERN_CXX_BEGIN 431ebe3b25bSBarry Smith 4320c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecContourScale(Vec,PetscReal,PetscReal); 433522c5e43SBarry Smith 43415091d37SBarry Smith /* 43515091d37SBarry Smith These numbers need to match the entries in 4363c94ec11SBarry Smith the function table in vecimpl.h 43715091d37SBarry Smith */ 438499d51b4SSatish Balay typedef enum { VECOP_VIEW = 32, VECOP_LOADINTOVECTOR = 40} VecOperation; 4390c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecSetOperation(Vec,VecOperation,void(*)(void)); 440b19c1e4cSBarry Smith 441e182c471SBarry Smith /* 442e182c471SBarry Smith Routines for dealing with ghosted vectors: 443e182c471SBarry Smith vectors with ghost elements at the end of the array. 444e182c471SBarry Smith */ 4450c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecCreateGhost(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Vec*); 4460c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecCreateGhostWithArray(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscScalar[],Vec*); 4470c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecCreateGhostBlock(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Vec*); 4480c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecCreateGhostBlockWithArray(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscScalar[],Vec*); 4490c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGhostGetLocalForm(Vec,Vec*); 450ba966639SSatish Balay PetscPolymorphicFunction(VecGhostGetLocalForm,(Vec x),(x,&s),Vec,s) 4510c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGhostRestoreLocalForm(Vec,Vec*); 4520c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGhostUpdateBegin(Vec,InsertMode,ScatterMode); 4530c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGhostUpdateEnd(Vec,InsertMode,ScatterMode); 454e182c471SBarry Smith 4550c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecConjugate(Vec); 45634233285SBarry Smith 4570c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScatterCreateToAll(Vec,VecScatter*,Vec*); 4580c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecScatterCreateToZero(Vec,VecScatter*,Vec*); 459bba1ac68SSatish Balay 4600c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT PetscViewerMathematicaGetVector(PetscViewer, Vec); 4610c735eedSKris Buschelman EXTERN PetscErrorCode PETSCVEC_DLLEXPORT PetscViewerMathematicaPutVector(PetscViewer, Vec); 4627dbadf16SMatthew Knepley 463d59c15a7SBarry Smith /*S 464d59c15a7SBarry Smith Vecs - Collection of vectors where the data for the vectors is stored in 465d59c15a7SBarry Smith one continquous memory 466d59c15a7SBarry Smith 467d59c15a7SBarry Smith Level: advanced 468d59c15a7SBarry Smith 469d59c15a7SBarry Smith Notes: 470d59c15a7SBarry Smith Temporary construct for handling multiply right hand side solves 471d59c15a7SBarry Smith 472d59c15a7SBarry Smith This is faked by storing a single vector that has enough array space for 473d59c15a7SBarry Smith n vectors 474d59c15a7SBarry Smith 475d59c15a7SBarry Smith Concepts: parallel decomposition 476d59c15a7SBarry Smith 477d59c15a7SBarry Smith S*/ 47895fbd943SSatish Balay struct _n_Vecs {PetscInt n; Vec v;}; 47995fbd943SSatish Balay typedef struct _n_Vecs* Vecs; 480d59c15a7SBarry Smith #define VecsDestroy(x) (VecDestroy((x)->v) || PetscFree(x)) 48195fbd943SSatish Balay #define VecsCreateSeq(comm,p,m,x) (PetscNew(struct _n_Vecs,x) || VecCreateSeq(comm,p*m,&(*(x))->v) || (-1 == ((*(x))->n = (m)))) 48295fbd943SSatish Balay #define VecsCreateSeqWithArray(comm,p,m,a,x) (PetscNew(struct _n_Vecs,x) || VecCreateSeqWithArray(comm,p*m,a,&(*(x))->v) || (-1 == ((*(x))->n = (m)))) 48395fbd943SSatish Balay #define VecsDuplicate(x,y) (PetscNew(struct _n_Vecs,y) || VecDuplicate(x->v,&(*(y))->v) || (-1 == ((*(y))->n = (x)->n))) 484e9fa29b7SSatish Balay 485e9fa29b7SSatish Balay 486e9fa29b7SSatish Balay PETSC_EXTERN_CXX_END 4872eac72dbSBarry Smith #endif 488