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: #undef __FUNCT__  
  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: int SNESInitializePackage(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(&SNES_COOKIE,         "SNES");
 32:   PetscLogClassRegister(&MATSNESMFCTX_COOKIE, "MatSNESMFCtx");
 33:   /* Register Constructors and Serializers */
 34:   SNESRegisterAll(path);
 35:   /* Register Events */
 36:   PetscLogEventRegister(&SNES_Solve,                    "SNESSolve",        SNES_COOKIE);
 37:   PetscLogEventRegister(&SNES_LineSearch,               "SNESLineSearch",   SNES_COOKIE);
 38:   PetscLogEventRegister(&SNES_FunctionEval,             "SNESFunctionEval", SNES_COOKIE);
 39:   PetscLogEventRegister(&SNES_JacobianEval,             "SNESJacobianEval", SNES_COOKIE);
 40:   /* Process info exclusions */
 41:   PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
 42:   if (opt == PETSC_TRUE) {
 43:     PetscStrstr(logList, "snes", &className);
 44:     if (className) {
 45:       PetscLogInfoDeactivateClass(SNES_COOKIE);
 46:     }
 47:   }
 48:   /* Process summary exclusions */
 49:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 50:   if (opt == PETSC_TRUE) {
 51:     PetscStrstr(logList, "snes", &className);
 52:     if (className) {
 53:       PetscLogEventDeactivateClass(SNES_COOKIE);
 54:     }
 55:   }
 56:   return(0);
 57: }

 59: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
 60: EXTERN_C_BEGIN
 61: #undef __FUNCT__  
 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: int PetscDLLibraryRegister(char *path)
 73: {

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

 79:   /*
 80:       If we got here then PETSc was properly loaded
 81:   */
 82:   SNESInitializePackage(path);
 83:   return(0);
 84: }
 85: EXTERN_C_END

 87: /* --------------------------------------------------------------------------*/
 88: static char *contents = "PETSc nonlinear solver library. n
 89:      line search Newton methodsn
 90:      trust region Newton methodsn";
 91: static char *authors  = PETSC_AUTHOR_INFO;

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

 95: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */