Actual source code: dlregispetsc.c
1: #define PETSC_DLL
3: #include petsc.h
4: #include petscdraw.h
5: #include petscsys.h
11: /*@C
12: PetscInitializePackage - This function initializes everything in the main Petsc package. It is called
13: from PetscDLLibraryRegister() when using dynamic libraries, and on the call to PetscInitialize()
14: when using static libraries.
16: Input Parameter:
17: path - The dynamic library path, or PETSC_NULL
19: Level: developer
21: .keywords: Petsc, initialize, package
22: .seealso: PetscInitialize()
23: @*/
24: PetscErrorCode PetscInitializePackage(const char path[])
25: {
26: static PetscTruth initialized = PETSC_FALSE;
27: char logList[256];
28: char *className;
29: PetscTruth opt;
30: PetscErrorCode ierr;
33: if (initialized) return(0);
34: initialized = PETSC_TRUE;
35: /* Register Classes */
36: PetscCookieRegister("Object",&PETSC_OBJECT_COOKIE);
38: /* Register Events */
39: PetscLogEventRegister("PetscBarrier", PETSC_SMALLEST_COOKIE,&PETSC_Barrier);
40: /* Process info exclusions */
41: PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
42: if (opt) {
43: PetscStrstr(logList, "null", &className);
44: if (className) {
45: PetscInfoDeactivateClass(0);
46: }
47: }
48: /* Process summary exclusions */
49: PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
50: if (opt) {
51: PetscStrstr(logList, "null", &className);
52: if (className) {
53: PetscLogEventDeactivateClass(0);
54: }
55: }
56: return(0);
57: }
62: /*
63: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
65: This one registers all the draw and PetscViewer objects.
67: Input Parameter:
68: path - library path
69: */
70: PetscErrorCode PetscDLLibraryRegister_petsc(const char path[])
71: {
74: PetscInitializeNoArguments(); if (ierr) return 1;
76: /*
77: If we got here then PETSc was properly loaded
78: */
79: PetscInitializePackage(path);
80: PetscDrawInitializePackage(path);
81: PetscViewerInitializePackage(path);
82: PetscRandomInitializePackage(path);
83: return(0);
84: }