Actual source code: dlregists.c
petsc-3.7.7 2017-09-25
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("TSAdjointStep",TS_CLASSID,&TS_AdjointStep);
67: PetscLogEventRegister("TSTrajSet",TSTRAJECTORY_CLASSID,&TSTrajectory_Set);
68: PetscLogEventRegister("TSTrajGet",TSTRAJECTORY_CLASSID,&TSTrajectory_Get);
69: PetscLogEventRegister("TSTrajDiskWrite",TS_CLASSID,&TSTrajectory_DiskWrite);
70: PetscLogEventRegister("TSTrajDiskRead",TS_CLASSID,&TSTrajectory_DiskRead);
71: PetscLogEventRegister("TSStep",TS_CLASSID,&TS_Step);
72: PetscLogEventRegister("TSPseudoCmptTStp",TS_CLASSID,&TS_PseudoComputeTimeStep);
73: PetscLogEventRegister("TSFunctionEval",TS_CLASSID,&TS_FunctionEval);
74: PetscLogEventRegister("TSJacobianEval",TS_CLASSID,&TS_JacobianEval);
75: /* Process info exclusions */
76: PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);
77: if (opt) {
78: PetscStrstr(logList, "ts", &className);
79: if (className) {
80: PetscInfoDeactivateClass(TS_CLASSID);
81: }
82: }
83: /* Process summary exclusions */
84: PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);
85: if (opt) {
86: PetscStrstr(logList, "ts", &className);
87: if (className) {
88: PetscLogEventDeactivateClass(TS_CLASSID);
89: }
90: }
91: PetscRegisterFinalize(TSFinalizePackage);
92: return(0);
93: }
95: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
98: /*
99: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
101: This one registers all the TS methods that are in the basic PETSc libpetscts library.
103: */
104: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void); /*prototype*/
105: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void)
106: {
110: TSInitializePackage();
111: return(0);
112: }
115: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */