Actual source code: dlregis.c

  1: /*$Id: dlregis.c,v 1.18 2001/03/23 23:24:07 balay Exp $*/

 3:  #include petscsnes.h

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

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

 13:   Level: developer

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

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

 57: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
 58: EXTERN_C_BEGIN
 59: /*
 60:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

 64:   Input Parameter:
 65:   path - library path

 67:  */
 68: int PetscDLLibraryRegister(char *path)
 69: {

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

 75:   /*
 76:       If we got here then PETSc was properly loaded
 77:   */
 78:   SNESInitializePackage(path);
 79:   return(0);
 80: }
 81: EXTERN_C_END

 83: /* --------------------------------------------------------------------------*/
 84: static char *contents = "PETSc nonlinear solver library. n
 85:      line search Newton methodsn
 86:      trust region Newton methodsn";
 87: static char *authors  = PETSC_AUTHOR_INFO;

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

 91: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */