Actual source code: dlregisksp.c

      1: #define PETSCKSP_DLL

     3:  #include petscksp.h

      6: const char *PCSides[]          = {"LEFT","RIGHT","SYMMETRIC","PCSide","PC_",0};
      7: const char *PCASMTypes[]       = {"NONE","RESTRICT","INTERPOLATE","BASIC","PCASMType","PC_ASM_",0};
      8: const char *PCCompositeTypes[] = {"ADDITIVE","MULTIPLICATIVE","SPECIAL","PCCompositeType","PC_COMPOSITE",0};

     12: /*@C
     13:   PCInitializePackage - This function initializes everything in the PC package. It is called
     14:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PCCreate()
     15:   when using static libraries.

     17:   Input Parameter:
     18:   path - The dynamic library path, or PETSC_NULL

     20:   Level: developer

     22: .keywords: PC, initialize, package
     23: .seealso: PetscInitialize()
     24: @*/
     25: PetscErrorCode PETSCKSP_DLLEXPORT PCInitializePackage(const char path[]) {
     26:   static PetscTruth initialized = PETSC_FALSE;
     27:   char              logList[256];
     28:   char             *className;
     29:   PetscTruth        opt;

     33:   if (initialized) return(0);
     34:   initialized = PETSC_TRUE;
     35:   /* Register Classes */
     36:   PetscLogClassRegister(&PC_COOKIE,   "Preconditioner");
     37:   /* Register Constructors */
     38:   PCRegisterAll(path);
     39:   /* Register Events */
     40:   PetscLogEventRegister(&PC_SetUp,                   "PCSetUp",          PC_COOKIE);
     41:   PetscLogEventRegister(&PC_SetUpOnBlocks,           "PCSetUpOnBlocks",  PC_COOKIE);
     42:   PetscLogEventRegister(&PC_Apply,                   "PCApply",          PC_COOKIE);
     43:   PetscLogEventRegister(&PC_ApplyCoarse,             "PCApplyCoarse",    PC_COOKIE);
     44:   PetscLogEventRegister(&PC_ApplyMultiple,           "PCApplyMultiple",  PC_COOKIE);
     45:   PetscLogEventRegister(&PC_ApplySymmetricLeft,      "PCApplySymmLeft",  PC_COOKIE);
     46:   PetscLogEventRegister(&PC_ApplySymmetricRight,     "PCApplySymmRight", PC_COOKIE);
     47:   PetscLogEventRegister(&PC_ModifySubMatrices,       "PCModifySubMatri", PC_COOKIE);
     48:   /* Process info exclusions */
     49:   PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
     50:   if (opt) {
     51:     PetscStrstr(logList, "pc", &className);
     52:     if (className) {
     53:       PetscLogInfoDeactivateClass(PC_COOKIE);
     54:     }
     55:   }
     56:   /* Process summary exclusions */
     57:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
     58:   if (opt) {
     59:     PetscStrstr(logList, "pc", &className);
     60:     if (className) {
     61:       PetscLogEventDeactivateClass(PC_COOKIE);
     62:     }
     63:   }
     64:   return(0);
     65: }

     67: const char *KSPCGTypes[]                  = {"SYMMETRIC","HERMITIAN","KSPCGType","KSP_CG_",0};
     68: const char *KSPGMRESCGSRefinementTypes[]  = {"REFINE_NEVER", "REFINE_IFNEEDED", "REFINE_ALWAYS","KSPGMRESRefinementType","KSP_GMRES_CGS_",0};
     69: const char *KSPNormTypes[]                = {"NO_NORM","PRECONDITIONED_NORM","UNPRECONDITIONED_NORM","NATURAL_NORM","KSPNormType","KSP_",0};
     70: const char *KSPConvergedReasons_Shifted[] = {"DIVERGED_INDEFINITE_MAT","DIVERGED_NAN","DIVERGED_INDEFINITE_PC",
     71:                                              "DIVERGED_NONSYMMETRIC", "DIVERGED_BREAKDOWN_BICG","DIVERGED_BREAKDOWN",
     72:                                              "DIVERGED_DTOL","DIVERGED_ITS","DIVERGED_NULL","","CONVERGED_ITERATING",
     73:                                              "","CONVERGED_RTOL","CONVERGED_ATOL","CONVERGED_ITS",
     74:                                              "CONVERGED_QCG_NEG_CURVE","CONVERGED_QCG_CONSTRAINED","CONVERGED_STEP_LENGTH",
     75:                                              "KSPConvergedReason","KSP_",0};
     76: const char **KSPConvergedReasons = KSPConvergedReasons_Shifted + 10;

     80: /*@C
     81:   KSPInitializePackage - This function initializes everything in the KSP package. It is called
     82:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to KSPCreate()
     83:   when using static libraries.

     85:   Input Parameter:
     86:   path - The dynamic library path, or PETSC_NULL

     88:   Level: developer

     90: .keywords: KSP, initialize, package
     91: .seealso: PetscInitialize()
     92: @*/
     93: PetscErrorCode PETSCKSP_DLLEXPORT KSPInitializePackage(const char path[]) {
     94:   static PetscTruth initialized = PETSC_FALSE;
     95:   char              logList[256];
     96:   char              *className;
     97:   PetscTruth        opt;
     98:   PetscErrorCode    ierr;

    101:   if (initialized) return(0);
    102:   initialized = PETSC_TRUE;
    103:   /* Register Classes */
    104:   PetscLogClassRegister(&KSP_COOKIE,  "Krylov Solver");
    105:   /* Register Constructors */
    106:   KSPRegisterAll(path);
    107:   /* Register Events */
    108:   PetscLogEventRegister(&KSP_GMRESOrthogonalization, "KSPGMRESOrthog",   KSP_COOKIE);
    109:   PetscLogEventRegister(&KSP_SetUp,                  "KSPSetup",         KSP_COOKIE);
    110:   PetscLogEventRegister(&KSP_Solve,                  "KSPSolve",         KSP_COOKIE);
    111:   /* Process info exclusions */
    112:   PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
    113:   if (opt) {
    114:     PetscStrstr(logList, "ksp", &className);
    115:     if (className) {
    116:       PetscLogInfoDeactivateClass(KSP_COOKIE);
    117:     }
    118:   }
    119:   /* Process summary exclusions */
    120:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
    121:   if (opt) {
    122:     PetscStrstr(logList, "ksp", &className);
    123:     if (className) {
    124:       PetscLogEventDeactivateClass(KSP_COOKIE);
    125:     }
    126:   }
    127:   return(0);
    128: }

    130: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
    134: /*
    135:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

    137:   This one registers all the KSP and PC methods that are in the basic PETSc libpetscksp
    138:   library.

    140:   Input Parameter:
    141:   path - library path
    142:  */
    143: PetscErrorCode PETSCKSP_DLLEXPORT PetscDLLibraryRegister_petscksp(char *path)
    144: {

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

    150:   /*
    151:       If we got here then PETSc was properly loaded
    152:   */
    153:   PCInitializePackage(path);
    154:   KSPInitializePackage(path);
    155:   return(0);
    156: }

    159: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */