Actual source code: dlregispetsc.c

  2: #include <petscdraw.h>


  6: static PetscBool  PetscSysPackageInitialized = PETSC_FALSE;
  9: /*@C
 10:   PetscSysFinalizePackage - This function destroys everything in the Petsc interface to Mathematica. It is
 11:   called from PetscFinalize().

 13:   Level: developer

 15: .keywords: Petsc, destroy, package, mathematica
 16: .seealso: PetscFinalize()
 17: @*/
 18: PetscErrorCode  PetscSysFinalizePackage(void)
 19: {
 21:   PetscSysPackageInitialized = PETSC_FALSE;
 22:   return(0);
 23: }

 27: /*@C
 28:   PetscSysInitializePackage - This function initializes everything in the main Petsc package. It is called
 29:   from PetscDLLibraryRegister() when using dynamic libraries, and on the call to PetscInitialize()
 30:   when using static libraries.

 32:   Input Parameter:
 33:   path - The dynamic library path, or PETSC_NULL

 35:   Level: developer

 37: .keywords: Petsc, initialize, package
 38: .seealso: PetscInitialize()
 39: @*/
 40: PetscErrorCode  PetscSysInitializePackage(const char path[])
 41: {
 42:   char              logList[256];
 43:   char              *className;
 44:   PetscBool         opt;
 45:   PetscErrorCode    ierr;

 48:   if (PetscSysPackageInitialized) return(0);
 49:   PetscSysPackageInitialized = PETSC_TRUE;
 50:   /* Register Classes */
 51:   PetscClassIdRegister("Object",&PETSC_OBJECT_CLASSID);
 52:   PetscClassIdRegister("Container",&PETSC_CONTAINER_CLASSID);

 54:   /* Register Events */
 55:   PetscLogEventRegister("PetscBarrier", PETSC_SMALLEST_CLASSID,&PETSC_Barrier);
 56:   /* Process info exclusions */
 57:   PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
 58:   if (opt) {
 59:     PetscStrstr(logList, "null", &className);
 60:     if (className) {
 61:       PetscInfoDeactivateClass(0);
 62:     }
 63:   }
 64:   /* Process summary exclusions */
 65:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 66:   if (opt) {
 67:     PetscStrstr(logList, "null", &className);
 68:     if (className) {
 69:       PetscLogEventDeactivateClass(0);
 70:     }
 71:   }
 72:   PetscRegisterFinalize(PetscSysFinalizePackage);
 73:   return(0);
 74: }

 76: #ifdef PETSC_USE_DYNAMIC_LIBRARIES

 79: #if defined(PETSC_USE_SINGLE_LIBRARY)
 86: #endif

 89: #if defined(PETSC_USE_SINGLE_LIBRARY)
 91: #else
 93: #endif
 94: /*
 95:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

 99:   Input Parameter:
100:   path - library path
101:  */
102: #if defined(PETSC_USE_SINGLE_LIBRARY)
103: PetscErrorCode  PetscDLLibraryRegister_petsc(const char path[])
104: #else
105: PetscErrorCode  PetscDLLibraryRegister_petscsys(const char path[])
106: #endif
107: {

111:   /*
112:       If we got here then PETSc was properly loaded
113:   */
114:   PetscSysInitializePackage(path);
115:   PetscFwkInitializePackage(path);
116:   PetscDrawInitializePackage(path);
117:   PetscViewerInitializePackage(path);
118:   PetscRandomInitializePackage(path);

120: #if defined(PETSC_USE_SINGLE_LIBRARY)
121:   PetscDLLibraryRegister_petscvec(path);
122:   PetscDLLibraryRegister_petscmat(path);
123:   PetscDLLibraryRegister_petscdm(path);
124:   PetscDLLibraryRegister_petscksp(path);
125:   PetscDLLibraryRegister_petscsnes(path);
126:   PetscDLLibraryRegister_petscts(path);
127: #endif
128:   return(0);
129: }
131: #endif