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 726bd1501SBarry Smith #ifndef PETSCVEC_H 826bd1501SBarry Smith #define PETSCVEC_H 9*a256111fSJunchao Zhang #include "petscsys.h" 10*a256111fSJunchao Zhang #include "petscsystypes.h" 112c8e378dSBarry Smith #include <petscis.h> 12665c2dedSJed Brown #include <petscviewer.h> 132eac72dbSBarry Smith 1409321671SBarry Smith /*S 1509321671SBarry Smith Vec - Abstract PETSc vector object 1609321671SBarry Smith 1709321671SBarry Smith Level: beginner 1809321671SBarry Smith 1909321671SBarry Smith .seealso: VecCreate(), VecType, VecSetType() 2009321671SBarry Smith S*/ 21f09e8eb9SSatish Balay typedef struct _p_Vec* Vec; 2209321671SBarry Smith 2309321671SBarry Smith /*S 2409321671SBarry Smith VecScatter - Object used to manage communication of data 2509321671SBarry Smith between vectors in parallel. Manages both scatters and gathers 2609321671SBarry Smith 2709321671SBarry Smith Level: beginner 2809321671SBarry Smith 29130e142eSJunchao Zhang .seealso: VecScatterCreate(), VecScatterBegin(), VecScatterEnd() 3009321671SBarry Smith S*/ 31f09e8eb9SSatish Balay typedef struct _p_VecScatter* VecScatter; 3209321671SBarry Smith 3309321671SBarry Smith /*E 34398c84b2SBarry Smith ScatterMode - Determines the direction of a scatter 35398c84b2SBarry Smith 36398c84b2SBarry Smith Level: beginner 37398c84b2SBarry Smith 38398c84b2SBarry Smith .seealso: VecScatter, VecScatterBegin(), VecScatterEnd() 39398c84b2SBarry Smith E*/ 40398c84b2SBarry Smith typedef enum {SCATTER_FORWARD=0, SCATTER_REVERSE=1, SCATTER_FORWARD_LOCAL=2, SCATTER_REVERSE_LOCAL=3, SCATTER_LOCAL=2} ScatterMode; 41398c84b2SBarry Smith 42398c84b2SBarry Smith /*MC 43130e142eSJunchao Zhang SCATTER_FORWARD - Scatters the values as dictated by the VecScatterCreate() call 44398c84b2SBarry Smith 45398c84b2SBarry Smith Level: beginner 46398c84b2SBarry Smith 47130e142eSJunchao Zhang .seealso: VecScatter, ScatterMode, VecScatterCreate(), VecScatterBegin(), VecScatterEnd(), SCATTER_REVERSE, SCATTER_FORWARD_LOCAL, 48398c84b2SBarry Smith SCATTER_REVERSE_LOCAL 49398c84b2SBarry Smith 50398c84b2SBarry Smith M*/ 51398c84b2SBarry Smith 52398c84b2SBarry Smith /*MC 53398c84b2SBarry Smith SCATTER_REVERSE - Moves the values in the opposite direction then the directions indicated in 54130e142eSJunchao Zhang in the VecScatterCreate() 55398c84b2SBarry Smith 56398c84b2SBarry Smith Level: beginner 57398c84b2SBarry Smith 58130e142eSJunchao Zhang .seealso: VecScatter, ScatterMode, VecScatterCreate(), VecScatterBegin(), VecScatterEnd(), SCATTER_FORWARD, SCATTER_FORWARD_LOCAL, 59398c84b2SBarry Smith SCATTER_REVERSE_LOCAL 60398c84b2SBarry Smith 61398c84b2SBarry Smith M*/ 62398c84b2SBarry Smith 63398c84b2SBarry Smith /*MC 64130e142eSJunchao Zhang SCATTER_FORWARD_LOCAL - Scatters the values as dictated by the VecScatterCreate() call except NO parallel communication 65398c84b2SBarry Smith is done. Any variables that have be moved between processes are ignored 66398c84b2SBarry Smith 67398c84b2SBarry Smith Level: developer 68398c84b2SBarry Smith 69130e142eSJunchao Zhang .seealso: VecScatter, ScatterMode, VecScatterCreate(), VecScatterBegin(), VecScatterEnd(), SCATTER_REVERSE, SCATTER_FORWARD, 70398c84b2SBarry Smith SCATTER_REVERSE_LOCAL 71398c84b2SBarry Smith 72398c84b2SBarry Smith M*/ 73398c84b2SBarry Smith 74398c84b2SBarry Smith /*MC 75398c84b2SBarry Smith SCATTER_REVERSE_LOCAL - Moves the values in the opposite direction then the directions indicated in 76130e142eSJunchao Zhang in the VecScatterCreate() except NO parallel communication 77398c84b2SBarry Smith is done. Any variables that have be moved between processes are ignored 78398c84b2SBarry Smith 79398c84b2SBarry Smith Level: developer 80398c84b2SBarry Smith 81130e142eSJunchao Zhang .seealso: VecScatter, ScatterMode, VecScatterCreate(), VecScatterBegin(), VecScatterEnd(), SCATTER_FORWARD, SCATTER_FORWARD_LOCAL, 82398c84b2SBarry Smith SCATTER_REVERSE 83398c84b2SBarry Smith 84398c84b2SBarry Smith M*/ 85398c84b2SBarry Smith 8676bdecfbSBarry Smith /*J 878f6c3df8SBarry Smith VecType - String with the name of a PETSc vector 8809321671SBarry Smith 8909321671SBarry Smith Level: beginner 9009321671SBarry Smith 918f6c3df8SBarry Smith .seealso: VecSetType(), Vec, VecCreate(), VecDestroy() 9276bdecfbSBarry Smith J*/ 9319fd82e9SBarry Smith typedef const char* VecType; 940676abe4SMatthew Knepley #define VECSEQ "seq" 950676abe4SMatthew Knepley #define VECMPI "mpi" 96f48c50deSBarry Smith #define VECSTANDARD "standard" /* seq on one process and mpi on several */ 970676abe4SMatthew Knepley #define VECSHARED "shared" 98b17c682bSKarl Rupp #define VECSEQVIENNACL "seqviennacl" 99b17c682bSKarl Rupp #define VECMPIVIENNACL "mpiviennacl" 100b17c682bSKarl Rupp #define VECVIENNACL "viennacl" /* seqviennacl on one process and mpiviennacl on several */ 10182f73ecaSAlejandro Lamas Daviña #define VECSEQCUDA "seqcuda" 10282f73ecaSAlejandro Lamas Daviña #define VECMPICUDA "mpicuda" 10382f73ecaSAlejandro Lamas Daviña #define VECCUDA "cuda" /* seqcuda on one process and mpicuda on several */ 1041aae2881SJed Brown #define VECNEST "nest" 105803a1b88SHong Zhang #define VECNODE "node" /* use on-node shared memory */ 10610171e34SJunchao Zhang #define VECSEQKOKKOS "seqkokkos" 10710171e34SJunchao Zhang #define VECMPIKOKKOS "mpikokkos" 10810171e34SJunchao Zhang #define VECKOKKOS "kokkos" /* seqkokkos on one process and mpikokkos on several */ 1092eac72dbSBarry Smith 110803a1b88SHong Zhang /*J 111803a1b88SHong Zhang VecScatterType - String with the name of a PETSc vector scatter type 112803a1b88SHong Zhang 113803a1b88SHong Zhang Level: beginner 114803a1b88SHong Zhang 115130e142eSJunchao Zhang .seealso: VecScatterSetType(), VecScatter, VecScatterCreate(), VecScatterDestroy() 116803a1b88SHong Zhang J*/ 117803a1b88SHong Zhang typedef const char* VecScatterType; 118803a1b88SHong Zhang #define VECSCATTERSEQ "seq" 119803a1b88SHong Zhang #define VECSCATTERMPI1 "mpi1" 120803a1b88SHong Zhang #define VECSCATTERMPI3 "mpi3" /* use MPI3 on-node shared memory */ 121803a1b88SHong Zhang #define VECSCATTERMPI3NODE "mpi3node" /* use MPI3 on-node shared memory for vector type VECNODE */ 122ef6f2af5SJunchao Zhang #define VECSCATTERSF "sf" /* use StarForest */ 123803a1b88SHong Zhang 124803a1b88SHong Zhang /* Dynamic creation and loading functions */ 125803a1b88SHong Zhang PETSC_EXTERN PetscFunctionList VecScatterList; 126803a1b88SHong Zhang PETSC_EXTERN PetscErrorCode VecScatterSetType(VecScatter, VecScatterType); 127803a1b88SHong Zhang PETSC_EXTERN PetscErrorCode VecScatterGetType(VecScatter, VecScatterType *); 128803a1b88SHong Zhang PETSC_EXTERN PetscErrorCode VecScatterSetFromOptions(VecScatter); 129803a1b88SHong Zhang PETSC_EXTERN PetscErrorCode VecScatterRegister(const char[],PetscErrorCode (*)(VecScatter)); 130130e142eSJunchao Zhang PETSC_EXTERN PetscErrorCode VecScatterCreate(Vec,IS,Vec,IS,VecScatter*); 131803a1b88SHong Zhang PETSC_EXTERN PetscErrorCode VecScatterInitializePackage(void); 132803a1b88SHong Zhang PETSC_EXTERN PetscErrorCode VecScatterFinalizePackage(void); 1334b71561bSShri Abhyankar 134fd487807SMatthew Knepley /* Logging support */ 135450a797fSBarry Smith #define REAL_FILE_CLASSID 1211213 1360700a824SBarry Smith #define VEC_FILE_CLASSID 1211214 137014dd563SJed Brown PETSC_EXTERN PetscClassId VEC_CLASSID; 138014dd563SJed Brown PETSC_EXTERN PetscClassId VEC_SCATTER_CLASSID; 1398ba1e511SMatthew Knepley 14045b63f25SDmitry Karpeev 141607a6623SBarry Smith PETSC_EXTERN PetscErrorCode VecInitializePackage(void); 142014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecFinalizePackage(void); 143fd487807SMatthew Knepley 144014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecCreate(MPI_Comm,Vec*); 145014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecCreateSeq(MPI_Comm,PetscInt,Vec*); 146014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecCreateMPI(MPI_Comm,PetscInt,PetscInt,Vec*); 147014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecCreateSeqWithArray(MPI_Comm,PetscInt,PetscInt,const PetscScalar[],Vec*); 148014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecCreateMPIWithArray(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscScalar[],Vec*); 149014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecCreateShared(MPI_Comm,PetscInt,PetscInt,Vec*); 150803a1b88SHong Zhang PETSC_EXTERN PetscErrorCode VecCreateNode(MPI_Comm,PetscInt,PetscInt,Vec*); 151803a1b88SHong Zhang 152014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetFromOptions(Vec); 153fe2efc57SMark PETSC_EXTERN PetscErrorCode VecViewFromOptions(Vec,PetscObject,const char[]); 1540d2bece7SBarry Smith 155014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetUp(Vec); 156014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecDestroy(Vec*); 157014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecZeroEntries(Vec); 158014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetOptionsPrefix(Vec,const char[]); 159014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecAppendOptionsPrefix(Vec,const char[]); 160014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetOptionsPrefix(Vec,const char*[]); 161f69a0ea3SMatthew Knepley 162014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetSizes(Vec,PetscInt,PetscInt); 163fd487807SMatthew Knepley 16452b6e47cSBarry Smith PETSC_EXTERN PetscErrorCode VecDotNorm2(Vec,Vec,PetscScalar*,PetscReal*); 165014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecDot(Vec,Vec,PetscScalar*); 16667392de3SBarry Smith PETSC_EXTERN PetscErrorCode VecDotRealPart(Vec,Vec,PetscReal*); 167014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecTDot(Vec,Vec,PetscScalar*); 168014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecMDot(Vec,PetscInt,const Vec[],PetscScalar[]); 169014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecMTDot(Vec,PetscInt,const Vec[],PetscScalar[]); 170014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetSubVector(Vec,IS,Vec*); 171014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecRestoreSubVector(Vec,IS,Vec*); 172cddf8d76SBarry Smith 17309321671SBarry Smith /*E 17409321671SBarry Smith NormType - determines what type of norm to compute 17509321671SBarry Smith 17609321671SBarry Smith Level: beginner 17709321671SBarry Smith 17809321671SBarry Smith .seealso: VecNorm(), VecNormBegin(), VecNormEnd(), MatNorm() 17909321671SBarry Smith E*/ 1809dcbbd2bSBarry Smith typedef enum {NORM_1=0,NORM_2=1,NORM_FROBENIUS=2,NORM_INFINITY=3,NORM_1_AND_2=4} NormType; 1816a6fc655SJed Brown PETSC_EXTERN const char *const NormTypes[]; 182cddf8d76SBarry Smith #define NORM_MAX NORM_INFINITY 18309321671SBarry Smith 1849b250c83SBarry Smith /*MC 1859b250c83SBarry Smith NORM_1 - the one norm, ||v|| = sum_i | v_i |. ||A|| = max_j || v_*j ||, maximum column sum 1869b250c83SBarry Smith 1879b250c83SBarry Smith Level: beginner 1889b250c83SBarry Smith 1899b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_2, NORM_FROBENIUS, 1909b250c83SBarry Smith NORM_INFINITY, NORM_1_AND_2 1919b250c83SBarry Smith 1929b250c83SBarry Smith M*/ 1939b250c83SBarry Smith 1949b250c83SBarry Smith /*MC 195df54d55cSMatthias Liertzer NORM_2 - the two norm, ||v|| = sqrt(sum_i |v_i|^2) (vectors only) 1969b250c83SBarry Smith 1979b250c83SBarry Smith Level: beginner 1989b250c83SBarry Smith 1999b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_FROBENIUS, 2009b250c83SBarry Smith NORM_INFINITY, NORM_1_AND_2 2019b250c83SBarry Smith 2029b250c83SBarry Smith M*/ 2039b250c83SBarry Smith 2049b250c83SBarry Smith /*MC 205df54d55cSMatthias Liertzer NORM_FROBENIUS - ||A|| = sqrt(sum_ij |A_ij|^2), same as NORM_2 for vectors 2069b250c83SBarry Smith 2079b250c83SBarry Smith Level: beginner 2089b250c83SBarry Smith 2099b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_2, 2109b250c83SBarry Smith NORM_INFINITY, NORM_1_AND_2 2119b250c83SBarry Smith 2129b250c83SBarry Smith M*/ 2139b250c83SBarry Smith 2149b250c83SBarry Smith /*MC 2159b250c83SBarry Smith NORM_INFINITY - ||v|| = max_i |v_i|. ||A|| = max_i || v_i* ||, maximum row sum 2169b250c83SBarry Smith 2179b250c83SBarry Smith Level: beginner 2189b250c83SBarry Smith 2199b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_2, 2209b250c83SBarry Smith NORM_FROBINIUS, NORM_1_AND_2 2219b250c83SBarry Smith 2229b250c83SBarry Smith M*/ 2239b250c83SBarry Smith 2249b250c83SBarry Smith /*MC 2259b250c83SBarry Smith NORM_1_AND_2 - computes both the 1 and 2 norm of a vector 2269b250c83SBarry Smith 2279b250c83SBarry Smith Level: beginner 2289b250c83SBarry Smith 2299b250c83SBarry Smith .seealso: NormType, MatNorm(), VecNorm(), VecNormBegin(), VecNormEnd(), NORM_1, NORM_2, 2309b250c83SBarry Smith NORM_FROBINIUS, NORM_INFINITY 2319b250c83SBarry Smith 2329b250c83SBarry Smith M*/ 2339b250c83SBarry Smith 2349b250c83SBarry Smith /*MC 2359b250c83SBarry Smith NORM_MAX - see NORM_INFINITY 2369b250c83SBarry Smith 237d41222bbSBarry Smith Level: beginner 238d41222bbSBarry Smith 2399b250c83SBarry Smith M*/ 2409b250c83SBarry Smith 241014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecNorm(Vec,NormType,PetscReal *); 242014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecNormAvailable(Vec,NormType,PetscBool *,PetscReal *); 243014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecNormalize(Vec,PetscReal *); 244014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSum(Vec,PetscScalar*); 245014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecMax(Vec,PetscInt*,PetscReal *); 246014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecMin(Vec,PetscInt*,PetscReal *); 247014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecScale(Vec,PetscScalar); 248014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecCopy(Vec,Vec); 249014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetRandom(Vec,PetscRandom); 250014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSet(Vec,PetscScalar); 251422a814eSBarry Smith PETSC_EXTERN PetscErrorCode VecSetInf(Vec); 252014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSwap(Vec,Vec); 253014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecAXPY(Vec,PetscScalar,Vec); 254014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecAXPBY(Vec,PetscScalar,PetscScalar,Vec); 255014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecMAXPY(Vec,PetscInt,const PetscScalar[],Vec[]); 256014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecAYPX(Vec,PetscScalar,Vec); 257014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecWAXPY(Vec,PetscScalar,Vec,Vec); 258014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecAXPBYPCZ(Vec,PetscScalar,PetscScalar,PetscScalar,Vec,Vec); 259014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecPointwiseMax(Vec,Vec,Vec); 260014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecPointwiseMaxAbs(Vec,Vec,Vec); 261014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecPointwiseMin(Vec,Vec,Vec); 262014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecPointwiseMult(Vec,Vec,Vec); 263014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecPointwiseDivide(Vec,Vec,Vec); 264014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecMaxPointwiseDivide(Vec,Vec,PetscReal*); 265014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecShift(Vec,PetscScalar); 266014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecReciprocal(Vec); 267014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecPermute(Vec, IS, PetscBool); 268014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSqrtAbs(Vec); 269014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecLog(Vec); 270014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecExp(Vec); 271014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecAbs(Vec); 272014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecDuplicate(Vec,Vec*); 273014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecDuplicateVecs(Vec,PetscInt,Vec*[]); 274014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecDestroyVecs(PetscInt, Vec*[]); 275014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideNormAll(Vec,NormType,PetscReal[]); 276014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideMaxAll(Vec,PetscInt [],PetscReal []); 277014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideMinAll(Vec,PetscInt [],PetscReal []); 278014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideScaleAll(Vec,const PetscScalar[]); 279849b11cfSMatthew G. Knepley PETSC_EXTERN PetscErrorCode VecUniqueEntries(Vec,PetscInt*,PetscScalar**); 2804a560884SBarry Smith 281014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideNorm(Vec,PetscInt,NormType,PetscReal*); 282014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideMax(Vec,PetscInt,PetscInt *,PetscReal *); 283014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideMin(Vec,PetscInt,PetscInt *,PetscReal *); 284014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideScale(Vec,PetscInt,PetscScalar); 285014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideSet(Vec,PetscInt,PetscScalar); 286954b3ec6SBarry Smith 287954b3ec6SBarry Smith 288014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideGather(Vec,PetscInt,Vec,InsertMode); 289014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideScatter(Vec,PetscInt,Vec,InsertMode); 290014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideGatherAll(Vec,Vec[],InsertMode); 291014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStrideScatterAll(Vec[],Vec,InsertMode); 292d2655a18SBarry Smith 293bdeb6c88SBarry Smith PETSC_EXTERN PetscErrorCode VecStrideSubSetScatter(Vec,PetscInt,const PetscInt[],const PetscInt[],Vec,InsertMode); 294bdeb6c88SBarry Smith PETSC_EXTERN PetscErrorCode VecStrideSubSetGather(Vec,PetscInt,const PetscInt[],const PetscInt[],Vec,InsertMode); 295bdeb6c88SBarry Smith 296014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetValues(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 297014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetValues(Vec,PetscInt,const PetscInt[],PetscScalar[]); 298014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecAssemblyBegin(Vec); 299014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecAssemblyEnd(Vec); 300014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStashSetInitialSize(Vec,PetscInt,PetscInt); 301014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStashView(Vec,PetscViewer); 302685405a1SBarry Smith PETSC_EXTERN PetscErrorCode VecStashViewFromOptions(Vec,PetscObject,const char[]); 303014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecStashGetInfo(Vec,PetscInt*,PetscInt*,PetscInt*,PetscInt*); 30462dc5420SSatish Balay 30530de9b25SBarry Smith /*MC 30630de9b25SBarry Smith VecSetValue - Set a single entry into a vector. 30730de9b25SBarry Smith 30830de9b25SBarry Smith Synopsis: 309aaa7dc30SBarry Smith #include <petscvec.h> 3108122439eSJed Brown PetscErrorCode VecSetValue(Vec v,PetscInt row,PetscScalar value, InsertMode mode); 31130de9b25SBarry Smith 31230de9b25SBarry Smith Not Collective 31330de9b25SBarry Smith 31430de9b25SBarry Smith Input Parameters: 31530de9b25SBarry Smith + v - the vector 31630de9b25SBarry Smith . row - the row location of the entry 31730de9b25SBarry Smith . value - the value to insert 31830de9b25SBarry Smith - mode - either INSERT_VALUES or ADD_VALUES 31930de9b25SBarry Smith 32030de9b25SBarry Smith Notes: 32130de9b25SBarry Smith For efficiency one should use VecSetValues() and set several or 32230de9b25SBarry Smith many values simultaneously if possible. 32330de9b25SBarry Smith 3241d73ed98SBarry Smith These values may be cached, so VecAssemblyBegin() and VecAssemblyEnd() 325879a43d7SBarry Smith MUST be called after all calls to VecSetValue() have been completed. 3261d73ed98SBarry Smith 327879a43d7SBarry Smith VecSetValue() uses 0-based indices in Fortran as well as in C. 3281d73ed98SBarry Smith 3291d73ed98SBarry Smith Level: beginner 3301d73ed98SBarry Smith 3311d73ed98SBarry Smith .seealso: VecSetValues(), VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesBlockedLocal(), VecSetValueLocal() 3321d73ed98SBarry Smith M*/ 33350755921SBarry Smith PETSC_STATIC_INLINE PetscErrorCode VecSetValue(Vec v,PetscInt i,PetscScalar va,InsertMode mode) {return VecSetValues(v,1,&i,&va,mode);} 3341d73ed98SBarry Smith 33530de9b25SBarry Smith 336014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetBlockSize(Vec,PetscInt); 337014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetBlockSize(Vec,PetscInt*); 338014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetValuesBlocked(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 3398ed539a5SBarry Smith 340fd487807SMatthew Knepley /* Dynamic creation and loading functions */ 341140e18c1SBarry Smith PETSC_EXTERN PetscFunctionList VecList; 34219fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode VecSetType(Vec,VecType); 34319fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode VecGetType(Vec,VecType*); 344bdf89e91SBarry Smith PETSC_EXTERN PetscErrorCode VecRegister(const char[],PetscErrorCode (*)(Vec)); 34530de9b25SBarry Smith 346014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecScatterBegin(VecScatter,Vec,Vec,InsertMode,ScatterMode); 347014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecScatterEnd(VecScatter,Vec,Vec,InsertMode,ScatterMode); 348014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecScatterDestroy(VecScatter*); 349246626dcSBarry Smith PETSC_EXTERN PetscErrorCode VecScatterSetUp(VecScatter); 350014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecScatterCopy(VecScatter,VecScatter *); 351014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecScatterView(VecScatter,PetscViewer); 352fe2efc57SMark PETSC_EXTERN PetscErrorCode VecScatterViewFromOptions(VecScatter,PetscObject,const char[]); 353d27e6124SSatish Balay PETSC_EXTERN PetscErrorCode VecScatterRemap(VecScatter,PetscInt[],PetscInt[]); 354014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecScatterGetMerged(VecScatter,PetscBool*); 3552195c698SBarry Smith 356014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetArray4d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]); 357014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecRestoreArray4d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]); 358014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetArray3d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar***[]); 359014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecRestoreArray3d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar***[]); 360014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetArray2d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar**[]); 361014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecRestoreArray2d(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar**[]); 362014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetArray1d(Vec,PetscInt,PetscInt,PetscScalar*[]); 363014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecRestoreArray1d(Vec,PetscInt,PetscInt,PetscScalar*[]); 364ab360428SBarry Smith 365fdc842d1SBarry Smith PETSC_EXTERN PetscErrorCode VecGetArray4dWrite(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]); 366fdc842d1SBarry Smith PETSC_EXTERN PetscErrorCode VecGetArray4dWrite(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]); 367fdc842d1SBarry Smith PETSC_EXTERN PetscErrorCode VecRestoreArray4dWrite(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]); 368fdc842d1SBarry Smith PETSC_EXTERN PetscErrorCode VecGetArray3dWrite(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar***[]); 369fdc842d1SBarry Smith PETSC_EXTERN PetscErrorCode VecRestoreArray3dWrite(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar***[]); 370fdc842d1SBarry Smith PETSC_EXTERN PetscErrorCode VecGetArray2dWrite(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar**[]); 371fdc842d1SBarry Smith PETSC_EXTERN PetscErrorCode VecRestoreArray2dWrite(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar**[]); 372fdc842d1SBarry Smith PETSC_EXTERN PetscErrorCode VecGetArray1dWrite(Vec,PetscInt,PetscInt,PetscScalar*[]); 373fdc842d1SBarry Smith PETSC_EXTERN PetscErrorCode VecRestoreArray1dWrite(Vec,PetscInt,PetscInt,PetscScalar*[]); 374fdc842d1SBarry Smith 3755edff71fSBarry Smith PETSC_EXTERN PetscErrorCode VecGetArray4dRead(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]); 3765edff71fSBarry Smith PETSC_EXTERN PetscErrorCode VecRestoreArray4dRead(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar****[]); 3775edff71fSBarry Smith PETSC_EXTERN PetscErrorCode VecGetArray3dRead(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar***[]); 3785edff71fSBarry Smith PETSC_EXTERN PetscErrorCode VecRestoreArray3dRead(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar***[]); 3795edff71fSBarry Smith PETSC_EXTERN PetscErrorCode VecGetArray2dRead(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar**[]); 3805edff71fSBarry Smith PETSC_EXTERN PetscErrorCode VecRestoreArray2dRead(Vec,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar**[]); 3815edff71fSBarry Smith PETSC_EXTERN PetscErrorCode VecGetArray1dRead(Vec,PetscInt,PetscInt,PetscScalar*[]); 3825edff71fSBarry Smith PETSC_EXTERN PetscErrorCode VecRestoreArray1dRead(Vec,PetscInt,PetscInt,PetscScalar*[]); 3835edff71fSBarry Smith 384014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecPlaceArray(Vec,const PetscScalar[]); 385014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecResetArray(Vec); 386014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecReplaceArray(Vec,const PetscScalar[]); 387de0d48c1SKarl Rupp 388014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetArrays(const Vec[],PetscInt,PetscScalar**[]); 389014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecRestoreArrays(const Vec[],PetscInt,PetscScalar**[]); 39084cb2905SBarry Smith 391014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecView(Vec,PetscViewer); 392014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecEqual(Vec,Vec,PetscBool*); 393014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecLoad(Vec,PetscViewer); 3948ed539a5SBarry Smith 395014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetSize(Vec,PetscInt*); 396014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetLocalSize(Vec,PetscInt*); 397014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetOwnershipRange(Vec,PetscInt*,PetscInt*); 398014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetOwnershipRanges(Vec,const PetscInt*[]); 3998ed539a5SBarry Smith 400014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetLocalToGlobalMapping(Vec,ISLocalToGlobalMapping); 401014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetValuesLocal(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 40288b03592SBarry Smith 4039a971ab9SStefano Zampini PETSC_EXTERN PetscErrorCode VecCUDAGetArray(Vec,PetscScalar**); 4049a971ab9SStefano Zampini PETSC_EXTERN PetscErrorCode VecCUDARestoreArray(Vec,PetscScalar**); 405de0d48c1SKarl Rupp 4069a971ab9SStefano Zampini PETSC_EXTERN PetscErrorCode VecCUDAGetArrayRead(Vec,const PetscScalar**); 4079a971ab9SStefano Zampini PETSC_EXTERN PetscErrorCode VecCUDARestoreArrayRead(Vec,const PetscScalar**); 408de0d48c1SKarl Rupp 4099a971ab9SStefano Zampini PETSC_EXTERN PetscErrorCode VecCUDAGetArrayWrite(Vec,PetscScalar**); 4109a971ab9SStefano Zampini PETSC_EXTERN PetscErrorCode VecCUDARestoreArrayWrite(Vec,PetscScalar**); 411de0d48c1SKarl Rupp 412cbf3516aSStefano Zampini PETSC_EXTERN PetscErrorCode VecCUDAPlaceArray(Vec,const PetscScalar[]); 413cbf3516aSStefano Zampini PETSC_EXTERN PetscErrorCode VecCUDAReplaceArray(Vec,const PetscScalar[]); 414de0d48c1SKarl Rupp PETSC_EXTERN PetscErrorCode VecCUDAResetArray(Vec); 415de0d48c1SKarl Rupp 41676ec7f3eSKaushik Kulkarni PETSC_EXTERN PetscErrorCode VecViennaCLGetCLContext(Vec, PETSC_UINTPTR_T*); 41776ec7f3eSKaushik Kulkarni PETSC_EXTERN PetscErrorCode VecViennaCLGetCLQueue(Vec, PETSC_UINTPTR_T*); 41876ec7f3eSKaushik Kulkarni PETSC_EXTERN PetscErrorCode VecViennaCLGetCLMemRead(Vec, PETSC_UINTPTR_T*); 41976ec7f3eSKaushik Kulkarni PETSC_EXTERN PetscErrorCode VecViennaCLGetCLMemWrite(Vec, PETSC_UINTPTR_T*); 42076ec7f3eSKaushik Kulkarni PETSC_EXTERN PetscErrorCode VecViennaCLRestoreCLMemWrite(Vec); 42176ec7f3eSKaushik Kulkarni PETSC_EXTERN PetscErrorCode VecViennaCLGetCLMem(Vec, PETSC_UINTPTR_T*); 42276ec7f3eSKaushik Kulkarni PETSC_EXTERN PetscErrorCode VecViennaCLRestoreCLMem(Vec); 42376ec7f3eSKaushik Kulkarni 42488b03592SBarry Smith /*MC 42588b03592SBarry Smith VecSetValueLocal - Set a single entry into a vector using the local numbering 42688b03592SBarry Smith 42788b03592SBarry Smith Synopsis: 428aaa7dc30SBarry Smith #include <petscvec.h> 4298122439eSJed Brown PetscErrorCode VecSetValueLocal(Vec v,PetscInt row,PetscScalar value, InsertMode mode); 43088b03592SBarry Smith 43188b03592SBarry Smith Not Collective 43288b03592SBarry Smith 43388b03592SBarry Smith Input Parameters: 43488b03592SBarry Smith + v - the vector 43588b03592SBarry Smith . row - the row location of the entry 43688b03592SBarry Smith . value - the value to insert 43788b03592SBarry Smith - mode - either INSERT_VALUES or ADD_VALUES 43888b03592SBarry Smith 43988b03592SBarry Smith Notes: 44088b03592SBarry Smith For efficiency one should use VecSetValues() and set several or 44188b03592SBarry Smith many values simultaneously if possible. 44288b03592SBarry Smith 44388b03592SBarry Smith These values may be cached, so VecAssemblyBegin() and VecAssemblyEnd() 44488b03592SBarry Smith MUST be called after all calls to VecSetValues() have been completed. 44588b03592SBarry Smith 44688b03592SBarry Smith VecSetValues() uses 0-based indices in Fortran as well as in C. 44788b03592SBarry Smith 44888b03592SBarry Smith Level: beginner 44988b03592SBarry Smith 45088b03592SBarry Smith .seealso: VecSetValues(), VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesBlockedLocal(), VecSetValue() 45188b03592SBarry Smith M*/ 45288b03592SBarry Smith PETSC_STATIC_INLINE PetscErrorCode VecSetValueLocal(Vec v,PetscInt i,PetscScalar va,InsertMode mode) {return VecSetValuesLocal(v,1,&i,&va,mode);} 45388b03592SBarry Smith 454014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetValuesBlockedLocal(Vec,PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 455014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGetLocalToGlobalMapping(Vec,ISLocalToGlobalMapping*); 45690f02eecSBarry Smith 457014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecDotBegin(Vec,Vec,PetscScalar *); 458014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecDotEnd(Vec,Vec,PetscScalar *); 459014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecTDotBegin(Vec,Vec,PetscScalar *); 460014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecTDotEnd(Vec,Vec,PetscScalar *); 461014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecNormBegin(Vec,NormType,PetscReal *); 462014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecNormEnd(Vec,NormType,PetscReal *); 463d3c178dbSBarry Smith 464014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecMDotBegin(Vec,PetscInt,const Vec[],PetscScalar[]); 465014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecMDotEnd(Vec,PetscInt,const Vec[],PetscScalar[]); 466014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecMTDotBegin(Vec,PetscInt,const Vec[],PetscScalar[]); 467014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecMTDotEnd(Vec,PetscInt,const Vec[],PetscScalar[]); 468014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscCommSplitReductionBegin(MPI_Comm); 469a751f32aSSatish Balay 470b470e4b4SRichard Tran Mills PETSC_EXTERN PetscErrorCode VecBindToCPU(Vec,PetscBool); 471b470e4b4SRichard Tran Mills PETSC_DEPRECATED_FUNCTION("Use VecBindToCPU (since v3.13)") PETSC_STATIC_INLINE PetscErrorCode VecPinToCPU(Vec v,PetscBool flg) {return VecBindToCPU(v,flg);} 472387df023SRichard Tran Mills PETSC_EXTERN PetscErrorCode VecSetPinnedMemoryMin(Vec,size_t); 473387df023SRichard Tran Mills PETSC_EXTERN PetscErrorCode VecGetPinnedMemoryMin(Vec,size_t *); 474a751f32aSSatish Balay 47548d97fd2SKaushik Kulkarni 47648d97fd2SKaushik Kulkarni /*E 47748d97fd2SKaushik Kulkarni PetscOffloadMask - indicates which memory (CPU, GPU, or none) contains valid data 47848d97fd2SKaushik Kulkarni 47948d97fd2SKaushik Kulkarni PETSC_OFFLOAD_UNALLOCATED - no memory contains valid matrix entries; NEVER used for vectors 48048d97fd2SKaushik Kulkarni PETSC_OFFLOAD_GPU - GPU has valid vector/matrix entries 48148d97fd2SKaushik Kulkarni PETSC_OFFLOAD_CPU - CPU has valid vector/matrix entries 48248d97fd2SKaushik Kulkarni PETSC_OFFLOAD_BOTH - Both GPU and CPU have valid vector/matrix entries and they match 48348d97fd2SKaushik Kulkarni PETSC_OFFLOAD_VECKOKKOS - Reserved for Vec_Kokkos. The offload is managed by Kokkos, thus this flag is not used in Vec_Kokkos. 48448d97fd2SKaushik Kulkarni 48548d97fd2SKaushik Kulkarni Level: developer 48648d97fd2SKaushik Kulkarni E*/ 48748d97fd2SKaushik Kulkarni typedef enum {PETSC_OFFLOAD_UNALLOCATED=0x0,PETSC_OFFLOAD_CPU=0x1,PETSC_OFFLOAD_GPU=0x2,PETSC_OFFLOAD_BOTH=0x3,PETSC_OFFLOAD_VECKOKKOS=0x100} PetscOffloadMask; 4886fe358cdSKaushik Kulkarni PETSC_EXTERN PetscErrorCode VecGetOffloadMask(Vec,PetscOffloadMask *); 48948d97fd2SKaushik Kulkarni 490bda0d2a0SJed Brown typedef enum {VEC_IGNORE_OFF_PROC_ENTRIES,VEC_IGNORE_NEGATIVE_INDICES,VEC_SUBSET_OFF_PROC_ENTRIES} VecOption; 491014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetOption(Vec,VecOption,PetscBool); 49290f02eecSBarry Smith 4935c0c2446SJed Brown PETSC_EXTERN PetscErrorCode VecGetArray(Vec,PetscScalar**); 494fdc842d1SBarry Smith PETSC_EXTERN PetscErrorCode VecGetArrayWrite(Vec,PetscScalar**); 4955c0c2446SJed Brown PETSC_EXTERN PetscErrorCode VecGetArrayRead(Vec,const PetscScalar**); 4965c0c2446SJed Brown PETSC_EXTERN PetscErrorCode VecRestoreArray(Vec,PetscScalar**); 497fdc842d1SBarry Smith PETSC_EXTERN PetscErrorCode VecRestoreArrayWrite(Vec,PetscScalar**); 4985c0c2446SJed Brown PETSC_EXTERN PetscErrorCode VecRestoreArrayRead(Vec,const PetscScalar**); 499046dc149SDominic Meiser PETSC_EXTERN PetscErrorCode VecGetLocalVector(Vec,Vec); 500046dc149SDominic Meiser PETSC_EXTERN PetscErrorCode VecRestoreLocalVector(Vec,Vec); 501046dc149SDominic Meiser PETSC_EXTERN PetscErrorCode VecGetLocalVectorRead(Vec,Vec); 502046dc149SDominic Meiser PETSC_EXTERN PetscErrorCode VecRestoreLocalVectorRead(Vec,Vec); 503*a256111fSJunchao Zhang PETSC_EXTERN PetscErrorCode VecGetArrayAndMemType(Vec,PetscScalar**,PetscMemType*); 504*a256111fSJunchao Zhang PETSC_EXTERN PetscErrorCode VecRestoreArrayAndMemType(Vec,PetscScalar**); 505*a256111fSJunchao Zhang PETSC_EXTERN PetscErrorCode VecGetArrayReadAndMemType(Vec,const PetscScalar**,PetscMemType*); 506*a256111fSJunchao Zhang PETSC_EXTERN PetscErrorCode VecRestoreArrayReadAndMemType(Vec,const PetscScalar**); 50710171e34SJunchao Zhang 5089521ec69SBarry Smith /*@C 5099521ec69SBarry Smith VecGetArrayPair - Accesses a pair of pointers for two vectors that may be common. When not common the first is read only 5109521ec69SBarry Smith 511d083f849SBarry Smith Logically Collective on x 5129521ec69SBarry Smith 513f5f57ec0SBarry Smith Input Parameters: 5149521ec69SBarry Smith + x - the vector 5159521ec69SBarry Smith - y - the second vector 5169521ec69SBarry Smith 517f5f57ec0SBarry Smith Output Parameters: 5189521ec69SBarry Smith + xv - location to put pointer to the first array 5199521ec69SBarry Smith - yv - location to put pointer to the second array 5209521ec69SBarry Smith 5219521ec69SBarry Smith Level: developer 5229521ec69SBarry Smith 523f5f57ec0SBarry Smith Not available from Fortran 524f5f57ec0SBarry Smith 5259521ec69SBarry Smith .seealso: VecGetArray(), VecGetArrayRead(), VecRestoreArrayPair() 5269521ec69SBarry Smith 5279521ec69SBarry Smith @*/ 528d9ca1df4SBarry Smith PETSC_STATIC_INLINE PetscErrorCode VecGetArrayPair(Vec x,Vec y,PetscScalar **xv,PetscScalar **yv) 529d9ca1df4SBarry Smith { 530d9ca1df4SBarry Smith PetscErrorCode ierr; 531d9ca1df4SBarry Smith 532d9ca1df4SBarry Smith PetscFunctionBegin; 533d9ca1df4SBarry Smith ierr = VecGetArray(y,yv);CHKERRQ(ierr); 534d9ca1df4SBarry Smith if (x != y) { 535d9ca1df4SBarry Smith ierr = VecGetArrayRead(x,(const PetscScalar **)xv);CHKERRQ(ierr); 536d9ca1df4SBarry Smith } else { 537d9ca1df4SBarry Smith *xv = *yv; 538d9ca1df4SBarry Smith } 539d9ca1df4SBarry Smith PetscFunctionReturn(0); 540d9ca1df4SBarry Smith } 5419521ec69SBarry Smith 5429521ec69SBarry Smith /*@C 5439521ec69SBarry Smith VecRestoreArrayPair - Returns a pair of pointers for two vectors that may be common. When not common the first is read only 5449521ec69SBarry Smith 545d083f849SBarry Smith Logically Collective on x 5469521ec69SBarry Smith 547f5f57ec0SBarry Smith Input Parameters: 5489521ec69SBarry Smith + x - the vector 5499521ec69SBarry Smith - y - the second vector 5509521ec69SBarry Smith 551f5f57ec0SBarry Smith Output Parameters: 5529521ec69SBarry Smith + xv - location to put pointer to the first array 5539521ec69SBarry Smith - yv - location to put pointer to the second array 5549521ec69SBarry Smith 5559521ec69SBarry Smith Level: developer 5569521ec69SBarry Smith 557f5f57ec0SBarry Smith Not available from Fortran 558f5f57ec0SBarry Smith 5599521ec69SBarry Smith .seealso: VecGetArray(), VecGetArrayRead(), VecGetArrayPair() 5609521ec69SBarry Smith 5619521ec69SBarry Smith @*/ 562d9ca1df4SBarry Smith PETSC_STATIC_INLINE PetscErrorCode VecRestoreArrayPair(Vec x,Vec y,PetscScalar **xv,PetscScalar **yv) 563d9ca1df4SBarry Smith { 564d9ca1df4SBarry Smith PetscErrorCode ierr; 565d9ca1df4SBarry Smith 566d9ca1df4SBarry Smith PetscFunctionBegin; 567d9ca1df4SBarry Smith ierr = VecRestoreArray(y,yv);CHKERRQ(ierr); 568d9ca1df4SBarry Smith if (x != y) { 569d9ca1df4SBarry Smith ierr = VecRestoreArrayRead(x,(const PetscScalar **)xv);CHKERRQ(ierr); 570d9ca1df4SBarry Smith } 571d9ca1df4SBarry Smith PetscFunctionReturn(0); 572d9ca1df4SBarry Smith } 573d9ca1df4SBarry Smith 574d9ca1df4SBarry Smith #if defined(PETSC_USE_DEBUG) 57538fecf7cSJunchao Zhang PETSC_EXTERN PetscErrorCode VecLockReadPush(Vec); 57638fecf7cSJunchao Zhang PETSC_EXTERN PetscErrorCode VecLockReadPop(Vec); 57738fecf7cSJunchao Zhang /* We also have a non-public VecLockWriteSet_Private() in vecimpl.h */ 578d9ca1df4SBarry Smith PETSC_EXTERN PetscErrorCode VecLockGet(Vec,PetscInt*); 579da1c2f70SJunchao Zhang PETSC_STATIC_INLINE PetscErrorCode VecSetErrorIfLocked(Vec x,PetscInt arg) 580da1c2f70SJunchao Zhang { 581da1c2f70SJunchao Zhang PetscInt state; 582da1c2f70SJunchao Zhang PetscErrorCode ierr; 58338fecf7cSJunchao Zhang 584da1c2f70SJunchao Zhang PetscFunctionBegin; 585da1c2f70SJunchao Zhang ierr = VecLockGet(x,&state);CHKERRQ(ierr); 586da1c2f70SJunchao Zhang if (state != 0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE," Vec is already locked for read-only or read/write access, argument # %d",arg); 587da1c2f70SJunchao Zhang PetscFunctionReturn(0); 588da1c2f70SJunchao Zhang } 58938fecf7cSJunchao Zhang /* The three are deprecated */ 5905f1efc1aSLisandro Dalcin PETSC_EXTERN PETSC_DEPRECATED_FUNCTION("Use VecLockReadPush() (since version 3.11)") PetscErrorCode VecLockPush(Vec); 5915f1efc1aSLisandro Dalcin PETSC_EXTERN PETSC_DEPRECATED_FUNCTION("Use VecLockReadPop() (since version 3.11)") PetscErrorCode VecLockPop(Vec); 592ed274036SLisandro Dalcin #define VecLocked(x,arg) VecSetErrorIfLocked(x,arg) PETSC_DEPRECATED_MACRO("GCC warning \"Use VecSetErrorIfLocked() (since version 3.11)\"") 593d9ca1df4SBarry Smith #else 59445fccdb2SJunchao Zhang #define VecLockReadPush(x) 0 59545fccdb2SJunchao Zhang #define VecLockReadPop(x) 0 59638fecf7cSJunchao Zhang #define VecLockGet(x,s) *(s) = 0 59745fccdb2SJunchao Zhang #define VecSetErrorIfLocked(x,arg) 0 59838fecf7cSJunchao Zhang /* The three are deprecated */ 59945fccdb2SJunchao Zhang #define VecLockPush(x) 0 60045fccdb2SJunchao Zhang #define VecLockPop(x) 0 60145fccdb2SJunchao Zhang #define VecLocked(x,arg) 0 602d9ca1df4SBarry Smith #endif 603e1fa1e0fSSatish Balay 60462796dfbSBarry Smith PETSC_EXTERN PetscErrorCode VecValidValues(Vec,PetscInt,PetscBool); 605f7ecc322SBarry Smith 60615091d37SBarry Smith /* 60715091d37SBarry Smith These numbers need to match the entries in 6083c94ec11SBarry Smith the function table in vecimpl.h 60915091d37SBarry Smith */ 61092d03f5aSMatthew G. Knepley typedef enum { VECOP_DUPLICATE = 0, VECOP_VIEW = 33, VECOP_LOAD = 41, VECOP_VIEWNATIVE = 68, VECOP_LOADNATIVE = 69 } VecOperation; 611014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecSetOperation(Vec,VecOperation,void(*)(void)); 612b19c1e4cSBarry Smith 613e182c471SBarry Smith /* 614e182c471SBarry Smith Routines for dealing with ghosted vectors: 615e182c471SBarry Smith vectors with ghost elements at the end of the array. 616e182c471SBarry Smith */ 617014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecMPISetGhost(Vec,PetscInt,const PetscInt[]); 618014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecCreateGhost(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Vec*); 619014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecCreateGhostWithArray(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscScalar[],Vec*); 620014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecCreateGhostBlock(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Vec*); 621014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecCreateGhostBlockWithArray(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscScalar[],Vec*); 622014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGhostGetLocalForm(Vec,Vec*); 623014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGhostRestoreLocalForm(Vec,Vec*); 6243efe6655SBarry Smith PETSC_EXTERN PetscErrorCode VecGhostIsLocalForm(Vec,Vec,PetscBool*); 625014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGhostUpdateBegin(Vec,InsertMode,ScatterMode); 626014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecGhostUpdateEnd(Vec,InsertMode,ScatterMode); 627e182c471SBarry Smith 628014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecConjugate(Vec); 629c92e3469SBarry Smith PETSC_EXTERN PetscErrorCode VecImaginaryPart(Vec); 630c92e3469SBarry Smith PETSC_EXTERN PetscErrorCode VecRealPart(Vec); 63134233285SBarry Smith 632014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecScatterCreateToAll(Vec,VecScatter*,Vec*); 633014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecScatterCreateToZero(Vec,VecScatter*,Vec*); 634bba1ac68SSatish Balay 6354473680cSBarry Smith PETSC_EXTERN PetscErrorCode ISComplementVec(IS,Vec,IS*); 6364473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecPow(Vec, PetscScalar); 6374473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecMedian(Vec, Vec, Vec, Vec); 638ce902467SBarry Smith PETSC_EXTERN PetscErrorCode VecWhichInactive(Vec, Vec, Vec, Vec, PetscBool, IS *); 6394473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecWhichBetween(Vec, Vec, Vec, IS *); 6404473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecWhichBetweenOrEqual(Vec, Vec, Vec, IS *); 6414473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecWhichGreaterThan(Vec, Vec, IS *); 6424473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecWhichLessThan(Vec, Vec, IS *); 6434473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecWhichEqual(Vec, Vec, IS *); 6444473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecISAXPY(Vec, IS, PetscScalar,Vec); 6458883cd90SMatthew G. Knepley PETSC_EXTERN PetscErrorCode VecISCopy(Vec, IS, ScatterMode, Vec); 6464473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecISSet(Vec,IS, PetscScalar); 6474473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecBoundGradientProjection(Vec, Vec, Vec, Vec, Vec); 6484473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecStepBoundInfo(Vec,Vec,Vec,Vec,PetscReal*, PetscReal*,PetscReal*); 6494473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecStepMax(Vec, Vec, PetscReal *); 6504473680cSBarry Smith PETSC_EXTERN PetscErrorCode VecStepMaxBounded(Vec,Vec,Vec,Vec,PetscReal*); 6514473680cSBarry Smith 652014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaGetVector(PetscViewer, Vec); 653014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaPutVector(PetscViewer, Vec); 6547dbadf16SMatthew Knepley 655d59c15a7SBarry Smith /*S 656d59c15a7SBarry Smith Vecs - Collection of vectors where the data for the vectors is stored in 657759e7b9cSHong Zhang one contiguous memory 658d59c15a7SBarry Smith 659d59c15a7SBarry Smith Level: advanced 660d59c15a7SBarry Smith 661d59c15a7SBarry Smith Notes: 662d59c15a7SBarry Smith Temporary construct for handling multiply right hand side solves 663d59c15a7SBarry Smith 664d59c15a7SBarry Smith This is faked by storing a single vector that has enough array space for 665d59c15a7SBarry Smith n vectors 666d59c15a7SBarry Smith 667d59c15a7SBarry Smith S*/ 66895fbd943SSatish Balay struct _n_Vecs {PetscInt n; Vec v;}; 66995fbd943SSatish Balay typedef struct _n_Vecs* Vecs; 670e1317eeeSBarry Smith PETSC_EXTERN PetscErrorCode VecsDestroy(Vecs); 671e1317eeeSBarry Smith PETSC_EXTERN PetscErrorCode VecsCreateSeq(MPI_Comm,PetscInt,PetscInt,Vecs*); 672e1317eeeSBarry Smith PETSC_EXTERN PetscErrorCode VecsCreateSeqWithArray(MPI_Comm,PetscInt,PetscInt,PetscScalar*,Vecs*); 673e1317eeeSBarry Smith PETSC_EXTERN PetscErrorCode VecsDuplicate(Vecs,Vecs*); 674e9fa29b7SSatish Balay 675e9e886b6SKarl Rupp #if defined(PETSC_HAVE_VIENNACL) 676b17c682bSKarl Rupp typedef struct _p_PetscViennaCLIndices* PetscViennaCLIndices; 677b17c682bSKarl Rupp PETSC_EXTERN PetscErrorCode PetscViennaCLIndicesCreate(PetscInt, PetscInt*,PetscInt, PetscInt*,PetscViennaCLIndices*); 678b17c682bSKarl Rupp PETSC_EXTERN PetscErrorCode PetscViennaCLIndicesDestroy(PetscViennaCLIndices*); 679b17c682bSKarl Rupp PETSC_EXTERN PetscErrorCode VecViennaCLCopyToGPUSome_Public(Vec,PetscViennaCLIndices); 680b17c682bSKarl Rupp PETSC_EXTERN PetscErrorCode VecViennaCLCopyFromGPUSome_Public(Vec,PetscViennaCLIndices); 681b17c682bSKarl Rupp PETSC_EXTERN PetscErrorCode VecCreateSeqViennaCL(MPI_Comm,PetscInt,Vec*); 682b17c682bSKarl Rupp PETSC_EXTERN PetscErrorCode VecCreateMPIViennaCL(MPI_Comm,PetscInt,PetscInt,Vec*); 683b8ced49eSKarl Rupp #endif 684fd314934SBarry Smith #if defined(PETSC_HAVE_CUDA) 68582f73ecaSAlejandro Lamas Daviña typedef struct _p_PetscCUDAIndices* PetscCUDAIndices; 68682f73ecaSAlejandro Lamas Daviña typedef struct _p_VecScatterCUDAIndices_StoS* VecScatterCUDAIndices_StoS; 68782f73ecaSAlejandro Lamas Daviña typedef struct _p_VecScatterCUDAIndices_PtoP* VecScatterCUDAIndices_PtoP; 688959dcdf5SJunchao Zhang PETSC_EXTERN PetscErrorCode VecCUDACopyToGPUSome_Public(Vec,PetscCUDAIndices,ScatterMode); 689959dcdf5SJunchao Zhang PETSC_EXTERN PetscErrorCode VecCUDACopyFromGPUSome_Public(Vec,PetscCUDAIndices,ScatterMode); 690959dcdf5SJunchao Zhang PETSC_EXTERN PetscErrorCode VecScatterInitializeForGPU(VecScatter,Vec); 69182f73ecaSAlejandro Lamas Daviña PETSC_EXTERN PetscErrorCode VecScatterFinalizeForGPU(VecScatter); 69282f73ecaSAlejandro Lamas Daviña PETSC_EXTERN PetscErrorCode VecCreateSeqCUDA(MPI_Comm,PetscInt,Vec*); 69376d6722aSAlejandro Lamas Daviña PETSC_EXTERN PetscErrorCode VecCreateSeqCUDAWithArray(MPI_Comm,PetscInt,PetscInt,const PetscScalar*,Vec*); 694f94e795aSKaushik Kulkarni PETSC_EXTERN PetscErrorCode VecCreateSeqCUDAWithArrays(MPI_Comm,PetscInt,PetscInt,const PetscScalar*,const PetscScalar*,Vec*); 69582f73ecaSAlejandro Lamas Daviña PETSC_EXTERN PetscErrorCode VecCreateMPICUDA(MPI_Comm,PetscInt,PetscInt,Vec*); 69676d6722aSAlejandro Lamas Daviña PETSC_EXTERN PetscErrorCode VecCreateMPICUDAWithArray(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscScalar*,Vec*); 697f94e795aSKaushik Kulkarni PETSC_EXTERN PetscErrorCode VecCreateMPICUDAWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscScalar*,const PetscScalar*,Vec*); 698b17c682bSKarl Rupp #endif 699b17c682bSKarl Rupp 700014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecNestGetSubVecs(Vec,PetscInt*,Vec**); 701014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecNestGetSubVec(Vec,PetscInt,Vec*); 702014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecNestSetSubVecs(Vec,PetscInt,PetscInt*,Vec*); 703014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecNestSetSubVec(Vec,PetscInt,Vec); 704014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecCreateNest(MPI_Comm,PetscInt,IS*,Vec*,Vec*); 705014dd563SJed Brown PETSC_EXTERN PetscErrorCode VecNestGetSize(Vec,PetscInt*); 70645b63f25SDmitry Karpeev 707c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetVec(PetscOptions,const char[],const char[],Vec,PetscBool*); 7084325cce7SMatthew G Knepley PETSC_EXTERN PetscErrorCode VecChop(Vec,PetscReal); 709ab352700SBarry Smith 710077aedafSJed Brown PETSC_EXTERN PetscErrorCode VecGetLayout(Vec,PetscLayout*); 711077aedafSJed Brown PETSC_EXTERN PetscErrorCode VecSetLayout(Vec,PetscLayout); 7129a6d0b0bSJed Brown 7139a6d0b0bSJed Brown PETSC_EXTERN PetscErrorCode PetscSectionVecView(PetscSection, Vec, PetscViewer); 7149a6d0b0bSJed Brown PETSC_EXTERN PetscErrorCode VecGetValuesSection(Vec, PetscSection, PetscInt, PetscScalar **); 7159a6d0b0bSJed Brown PETSC_EXTERN PetscErrorCode VecSetValuesSection(Vec, PetscSection, PetscInt, PetscScalar [], InsertMode); 71622d96a0cSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscSectionVecNorm(PetscSection, PetscSection, Vec, NormType, PetscReal []); 7179a6d0b0bSJed Brown 7185543aaa0SToby Isaac /*S 7195543aaa0SToby Isaac VecTagger - Object used to manage the tagging of a subset of indices based on the values of a vector. The 7205543aaa0SToby Isaac motivating application is the selection of cells for refinement or coarsening based on vector containing 7215543aaa0SToby Isaac the values in an error indicator metric. 7225543aaa0SToby Isaac 7235543aaa0SToby Isaac Level: advanced 7245543aaa0SToby Isaac S*/ 72561bbf837SToby Isaac typedef struct _p_VecTagger *VecTagger; 7265543aaa0SToby Isaac 7275543aaa0SToby Isaac /*J 7285543aaa0SToby Isaac VecTaggerType - String with the name of a VecTagger type 7295543aaa0SToby Isaac 7305543aaa0SToby Isaac Level: advanced 7315543aaa0SToby Isaac J*/ 7325543aaa0SToby Isaac typedef const char* VecTaggerType; 7334178c1b7SToby Isaac /* tag where the vector values are in a box of explicitly defined values */ 734cab77d58SToby Isaac #define VECTAGGERABSOLUTE "absolute" 7354178c1b7SToby Isaac /* tag where the vector values are in a box of values relative to the set of all values in the vector */ 7365543aaa0SToby Isaac #define VECTAGGERRELATIVE "relative" 7375543aaa0SToby Isaac /* tag where the vector values are in a relative range of the *cumulative distribution* of values in the vector */ 7381d1d0dd8SToby Isaac #define VECTAGGERCDF "cdf" 7395543aaa0SToby Isaac /* tag a vector as the union of other tags */ 7405543aaa0SToby Isaac #define VECTAGGEROR "or" 7415543aaa0SToby Isaac /* tag a vector as the intersection of other tags */ 7425543aaa0SToby Isaac #define VECTAGGERAND "and" 7435543aaa0SToby Isaac 7445543aaa0SToby Isaac PETSC_EXTERN PetscClassId VEC_TAGGER_CLASSID; 74561bbf837SToby Isaac PETSC_EXTERN PetscFunctionList VecTaggerList; 74661bbf837SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerRegister(const char[],PetscErrorCode (*) (VecTagger)); 7475543aaa0SToby Isaac 7485543aaa0SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerCreate(MPI_Comm,VecTagger *); 749cab77d58SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerSetBlockSize(VecTagger,PetscInt); 750cab77d58SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerGetBlockSize(VecTagger,PetscInt*); 7515543aaa0SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerSetType(VecTagger,VecTaggerType); 7525543aaa0SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerGetType(VecTagger,VecTaggerType *); 7535543aaa0SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerSetInvert(VecTagger,PetscBool); 7545543aaa0SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerGetInvert(VecTagger,PetscBool*); 7555543aaa0SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerSetFromOptions(VecTagger); 7565543aaa0SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerSetUp(VecTagger); 7575543aaa0SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerView(VecTagger,PetscViewer); 7585543aaa0SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerComputeIS(VecTagger,Vec,IS *); 7595543aaa0SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerDestroy(VecTagger *); 7605543aaa0SToby Isaac 7614178c1b7SToby Isaac /*S 7624178c1b7SToby Isaac VecTaggerBox - A box range used to tag values. For real scalars, this is just a closed interval; for complex scalars, the box is the closed region in the complex plane 7634178c1b7SToby Isaac such that real(min) <= real(z) <= real(max) and imag(min) <= imag(z) <= imag(max). INF is an acceptable endpoint. 76461bbf837SToby Isaac 7654178c1b7SToby Isaac Level: beginner 76661bbf837SToby Isaac 7674178c1b7SToby Isaac .seealso: VecTaggerComputeIntervals() 7684178c1b7SToby Isaac S*/ 7694178c1b7SToby Isaac typedef struct { 7704178c1b7SToby Isaac PetscScalar min; 7714178c1b7SToby Isaac PetscScalar max; 7724178c1b7SToby Isaac } VecTaggerBox; 7734178c1b7SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerComputeBoxes(VecTagger,Vec,PetscInt *,VecTaggerBox **); 7744178c1b7SToby Isaac 7754178c1b7SToby Isaac 7764178c1b7SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerAbsoluteSetBox(VecTagger,VecTaggerBox *); 7774178c1b7SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerAbsoluteGetBox(VecTagger,const VecTaggerBox **); 7784178c1b7SToby Isaac 7794178c1b7SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerRelativeSetBox(VecTagger,VecTaggerBox *); 7804178c1b7SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerRelativeGetBox(VecTagger,const VecTaggerBox **); 7814178c1b7SToby Isaac 7824178c1b7SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerCDFSetBox(VecTagger,VecTaggerBox *); 7834178c1b7SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerCDFGetBox(VecTagger,const VecTaggerBox **); 7841d1d0dd8SToby Isaac 7851d1d0dd8SToby Isaac /*E 7861d1d0dd8SToby Isaac VecTaggerCDFMethod - Determines what method is used to compute absolute values from cumulative distribution values (e.g., what value is the preimage of .95 in the cdf). Relevant only in parallel: in serial it is directly computed. 7871d1d0dd8SToby Isaac 7881d1d0dd8SToby Isaac Level: advanced 7891d1d0dd8SToby Isaac .seealso: VecTaggerCDFSetMethod(), VecTaggerCDFMethods 7901d1d0dd8SToby Isaac E*/ 7911d1d0dd8SToby Isaac typedef enum {VECTAGGER_CDF_GATHER,VECTAGGER_CDF_ITERATIVE,VECTAGGER_CDF_NUM_METHODS} VecTaggerCDFMethod; 7921d1d0dd8SToby Isaac PETSC_EXTERN const char *const VecTaggerCDFMethods[]; 7931d1d0dd8SToby Isaac 7941d1d0dd8SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerCDFSetMethod(VecTagger,VecTaggerCDFMethod); 7951d1d0dd8SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerCDFGetMethod(VecTagger,VecTaggerCDFMethod*); 7961d1d0dd8SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerCDFIterativeSetTolerances(VecTagger,PetscInt,PetscReal,PetscReal); 7971d1d0dd8SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerCDFIterativeGetTolerances(VecTagger,PetscInt*,PetscReal*,PetscReal*); 79861bbf837SToby Isaac 799497ee004SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerOrSetSubs(VecTagger,PetscInt,VecTagger*,PetscCopyMode); 800497ee004SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerOrGetSubs(VecTagger,PetscInt*,VecTagger**); 80161bbf837SToby Isaac 802497ee004SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerAndSetSubs(VecTagger,PetscInt,VecTagger*,PetscCopyMode); 803497ee004SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerAndGetSubs(VecTagger,PetscInt*,VecTagger**); 80461bbf837SToby Isaac 80561bbf837SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerInitializePackage(void); 80661bbf837SToby Isaac PETSC_EXTERN PetscErrorCode VecTaggerFinalizePackage(void); 80761bbf837SToby Isaac 8082eac72dbSBarry Smith #endif 809