Actual source code: dlregismat.c

      1: #define PETSCMAT_DLL

     3:  #include petscmat.h

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

     12:   Input Parameter:
     13:   path - The dynamic library path, or PETSC_NULL

     15:   Level: developer

     17: .keywords: Mat, initialize, package
     18: .seealso: PetscInitialize()
     19: @*/
     20: PetscErrorCode PETSCMAT_DLLEXPORT MatInitializePackage(char *path)
     21: {
     22:   static PetscTruth initialized = PETSC_FALSE;
     23:   char              logList[256];
     24:   char              *className;
     25:   PetscTruth        opt;
     26:   PetscErrorCode    ierr;

     29:   if (initialized) return(0);
     30:   initialized = PETSC_TRUE;
     31:   /* Register Classes */
     32:   PetscLogClassRegister(&MAT_COOKIE,              "Matrix");
     33:   PetscLogClassRegister(&MAT_FDCOLORING_COOKIE,   "Matrix FD Coloring");
     34:   PetscLogClassRegister(&MAT_PARTITIONING_COOKIE, "Matrix Partitioning");
     35:   PetscLogClassRegister(&MAT_NULLSPACE_COOKIE,    "Matrix Null Space");
     36:   /* Register Constructors */
     37:   MatRegisterAll(path);
     38:   /* Register Events */
     39:   PetscLogEventRegister(&MAT_Mult,                     "MatMult",          MAT_COOKIE);
     40:   PetscLogEventRegister(&MAT_Mults,                    "MatMults",         MAT_COOKIE);
     41:   PetscLogEventRegister(&MAT_MultConstrained,          "MatMultConstr",    MAT_COOKIE);
     42:   PetscLogEventRegister(&MAT_MultAdd,                  "MatMultAdd",       MAT_COOKIE);
     43:   PetscLogEventRegister(&MAT_MultTranspose,            "MatMultTranspose", MAT_COOKIE);
     44:   PetscLogEventRegister(&MAT_MultTransposeConstrained, "MatMultTrConstr",  MAT_COOKIE);
     45:   PetscLogEventRegister(&MAT_MultTransposeAdd,         "MatMultTrAdd",     MAT_COOKIE);
     46:   PetscLogEventRegister(&MAT_Solve,                    "MatSolve",         MAT_COOKIE);
     47:   PetscLogEventRegister(&MAT_Solves,                   "MatSolves",        MAT_COOKIE);
     48:   PetscLogEventRegister(&MAT_SolveAdd,                 "MatSolveAdd",      MAT_COOKIE);
     49:   PetscLogEventRegister(&MAT_SolveTranspose,           "MatSolveTranspos", MAT_COOKIE);
     50:   PetscLogEventRegister(&MAT_SolveTransposeAdd,        "MatSolveTrAdd",    MAT_COOKIE);
     51:   PetscLogEventRegister(&MAT_Relax,                    "MatRelax",         MAT_COOKIE);
     52:   PetscLogEventRegister(&MAT_ForwardSolve,             "MatForwardSolve",  MAT_COOKIE);
     53:   PetscLogEventRegister(&MAT_BackwardSolve,            "MatBackwardSolve", MAT_COOKIE);
     54:   PetscLogEventRegister(&MAT_LUFactor,                 "MatLUFactor",      MAT_COOKIE);
     55:   PetscLogEventRegister(&MAT_LUFactorSymbolic,         "MatLUFactorSym",   MAT_COOKIE);
     56:   PetscLogEventRegister(&MAT_LUFactorNumeric,          "MatLUFactorNum",   MAT_COOKIE);
     57:   PetscLogEventRegister(&MAT_CholeskyFactor,           "MatCholeskyFctr",  MAT_COOKIE);
     58:   PetscLogEventRegister(&MAT_CholeskyFactorSymbolic,   "MatCholFctrSym",   MAT_COOKIE);
     59:   PetscLogEventRegister(&MAT_CholeskyFactorNumeric,    "MatCholFctrNum",   MAT_COOKIE);
     60:   PetscLogEventRegister(&MAT_ILUFactor,                "MatILUFactor",     MAT_COOKIE);
     61:   PetscLogEventRegister(&MAT_ILUFactorSymbolic,        "MatILUFactorSym",  MAT_COOKIE);
     62:   PetscLogEventRegister(&MAT_ICCFactorSymbolic,        "MatICCFactorSym",  MAT_COOKIE);
     63:   PetscLogEventRegister(&MAT_Copy,                     "MatCopy",          MAT_COOKIE);
     64:   PetscLogEventRegister(&MAT_Convert,                  "MatConvert",       MAT_COOKIE);
     65:   PetscLogEventRegister(&MAT_Scale,                    "MatScale",         MAT_COOKIE);
     66:   PetscLogEventRegister(&MAT_AssemblyBegin,            "MatAssemblyBegin", MAT_COOKIE);
     67:   PetscLogEventRegister(&MAT_AssemblyEnd,              "MatAssemblyEnd",   MAT_COOKIE);
     68:   PetscLogEventRegister(&MAT_SetValues,                "MatSetValues",     MAT_COOKIE);
     69:   PetscLogEventRegister(&MAT_GetValues,                "MatGetValues",     MAT_COOKIE);
     70:   PetscLogEventRegister(&MAT_GetRow,                   "MatGetRow",        MAT_COOKIE);
     71:   PetscLogEventRegister(&MAT_GetSubMatrices,           "MatGetSubMatrice", MAT_COOKIE);
     72:   PetscLogEventRegister(&MAT_GetColoring,              "MatGetColoring",   MAT_COOKIE);
     73:   PetscLogEventRegister(&MAT_GetOrdering,              "MatGetOrdering",   MAT_COOKIE);
     74:   PetscLogEventRegister(&MAT_IncreaseOverlap,          "MatIncreaseOvrlp", MAT_COOKIE);
     75:   PetscLogEventRegister(&MAT_Partitioning,             "MatPartitioning",  MAT_PARTITIONING_COOKIE);
     76:   PetscLogEventRegister(&MAT_ZeroEntries,              "MatZeroEntries",   MAT_COOKIE);
     77:   PetscLogEventRegister(&MAT_Load,                     "MatLoad",          MAT_COOKIE);
     78:   PetscLogEventRegister(&MAT_View,                     "MatView",          MAT_COOKIE);
     79:   PetscLogEventRegister(&MAT_AXPY,                     "MatAXPY",          MAT_COOKIE);
     80:   PetscLogEventRegister(&MAT_FDColoringCreate,         "MatFDColorCreate", MAT_FDCOLORING_COOKIE);
     81:   PetscLogEventRegister(&MAT_FDColoringApply,          "MatFDColorApply",  MAT_FDCOLORING_COOKIE);
     82:   PetscLogEventRegister(&MAT_FDColoringFunction,       "MatFDColorFunc",   MAT_FDCOLORING_COOKIE);
     83:   PetscLogEventRegister(&MAT_Transpose,                "MatTranspose",     MAT_COOKIE);
     84:   PetscLogEventRegister(&MAT_MatMult,                  "MatMatMult",       MAT_COOKIE);
     85:   PetscLogEventRegister(&MAT_MatMultSymbolic,          "MatMatMultSym",    MAT_COOKIE);
     86:   PetscLogEventRegister(&MAT_MatMultNumeric,           "MatMatMultNum",    MAT_COOKIE);
     87:   PetscLogEventRegister(&MAT_PtAP,                     "MatPtAP",          MAT_COOKIE);
     88:   PetscLogEventRegister(&MAT_PtAPSymbolic,             "MatPtAPSymbolic",  MAT_COOKIE);
     89:   PetscLogEventRegister(&MAT_PtAPNumeric,              "MatPtAPNumeric",   MAT_COOKIE);
     90:   PetscLogEventRegister(&MAT_MatMultTranspose,         "MatMatMultTrans",  MAT_COOKIE);
     91:   PetscLogEventRegister(&MAT_MatMultTransposeSymbolic, "MatMatMultTrnSym" ,MAT_COOKIE);
     92:   PetscLogEventRegister(&MAT_MatMultTransposeNumeric,  "MatMatMultTrnNum", MAT_COOKIE);
     93:   /* Turn off high traffic events by default */
     94:   PetscLogEventSetActiveAll(MAT_SetValues, PETSC_FALSE);
     95:   /* Process info exclusions */
     96:   PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
     97:   if (opt) {
     98:     PetscStrstr(logList, "mat", &className);
     99:     if (className) {
    100:       PetscLogInfoDeactivateClass(MAT_COOKIE);
    101:     }
    102:   }
    103:   /* Process summary exclusions */
    104:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
    105:   if (opt) {
    106:     PetscStrstr(logList, "mat", &className);
    107:     if (className) {
    108:       PetscLogEventDeactivateClass(MAT_COOKIE);
    109:     }
    110:   }
    111:   return(0);
    112: }

    114: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
    118: /*
    119:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

    121:   This one registers all the TS methods that are in the basic PETSc Matrix library.

    123:   Input Parameter:
    124:   path - library path
    125:  */
    126: PetscErrorCode PETSCMAT_DLLEXPORT PetscDLLibraryRegister_petscmat(char *path)
    127: {

    130:   PetscInitializeNoArguments(); if (ierr) return 1;

    133:   /*
    134:       If we got here then PETSc was properly loaded
    135:   */
    136:   MatInitializePackage(path);
    137:   return(0);
    138: }

    142: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */