Actual source code: dlregismat.c

petsc-3.3-p7 2013-05-11
  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 *MatFactorShiftTypes[] = {"NONE","NONZERO","POSITIVE_DEFINITE","INBLOCKS","MatFactorShiftType","PC_FACTOR_",0};
 17: const char *MPPTScotchStrategyTypes[] = {"QUALITY","SPEED","BALANCE","SAFETY","SCALABILITY","MPPTScotchStrategyType","MP_PTSCOTCH_",0};
 18: const char *MPChacoGlobalTypes[] = {"","MULTILEVEL","SPECTRAL","","LINEAR","RANDOM","SCATTERED","MPChacoGlobalType","MP_CHACO_",0};
 19: const char *MPChacoLocalTypes[] = {"","KERNIGHAN","NONE","MPChacoLocalType","MP_CHACO_",0};
 20: const char *MPChacoEigenTypes[] = {"LANCZOS","RQI","MPChacoEigenType","MP_CHACO_",0};

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

 30:   Level: developer

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

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

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

 71:   Input Parameter:
 72:   path - The dynamic library path, or PETSC_NULL

 74:   Level: developer

 76: .keywords: Mat, initialize, package
 77: .seealso: PetscInitialize()
 78: @*/
 79: PetscErrorCode  MatInitializePackage(const char path[])
 80: {
 81:   char              logList[256];
 82:   char              *className;
 83:   PetscBool         opt;
 84:   PetscErrorCode    ierr;

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


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

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

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

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

220: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
221: EXTERN_C_BEGIN
224: /*
225:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

229:   Input Parameter:
230:   path - library path
231:  */
232: PetscErrorCode  PetscDLLibraryRegister_petscmat(const char path[])
233: {

237:   MatInitializePackage(path);
238:   return(0);
239: }
240: EXTERN_C_END


243: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */