Actual source code: dlregismat.c

petsc-3.4.5 2014-06-29
  2: #include <petsc-private/matimpl.h>

  4: const char       *MatOptions[] = {"ROW_ORIENTED","NEW_NONZERO_LOCATIONS",
  5:                                   "SYMMETRIC",
  6:                                   "STRUCTURALLY_SYMMETRIC",
  7:                                   "NEW_DIAGONALS",
  8:                                   "IGNORE_OFF_PROC_ENTRIES",
  9:                                   "NEW_NONZERO_LOCATION_ERR",
 10:                                   "NEW_NONZERO_ALLOCATION_ERR","USE_HASH_TABLE",
 11:                                   "KEEP_NONZERO_PATTERN","IGNORE_ZERO_ENTRIES","USE_INODES",
 12:                                   "HERMITIAN",
 13:                                   "SYMMETRY_ETERNAL",
 14:                                   "CHECK_COMPRESSED_ROW",
 15:                                   "IGNORE_LOWER_TRIANGULAR","ERROR_LOWER_TRIANGULAR","GETROW_UPPERTRIANGULAR","SPD","NO_OFF_PROC_ENTRIES","NO_OFF_PROC_ZERO_ROWS","MatOption","MAT_",0};
 16: const char *const MatFactorShiftTypes[] = {"NONE","NONZERO","POSITIVE_DEFINITE","INBLOCKS","MatFactorShiftType","PC_FACTOR_",0};
 17: const char *const MatFactorShiftTypesDetail[] = {NULL,"diagonal shift to prevent zero pivot","Manteuffel shift","diagonal shift on blocks to prevent zero pivot"};
 18: const char *const MPPTScotchStrategyTypes[] = {"QUALITY","SPEED","BALANCE","SAFETY","SCALABILITY","MPPTScotchStrategyType","MP_PTSCOTCH_",0};
 19: const char *const MPChacoGlobalTypes[] = {"","MULTILEVEL","SPECTRAL","","LINEAR","RANDOM","SCATTERED","MPChacoGlobalType","MP_CHACO_",0};
 20: const char *const MPChacoLocalTypes[] = {"","KERNIGHAN","NONE","MPChacoLocalType","MP_CHACO_",0};
 21: const char *const MPChacoEigenTypes[] = {"LANCZOS","RQI","MPChacoEigenType","MP_CHACO_",0};

 23: extern PetscErrorCode  MatMFFDInitializePackage(void);
 24: static PetscBool MatPackageInitialized = PETSC_FALSE;
 27: /*@C
 28:   MatFinalizePackage - This function destroys everything in the Petsc interface to the Mat package. It is
 29:   called from PetscFinalize().

 31:   Level: developer

 33: .keywords: Petsc, destroy, package, mathematica
 34: .seealso: PetscFinalize()
 35: @*/
 36: PetscErrorCode  MatFinalizePackage(void)
 37: {
 38:   MatBaseName    nnames,names = MatBaseNameList;

 42:   while (names) {
 43:     nnames = names->next;
 44:     PetscFree(names->bname);
 45:     PetscFree(names->sname);
 46:     PetscFree(names->mname);
 47:     PetscFree(names);
 48:     names  = nnames;
 49:   }
 50:   PetscFunctionListDestroy(&MatList);
 51:   PetscFunctionListDestroy(&MatOrderingList);
 52:   PetscFunctionListDestroy(&MatColoringList);
 53:   PetscFunctionListDestroy(&MatPartitioningList);
 54:   PetscFunctionListDestroy(&MatCoarsenList);
 55:   MatBaseNameList                  = NULL;
 56:   MatPackageInitialized            = PETSC_FALSE;
 57:   MatRegisterAllCalled             = PETSC_FALSE;
 58:   MatOrderingRegisterAllCalled     = PETSC_FALSE;
 59:   MatColoringRegisterAllCalled     = PETSC_FALSE;
 60:   MatPartitioningRegisterAllCalled = PETSC_FALSE;
 61:   MatCoarsenRegisterAllCalled      = PETSC_FALSE;
 62:   return(0);
 63: }

 67: /*@C
 68:   MatInitializePackage - This function initializes everything in the Mat package. It is called
 69:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to MatCreate()
 70:   when using static libraries.

 72:   Level: developer

 74: .keywords: Mat, initialize, package
 75: .seealso: PetscInitialize()
 76: @*/
 77: PetscErrorCode  MatInitializePackage(void)
 78: {
 79:   char           logList[256];
 80:   char           *className;
 81:   PetscBool      opt;

 85:   if (MatPackageInitialized) return(0);
 86:   MatPackageInitialized = PETSC_TRUE;
 87:   /* Inialize subpackage */
 88:   MatMFFDInitializePackage();
 89:   /* Register Classes */
 90:   PetscClassIdRegister("Matrix",&MAT_CLASSID);
 91:   PetscClassIdRegister("Matrix FD Coloring",&MAT_FDCOLORING_CLASSID);
 92:   PetscClassIdRegister("Matrix MatTranspose Coloring",&MAT_TRANSPOSECOLORING_CLASSID);
 93:   PetscClassIdRegister("Matrix Partitioning",&MAT_PARTITIONING_CLASSID);
 94:   PetscClassIdRegister("Matrix Coarsen",&MAT_COARSEN_CLASSID);
 95:   PetscClassIdRegister("Matrix Null Space",&MAT_NULLSPACE_CLASSID);
 96:   /* Register Constructors */
 97:   MatRegisterAll();
 98:   MatOrderingRegisterAll();
 99:   MatColoringRegisterAll();
100:   MatPartitioningRegisterAll();
101:   MatCoarsenRegisterAll();
102:   /* Register Events */
103:   PetscLogEventRegister("MatMult",          MAT_CLASSID,&MAT_Mult);
104:   PetscLogEventRegister("MatMults",         MAT_CLASSID,&MAT_Mults);
105:   PetscLogEventRegister("MatMultConstr",    MAT_CLASSID,&MAT_MultConstrained);
106:   PetscLogEventRegister("MatMultAdd",       MAT_CLASSID,&MAT_MultAdd);
107:   PetscLogEventRegister("MatMultTranspose", MAT_CLASSID,&MAT_MultTranspose);
108:   PetscLogEventRegister("MatMultTrConstr",  MAT_CLASSID,&MAT_MultTransposeConstrained);
109:   PetscLogEventRegister("MatMultTrAdd",     MAT_CLASSID,&MAT_MultTransposeAdd);
110:   PetscLogEventRegister("MatSolve",         MAT_CLASSID,&MAT_Solve);
111:   PetscLogEventRegister("MatSolves",        MAT_CLASSID,&MAT_Solves);
112:   PetscLogEventRegister("MatSolveAdd",      MAT_CLASSID,&MAT_SolveAdd);
113:   PetscLogEventRegister("MatSolveTranspos", MAT_CLASSID,&MAT_SolveTranspose);
114:   PetscLogEventRegister("MatSolveTrAdd",    MAT_CLASSID,&MAT_SolveTransposeAdd);
115:   PetscLogEventRegister("MatSOR",           MAT_CLASSID,&MAT_SOR);
116:   PetscLogEventRegister("MatForwardSolve",  MAT_CLASSID,&MAT_ForwardSolve);
117:   PetscLogEventRegister("MatBackwardSolve", MAT_CLASSID,&MAT_BackwardSolve);
118:   PetscLogEventRegister("MatLUFactor",      MAT_CLASSID,&MAT_LUFactor);
119:   PetscLogEventRegister("MatLUFactorSym",   MAT_CLASSID,&MAT_LUFactorSymbolic);
120:   PetscLogEventRegister("MatLUFactorNum",   MAT_CLASSID,&MAT_LUFactorNumeric);
121:   PetscLogEventRegister("MatCholeskyFctr",  MAT_CLASSID,&MAT_CholeskyFactor);
122:   PetscLogEventRegister("MatCholFctrSym",   MAT_CLASSID,&MAT_CholeskyFactorSymbolic);
123:   PetscLogEventRegister("MatCholFctrNum",   MAT_CLASSID,&MAT_CholeskyFactorNumeric);
124:   PetscLogEventRegister("MatILUFactor",     MAT_CLASSID,&MAT_ILUFactor);
125:   PetscLogEventRegister("MatILUFactorSym",  MAT_CLASSID,&MAT_ILUFactorSymbolic);
126:   PetscLogEventRegister("MatICCFactorSym",  MAT_CLASSID,&MAT_ICCFactorSymbolic);
127:   PetscLogEventRegister("MatCopy",          MAT_CLASSID,&MAT_Copy);
128:   PetscLogEventRegister("MatConvert",       MAT_CLASSID,&MAT_Convert);
129:   PetscLogEventRegister("MatScale",         MAT_CLASSID,&MAT_Scale);
130:   PetscLogEventRegister("MatAssemblyBegin", MAT_CLASSID,&MAT_AssemblyBegin);
131:   PetscLogEventRegister("MatAssemblyEnd",   MAT_CLASSID,&MAT_AssemblyEnd);
132:   PetscLogEventRegister("MatSetValues",     MAT_CLASSID,&MAT_SetValues);
133:   PetscLogEventRegister("MatGetValues",     MAT_CLASSID,&MAT_GetValues);
134:   PetscLogEventRegister("MatGetRow",        MAT_CLASSID,&MAT_GetRow);
135:   PetscLogEventRegister("MatGetRowIJ",      MAT_CLASSID,&MAT_GetRowIJ);
136:   PetscLogEventRegister("MatGetSubMatrice", MAT_CLASSID,&MAT_GetSubMatrices);
137:   PetscLogEventRegister("MatGetColoring",   MAT_CLASSID,&MAT_GetColoring);
138:   PetscLogEventRegister("MatGetOrdering",   MAT_CLASSID,&MAT_GetOrdering);
139:   PetscLogEventRegister("MatIncreaseOvrlp", MAT_CLASSID,&MAT_IncreaseOverlap);
140:   PetscLogEventRegister("MatPartitioning",  MAT_PARTITIONING_CLASSID,&MAT_Partitioning);
141:   PetscLogEventRegister("MatCoarsen",  MAT_COARSEN_CLASSID,&MAT_Coarsen);
142:   PetscLogEventRegister("MatZeroEntries",   MAT_CLASSID,&MAT_ZeroEntries);
143:   PetscLogEventRegister("MatLoad",          MAT_CLASSID,&MAT_Load);
144:   PetscLogEventRegister("MatView",          MAT_CLASSID,&MAT_View);
145:   PetscLogEventRegister("MatAXPY",          MAT_CLASSID,&MAT_AXPY);
146:   PetscLogEventRegister("MatFDColorCreate", MAT_FDCOLORING_CLASSID,&MAT_FDColoringCreate);
147:   PetscLogEventRegister("MatFDColorApply",  MAT_FDCOLORING_CLASSID,&MAT_FDColoringApply);
148:   PetscLogEventRegister("MatFDColorFunc",   MAT_FDCOLORING_CLASSID,&MAT_FDColoringFunction);
149:   PetscLogEventRegister("MatTranspose",     MAT_CLASSID,&MAT_Transpose);
150:   PetscLogEventRegister("MatMatMult",       MAT_CLASSID,&MAT_MatMult);
151:   PetscLogEventRegister("MatMatSolve",      MAT_CLASSID,&MAT_MatSolve);
152:   PetscLogEventRegister("MatMatMultSym",    MAT_CLASSID,&MAT_MatMultSymbolic);
153:   PetscLogEventRegister("MatMatMultNum",    MAT_CLASSID,&MAT_MatMultNumeric);
154:   PetscLogEventRegister("MatMatMatMult",    MAT_CLASSID,&MAT_MatMatMult);
155:   PetscLogEventRegister("MatMatMatMultSym", MAT_CLASSID,&MAT_MatMatMultSymbolic);
156:   PetscLogEventRegister("MatMatMatMultNum", MAT_CLASSID,&MAT_MatMatMultNumeric);
157:   PetscLogEventRegister("MatPtAP",          MAT_CLASSID,&MAT_PtAP);
158:   PetscLogEventRegister("MatPtAPSymbolic",  MAT_CLASSID,&MAT_PtAPSymbolic);
159:   PetscLogEventRegister("MatPtAPNumeric",   MAT_CLASSID,&MAT_PtAPNumeric);
160:   PetscLogEventRegister("MatRARt",          MAT_CLASSID,&MAT_RARt);
161:   PetscLogEventRegister("MatRARtSymbolic",  MAT_CLASSID,&MAT_RARtSymbolic);
162:   PetscLogEventRegister("MatRARtNumeric",   MAT_CLASSID,&MAT_RARtNumeric);
163:   PetscLogEventRegister("MatMatTransMult",  MAT_CLASSID,&MAT_MatTransposeMult);
164:   PetscLogEventRegister("MatMatTrnMultSym", MAT_CLASSID,&MAT_MatTransposeMultSymbolic);
165:   PetscLogEventRegister("MatMatTrnMultNum", MAT_CLASSID,&MAT_MatTransposeMultNumeric);
166:   PetscLogEventRegister("MatTrnMatMult",    MAT_CLASSID,&MAT_TransposeMatMult);
167:   PetscLogEventRegister("MatTrnMatMultSym", MAT_CLASSID,&MAT_TransposeMatMultSymbolic);
168:   PetscLogEventRegister("MatTrnMatMultNum", MAT_CLASSID,&MAT_TransposeMatMultNumeric);
169:   PetscLogEventRegister("MatTrnColorCreate", MAT_CLASSID,&MAT_TransposeColoringCreate);
170:   PetscLogEventRegister("MatGetRedundant",  MAT_CLASSID,&MAT_GetRedundantMatrix);
171:   PetscLogEventRegister("MatGetSeqNZStrct", MAT_CLASSID,&MAT_GetSequentialNonzeroStructure);
172:   PetscLogEventRegister("MatGetMultiProcBlock", MAT_CLASSID,&MAT_GetMultiProcBlock);


175:   /* these may be specific to MPIAIJ matrices */
176:   PetscLogEventRegister("MatMPISumSeqNumeric",MAT_CLASSID,&MAT_Seqstompinum);
177:   PetscLogEventRegister("MatMPISumSeqSymbolic",MAT_CLASSID,&MAT_Seqstompisym);
178:   PetscLogEventRegister("MatMPISumSeq",MAT_CLASSID,&MAT_Seqstompi);
179:   PetscLogEventRegister("MatMPIConcateSeq",MAT_CLASSID,&MAT_Merge);
180:   PetscLogEventRegister("MatGetLocalMat",MAT_CLASSID,&MAT_Getlocalmat);
181:   PetscLogEventRegister("MatGetLocalMatCondensed",MAT_CLASSID,&MAT_Getlocalmatcondensed);
182:   PetscLogEventRegister("MatGetBrowsOfAcols",MAT_CLASSID,&MAT_GetBrowsOfAcols);
183:   PetscLogEventRegister("MatGetBrAoCol",MAT_CLASSID,&MAT_GetBrowsOfAocols);

185:   PetscLogEventRegister("MatApplyPAPt_Symbolic",MAT_CLASSID,&MAT_Applypapt_symbolic);
186:   PetscLogEventRegister("MatApplyPAPt_Numeric",MAT_CLASSID,&MAT_Applypapt_numeric);
187:   PetscLogEventRegister("MatApplyPAPt",MAT_CLASSID,&MAT_Applypapt);

189:   PetscLogEventRegister("MatGetSymTrans",MAT_CLASSID,&MAT_Getsymtranspose);
190:   PetscLogEventRegister("MatGetSymTransR",MAT_CLASSID,&MAT_Getsymtransreduced);
191:   PetscLogEventRegister("MatTranspose_SeqAIJ_FAST",MAT_CLASSID,&MAT_Transpose_SeqAIJ);
192:   PetscLogEventRegister("MatCUSPCopyTo",MAT_CLASSID,&MAT_CUSPCopyToGPU);
193:   PetscLogEventRegister("MatCUSPARSECopyTo",MAT_CLASSID,&MAT_CUSPARSECopyToGPU);
194:   PetscLogEventRegister("MatSetValBatch",MAT_CLASSID,&MAT_SetValuesBatch);
195:   PetscLogEventRegister("MatSetValBatch1",MAT_CLASSID,&MAT_SetValuesBatchI);
196:   PetscLogEventRegister("MatSetValBatch2",MAT_CLASSID,&MAT_SetValuesBatchII);
197:   PetscLogEventRegister("MatSetValBatch3",MAT_CLASSID,&MAT_SetValuesBatchIII);
198:   PetscLogEventRegister("MatSetValBatch4",MAT_CLASSID,&MAT_SetValuesBatchIV);

200:   /* Turn off high traffic events by default */
201:   PetscLogEventSetActiveAll(MAT_SetValues, PETSC_FALSE);
202:   /* Process info exclusions */
203:   PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);
204:   if (opt) {
205:     PetscStrstr(logList, "mat", &className);
206:     if (className) {
207:       PetscInfoDeactivateClass(MAT_CLASSID);
208:     }
209:   }
210:   /* Process summary exclusions */
211:   PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);
212:   if (opt) {
213:     PetscStrstr(logList, "mat", &className);
214:     if (className) {
215:       PetscLogEventDeactivateClass(MAT_CLASSID);
216:     }
217:   }
218:   PetscRegisterFinalize(MatFinalizePackage);
219:   return(0);
220: }

222: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
225: /*
226:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

228:   This one registers all the matrix methods that are in the basic PETSc Matrix library.

230:  */
231: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscmat(void)
232: {

236:   MatInitializePackage();
237:   return(0);
238: }


241: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */