1 /* 2 Include file for the matrix component of PETSc 3 */ 4 #ifndef __PETSCMAT_H 5 #define __PETSCMAT_H 6 #include "petscvec.h" 7 PETSC_EXTERN_CXX_BEGIN 8 9 /*S 10 Mat - Abstract PETSc matrix object 11 12 Level: beginner 13 14 Concepts: matrix; linear operator 15 16 .seealso: MatCreate(), MatType, MatSetType() 17 S*/ 18 typedef struct _p_Mat* Mat; 19 20 /*E 21 MatType - String with the name of a PETSc matrix or the creation function 22 with an optional dynamic library name, for example 23 http://www.mcs.anl.gov/petsc/lib.a:mymatcreate() 24 25 Level: beginner 26 27 .seealso: MatSetType(), Mat 28 E*/ 29 #define MATSAME "same" 30 #define MATSEQMAIJ "seqmaij" 31 #define MATMPIMAIJ "mpimaij" 32 #define MATMAIJ "maij" 33 #define MATIS "is" 34 #define MATMPIROWBS "mpirowbs" 35 #define MATSEQAIJ "seqaij" 36 #define MATMPIAIJ "mpiaij" 37 #define MATAIJ "aij" 38 #define MATSHELL "shell" 39 #define MATSEQBDIAG "seqbdiag" 40 #define MATMPIBDIAG "mpibdiag" 41 #define MATBDIAG "bdiag" 42 #define MATSEQDENSE "seqdense" 43 #define MATMPIDENSE "mpidense" 44 #define MATDENSE "dense" 45 #define MATSEQBAIJ "seqbaij" 46 #define MATMPIBAIJ "mpibaij" 47 #define MATBAIJ "baij" 48 #define MATMPIADJ "mpiadj" 49 #define MATSEQSBAIJ "seqsbaij" 50 #define MATMPISBAIJ "mpisbaij" 51 #define MATSBAIJ "sbaij" 52 #define MATDAAD "daad" 53 #define MATMFFD "mffd" 54 #define MATNORMAL "normal" 55 #define MATLRC "lrc" 56 #define MATSEQAIJSPOOLES "seqaijspooles" 57 #define MATMPIAIJSPOOLES "mpiaijspooles" 58 #define MATSEQSBAIJSPOOLES "seqsbaijspooles" 59 #define MATMPISBAIJSPOOLES "mpisbaijspooles" 60 #define MATAIJSPOOLES "aijspooles" 61 #define MATSBAIJSPOOLES "sbaijspooles" 62 #define MATSUPERLU "superlu" 63 #define MATSUPERLU_DIST "superlu_dist" 64 #define MATUMFPACK "umfpack" 65 #define MATESSL "essl" 66 #define MATLUSOL "lusol" 67 #define MATAIJMUMPS "aijmumps" 68 #define MATSBAIJMUMPS "sbaijmumps" 69 #define MATDSCPACK "dscpack" 70 #define MATMATLAB "matlab" 71 #define MATSEQCSRPERM "seqcsrperm" 72 #define MATMPICSRPERM "mpicsrperm" 73 #define MATCSRPERM "csrperm" 74 #define MATSEQCRL "seqcrl" 75 #define MATMPICRL "mpicrl" 76 #define MATCRL "crl" 77 #define MATPLAPACK "plapack" 78 #define MatType const char* 79 80 /* Logging support */ 81 #define MAT_FILE_COOKIE 1211216 /* used to indicate matrices in binary files */ 82 extern PetscCookie PETSCMAT_DLLEXPORT MAT_COOKIE; 83 extern PetscCookie PETSCMAT_DLLEXPORT MAT_FDCOLORING_COOKIE; 84 extern PetscCookie PETSCMAT_DLLEXPORT MAT_PARTITIONING_COOKIE; 85 extern PetscCookie PETSCMAT_DLLEXPORT MAT_NULLSPACE_COOKIE; 86 87 /*E 88 MatReuse - Indicates if matrices obtained from a previous call to MatGetSubMatrices() 89 or MatGetSubMatrix() are to be reused to store the new matrix values. 90 91 Level: beginner 92 93 Any additions/changes here MUST also be made in include/finclude/petscmat.h 94 95 .seealso: MatGetSubMatrices(), MatGetSubMatrix(), MatDestroyMatrices(), MatConvert() 96 E*/ 97 typedef enum {MAT_INITIAL_MATRIX,MAT_REUSE_MATRIX} MatReuse; 98 99 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInitializePackage(char *); 100 101 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreate(MPI_Comm,Mat*); 102 PetscPolymorphicFunction(MatCreate,(MPI_Comm comm),(comm,&A),Mat,A) 103 PetscPolymorphicFunction(MatCreate,(),(PETSC_COMM_WORLD,&A),Mat,A) 104 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetSizes(Mat,PetscInt,PetscInt,PetscInt,PetscInt); 105 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetType(Mat,MatType); 106 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetFromOptions(Mat); 107 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetUpPreallocation(Mat); 108 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRegisterAll(const char[]); 109 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat)); 110 111 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetOptionsPrefix(Mat,const char[]); 112 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAppendOptionsPrefix(Mat,const char[]); 113 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetOptionsPrefix(Mat,const char*[]); 114 115 /*MC 116 MatRegisterDynamic - Adds a new matrix type 117 118 Synopsis: 119 PetscErrorCode MatRegisterDynamic(char *name,char *path,char *name_create,PetscErrorCode (*routine_create)(Mat)) 120 121 Not Collective 122 123 Input Parameters: 124 + name - name of a new user-defined matrix type 125 . path - path (either absolute or relative) the library containing this solver 126 . name_create - name of routine to create method context 127 - routine_create - routine to create method context 128 129 Notes: 130 MatRegisterDynamic() may be called multiple times to add several user-defined solvers. 131 132 If dynamic libraries are used, then the fourth input argument (routine_create) 133 is ignored. 134 135 Sample usage: 136 .vb 137 MatRegisterDynamic("my_mat",/home/username/my_lib/lib/libO/solaris/mylib.a, 138 "MyMatCreate",MyMatCreate); 139 .ve 140 141 Then, your solver can be chosen with the procedural interface via 142 $ MatSetType(Mat,"my_mat") 143 or at runtime via the option 144 $ -mat_type my_mat 145 146 Level: advanced 147 148 Notes: ${PETSC_ARCH} occuring in pathname will be replaced with appropriate values. 149 If your function is not being put into a shared library then use VecRegister() instead 150 151 .keywords: Mat, register 152 153 .seealso: MatRegisterAll(), MatRegisterDestroy() 154 155 M*/ 156 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 157 #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,0) 158 #else 159 #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,d) 160 #endif 161 162 extern PetscTruth MatRegisterAllCalled; 163 extern PetscFList MatList; 164 165 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqDense(MPI_Comm,PetscInt,PetscInt,PetscScalar[],Mat*); 166 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIDense(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar[],Mat*); 167 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 168 PetscPolymorphicFunction(MatCreateSeqAIJ,(PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[]),(PETSC_COMM_SELF,m,n,nz,nnz,&A),Mat,A) 169 PetscPolymorphicFunction(MatCreateSeqAIJ,(PetscInt m,PetscInt n,PetscInt nz),(PETSC_COMM_SELF,m,n,nz,PETSC_NULL,&A),Mat,A) 170 PetscPolymorphicFunction(MatCreateSeqAIJ,(PetscInt m,PetscInt n,const PetscInt nnz[]),(PETSC_COMM_SELF,m,n,0,nnz,&A),Mat,A) 171 PetscPolymorphicFunction(MatCreateSeqAIJ,(PetscInt m,PetscInt n),(PETSC_COMM_SELF,m,n,0,PETSC_NULL,&A),Mat,A) 172 PetscPolymorphicSubroutine(MatCreateSeqAIJ,(PetscInt m,PetscInt n,PetscInt nz,Mat *A),(PETSC_COMM_SELF,m,n,nz,PETSC_NULL,A)) 173 PetscPolymorphicSubroutine(MatCreateSeqAIJ,(PetscInt m,PetscInt n,const PetscInt nnz[],Mat *A),(PETSC_COMM_SELF,m,n,0,nnz,A)) 174 PetscPolymorphicSubroutine(MatCreateSeqAIJ,(PetscInt m,PetscInt n,Mat *A),(PETSC_COMM_SELF,m,n,0,PETSC_NULL,A)) 175 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*); 176 PetscPolymorphicFunction(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,const PetscInt nnz[],PetscInt onz,const PetscInt onnz[]),(comm,m,n,M,N,nz,nnz,onz,onnz,&A),Mat,A) 177 PetscPolymorphicFunction(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz),(comm,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,&A),Mat,A) 178 PetscPolymorphicFunction(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[]),(comm,m,n,M,N,0,nnz,0,onz,&A),Mat,A) 179 PetscPolymorphicFunction(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N),(comm,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,&A),Mat,A) 180 PetscPolymorphicSubroutine(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz,Mat *A),(comm,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,A)) 181 PetscPolymorphicSubroutine(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[],Mat *A),(comm,m,n,M,N,0,nnz,0,onz,A)) 182 PetscPolymorphicSubroutine(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,Mat *A),(comm,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,A)) 183 PetscPolymorphicFunction(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,const PetscInt nnz[],PetscInt onz,const PetscInt onnz[]),(PETSC_COMM_WORLD,m,n,M,N,nz,nnz,onz,onnz,&A),Mat,A) 184 PetscPolymorphicFunction(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz),(PETSC_COMM_WORLD,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,&A),Mat,A) 185 PetscPolymorphicFunction(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[]),(PETSC_COMM_WORLD,m,n,M,N,0,nnz,0,onz,&A),Mat,A) 186 PetscPolymorphicFunction(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N),(PETSC_COMM_WORLD,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,&A),Mat,A) 187 PetscPolymorphicSubroutine(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz,Mat *A),(PETSC_COMM_WORLD,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,A)) 188 PetscPolymorphicSubroutine(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[],Mat *A),(PETSC_COMM_WORLD,m,n,M,N,0,nnz,0,onz,A)) 189 PetscPolymorphicSubroutine(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,Mat *A),(PETSC_COMM_WORLD,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,A)) 190 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIRowbs(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 191 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqBDiag(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscScalar*[],Mat*); 192 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIBDiag(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscScalar*[],Mat*); 193 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 194 PetscPolymorphicFunction(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[]),(PETSC_COMM_SELF,bs,m,n,nz,nnz,&A),Mat,A) 195 PetscPolymorphicFunction(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz),(PETSC_COMM_SELF,bs,m,n,nz,PETSC_NULL,&A),Mat,A) 196 PetscPolymorphicFunction(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,const PetscInt nnz[]),(PETSC_COMM_SELF,bs,m,n,0,nnz,&A),Mat,A) 197 PetscPolymorphicFunction(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n),(PETSC_COMM_SELF,bs,m,n,0,PETSC_NULL,&A),Mat,A) 198 PetscPolymorphicSubroutine(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,Mat *A),(PETSC_COMM_SELF,bs,m,n,nz,PETSC_NULL,A)) 199 PetscPolymorphicSubroutine(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,const PetscInt nnz[],Mat *A),(PETSC_COMM_SELF,bs,m,n,0,nnz,A)) 200 PetscPolymorphicSubroutine(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,Mat *A),(PETSC_COMM_SELF,bs,m,n,0,PETSC_NULL,A)) 201 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*); 202 PetscPolymorphicFunction(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,const PetscInt nnz[],PetscInt onz,const PetscInt onnz[]),(comm,bs,m,n,M,N,nz,nnz,onz,onnz,&A),Mat,A) 203 PetscPolymorphicFunction(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz),(comm,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,&A),Mat,A) 204 PetscPolymorphicFunction(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[]),(comm,bs,m,n,M,N,0,nnz,0,onz,&A),Mat,A) 205 PetscPolymorphicFunction(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N),(comm,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,&A),Mat,A) 206 PetscPolymorphicSubroutine(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz,Mat *A),(comm,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,A)) 207 PetscPolymorphicSubroutine(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[],Mat *A),(comm,bs,m,n,M,N,0,nnz,0,onz,A)) 208 PetscPolymorphicSubroutine(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,Mat *A),(comm,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,A)) 209 PetscPolymorphicFunction(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,const PetscInt nnz[],PetscInt onz,const PetscInt onnz[]),(PETSC_COMM_WORLD,bs,m,n,M,N,nz,nnz,onz,onnz,&A),Mat,A) 210 PetscPolymorphicFunction(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz),(PETSC_COMM_WORLD,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,&A),Mat,A) 211 PetscPolymorphicFunction(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[]),(PETSC_COMM_WORLD,bs,m,n,M,N,0,nnz,0,onz,&A),Mat,A) 212 PetscPolymorphicFunction(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N),(PETSC_COMM_WORLD,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,&A),Mat,A) 213 PetscPolymorphicSubroutine(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz,Mat *A),(PETSC_COMM_WORLD,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,A)) 214 PetscPolymorphicSubroutine(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[],Mat *A),(PETSC_COMM_WORLD,bs,m,n,M,N,0,nnz,0,onz,A)) 215 PetscPolymorphicSubroutine(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,Mat *A),(PETSC_COMM_WORLD,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,A)) 216 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIAdj(MPI_Comm,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscInt[],Mat*); 217 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqSBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 218 PetscPolymorphicFunction(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[]),(PETSC_COMM_SELF,bs,m,n,nz,nnz,&A),Mat,A) 219 PetscPolymorphicFunction(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz),(PETSC_COMM_SELF,bs,m,n,nz,PETSC_NULL,&A),Mat,A) 220 PetscPolymorphicFunction(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,const PetscInt nnz[]),(PETSC_COMM_SELF,bs,m,n,0,nnz,&A),Mat,A) 221 PetscPolymorphicFunction(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n),(PETSC_COMM_SELF,bs,m,n,0,PETSC_NULL,&A),Mat,A) 222 PetscPolymorphicSubroutine(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,Mat *A),(PETSC_COMM_SELF,bs,m,n,nz,PETSC_NULL,A)) 223 PetscPolymorphicSubroutine(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,const PetscInt nnz[],Mat *A),(PETSC_COMM_SELF,bs,m,n,0,nnz,A)) 224 PetscPolymorphicSubroutine(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,Mat *A),(PETSC_COMM_SELF,bs,m,n,0,PETSC_NULL,A)) 225 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPISBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*); 226 PetscPolymorphicFunction(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,const PetscInt nnz[],PetscInt onz,const PetscInt onnz[]),(comm,bs,m,n,M,N,nz,nnz,onz,onnz,&A),Mat,A) 227 PetscPolymorphicFunction(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz),(comm,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,&A),Mat,A) 228 PetscPolymorphicFunction(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[]),(comm,bs,m,n,M,N,0,nnz,0,onz,&A),Mat,A) 229 PetscPolymorphicFunction(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N),(comm,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,&A),Mat,A) 230 PetscPolymorphicSubroutine(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz,Mat *A),(comm,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,A)) 231 PetscPolymorphicSubroutine(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[],Mat *A),(comm,bs,m,n,M,N,0,nnz,0,onz,A)) 232 PetscPolymorphicSubroutine(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,Mat *A),(comm,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,A)) 233 PetscPolymorphicFunction(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,const PetscInt nnz[],PetscInt onz,const PetscInt onnz[]),(PETSC_COMM_WORLD,bs,m,n,M,N,nz,nnz,onz,onnz,&A),Mat,A) 234 PetscPolymorphicFunction(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz),(PETSC_COMM_WORLD,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,&A),Mat,A) 235 PetscPolymorphicFunction(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[]),(PETSC_COMM_WORLD,bs,m,n,M,N,0,nnz,0,onz,&A),Mat,A) 236 PetscPolymorphicFunction(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N),(PETSC_COMM_WORLD,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,&A),Mat,A) 237 PetscPolymorphicSubroutine(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz,Mat *A),(PETSC_COMM_WORLD,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,A)) 238 PetscPolymorphicSubroutine(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[],Mat *A),(PETSC_COMM_WORLD,bs,m,n,M,N,0,nnz,0,onz,A)) 239 PetscPolymorphicSubroutine(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,Mat *A),(PETSC_COMM_WORLD,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,A)) 240 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateShell(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,void *,Mat*); 241 PetscPolymorphicFunction(MatCreateShell,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,void *ctx),(comm,m,n,M,N,ctx,&A),Mat,A) 242 PetscPolymorphicFunction(MatCreateShell,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,void *ctx),(PETSC_COMM_WORLD,m,n,M,N,ctx,&A),Mat,A) 243 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateAdic(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,void (*)(void),Mat*); 244 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateNormal(Mat,Mat*); 245 PetscPolymorphicFunction(MatCreateNormal,(Mat mat),(mat,&A),Mat,A) 246 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateLRC(Mat,Mat,Mat,Mat*); 247 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateIS(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,ISLocalToGlobalMapping,Mat*); 248 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqCRL(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 249 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPICRL(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*); 250 251 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetUp(Mat); 252 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDestroy(Mat); 253 254 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPrintHelp(Mat); 255 256 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConjugate(Mat); 257 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRealPart(Mat); 258 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatImaginaryPart(Mat); 259 260 /* ------------------------------------------------------------*/ 261 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValues(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 262 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesBlocked(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 263 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesRow(Mat,PetscInt,const PetscScalar[]); 264 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesRowLocal(Mat,PetscInt,const PetscScalar[]); 265 266 /*S 267 MatStencil - Data structure (C struct) for storing information about a single row or 268 column of a matrix as index on an associated grid. 269 270 Level: beginner 271 272 Concepts: matrix; linear operator 273 274 .seealso: MatSetValuesStencil(), MatSetStencil(), MatSetValuesBlockStencil() 275 S*/ 276 typedef struct { 277 PetscInt k,j,i,c; 278 } MatStencil; 279 280 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesStencil(Mat,PetscInt,const MatStencil[],PetscInt,const MatStencil[],const PetscScalar[],InsertMode); 281 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesBlockedStencil(Mat,PetscInt,const MatStencil[],PetscInt,const MatStencil[],const PetscScalar[],InsertMode); 282 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetStencil(Mat,PetscInt,const PetscInt[],const PetscInt[],PetscInt); 283 284 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetColoring(Mat,ISColoring); 285 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesAdic(Mat,void*); 286 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesAdifor(Mat,PetscInt,void*); 287 288 /*E 289 MatAssemblyType - Indicates if the matrix is now to be used, or if you plan 290 to continue to add values to it 291 292 Level: beginner 293 294 .seealso: MatAssemblyBegin(), MatAssemblyEnd() 295 E*/ 296 typedef enum {MAT_FLUSH_ASSEMBLY=1,MAT_FINAL_ASSEMBLY=0} MatAssemblyType; 297 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAssemblyBegin(Mat,MatAssemblyType); 298 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAssemblyEnd(Mat,MatAssemblyType); 299 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAssembled(Mat,PetscTruth*); 300 301 extern PETSCMAT_DLLEXPORT PetscInt MatSetValue_Row; 302 extern PETSCMAT_DLLEXPORT PetscInt MatSetValue_Column; 303 extern PETSCMAT_DLLEXPORT PetscScalar MatSetValue_Value; 304 305 /*MC 306 MatSetValue - Set a single entry into a matrix. 307 308 Synopsis: 309 PetscErrorCode MatSetValue(Mat m,PetscInt row,PetscInt col,PetscScalar value,InsertMode mode); 310 311 Not collective 312 313 Input Parameters: 314 + m - the matrix 315 . row - the row location of the entry 316 . col - the column location of the entry 317 . value - the value to insert 318 - mode - either INSERT_VALUES or ADD_VALUES 319 320 Notes: 321 For efficiency one should use MatSetValues() and set several or many 322 values simultaneously if possible. 323 324 Level: beginner 325 326 .seealso: MatSetValues(), MatSetValueLocal() 327 M*/ 328 #define MatSetValue(v,i,j,va,mode) \ 329 ((MatSetValue_Row = i,MatSetValue_Column = j,MatSetValue_Value = va,0) || \ 330 MatSetValues(v,1,&MatSetValue_Row,1,&MatSetValue_Column,&MatSetValue_Value,mode)) 331 332 #define MatGetValue(v,i,j,va) \ 333 ((MatSetValue_Row = i,MatSetValue_Column = j,0) || \ 334 MatGetValues(v,1,&MatSetValue_Row,1,&MatSetValue_Column,&va)) 335 336 #define MatSetValueLocal(v,i,j,va,mode) \ 337 ((MatSetValue_Row = i,MatSetValue_Column = j,MatSetValue_Value = va,0) || \ 338 MatSetValuesLocal(v,1,&MatSetValue_Row,1,&MatSetValue_Column,&MatSetValue_Value,mode)) 339 340 /*E 341 MatOption - Options that may be set for a matrix and its behavior or storage 342 343 Level: beginner 344 345 Any additions/changes here MUST also be made in include/finclude/petscmat.h 346 347 .seealso: MatSetOption() 348 E*/ 349 typedef enum {MAT_ROW_ORIENTED=1,MAT_COLUMN_ORIENTED=2,MAT_ROWS_SORTED=4, 350 MAT_COLUMNS_SORTED=8,MAT_NO_NEW_NONZERO_LOCATIONS=16, 351 MAT_YES_NEW_NONZERO_LOCATIONS=32,MAT_SYMMETRIC=64, 352 MAT_STRUCTURALLY_SYMMETRIC=65,MAT_NO_NEW_DIAGONALS=66, 353 MAT_YES_NEW_DIAGONALS=67,MAT_INODE_LIMIT_1=68,MAT_INODE_LIMIT_2=69, 354 MAT_INODE_LIMIT_3=70,MAT_INODE_LIMIT_4=71,MAT_INODE_LIMIT_5=72, 355 MAT_IGNORE_OFF_PROC_ENTRIES=73,MAT_ROWS_UNSORTED=74, 356 MAT_COLUMNS_UNSORTED=75,MAT_NEW_NONZERO_LOCATION_ERR=76, 357 MAT_NEW_NONZERO_ALLOCATION_ERR=77,MAT_USE_HASH_TABLE=78, 358 MAT_KEEP_ZEROED_ROWS=79,MAT_IGNORE_ZERO_ENTRIES=80,MAT_USE_INODES=81, 359 MAT_DO_NOT_USE_INODES=82,MAT_NOT_SYMMETRIC=83,MAT_HERMITIAN=84, 360 MAT_NOT_STRUCTURALLY_SYMMETRIC=85,MAT_NOT_HERMITIAN=86, 361 MAT_SYMMETRY_ETERNAL=87,MAT_NOT_SYMMETRY_ETERNAL=88, 362 MAT_USE_COMPRESSEDROW=89,MAT_DO_NOT_USE_COMPRESSEDROW=90, 363 MAT_IGNORE_LOWER_TRIANGULAR=91,MAT_ERROR_LOWER_TRIANGULAR=92,MAT_GETROW_UPPERTRIANGULAR=93} MatOption; 364 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetOption(Mat,MatOption); 365 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetType(Mat,MatType*); 366 PetscPolymorphicFunction(MatGetType,(Mat mat),(mat,&t),MatType,t) 367 368 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetValues(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],PetscScalar[]); 369 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetRow(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]); 370 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreRow(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]); 371 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetRowUpperTriangular(Mat); 372 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreRowUpperTriangular(Mat); 373 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetColumn(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]); 374 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreColumn(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]); 375 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetColumnVector(Mat,Vec,PetscInt); 376 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetArray(Mat,PetscScalar *[]); 377 PetscPolymorphicFunction(MatGetArray,(Mat mat),(mat,&a),PetscScalar*,a) 378 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreArray(Mat,PetscScalar *[]); 379 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetBlockSize(Mat,PetscInt *); 380 PetscPolymorphicFunction(MatGetBlockSize,(Mat mat),(mat,&a),PetscInt,a) 381 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetBlockSize(Mat,PetscInt); 382 383 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMult(Mat,Vec,Vec); 384 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultAdd(Mat,Vec,Vec,Vec); 385 PetscPolymorphicSubroutine(MatMultAdd,(Mat A,Vec x,Vec y),(A,x,y,y)) 386 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTranspose(Mat,Vec,Vec); 387 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsTranspose(Mat,Mat,PetscReal,PetscTruth*); 388 PetscPolymorphicFunction(MatIsTranspose,(Mat A,Mat B,PetscReal tol),(A,B,tol,&t),PetscTruth,t) 389 PetscPolymorphicFunction(MatIsTranspose,(Mat A,Mat B),(A,B,0,&t),PetscTruth,t) 390 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTransposeAdd(Mat,Vec,Vec,Vec); 391 PetscPolymorphicSubroutine(MatMultTransposeAdd,(Mat A,Vec x,Vec y),(A,x,y,y)) 392 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultConstrained(Mat,Vec,Vec); 393 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTransposeConstrained(Mat,Vec,Vec); 394 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatSolve(Mat,Mat,Mat); 395 396 /*E 397 MatDuplicateOption - Indicates if a duplicated sparse matrix should have 398 its numerical values copied over or just its nonzero structure. 399 400 Level: beginner 401 402 Any additions/changes here MUST also be made in include/finclude/petscmat.h 403 404 .seealso: MatDuplicate() 405 E*/ 406 typedef enum {MAT_DO_NOT_COPY_VALUES,MAT_COPY_VALUES} MatDuplicateOption; 407 408 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConvertRegister(const char[],const char[],const char[],PetscErrorCode (*)(Mat,MatType,MatReuse,Mat*)); 409 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 410 #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,0) 411 #else 412 #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,d) 413 #endif 414 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConvertRegisterAll(const char[]); 415 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConvertRegisterDestroy(void); 416 extern PetscTruth MatConvertRegisterAllCalled; 417 extern PetscFList MatConvertList; 418 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConvert(Mat,MatType,MatReuse,Mat*); 419 PetscPolymorphicFunction(MatConvert,(Mat A,MatType t),(A,t,MAT_INITIAL_MATRIX,&a),Mat,a) 420 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDuplicate(Mat,MatDuplicateOption,Mat*); 421 PetscPolymorphicFunction(MatDuplicate,(Mat A,MatDuplicateOption o),(A,o,&a),Mat,a) 422 PetscPolymorphicFunction(MatDuplicate,(Mat A),(A,MAT_COPY_VALUES,&a),Mat,a) 423 424 /*E 425 MatStructure - Indicates if the matrix has the same nonzero structure 426 427 Level: beginner 428 429 Any additions/changes here MUST also be made in include/finclude/petscmat.h 430 431 .seealso: MatCopy(), KSPSetOperators(), PCSetOperators() 432 E*/ 433 typedef enum {SAME_NONZERO_PATTERN,DIFFERENT_NONZERO_PATTERN,SAME_PRECONDITIONER,SUBSET_NONZERO_PATTERN} MatStructure; 434 435 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCopy(Mat,Mat,MatStructure); 436 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatView(Mat,PetscViewer); 437 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsSymmetric(Mat,PetscReal,PetscTruth*); 438 PetscPolymorphicFunction(MatIsSymmetric,(Mat A,PetscReal tol),(A,tol,&t),PetscTruth,t) 439 PetscPolymorphicFunction(MatIsSymmetric,(Mat A),(A,0,&t),PetscTruth,t) 440 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsStructurallySymmetric(Mat,PetscTruth*); 441 PetscPolymorphicFunction(MatIsStructurallySymmetric,(Mat A),(A,&t),PetscTruth,t) 442 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsHermitian(Mat,PetscTruth*); 443 PetscPolymorphicFunction(MatIsHermitian,(Mat A),(A,&t),PetscTruth,t) 444 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsSymmetricKnown(Mat,PetscTruth*,PetscTruth*); 445 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsHermitianKnown(Mat,PetscTruth*,PetscTruth*); 446 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatLoad(PetscViewer,MatType,Mat*); 447 PetscPolymorphicFunction(MatLoad,(PetscViewer v,MatType t),(v,t,&a),Mat,a) 448 449 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetRowIJ(Mat,PetscInt,PetscTruth,PetscInt*,PetscInt *[],PetscInt *[],PetscTruth *); 450 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreRowIJ(Mat,PetscInt,PetscTruth,PetscInt *,PetscInt *[],PetscInt *[],PetscTruth *); 451 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetColumnIJ(Mat,PetscInt,PetscTruth,PetscInt*,PetscInt *[],PetscInt *[],PetscTruth *); 452 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreColumnIJ(Mat,PetscInt,PetscTruth,PetscInt *,PetscInt *[],PetscInt *[],PetscTruth *); 453 454 /*S 455 MatInfo - Context of matrix information, used with MatGetInfo() 456 457 In Fortran this is simply a double precision array of dimension MAT_INFO_SIZE 458 459 Level: intermediate 460 461 Concepts: matrix^nonzero information 462 463 .seealso: MatGetInfo(), MatInfoType 464 S*/ 465 typedef struct { 466 PetscLogDouble rows_global,columns_global; /* number of global rows and columns */ 467 PetscLogDouble rows_local,columns_local; /* number of local rows and columns */ 468 PetscLogDouble block_size; /* block size */ 469 PetscLogDouble nz_allocated,nz_used,nz_unneeded; /* number of nonzeros */ 470 PetscLogDouble memory; /* memory allocated */ 471 PetscLogDouble assemblies; /* number of matrix assemblies called */ 472 PetscLogDouble mallocs; /* number of mallocs during MatSetValues() */ 473 PetscLogDouble fill_ratio_given,fill_ratio_needed; /* fill ratio for LU/ILU */ 474 PetscLogDouble factor_mallocs; /* number of mallocs during factorization */ 475 } MatInfo; 476 477 /*E 478 MatInfoType - Indicates if you want information about the local part of the matrix, 479 the entire parallel matrix or the maximum over all the local parts. 480 481 Level: beginner 482 483 Any additions/changes here MUST also be made in include/finclude/petscmat.h 484 485 .seealso: MatGetInfo(), MatInfo 486 E*/ 487 typedef enum {MAT_LOCAL=1,MAT_GLOBAL_MAX=2,MAT_GLOBAL_SUM=3} MatInfoType; 488 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetInfo(Mat,MatInfoType,MatInfo*); 489 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatValid(Mat,PetscTruth*); 490 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetDiagonal(Mat,Vec); 491 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetRowMax(Mat,Vec); 492 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatTranspose(Mat,Mat*); 493 PetscPolymorphicFunction(MatTranspose,(Mat A),(A,&t),Mat,t) 494 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPermute(Mat,IS,IS,Mat *); 495 PetscPolymorphicFunction(MatPermute,(Mat A,IS is1,IS is2),(A,is1,is2,&t),Mat,t) 496 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPermuteSparsify(Mat,PetscInt,PetscReal,PetscReal,IS,IS,Mat *); 497 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDiagonalScale(Mat,Vec,Vec); 498 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDiagonalSet(Mat,Vec,InsertMode); 499 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatEqual(Mat,Mat,PetscTruth*); 500 PetscPolymorphicFunction(MatEqual,(Mat A,Mat B),(A,B,&t),PetscTruth,t) 501 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultEqual(Mat,Mat,PetscInt,PetscTruth*); 502 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultAddEqual(Mat,Mat,PetscInt,PetscTruth*); 503 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTransposeEqual(Mat,Mat,PetscInt,PetscTruth*); 504 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTransposeAddEqual(Mat,Mat,PetscInt,PetscTruth*); 505 506 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNorm(Mat,NormType,PetscReal *); 507 PetscPolymorphicFunction(MatNorm,(Mat A,NormType t),(A,t,&n),PetscReal,n) 508 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroEntries(Mat); 509 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroRows(Mat,PetscInt,const PetscInt [],PetscScalar); 510 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroRowsIS(Mat,IS,PetscScalar); 511 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroColumns(Mat,PetscInt,const PetscInt [],const PetscScalar*); 512 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroColumnsIS(Mat,IS,const PetscScalar*); 513 514 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatUseScaledForm(Mat,PetscTruth); 515 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatScaleSystem(Mat,Vec,Vec); 516 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatUnScaleSystem(Mat,Vec,Vec); 517 518 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetSize(Mat,PetscInt*,PetscInt*); 519 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetLocalSize(Mat,PetscInt*,PetscInt*); 520 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetOwnershipRange(Mat,PetscInt*,PetscInt*); 521 522 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetSubMatrices(Mat,PetscInt,const IS[],const IS[],MatReuse,Mat *[]); 523 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDestroyMatrices(PetscInt,Mat *[]); 524 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetSubMatrix(Mat,IS,IS,PetscInt,MatReuse,Mat *); 525 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetSubMatrixRaw(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],PetscInt,MatReuse,Mat *); 526 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMerge(MPI_Comm,Mat,PetscInt,MatReuse,Mat*); 527 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMerge_SeqsToMPI(MPI_Comm,Mat,PetscInt,PetscInt,MatReuse,Mat*); 528 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMerge_SeqsToMPISymbolic(MPI_Comm,Mat,PetscInt,PetscInt,Mat*); 529 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMerge_SeqsToMPINumeric(Mat,Mat); 530 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDestroy_MPIAIJ_SeqsToMPI(Mat); 531 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetLocalMat(Mat,MatReuse,Mat*); 532 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetLocalMatCondensed(Mat,MatReuse,IS*,IS*,Mat*); 533 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetBrowsOfAcols(Mat,Mat,MatReuse,IS*,IS*,PetscInt*,Mat*); 534 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetBrowsOfAoCols(Mat,Mat,MatReuse,PetscInt**,PetscScalar**,Mat*); 535 #if defined (PETSC_USE_CTABLE) 536 #include "petscctable.h" 537 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetCommunicationStructs(Mat, Vec *, PetscTable *, VecScatter *); 538 #else 539 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetCommunicationStructs(Mat, Vec *, PetscInt *[], VecScatter *); 540 #endif 541 542 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIncreaseOverlap(Mat,PetscInt,IS[],PetscInt); 543 544 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMult(Mat,Mat,MatReuse,PetscReal,Mat*); 545 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultSymbolic(Mat,Mat,PetscReal,Mat*); 546 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultNumeric(Mat,Mat,Mat); 547 548 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPtAP(Mat,Mat,MatReuse,PetscReal,Mat*); 549 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPtAPSymbolic(Mat,Mat,PetscReal,Mat*); 550 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPtAPNumeric(Mat,Mat,Mat); 551 552 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultTranspose(Mat,Mat,MatReuse,PetscReal,Mat*); 553 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultTransposeSymbolic(Mat,Mat,PetscReal,Mat*); 554 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultTransposeNumeric(Mat,Mat,Mat); 555 556 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAXPY(Mat,PetscScalar,Mat,MatStructure); 557 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAYPX(Mat,PetscScalar,Mat); 558 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCompress(Mat); 559 560 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatScale(Mat,PetscScalar); 561 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShift(Mat,PetscScalar); 562 563 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetLocalToGlobalMapping(Mat,ISLocalToGlobalMapping); 564 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping); 565 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroRowsLocal(Mat,PetscInt,const PetscInt [],PetscScalar); 566 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroRowsLocalIS(Mat,IS,PetscScalar); 567 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesLocal(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 568 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesBlockedLocal(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 569 570 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatStashSetInitialSize(Mat,PetscInt,PetscInt); 571 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatStashGetInfo(Mat,PetscInt*,PetscInt*,PetscInt*,PetscInt*); 572 573 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInterpolate(Mat,Vec,Vec); 574 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInterpolateAdd(Mat,Vec,Vec,Vec); 575 PetscPolymorphicSubroutine(MatInterpolateAdd,(Mat A,Vec x,Vec y),(A,x,y,y)) 576 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestrict(Mat,Vec,Vec); 577 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetVecs(Mat,Vec*,Vec*); 578 579 /*MC 580 MatPreallocateInitialize - Begins the block of code that will count the number of nonzeros per 581 row in a matrix providing the data that one can use to correctly preallocate the matrix. 582 583 Synopsis: 584 PetscErrorCode MatPreallocateInitialize(MPI_Comm comm, PetscInt nrows, PetscInt ncols, PetscInt *dnz, PetscInt *onz) 585 586 Collective on MPI_Comm 587 588 Input Parameters: 589 + comm - the communicator that will share the eventually allocated matrix 590 . nrows - the number of LOCAL rows in the matrix 591 - ncols - the number of LOCAL columns in the matrix 592 593 Output Parameters: 594 + dnz - the array that will be passed to the matrix preallocation routines 595 - ozn - the other array passed to the matrix preallocation routines 596 597 598 Level: intermediate 599 600 Notes: 601 See the chapter in the users manual on performance for more details 602 603 Do not malloc or free dnz and onz, that is handled internally by these routines 604 605 Use MatPreallocateInitializeSymmetric() for symmetric matrices (MPISBAIJ matrices) 606 607 Concepts: preallocation^Matrix 608 609 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), 610 MatPreallocateInitializeSymmetric(), MatPreallocateSymmetricSetLocal() 611 M*/ 612 #define MatPreallocateInitialize(comm,nrows,ncols,dnz,onz) 0; \ 613 { \ 614 PetscErrorCode _4_ierr; PetscInt __tmp = (nrows),__ctmp = (ncols),__rstart,__start,__end; \ 615 _4_ierr = PetscMalloc(2*__tmp*sizeof(PetscInt),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\ 616 _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(PetscInt));CHKERRQ(_4_ierr);\ 617 _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __start = __end - __ctmp;\ 618 _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp; 619 620 /*MC 621 MatPreallocateSymmetricInitialize - Begins the block of code that will count the number of nonzeros per 622 row in a matrix providing the data that one can use to correctly preallocate the matrix. 623 624 Synopsis: 625 PetscErrorCode MatPreallocateSymmetricInitialize(MPI_Comm comm, PetscInt nrows, PetscInt ncols, PetscInt *dnz, PetscInt *onz) 626 627 Collective on MPI_Comm 628 629 Input Parameters: 630 + comm - the communicator that will share the eventually allocated matrix 631 . nrows - the number of LOCAL rows in the matrix 632 - ncols - the number of LOCAL columns in the matrix 633 634 Output Parameters: 635 + dnz - the array that will be passed to the matrix preallocation routines 636 - ozn - the other array passed to the matrix preallocation routines 637 638 639 Level: intermediate 640 641 Notes: 642 See the chapter in the users manual on performance for more details 643 644 Do not malloc or free dnz and onz, that is handled internally by these routines 645 646 Concepts: preallocation^Matrix 647 648 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), 649 MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal() 650 M*/ 651 #define MatPreallocateSymmetricInitialize(comm,nrows,ncols,dnz,onz) 0; \ 652 { \ 653 PetscErrorCode _4_ierr; PetscInt __tmp = (nrows),__ctmp = (ncols),__rstart,__end; \ 654 _4_ierr = PetscMalloc(2*__tmp*sizeof(PetscInt),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\ 655 _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(PetscInt));CHKERRQ(_4_ierr);\ 656 _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr);\ 657 _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp; 658 659 /*MC 660 MatPreallocateSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be 661 inserted using a local number of the rows and columns 662 663 Synopsis: 664 PetscErrorCode MatPreallocateSetLocal(ISLocalToGlobalMappping map,PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz) 665 666 Not Collective 667 668 Input Parameters: 669 + map - the mapping between local numbering and global numbering 670 . nrows - the number of rows indicated 671 . rows - the indices of the rows 672 . ncols - the number of columns in the matrix 673 . cols - the columns indicated 674 . dnz - the array that will be passed to the matrix preallocation routines 675 - ozn - the other array passed to the matrix preallocation routines 676 677 678 Level: intermediate 679 680 Notes: 681 See the chapter in the users manual on performance for more details 682 683 Do not malloc or free dnz and onz, that is handled internally by these routines 684 685 Concepts: preallocation^Matrix 686 687 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 688 MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal() 689 M*/ 690 #define MatPreallocateSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\ 691 {\ 692 PetscInt __l;\ 693 _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\ 694 _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\ 695 for (__l=0;__l<nrows;__l++) {\ 696 _4_ierr = MatPreallocateSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\ 697 }\ 698 } 699 700 /*MC 701 MatPreallocateSymmetricSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be 702 inserted using a local number of the rows and columns 703 704 Synopsis: 705 PetscErrorCode MatPreallocateSymmetricSetLocal(ISLocalToGlobalMappping map,PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz) 706 707 Not Collective 708 709 Input Parameters: 710 + map - the mapping between local numbering and global numbering 711 . nrows - the number of rows indicated 712 . rows - the indices of the rows 713 . ncols - the number of columns in the matrix 714 . cols - the columns indicated 715 . dnz - the array that will be passed to the matrix preallocation routines 716 - ozn - the other array passed to the matrix preallocation routines 717 718 719 Level: intermediate 720 721 Notes: 722 See the chapter in the users manual on performance for more details 723 724 Do not malloc or free dnz and onz that is handled internally by these routines 725 726 Concepts: preallocation^Matrix 727 728 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 729 MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal() 730 M*/ 731 #define MatPreallocateSymmetricSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\ 732 {\ 733 PetscInt __l;\ 734 _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\ 735 _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\ 736 for (__l=0;__l<nrows;__l++) {\ 737 _4_ierr = MatPreallocateSymmetricSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\ 738 }\ 739 } 740 741 /*MC 742 MatPreallocateSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be 743 inserted using a local number of the rows and columns 744 745 Synopsis: 746 PetscErrorCode MatPreallocateSet(PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz) 747 748 Not Collective 749 750 Input Parameters: 751 + nrows - the number of rows indicated 752 . rows - the indices of the rows 753 . ncols - the number of columns in the matrix 754 - cols - the columns indicated 755 756 Output Parameters: 757 + dnz - the array that will be passed to the matrix preallocation routines 758 - ozn - the other array passed to the matrix preallocation routines 759 760 761 Level: intermediate 762 763 Notes: 764 See the chapter in the users manual on performance for more details 765 766 Do not malloc or free dnz and onz that is handled internally by these routines 767 768 Concepts: preallocation^Matrix 769 770 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 771 MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal() 772 M*/ 773 #define MatPreallocateSet(row,nc,cols,dnz,onz) 0;\ 774 { PetscInt __i; \ 775 for (__i=0; __i<nc; __i++) {\ 776 if (cols[__i] < __start || cols[__i] >= __end) onz[row - __rstart]++; \ 777 }\ 778 dnz[row - __rstart] = nc - onz[row - __rstart];\ 779 } 780 781 /*MC 782 MatPreallocateSymmetricSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be 783 inserted using a local number of the rows and columns 784 785 Synopsis: 786 PetscErrorCode MatPreallocateSymmetricSet(PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz) 787 788 Not Collective 789 790 Input Parameters: 791 + nrows - the number of rows indicated 792 . rows - the indices of the rows 793 . ncols - the number of columns in the matrix 794 . cols - the columns indicated 795 . dnz - the array that will be passed to the matrix preallocation routines 796 - ozn - the other array passed to the matrix preallocation routines 797 798 799 Level: intermediate 800 801 Notes: 802 See the chapter in the users manual on performance for more details 803 804 Do not malloc or free dnz and onz that is handled internally by these routines 805 806 Concepts: preallocation^Matrix 807 808 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 809 MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal() 810 M*/ 811 #define MatPreallocateSymmetricSet(row,nc,cols,dnz,onz) 0;\ 812 { PetscInt __i; \ 813 for (__i=0; __i<nc; __i++) {\ 814 if (cols[__i] >= __end) onz[row - __rstart]++; \ 815 else if (cols[__i] >= row) dnz[row - __rstart]++;\ 816 }\ 817 } 818 819 /*MC 820 MatPreallocateFinalize - Ends the block of code that will count the number of nonzeros per 821 row in a matrix providing the data that one can use to correctly preallocate the matrix. 822 823 Synopsis: 824 PetscErrorCode MatPreallocateFinalize(PetscInt *dnz, PetscInt *onz) 825 826 Collective on MPI_Comm 827 828 Input Parameters: 829 + dnz - the array that will be passed to the matrix preallocation routines 830 - ozn - the other array passed to the matrix preallocation routines 831 832 833 Level: intermediate 834 835 Notes: 836 See the chapter in the users manual on performance for more details 837 838 Do not malloc or free dnz and onz that is handled internally by these routines 839 840 Concepts: preallocation^Matrix 841 842 .seealso: MatPreallocateInitialize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), 843 MatPreallocateSymmetricInitialize(), MatPreallocateSymmetricSetLocal() 844 M*/ 845 #define MatPreallocateFinalize(dnz,onz) 0;_4_ierr = PetscFree(dnz);CHKERRQ(_4_ierr);} 846 847 848 849 /* Routines unique to particular data structures */ 850 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShellGetContext(Mat,void **); 851 PetscPolymorphicFunction(MatShellGetContext,(Mat A),(A,&t),void*,t) 852 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatBDiagGetData(Mat,PetscInt*,PetscInt*,PetscInt*[],PetscInt*[],PetscScalar***); 853 854 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInodeAdjustForInodes(Mat,IS*,IS*); 855 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInodeGetInodeSizes(Mat,PetscInt *,PetscInt *[],PetscInt *); 856 857 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqAIJSetColumnIndices(Mat,PetscInt[]); 858 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqBAIJSetColumnIndices(Mat,PetscInt[]); 859 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscScalar[],Mat*); 860 861 #define MAT_SKIP_ALLOCATION -4 862 863 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[]); 864 PetscPolymorphicSubroutine(MatSeqBAIJSetPreallocation,(Mat A,PetscInt bs,const PetscInt nnz[]),(A,bs,0,nnz)) 865 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqSBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[]); 866 PetscPolymorphicSubroutine(MatSeqSBAIJSetPreallocation,(Mat A,PetscInt bs,const PetscInt nnz[]),(A,bs,0,nnz)) 867 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqAIJSetPreallocation(Mat,PetscInt,const PetscInt[]); 868 PetscPolymorphicSubroutine(MatSeqAIJSetPreallocation,(Mat A,const PetscInt nnz[]),(A,0,nnz)) 869 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqDensePreallocation(Mat,PetscScalar[]); 870 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqBDiagSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscScalar*[]); 871 872 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 873 PetscPolymorphicSubroutine(MatMPIBAIJSetPreallocation,(Mat A,PetscInt bs,const PetscInt nnz[],const PetscInt onz[]),(A,bs,0,nnz,0,onz)) 874 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPISBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 875 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIAIJSetPreallocation(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 876 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqAIJSetPreallocationCSR(Mat,const PetscInt [],const PetscInt [],const PetscScalar []); 877 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIAIJSetPreallocationCSR(Mat,const PetscInt[],const PetscInt[],const PetscScalar[]); 878 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBAIJSetPreallocationCSR(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]); 879 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIDensePreallocation(Mat,PetscScalar[]); 880 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBDiagSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscScalar*[]); 881 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIAdjSetPreallocation(Mat,PetscInt[],PetscInt[],PetscInt[]); 882 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIDenseSetPreallocation(Mat,PetscScalar[]); 883 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqDenseSetPreallocation(Mat,PetscScalar[]); 884 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIRowbsSetPreallocation(Mat,PetscInt,const PetscInt[]); 885 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIAIJGetSeqAIJ(Mat,Mat*,Mat*,PetscInt*[]); 886 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBAIJGetSeqBAIJ(Mat,Mat*,Mat*,PetscInt*[]); 887 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAdicSetLocalFunction(Mat,void (*)(void)); 888 889 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqDenseSetLDA(Mat,PetscInt); 890 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDenseGetLocalMatrix(Mat,Mat*); 891 892 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatStoreValues(Mat); 893 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRetrieveValues(Mat); 894 895 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDAADSetCtx(Mat,void*); 896 897 /* 898 These routines are not usually accessed directly, rather solving is 899 done through the KSP and PC interfaces. 900 */ 901 902 /*E 903 MatOrderingType - String with the name of a PETSc matrix ordering or the creation function 904 with an optional dynamic library name, for example 905 http://www.mcs.anl.gov/petsc/lib.a:orderingcreate() 906 907 Level: beginner 908 909 .seealso: MatGetOrdering() 910 E*/ 911 #define MatOrderingType char* 912 #define MATORDERING_NATURAL "natural" 913 #define MATORDERING_ND "nd" 914 #define MATORDERING_1WD "1wd" 915 #define MATORDERING_RCM "rcm" 916 #define MATORDERING_QMD "qmd" 917 #define MATORDERING_ROWLENGTH "rowlength" 918 #define MATORDERING_DSC_ND "dsc_nd" 919 #define MATORDERING_DSC_MMD "dsc_mmd" 920 #define MATORDERING_DSC_MDF "dsc_mdf" 921 #define MATORDERING_CONSTRAINED "constrained" 922 #define MATORDERING_IDENTITY "identity" 923 #define MATORDERING_REVERSE "reverse" 924 925 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetOrdering(Mat,const MatOrderingType,IS*,IS*); 926 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetOrderingList(PetscFList *list); 927 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatOrderingRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat,const MatOrderingType,IS*,IS*)); 928 929 /*MC 930 MatOrderingRegisterDynamic - Adds a new sparse matrix ordering to the 931 matrix package. 932 933 Synopsis: 934 PetscErrorCode MatOrderingRegisterDynamic(char *name_ordering,char *path,char *name_create,PetscErrorCode (*routine_create)(MatOrdering)) 935 936 Not Collective 937 938 Input Parameters: 939 + sname - name of ordering (for example MATORDERING_ND) 940 . path - location of library where creation routine is 941 . name - name of function that creates the ordering type,a string 942 - function - function pointer that creates the ordering 943 944 Level: developer 945 946 If dynamic libraries are used, then the fourth input argument (function) 947 is ignored. 948 949 Sample usage: 950 .vb 951 MatOrderingRegisterDynamic("my_order",/home/username/my_lib/lib/libO/solaris/mylib.a, 952 "MyOrder",MyOrder); 953 .ve 954 955 Then, your partitioner can be chosen with the procedural interface via 956 $ MatOrderingSetType(part,"my_order) 957 or at runtime via the option 958 $ -pc_factor_mat_ordering_type my_order 959 960 ${PETSC_ARCH} occuring in pathname will be replaced with appropriate values. 961 962 .keywords: matrix, ordering, register 963 964 .seealso: MatOrderingRegisterDestroy(), MatOrderingRegisterAll() 965 M*/ 966 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 967 #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,0) 968 #else 969 #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,d) 970 #endif 971 972 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatOrderingRegisterDestroy(void); 973 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatOrderingRegisterAll(const char[]); 974 extern PetscTruth MatOrderingRegisterAllCalled; 975 extern PetscFList MatOrderingList; 976 977 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatReorderForNonzeroDiagonal(Mat,PetscReal,IS,IS); 978 979 /*S 980 MatFactorInfo - Data passed into the matrix factorization routines 981 982 In Fortran these are simply double precision arrays of size MAT_FACTORINFO_SIZE 983 984 Notes: These are not usually directly used by users, instead use PC type of LU, ILU, CHOLESKY or ICC. 985 986 Level: developer 987 988 .seealso: MatLUFactorSymbolic(), MatILUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatICCFactorSymbolic(), MatICCFactor(), 989 MatFactorInfoInitialize() 990 991 S*/ 992 typedef struct { 993 PetscReal shiftnz; /* scaling of identity added to matrix to prevent zero pivots */ 994 PetscReal shiftpd; /* if true, shift until positive pivots */ 995 PetscReal shift_fraction; /* record shift fraction taken */ 996 PetscReal diagonal_fill; /* force diagonal to fill in if initially not filled */ 997 PetscReal dt; /* drop tolerance */ 998 PetscReal dtcol; /* tolerance for pivoting */ 999 PetscReal dtcount; /* maximum nonzeros to be allowed per row */ 1000 PetscReal fill; /* expected fill; nonzeros in factored matrix/nonzeros in original matrix*/ 1001 PetscReal levels; /* ICC/ILU(levels) */ 1002 PetscReal pivotinblocks; /* for BAIJ and SBAIJ matrices pivot in factorization on blocks, default 1.0 1003 factorization may be faster if do not pivot */ 1004 PetscReal zeropivot; /* pivot is called zero if less than this */ 1005 } MatFactorInfo; 1006 1007 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFactorInfoInitialize(MatFactorInfo*); 1008 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCholeskyFactor(Mat,IS,MatFactorInfo*); 1009 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCholeskyFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*); 1010 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCholeskyFactorNumeric(Mat,MatFactorInfo*,Mat*); 1011 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatLUFactor(Mat,IS,IS,MatFactorInfo*); 1012 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatILUFactor(Mat,IS,IS,MatFactorInfo*); 1013 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatLUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*); 1014 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatILUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*); 1015 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatICCFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*); 1016 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatICCFactor(Mat,IS,MatFactorInfo*); 1017 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatLUFactorNumeric(Mat,MatFactorInfo*,Mat*); 1018 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatILUDTFactor(Mat,IS,IS,MatFactorInfo*,Mat *); 1019 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetInertia(Mat,PetscInt*,PetscInt*,PetscInt*); 1020 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolve(Mat,Vec,Vec); 1021 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatForwardSolve(Mat,Vec,Vec); 1022 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatBackwardSolve(Mat,Vec,Vec); 1023 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolveAdd(Mat,Vec,Vec,Vec); 1024 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolveTranspose(Mat,Vec,Vec); 1025 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolveTransposeAdd(Mat,Vec,Vec,Vec); 1026 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolves(Mat,Vecs,Vecs); 1027 1028 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetUnfactored(Mat); 1029 1030 /*E 1031 MatSORType - What type of (S)SOR to perform 1032 1033 Level: beginner 1034 1035 May be bitwise ORd together 1036 1037 Any additions/changes here MUST also be made in include/finclude/petscmat.h 1038 1039 MatSORType may be bitwise ORd together, so do not change the numbers 1040 1041 .seealso: MatRelax(), MatPBRelax() 1042 E*/ 1043 typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3, 1044 SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8, 1045 SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16, 1046 SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType; 1047 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,PetscInt,PetscInt,Vec); 1048 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPBRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,PetscInt,PetscInt,Vec); 1049 1050 /* 1051 These routines are for efficiently computing Jacobians via finite differences. 1052 */ 1053 1054 /*E 1055 MatColoringType - String with the name of a PETSc matrix coloring or the creation function 1056 with an optional dynamic library name, for example 1057 http://www.mcs.anl.gov/petsc/lib.a:coloringcreate() 1058 1059 Level: beginner 1060 1061 .seealso: MatGetColoring() 1062 E*/ 1063 #define MatColoringType char* 1064 #define MATCOLORING_NATURAL "natural" 1065 #define MATCOLORING_SL "sl" 1066 #define MATCOLORING_LF "lf" 1067 #define MATCOLORING_ID "id" 1068 1069 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetColoring(Mat,const MatColoringType,ISColoring*); 1070 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatColoringRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat,const MatColoringType,ISColoring *)); 1071 1072 /*MC 1073 MatColoringRegisterDynamic - Adds a new sparse matrix coloring to the 1074 matrix package. 1075 1076 Synopsis: 1077 PetscErrorCode MatColoringRegisterDynamic(char *name_coloring,char *path,char *name_create,PetscErrorCode (*routine_create)(MatColoring)) 1078 1079 Not Collective 1080 1081 Input Parameters: 1082 + sname - name of Coloring (for example MATCOLORING_SL) 1083 . path - location of library where creation routine is 1084 . name - name of function that creates the Coloring type, a string 1085 - function - function pointer that creates the coloring 1086 1087 Level: developer 1088 1089 If dynamic libraries are used, then the fourth input argument (function) 1090 is ignored. 1091 1092 Sample usage: 1093 .vb 1094 MatColoringRegisterDynamic("my_color",/home/username/my_lib/lib/libO/solaris/mylib.a, 1095 "MyColor",MyColor); 1096 .ve 1097 1098 Then, your partitioner can be chosen with the procedural interface via 1099 $ MatColoringSetType(part,"my_color") 1100 or at runtime via the option 1101 $ -mat_coloring_type my_color 1102 1103 $PETSC_ARCH occuring in pathname will be replaced with appropriate values. 1104 1105 .keywords: matrix, Coloring, register 1106 1107 .seealso: MatColoringRegisterDestroy(), MatColoringRegisterAll() 1108 M*/ 1109 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 1110 #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,0) 1111 #else 1112 #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,d) 1113 #endif 1114 1115 extern PetscTruth MatColoringRegisterAllCalled; 1116 1117 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatColoringRegisterAll(const char[]); 1118 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatColoringRegisterDestroy(void); 1119 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatColoringPatch(Mat,PetscInt,PetscInt,ISColoringValue[],ISColoring*); 1120 1121 /*S 1122 MatFDColoring - Object for computing a sparse Jacobian via finite differences 1123 and coloring 1124 1125 Level: beginner 1126 1127 Concepts: coloring, sparse Jacobian, finite differences 1128 1129 .seealso: MatFDColoringCreate() 1130 S*/ 1131 typedef struct _p_MatFDColoring* MatFDColoring; 1132 1133 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringCreate(Mat,ISColoring,MatFDColoring *); 1134 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringDestroy(MatFDColoring); 1135 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringView(MatFDColoring,PetscViewer); 1136 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetFunction(MatFDColoring,PetscErrorCode (*)(void),void*); 1137 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringGetFunction(MatFDColoring,PetscErrorCode (**)(void),void**); 1138 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetParameters(MatFDColoring,PetscReal,PetscReal); 1139 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetFrequency(MatFDColoring,PetscInt); 1140 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringGetFrequency(MatFDColoring,PetscInt*); 1141 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetFromOptions(MatFDColoring); 1142 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *); 1143 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringApplyTS(Mat,MatFDColoring,PetscReal,Vec,MatStructure*,void *); 1144 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetRecompute(MatFDColoring); 1145 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetF(MatFDColoring,Vec); 1146 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringGetPerturbedColumns(MatFDColoring,PetscInt*,PetscInt*[]); 1147 /* 1148 These routines are for partitioning matrices: currently used only 1149 for adjacency matrix, MatCreateMPIAdj(). 1150 */ 1151 1152 /*S 1153 MatPartitioning - Object for managing the partitioning of a matrix or graph 1154 1155 Level: beginner 1156 1157 Concepts: partitioning 1158 1159 .seealso: MatPartitioningCreate(), MatPartitioningType 1160 S*/ 1161 typedef struct _p_MatPartitioning* MatPartitioning; 1162 1163 /*E 1164 MatPartitioningType - String with the name of a PETSc matrix partitioning or the creation function 1165 with an optional dynamic library name, for example 1166 http://www.mcs.anl.gov/petsc/lib.a:partitioningcreate() 1167 1168 Level: beginner 1169 1170 .seealso: MatPartitioningCreate(), MatPartitioning 1171 E*/ 1172 #define MatPartitioningType char* 1173 #define MAT_PARTITIONING_CURRENT "current" 1174 #define MAT_PARTITIONING_SQUARE "square" 1175 #define MAT_PARTITIONING_PARMETIS "parmetis" 1176 #define MAT_PARTITIONING_CHACO "chaco" 1177 #define MAT_PARTITIONING_JOSTLE "jostle" 1178 #define MAT_PARTITIONING_PARTY "party" 1179 #define MAT_PARTITIONING_SCOTCH "scotch" 1180 1181 1182 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningCreate(MPI_Comm,MatPartitioning*); 1183 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetType(MatPartitioning,const MatPartitioningType); 1184 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetNParts(MatPartitioning,PetscInt); 1185 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetAdjacency(MatPartitioning,Mat); 1186 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetVertexWeights(MatPartitioning,const PetscInt[]); 1187 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetPartitionWeights(MatPartitioning,const PetscReal []); 1188 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningApply(MatPartitioning,IS*); 1189 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningDestroy(MatPartitioning); 1190 1191 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningRegister(const char[],const char[],const char[],PetscErrorCode (*)(MatPartitioning)); 1192 1193 /*MC 1194 MatPartitioningRegisterDynamic - Adds a new sparse matrix partitioning to the 1195 matrix package. 1196 1197 Synopsis: 1198 PetscErrorCode MatPartitioningRegisterDynamic(char *name_partitioning,char *path,char *name_create,PetscErrorCode (*routine_create)(MatPartitioning)) 1199 1200 Not Collective 1201 1202 Input Parameters: 1203 + sname - name of partitioning (for example MAT_PARTITIONING_CURRENT) or parmetis 1204 . path - location of library where creation routine is 1205 . name - name of function that creates the partitioning type, a string 1206 - function - function pointer that creates the partitioning type 1207 1208 Level: developer 1209 1210 If dynamic libraries are used, then the fourth input argument (function) 1211 is ignored. 1212 1213 Sample usage: 1214 .vb 1215 MatPartitioningRegisterDynamic("my_part",/home/username/my_lib/lib/libO/solaris/mylib.a, 1216 "MyPartCreate",MyPartCreate); 1217 .ve 1218 1219 Then, your partitioner can be chosen with the procedural interface via 1220 $ MatPartitioningSetType(part,"my_part") 1221 or at runtime via the option 1222 $ -mat_partitioning_type my_part 1223 1224 $PETSC_ARCH occuring in pathname will be replaced with appropriate values. 1225 1226 .keywords: matrix, partitioning, register 1227 1228 .seealso: MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll() 1229 M*/ 1230 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 1231 #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,0) 1232 #else 1233 #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,d) 1234 #endif 1235 1236 extern PetscTruth MatPartitioningRegisterAllCalled; 1237 1238 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningRegisterAll(const char[]); 1239 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningRegisterDestroy(void); 1240 1241 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningView(MatPartitioning,PetscViewer); 1242 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetFromOptions(MatPartitioning); 1243 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningGetType(MatPartitioning,MatPartitioningType*); 1244 1245 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningParmetisSetCoarseSequential(MatPartitioning); 1246 1247 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningJostleSetCoarseLevel(MatPartitioning,PetscReal); 1248 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningJostleSetCoarseSequential(MatPartitioning); 1249 1250 typedef enum {MP_CHACO_MULTILEVEL_KL,MP_CHACO_SPECTRAL,MP_CHACO_LINEAR,MP_CHACO_RANDOM, MP_CHACO_SCATTERED} MPChacoGlobalType; 1251 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetGlobal(MatPartitioning, MPChacoGlobalType); 1252 typedef enum { MP_CHACO_KERNIGHAN_LIN, MP_CHACO_NONE } MPChacoLocalType; 1253 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetLocal(MatPartitioning, MPChacoLocalType); 1254 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetCoarseLevel(MatPartitioning,PetscReal); 1255 typedef enum { MP_CHACO_LANCZOS, MP_CHACO_RQI_SYMMLQ } MPChacoEigenType; 1256 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetEigenSolver(MatPartitioning,MPChacoEigenType); 1257 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetEigenTol(MatPartitioning, PetscReal); 1258 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetEigenNumber(MatPartitioning, PetscInt); 1259 1260 #define MP_PARTY_OPT "opt" 1261 #define MP_PARTY_LIN "lin" 1262 #define MP_PARTY_SCA "sca" 1263 #define MP_PARTY_RAN "ran" 1264 #define MP_PARTY_GBF "gbf" 1265 #define MP_PARTY_GCF "gcf" 1266 #define MP_PARTY_BUB "bub" 1267 #define MP_PARTY_DEF "def" 1268 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetGlobal(MatPartitioning, const char*); 1269 #define MP_PARTY_HELPFUL_SETS "hs" 1270 #define MP_PARTY_KERNIGHAN_LIN "kl" 1271 #define MP_PARTY_NONE "no" 1272 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetLocal(MatPartitioning, const char*); 1273 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetCoarseLevel(MatPartitioning,PetscReal); 1274 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetBipart(MatPartitioning,PetscTruth); 1275 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetMatchOptimization(MatPartitioning,PetscTruth); 1276 1277 typedef enum { MP_SCOTCH_GREEDY, MP_SCOTCH_GPS, MP_SCOTCH_GR_GPS } MPScotchGlobalType; 1278 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetArch(MatPartitioning,const char*); 1279 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetMultilevel(MatPartitioning); 1280 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetGlobal(MatPartitioning,MPScotchGlobalType); 1281 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetCoarseLevel(MatPartitioning,PetscReal); 1282 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetHostList(MatPartitioning,const char*); 1283 typedef enum { MP_SCOTCH_KERNIGHAN_LIN, MP_SCOTCH_NONE } MPScotchLocalType; 1284 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetLocal(MatPartitioning,MPScotchLocalType); 1285 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetMapping(MatPartitioning); 1286 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetStrategy(MatPartitioning,char*); 1287 1288 /* 1289 If you add entries here you must also add them to finclude/petscmat.h 1290 */ 1291 typedef enum { MATOP_SET_VALUES=0, 1292 MATOP_GET_ROW=1, 1293 MATOP_RESTORE_ROW=2, 1294 MATOP_MULT=3, 1295 MATOP_MULT_ADD=4, 1296 MATOP_MULT_TRANSPOSE=5, 1297 MATOP_MULT_TRANSPOSE_ADD=6, 1298 MATOP_SOLVE=7, 1299 MATOP_SOLVE_ADD=8, 1300 MATOP_SOLVE_TRANSPOSE=9, 1301 MATOP_SOLVE_TRANSPOSE_ADD=10, 1302 MATOP_LUFACTOR=11, 1303 MATOP_CHOLESKYFACTOR=12, 1304 MATOP_RELAX=13, 1305 MATOP_TRANSPOSE=14, 1306 MATOP_GETINFO=15, 1307 MATOP_EQUAL=16, 1308 MATOP_GET_DIAGONAL=17, 1309 MATOP_DIAGONAL_SCALE=18, 1310 MATOP_NORM=19, 1311 MATOP_ASSEMBLY_BEGIN=20, 1312 MATOP_ASSEMBLY_END=21, 1313 MATOP_COMPRESS=22, 1314 MATOP_SET_OPTION=23, 1315 MATOP_ZERO_ENTRIES=24, 1316 MATOP_ZERO_ROWS=25, 1317 MATOP_LUFACTOR_SYMBOLIC=26, 1318 MATOP_LUFACTOR_NUMERIC=27, 1319 MATOP_CHOLESKY_FACTOR_SYMBOLIC=28, 1320 MATOP_CHOLESKY_FACTOR_NUMERIC=29, 1321 MATOP_SETUP_PREALLOCATION=30, 1322 MATOP_ILUFACTOR_SYMBOLIC=31, 1323 MATOP_ICCFACTOR_SYMBOLIC=32, 1324 MATOP_GET_ARRAY=33, 1325 MATOP_RESTORE_ARRAY=34, 1326 MATOP_DUPLICATE=35, 1327 MATOP_FORWARD_SOLVE=36, 1328 MATOP_BACKWARD_SOLVE=37, 1329 MATOP_ILUFACTOR=38, 1330 MATOP_ICCFACTOR=39, 1331 MATOP_AXPY=40, 1332 MATOP_GET_SUBMATRICES=41, 1333 MATOP_INCREASE_OVERLAP=42, 1334 MATOP_GET_VALUES=43, 1335 MATOP_COPY=44, 1336 MATOP_PRINT_HELP=45, 1337 MATOP_SCALE=46, 1338 MATOP_SHIFT=47, 1339 MATOP_DIAGONAL_SHIFT=48, 1340 MATOP_ILUDT_FACTOR=49, 1341 MATOP_GET_BLOCK_SIZE=50, 1342 MATOP_GET_ROW_IJ=51, 1343 MATOP_RESTORE_ROW_IJ=52, 1344 MATOP_GET_COLUMN_IJ=53, 1345 MATOP_RESTORE_COLUMN_IJ=54, 1346 MATOP_FDCOLORING_CREATE=55, 1347 MATOP_COLORING_PATCH=56, 1348 MATOP_SET_UNFACTORED=57, 1349 MATOP_PERMUTE=58, 1350 MATOP_SET_VALUES_BLOCKED=59, 1351 MATOP_GET_SUBMATRIX=60, 1352 MATOP_DESTROY=61, 1353 MATOP_VIEW=62, 1354 MATOP_GET_MAPS=63, 1355 MATOP_USE_SCALED_FORM=64, 1356 MATOP_SCALE_SYSTEM=65, 1357 MATOP_UNSCALE_SYSTEM=66, 1358 MATOP_SET_LOCAL_TO_GLOBAL_MAP=67, 1359 MATOP_SET_VALUES_LOCAL=68, 1360 MATOP_ZERO_ROWS_LOCAL=69, 1361 MATOP_GET_ROW_MAX=70, 1362 MATOP_CONVERT=71, 1363 MATOP_SET_COLORING=72, 1364 MATOP_SET_VALUES_ADIC=73, 1365 MATOP_SET_VALUES_ADIFOR=74, 1366 MATOP_FD_COLORING_APPLY=75, 1367 MATOP_SET_FROM_OPTIONS=76, 1368 MATOP_MULT_CON=77, 1369 MATOP_MULT_TRANSPOSE_CON=78, 1370 MATOP_ILU_FACTOR_SYMBOLIC_CON=79, 1371 MATOP_PERMUTE_SPARSIFY=80, 1372 MATOP_MULT_MULTIPLE=81, 1373 MATOP_SOLVE_MULTIPLE=82, 1374 MATOP_GET_INERTIA=83, 1375 MATOP_LOAD=84, 1376 MATOP_IS_SYMMETRIC=85, 1377 MATOP_IS_HERMITIAN=86, 1378 MATOP_IS_STRUCTURALLY_SYMMETRIC=87, 1379 MATOP_PB_RELAX=88, 1380 MATOP_GET_VECS=89, 1381 MATOP_MAT_MULT=90, 1382 MATOP_MAT_MULT_SYMBOLIC=91, 1383 MATOP_MAT_MULT_NUMERIC=92, 1384 MATOP_PTAP=93, 1385 MATOP_PTAP_SYMBOLIC=94, 1386 MATOP_PTAP_NUMERIC=95, 1387 MATOP_MAT_MULTTRANSPOSE=96, 1388 MATOP_MAT_MULTTRANSPOSE_SYMBOLIC=97, 1389 MATOP_MAT_MULTTRANSPOSE_NUMERIC=98, 1390 MATOP_PTAP_SYMBOLIC_SEQAIJ=99, 1391 MATOP_PTAP_NUMERIC_SEQAIJ=100, 1392 MATOP_PTAP_SYMBOLIC_MPIAIJ=101, 1393 MATOP_PTAP_NUMERIC_MPIAIJ=102, 1394 MATOP_SET_VALUES_ROW = 105, 1395 MATOP_GET_ROW_UTRIANGULAR=108, 1396 MATOP_RESTORE_ROW_UTRIANGULAR=109, 1397 MATOP_MATSOLVE=110 1398 } MatOperation; 1399 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatHasOperation(Mat,MatOperation,PetscTruth*); 1400 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShellSetOperation(Mat,MatOperation,void(*)(void)); 1401 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShellGetOperation(Mat,MatOperation,void(**)(void)); 1402 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShellSetContext(Mat,void*); 1403 1404 /* 1405 Codes for matrices stored on disk. By default they are 1406 stored in a universal format. By changing the format with 1407 PetscViewerSetFormat(viewer,PETSC_VIEWER_BINARY_NATIVE); the matrices will 1408 be stored in a way natural for the matrix, for example dense matrices 1409 would be stored as dense. Matrices stored this way may only be 1410 read into matrices of the same time. 1411 */ 1412 #define MATRIX_BINARY_FORMAT_DENSE -1 1413 1414 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBAIJSetHashTableFactor(Mat,PetscReal); 1415 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatISGetLocalMat(Mat,Mat*); 1416 1417 /*S 1418 MatNullSpace - Object that removes a null space from a vector, i.e. 1419 orthogonalizes the vector to a subsapce 1420 1421 Level: advanced 1422 1423 Concepts: matrix; linear operator, null space 1424 1425 Users manual sections: 1426 . sec_singular 1427 1428 .seealso: MatNullSpaceCreate() 1429 S*/ 1430 typedef struct _p_MatNullSpace* MatNullSpace; 1431 1432 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceCreate(MPI_Comm,PetscTruth,PetscInt,const Vec[],MatNullSpace*); 1433 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceSetFunction(MatNullSpace,PetscErrorCode (*)(Vec,void*),void*); 1434 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceDestroy(MatNullSpace); 1435 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceRemove(MatNullSpace,Vec,Vec*); 1436 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceAttach(Mat,MatNullSpace); 1437 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceTest(MatNullSpace,Mat); 1438 1439 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatReorderingSeqSBAIJ(Mat,IS); 1440 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPISBAIJSetHashTableFactor(Mat,PetscReal); 1441 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqSBAIJSetColumnIndices(Mat,PetscInt *); 1442 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqBAIJInvertBlockDiagonal(Mat); 1443 1444 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMAIJ(Mat,PetscInt,Mat*); 1445 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMAIJRedimension(Mat,PetscInt,Mat*); 1446 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMAIJGetAIJ(Mat,Mat*); 1447 1448 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatComputeExplicitOperator(Mat,Mat*); 1449 1450 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDiagonalScaleLocal(Mat,Vec); 1451 1452 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT PetscViewerMathematicaPutMatrix(PetscViewer, PetscInt, PetscInt, PetscReal *); 1453 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT PetscViewerMathematicaPutCSRMatrix(PetscViewer, PetscInt, PetscInt, PetscInt *, PetscInt *, PetscReal *); 1454 1455 PETSC_EXTERN_CXX_END 1456 #endif 1457