Actual source code: dlregispetsc.c

  1: #define PETSC_DLL

 3:  #include petsc.h
 4:  #include petscdraw.h
 5:  #include petscsys.h


 11: /*@C
 12:   PetscInitializePackage - This function initializes everything in the main Petsc package. It is called
 13:   from PetscDLLibraryRegister() when using dynamic libraries, and on the call to PetscInitialize()
 14:   when using static libraries.

 16:   Input Parameter:
 17:   path - The dynamic library path, or PETSC_NULL

 19:   Level: developer

 21: .keywords: Petsc, initialize, package
 22: .seealso: PetscInitialize()
 23: @*/
 24: PetscErrorCode  PetscInitializePackage(char *path)
 25: {
 26:   static PetscTruth initialized = PETSC_FALSE;
 27:   char              logList[256];
 28:   char              *className;
 29:   PetscTruth        opt;
 30:   PetscErrorCode    ierr;

 33:   if (initialized) return(0);
 34:   initialized = PETSC_TRUE;
 35:   /* Register Classes */
 36:   PetscLogClassRegister(&PETSC_OBJECT_COOKIE, "Object");
 37:   PetscLogClassRegister(&PETSC_VIEWER_COOKIE, "Viewer");
 38:   PetscLogClassRegister(&PETSC_DRAW_COOKIE,   "Draw");
 39:   PetscLogClassRegister(&DRAWAXIS_COOKIE,     "Axis");
 40:   PetscLogClassRegister(&DRAWLG_COOKIE,       "Line Graph");
 41:   PetscLogClassRegister(&DRAWHG_COOKIE,       "Histogram");
 42:   PetscLogClassRegister(&DRAWSP_COOKIE,       "Scatter Plot");
 43:   PetscLogClassRegister(&PETSC_RANDOM_COOKIE, "Random Number Generator");
 44:   /* Register Constructors */
 45:   PetscDrawRegisterAll(path);
 46:   PetscViewerRegisterAll(path);
 47:   /* Register Events */
 49:   /* Process info exclusions */
 50:   PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
 51:   if (opt) {
 52:     PetscStrstr(logList, "null", &className);
 53:     if (className) {
 54:       PetscInfoDeactivateClass(0);
 55:     }
 56:   }
 57:   /* Process summary exclusions */
 58:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 59:   if (opt) {
 60:     PetscStrstr(logList, "null", &className);
 61:     if (className) {
 63:     }
 64:   }
 65:   /* Setup auxiliary packages */
 66: #if defined(PETSC_HAVE_MATHEMATICA)
 67:   PetscViewerMathematicaInitializePackage(PETSC_NULL);
 68: #endif
 69:   return(0);
 70: }

 75: /*
 76:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

 78:   This one registers all the draw and PetscViewer objects.

 80:   Input Parameter:
 81:   path - library path
 82:  */
 83: PetscErrorCode  PetscDLLibraryRegister_petsc(char *path)
 84: {

 87:   PetscInitializeNoArguments(); if (ierr) return 1;
 89:   /*
 90:       If we got here then PETSc was properly loaded
 91:   */
 92:   PetscInitializePackage(path);
 93:   return(0);
 94: }