Actual source code: dlregists.c
petsc-3.3-p7 2013-05-11
2: #include <petsc-private/tsimpl.h>
4: static PetscBool TSPackageInitialized = PETSC_FALSE;
7: /*@C
8: TSFinalizePackage - This function destroys everything in the Petsc interface to Mathematica. It is
9: called from PetscFinalize().
11: Level: developer
13: .keywords: Petsc, destroy, package, mathematica
14: .seealso: PetscFinalize()
15: @*/
16: PetscErrorCode TSFinalizePackage(void)
17: {
19: TSPackageInitialized = PETSC_FALSE;
20: TSList = PETSC_NULL;
21: TSRegisterAllCalled = PETSC_FALSE;
22: return(0);
23: }
27: /*@C
28: TSInitializePackage - This function initializes everything in the TS package. It is called
29: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to TSCreate()
30: when using static libraries.
32: Input Parameter:
33: path - The dynamic library path, or PETSC_NULL
35: Level: developer
37: .keywords: TS, initialize, package
38: .seealso: PetscInitialize()
39: @*/
40: PetscErrorCode TSInitializePackage(const char path[])
41: {
42: char logList[256];
43: char *className;
44: PetscBool opt;
45: PetscErrorCode ierr;
48: if (TSPackageInitialized) return(0);
49: TSPackageInitialized = PETSC_TRUE;
50: /* Inialize subpackages */
51: TSGLInitializePackage(path);
52: TSARKIMEXInitializePackage(path);
53: TSRosWInitializePackage(path);
54: TSAdaptInitializePackage(path);
55: TSGLAdaptInitializePackage(path);
56: /* Register Classes */
57: PetscClassIdRegister("TS",&TS_CLASSID);
58: /* Register Constructors */
59: TSRegisterAll(path);
60: /* Register Events */
61: PetscLogEventRegister("TSStep", TS_CLASSID,&TS_Step);
62: PetscLogEventRegister("TSPseudoCmptTStp", TS_CLASSID,&TS_PseudoComputeTimeStep);
63: PetscLogEventRegister("TSFunctionEval", TS_CLASSID,&TS_FunctionEval);
64: PetscLogEventRegister("TSJacobianEval", TS_CLASSID,&TS_JacobianEval);
65: /* Process info exclusions */
66: PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
67: if (opt) {
68: PetscStrstr(logList, "ts", &className);
69: if (className) {
70: PetscInfoDeactivateClass(TS_CLASSID);
71: }
72: }
73: /* Process summary exclusions */
74: PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
75: if (opt) {
76: PetscStrstr(logList, "ts", &className);
77: if (className) {
78: PetscLogEventDeactivateClass(TS_CLASSID);
79: }
80: }
81: PetscRegisterFinalize(TSFinalizePackage);
82: return(0);
83: }
85: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
86: EXTERN_C_BEGIN
89: /*
90: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
92: This one registers all the TS methods that are in the basic PETSc libpetscts library.
94: Input Parameter:
95: path - library path
96: */
97: PetscErrorCode PetscDLLibraryRegister_petscts(const char path[])
98: {
102: TSInitializePackage(path);
103: return(0);
104: }
105: EXTERN_C_END
108: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */