Actual source code: dlregis.c

  1: /*$Id: dlregis.c,v 1.20 2001/03/23 23:23:29 balay Exp $*/

 3:  #include petscsles.h

  5: #undef __FUNCT__  
  7: /*@C
  8:   SLESInitializePackage - This function initializes everything in the SLES package. It is called
  9:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to SLESCreate()
 10:   when using static libraries.

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

 15:   Level: developer

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

 28:   if (initialized == PETSC_TRUE) return(0);
 29:   initialized = PETSC_TRUE;
 30:   /* Register Classes */
 31:   PetscLogClassRegister(&KSP_COOKIE,  "Krylov Solver");
 32:   PetscLogClassRegister(&PC_COOKIE,   "Preconditioner");
 33:   PetscLogClassRegister(&SLES_COOKIE, "SLES");
 34:   /* Register Constructors and Serializers */
 35:   KSPRegisterAll(path);
 36:   PCRegisterAll(path);
 37:   /* Register Events */
 38:   PetscLogEventRegister(&PC_SetUp,                   "PCSetUp",          PC_COOKIE);
 39:   PetscLogEventRegister(&PC_SetUpOnBlocks,           "PCSetUpOnBlocks",  PC_COOKIE);
 40:   PetscLogEventRegister(&PC_Apply,                   "PCApply",          PC_COOKIE);
 41:   PetscLogEventRegister(&PC_ApplyCoarse,             "PCApplyCoarse",    PC_COOKIE);
 42:   PetscLogEventRegister(&PC_ApplyMultiple,           "PCApplyMultiple",  PC_COOKIE);
 43:   PetscLogEventRegister(&PC_ApplySymmetricLeft,      "PCApplySymmLeft",  PC_COOKIE);
 44:   PetscLogEventRegister(&PC_ApplySymmetricRight,     "PCApplySymmRight", PC_COOKIE);
 45:   PetscLogEventRegister(&PC_ModifySubMatrices,       "PCModifySubMatri", PC_COOKIE);
 46:   PetscLogEventRegister(&KSP_GMRESOrthogonalization, "KSPGMRESOrthog",   KSP_COOKIE);
 47:   PetscLogEventRegister(&SLES_SetUp,                 "SLESSetup",        SLES_COOKIE);
 48:   PetscLogEventRegister(&SLES_Solve,                 "SLESSolve",        SLES_COOKIE);
 49:   /* Process info exclusions */
 50:   PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
 51:   if (opt == PETSC_TRUE) {
 52:     PetscStrstr(logList, "sles", &className);
 53:     if (className) {
 54:       PetscLogInfoDeactivateClass(KSP_COOKIE);
 55:       PetscLogInfoDeactivateClass(PC_COOKIE);
 56:       PetscLogInfoDeactivateClass(SLES_COOKIE);
 57:     }
 58:     PetscStrstr(logList, "ksp", &className);
 59:     if (className) {
 60:       PetscLogInfoDeactivateClass(KSP_COOKIE);
 61:     }
 62:     PetscStrstr(logList, "pc", &className);
 63:     if (className) {
 64:       PetscLogInfoDeactivateClass(PC_COOKIE);
 65:     }
 66:   }
 67:   /* Process summary exclusions */
 68:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 69:   if (opt == PETSC_TRUE) {
 70:     PetscStrstr(logList, "sles", &className);
 71:     if (className) {
 72:       PetscLogEventDeactivateClass(KSP_COOKIE);
 73:       PetscLogEventDeactivateClass(PC_COOKIE);
 74:       PetscLogEventDeactivateClass(SLES_COOKIE);
 75:     }
 76:     PetscStrstr(logList, "ksp", &className);
 77:     if (className) {
 78:       PetscLogEventDeactivateClass(KSP_COOKIE);
 79:     }
 80:     PetscStrstr(logList, "pc", &className);
 81:     if (className) {
 82:       PetscLogEventDeactivateClass(PC_COOKIE);
 83:     }
 84:   }
 85:   return(0);
 86: }

 88: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
 89: EXTERN_C_BEGIN
 90: #undef __FUNCT__  
 92: /*
 93:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

 95:   This one registers all the KSP and PC methods that are in the basic PETSc libpetscsles
 96:   library.

 98:   Input Parameter:
 99:   path - library path
100:  */
101: int PetscDLLibraryRegister(char *path)
102: {

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

108:   /*
109:       If we got here then PETSc was properly loaded
110:   */
111:   SLESInitializePackage(path);
112:   return(0);
113: }
114: EXTERN_C_END

116: /* --------------------------------------------------------------------------*/
117: static char *contents = "PETSc Krylov subspace method and preconditioner library.n
118:      GMRES, PCG, Bi-CG-stab, ...n
119:      Jacobi, ILU, Block Jacobi, LU, Additive Schwarz, ...n";
120: static char *authors  = PETSC_AUTHOR_INFO;

122:  #include src/sys/src/utils/dlregis.h

124: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */