Actual source code: dlregispetsc.c
1: #define PETSC_DLL
3: #include petscdraw.h
7: static PetscTruth PetscPackageInitialized = PETSC_FALSE;
10: /*@C
11: PetscFinalizePackage - This function destroys everything in the Petsc interface to Mathematica. It is
12: called from PetscFinalize().
14: Level: developer
16: .keywords: Petsc, destroy, package, mathematica
17: .seealso: PetscFinalize()
18: @*/
19: PetscErrorCode PetscFinalizePackage(void)
20: {
22: PetscPackageInitialized = PETSC_FALSE;
23: return(0);
24: }
28: /*@C
29: PetscInitializePackage - This function initializes everything in the main Petsc package. It is called
30: from PetscDLLibraryRegister() when using dynamic libraries, and on the call to PetscInitialize()
31: when using static libraries.
33: Input Parameter:
34: path - The dynamic library path, or PETSC_NULL
36: Level: developer
38: .keywords: Petsc, initialize, package
39: .seealso: PetscInitialize()
40: @*/
41: PetscErrorCode PetscInitializePackage(const char path[])
42: {
43: char logList[256];
44: char *className;
45: PetscTruth opt;
46: PetscErrorCode ierr;
49: if (PetscPackageInitialized) return(0);
50: PetscPackageInitialized = PETSC_TRUE;
51: /* Register Classes */
52: PetscCookieRegister("Object",&PETSC_OBJECT_COOKIE);
53: PetscCookieRegister("Container",&PETSC_CONTAINER_COOKIE);
55: /* Register Events */
56: PetscLogEventRegister("PetscBarrier", PETSC_SMALLEST_COOKIE,&PETSC_Barrier);
57: /* Process info exclusions */
58: PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
59: if (opt) {
60: PetscStrstr(logList, "null", &className);
61: if (className) {
62: PetscInfoDeactivateClass(0);
63: }
64: }
65: /* Process summary exclusions */
66: PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
67: if (opt) {
68: PetscStrstr(logList, "null", &className);
69: if (className) {
70: PetscLogEventDeactivateClass(0);
71: }
72: }
73: PetscRegisterFinalize(PetscFinalizePackage);
74: return(0);
75: }
79: #if defined(PETSC_USE_SINGLE_LIBRARY) && defined(PETSC_USE_DYNAMIC_LIBRARIES)
86: #endif
90: /*
91: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
93: This one registers all the draw and PetscViewer objects.
95: Input Parameter:
96: path - library path
97: */
98: PetscErrorCode PetscDLLibraryRegister_petsc(const char path[])
99: {
102: PetscInitializeNoArguments(); if (ierr) return 1;
104: /*
105: If we got here then PETSc was properly loaded
106: */
107: PetscInitializePackage(path);
108: PetscDrawInitializePackage(path);
109: PetscViewerInitializePackage(path);
110: PetscRandomInitializePackage(path);
112: #if defined(PETSC_USE_SINGLE_LIBRARY) && defined(PETSC_USE_DYNAMIC_LIBRARIES)
113: PetscDLLibraryRegister_petscvec(path);
114: PetscDLLibraryRegister_petscmat(path);
115: PetscDLLibraryRegister_petscdm(path);
116: PetscDLLibraryRegister_petscksp(path);
117: PetscDLLibraryRegister_petscsnes(path);
118: PetscDLLibraryRegister_petscts(path);
119: #endif
120: return(0);
121: }