Actual source code: dlregissnes.c

  1: #define PETSCSNES_DLL

 3:  #include private/snesimpl.h

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

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

 15:   Level: developer

 17: .keywords: SNES, initialize, package
 18: .seealso: PetscInitialize()
 19: @*/
 20: PetscErrorCode  SNESInitializePackage(const 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:   PetscCookieRegister("SNES",&SNES_COOKIE);
 33:   /* Register Constructors */
 34:   SNESRegisterAll(path);
 35:   /* Register Events */
 36:   PetscLogEventRegister("SNESSolve",        SNES_COOKIE,&SNES_Solve);
 37:   PetscLogEventRegister("SNESLineSearch",   SNES_COOKIE,&SNES_LineSearch);
 38:   PetscLogEventRegister("SNESFunctionEval", SNES_COOKIE,&SNES_FunctionEval);
 39:   PetscLogEventRegister("SNESJacobianEval", SNES_COOKIE,&SNES_JacobianEval);
 40:   /* Process info exclusions */
 41:   PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
 42:   if (opt) {
 43:     PetscStrstr(logList, "snes", &className);
 44:     if (className) {
 45:       PetscInfoDeactivateClass(SNES_COOKIE);
 46:     }
 47:   }
 48:   /* Process summary exclusions */
 49:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 50:   if (opt) {
 51:     PetscStrstr(logList, "snes", &className);
 52:     if (className) {
 53:       PetscLogEventDeactivateClass(SNES_COOKIE);
 54:     }
 55:   }
 56:   return(0);
 57: }

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

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

 68:   Input Parameter:
 69:   path - library path

 71:  */
 72: PetscErrorCode  PetscDLLibraryRegister_petscsnes(const char path[])
 73: {

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

 86: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */