Actual source code: dlregis.c

 2:  #include petscsnes.h

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

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

 14:   Level: developer

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

 27:   if (initialized == PETSC_TRUE) return(0);
 28:   initialized = PETSC_TRUE;
 29:   /* Register Classes */
 30:   PetscLogClassRegister(&SNES_COOKIE,         "SNES");
 31:   PetscLogClassRegister(&MATSNESMFCTX_COOKIE, "MatSNESMFCtx");
 32:   /* Register Constructors */
 33:   SNESRegisterAll(path);
 34:   /* Register Events */
 35:   PetscLogEventRegister(&SNES_Solve,                    "SNESSolve",        SNES_COOKIE);
 36:   PetscLogEventRegister(&SNES_LineSearch,               "SNESLineSearch",   SNES_COOKIE);
 37:   PetscLogEventRegister(&SNES_FunctionEval,             "SNESFunctionEval", SNES_COOKIE);
 38:   PetscLogEventRegister(&SNES_JacobianEval,             "SNESJacobianEval", SNES_COOKIE);
 39:   /* Process info exclusions */
 40:   PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
 41:   if (opt == PETSC_TRUE) {
 42:     PetscStrstr(logList, "snes", &className);
 43:     if (className) {
 44:       PetscLogInfoDeactivateClass(SNES_COOKIE);
 45:     }
 46:   }
 47:   /* Process summary exclusions */
 48:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 49:   if (opt == PETSC_TRUE) {
 50:     PetscStrstr(logList, "snes", &className);
 51:     if (className) {
 52:       PetscLogEventDeactivateClass(SNES_COOKIE);
 53:     }
 54:   }
 55:   return(0);
 56: }

 58: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
 62: /*
 63:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

 65:   This registers all of the SNES methods that are in the basic PETSc libpetscsnes library.

 67:   Input Parameter:
 68:   path - library path

 70:  */
 71: PetscErrorCode PetscDLLibraryRegister(char *path)
 72: {

 75:   PetscInitializeNoArguments(); if (ierr) return 1;
 77:   /*
 78:       If we got here then PETSc was properly loaded
 79:   */
 80:   SNESInitializePackage(path);
 81:   return(0);
 82: }

 85: /* --------------------------------------------------------------------------*/
 86: static const char *contents = "PETSc nonlinear solver library. \n\
 87:      line search Newton methods\n\
 88:      trust region Newton methods\n";
 89: static const char *authors  = PETSC_AUTHOR_INFO;

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

 93: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */