Actual source code: dlregissnes.c

      1: #define PETSCSNES_DLL

     3:  #include petscsnes.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 PETSCSNES_DLLEXPORT SNESInitializePackage(const char path[]) {
     21:   static PetscTruth initialized = PETSC_FALSE;
     22:   char              logList[256];
     23:   char              *className;
     24:   PetscTruth        opt;
     25:   PetscErrorCode    ierr;

     28:   if (initialized) return(0);
     29:   initialized = PETSC_TRUE;
     30:   /* Register Classes */
     31:   PetscLogClassRegister(&SNES_COOKIE,         "SNES");
     32:   PetscLogClassRegister(&MATSNESMFCTX_COOKIE, "MatSNESMFCtx");
     33:   /* Register Constructors */
     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:   PetscLogEventRegister(&MATSNESMF_Mult,                "MatMultMatrixFre", MAT_COOKIE);
     41:   /* Process info exclusions */
     42:   PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
     43:   if (opt) {
     44:     PetscStrstr(logList, "snes", &className);
     45:     if (className) {
     46:       PetscLogInfoDeactivateClass(SNES_COOKIE);
     47:     }
     48:   }
     49:   /* Process summary exclusions */
     50:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
     51:   if (opt) {
     52:     PetscStrstr(logList, "snes", &className);
     53:     if (className) {
     54:       PetscLogEventDeactivateClass(SNES_COOKIE);
     55:     }
     56:   }
     57:   return(0);
     58: }

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

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

     69:   Input Parameter:
     70:   path - library path

     72:  */
     73: PetscErrorCode PETSCSNES_DLLEXPORT PetscDLLibraryRegister_petscsnes(char *path)
     74: {

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

     87: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */