Actual source code: dlregispetsc.c
petsc-3.8.4 2018-03-24
2: #include <petscdraw.h>
3: #include <petscviewer.h>
4: #include <petsc/private/viewerimpl.h>
6: extern PetscLogEvent PETSC_Barrier,PETSC_BuildTwoSided,PETSC_BuildTwoSidedF;
7: static PetscBool PetscSysPackageInitialized = PETSC_FALSE;
9: /*@C
10: PetscSysFinalizePackage - This function destroys everything in the PETSc created internally in the system library portion of PETSc.
11: It is called from PetscFinalize().
13: Level: developer
15: .keywords: Petsc, destroy, package
16: .seealso: PetscFinalize()
17: @*/
18: PetscErrorCode PetscSysFinalizePackage(void)
19: {
23: if (Petsc_Seq_keyval != MPI_KEYVAL_INVALID) {
24: MPI_Keyval_free(&Petsc_Seq_keyval);
25: }
26: PetscSysPackageInitialized = PETSC_FALSE;
27: return(0);
28: }
30: /*@C
31: PetscSysInitializePackage - This function initializes everything in the main Petsc package. It is called
32: from PetscDLLibraryRegister() when using dynamic libraries, and on the call to PetscInitialize()
33: when using static libraries.
35: Level: developer
37: .keywords: Petsc, initialize, package
38: .seealso: PetscInitialize()
39: @*/
40: PetscErrorCode PetscSysInitializePackage(void)
41: {
42: char logList[256];
43: char *className;
44: PetscBool opt;
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: PetscLogEventRegister("BuildTwoSided",PETSC_SMALLEST_CLASSID,&PETSC_BuildTwoSided);
57: PetscLogEventRegister("BuildTwoSidedF",PETSC_SMALLEST_CLASSID,&PETSC_BuildTwoSidedF);
58: /* Process info exclusions */
59: PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);
60: if (opt) {
61: PetscStrstr(logList, "null", &className);
62: if (className) {
63: PetscInfoDeactivateClass(0);
64: }
65: }
66: /* Process summary exclusions */
67: PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);
68: if (opt) {
69: PetscStrstr(logList, "null", &className);
70: if (className) {
71: PetscLogEventDeactivateClass(0);
72: }
73: }
74: PetscRegisterFinalize(PetscSysFinalizePackage);
75: return(0);
76: }
78: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
80: #if defined(PETSC_USE_SINGLE_LIBRARY)
81: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscvec(void);
82: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscmat(void);
83: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void);
84: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscksp(void);
85: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscsnes(void);
86: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void);
87: #endif
89: #if defined(PETSC_USE_SINGLE_LIBRARY)
90: #else
91: #endif
92: /*
93: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
95: This one registers all the draw and PetscViewer objects.
97: */
98: #if defined(PETSC_USE_SINGLE_LIBRARY)
99: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petsc(void)
100: #else
101: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscsys(void)
102: #endif
103: {
107: /*
108: If we got here then PETSc was properly loaded
109: */
110: PetscSysInitializePackage();
111: PetscDrawInitializePackage();
112: PetscViewerInitializePackage();
113: PetscRandomInitializePackage();
115: #if defined(PETSC_USE_SINGLE_LIBRARY)
116: PetscDLLibraryRegister_petscvec();
117: PetscDLLibraryRegister_petscmat();
118: PetscDLLibraryRegister_petscdm();
119: PetscDLLibraryRegister_petscksp();
120: PetscDLLibraryRegister_petscsnes();
121: PetscDLLibraryRegister_petscts();
122: #endif
123: return(0);
124: }
125: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */