Actual source code: dlregispetsc.c
petsc-3.11.4 2019-09-28
2: #include <petscdraw.h>
3: #include <petscviewer.h>
4: #include <petsc/private/viewerimpl.h>
6: static PetscBool PetscSysPackageInitialized = PETSC_FALSE;
8: /*@C
9: PetscSysFinalizePackage - This function destroys everything in the PETSc created internally in the system library portion of PETSc.
10: It is called from PetscFinalize().
12: Level: developer
14: .keywords: Petsc, destroy, package
15: .seealso: PetscFinalize()
16: @*/
17: PetscErrorCode PetscSysFinalizePackage(void)
18: {
22: if (Petsc_Seq_keyval != MPI_KEYVAL_INVALID) {
23: MPI_Comm_free_keyval(&Petsc_Seq_keyval);
24: }
25: PetscSysPackageInitialized = PETSC_FALSE;
26: return(0);
27: }
29: /*@C
30: PetscSysInitializePackage - This function initializes everything in the main Petsc package. It is called
31: from PetscDLLibraryRegister_petsc() when using dynamic libraries, and on the call to PetscInitialize()
32: when using shared or static libraries.
34: Level: developer
36: .keywords: Petsc, initialize, package
37: .seealso: PetscInitialize()
38: @*/
39: PetscErrorCode PetscSysInitializePackage(void)
40: {
41: char logList[256];
42: PetscBool opt,pkg;
46: if (PetscSysPackageInitialized) return(0);
47: PetscSysPackageInitialized = PETSC_TRUE;
48: /* Register Classes */
49: PetscClassIdRegister("Object",&PETSC_OBJECT_CLASSID);
50: PetscClassIdRegister("Container",&PETSC_CONTAINER_CLASSID);
52: /* Register Events */
53: PetscLogEventRegister("PetscBarrier", PETSC_SMALLEST_CLASSID,&PETSC_Barrier);
54: PetscLogEventRegister("BuildTwoSided",PETSC_SMALLEST_CLASSID,&PETSC_BuildTwoSided);
55: PetscLogEventRegister("BuildTwoSidedF",PETSC_SMALLEST_CLASSID,&PETSC_BuildTwoSidedF);
56: /* Process info exclusions */
57: PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
58: if (opt) {
59: PetscStrInList("null",logList,',',&pkg);
60: if (pkg) {PetscInfoDeactivateClass(0);}
61: }
62: /* Process summary exclusions */
63: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
64: if (opt) {
65: PetscStrInList("null",logList,',',&pkg);
66: if (pkg) {PetscLogEventExcludeClass(PETSC_SMALLEST_CLASSID);}
67: }
68: PetscRegisterFinalize(PetscSysFinalizePackage);
69: return(0);
70: }
72: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
74: #if defined(PETSC_USE_SINGLE_LIBRARY)
75: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscvec(void);
76: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscmat(void);
77: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void);
78: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscksp(void);
79: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscsnes(void);
80: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void);
81: #endif
83: #if defined(PETSC_USE_SINGLE_LIBRARY)
84: #else
85: #endif
86: /*
87: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
89: This one registers all the draw and PetscViewer objects.
91: */
92: #if defined(PETSC_USE_SINGLE_LIBRARY)
93: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petsc(void)
94: #else
95: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscsys(void)
96: #endif
97: {
101: /*
102: If we got here then PETSc was properly loaded
103: */
104: PetscSysInitializePackage();
105: PetscDrawInitializePackage();
106: PetscViewerInitializePackage();
107: PetscRandomInitializePackage();
109: #if defined(PETSC_USE_SINGLE_LIBRARY)
110: PetscDLLibraryRegister_petscvec();
111: PetscDLLibraryRegister_petscmat();
112: PetscDLLibraryRegister_petscdm();
113: PetscDLLibraryRegister_petscksp();
114: PetscDLLibraryRegister_petscsnes();
115: PetscDLLibraryRegister_petscts();
116: #endif
117: return(0);
118: }
119: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */