Actual source code: dlregists.c
petsc-3.6.1 2015-08-06
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: {
21: PetscFunctionListDestroy(&TSList);
22: PetscFunctionListDestroy(&TSTrajectoryList);
23: TSPackageInitialized = PETSC_FALSE;
24: TSRegisterAllCalled = PETSC_FALSE;
25: return(0);
26: }
30: /*@C
31: TSInitializePackage - This function initializes everything in the TS package. It is called
32: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to TSCreate()
33: when using static libraries.
35: Level: developer
37: .keywords: TS, initialize, package
38: .seealso: PetscInitialize()
39: @*/
40: PetscErrorCode TSInitializePackage(void)
41: {
42: char logList[256];
43: char *className;
44: PetscBool opt;
48: if (TSPackageInitialized) return(0);
49: TSPackageInitialized = PETSC_TRUE;
50: /* Inialize subpackages */
51: TSGLInitializePackage();
52: TSRKInitializePackage();
53: TSARKIMEXInitializePackage();
54: TSRosWInitializePackage();
55: TSSSPInitializePackage();
56: TSAdaptInitializePackage();
57: TSGLAdaptInitializePackage();
58: /* Register Classes */
59: PetscClassIdRegister("TS",&TS_CLASSID);
60: PetscClassIdRegister("DMTS",&DMTS_CLASSID);
61: PetscClassIdRegister("TSTrajectory",&TSTRAJECTORY_CLASSID);
62: /* Register Constructors */
63: TSRegisterAll();
64: TSTrajectoryRegisterAll();
65: /* Register Events */
66: PetscLogEventRegister("TSStep", TS_CLASSID,&TS_Step);
67: PetscLogEventRegister("TSPseudoCmptTStp", TS_CLASSID,&TS_PseudoComputeTimeStep);
68: PetscLogEventRegister("TSFunctionEval", TS_CLASSID,&TS_FunctionEval);
69: PetscLogEventRegister("TSJacobianEval", TS_CLASSID,&TS_JacobianEval);
70: /* Process info exclusions */
71: PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);
72: if (opt) {
73: PetscStrstr(logList, "ts", &className);
74: if (className) {
75: PetscInfoDeactivateClass(TS_CLASSID);
76: }
77: }
78: /* Process summary exclusions */
79: PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);
80: if (opt) {
81: PetscStrstr(logList, "ts", &className);
82: if (className) {
83: PetscLogEventDeactivateClass(TS_CLASSID);
84: }
85: }
86: PetscRegisterFinalize(TSFinalizePackage);
87: return(0);
88: }
90: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
93: /*
94: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
96: This one registers all the TS methods that are in the basic PETSc libpetscts library.
98: */
99: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void)
100: {
104: TSInitializePackage();
105: return(0);
106: }
109: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */