Actual source code: dlregispetsc.c

      1: #define PETSC_DLL

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

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

     14:   Input Parameter:
     15:   path - The dynamic library path, or PETSC_NULL

     17:   Level: developer

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

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

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

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

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

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