Actual source code: dlregists.c
petsc-3.10.5 2019-03-28
2: #include <petsc/private/tsimpl.h>
4: static PetscBool TSPackageInitialized = PETSC_FALSE;
5: /*@C
6: TSFinalizePackage - This function destroys everything in the Petsc interface to Mathematica. It is
7: called from PetscFinalize().
9: Level: developer
11: .keywords: Petsc, destroy, package, mathematica
12: .seealso: PetscFinalize()
13: @*/
14: PetscErrorCode TSFinalizePackage(void)
15: {
19: PetscFunctionListDestroy(&TSList);
20: PetscFunctionListDestroy(&TSTrajectoryList);
21: TSPackageInitialized = PETSC_FALSE;
22: TSRegisterAllCalled = PETSC_FALSE;
23: return(0);
24: }
26: /*@C
27: TSInitializePackage - This function initializes everything in the TS package. It is called
28: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to TSCreate()
29: when using static libraries.
31: Level: developer
33: .keywords: TS, initialize, package
34: .seealso: PetscInitialize()
35: @*/
36: PetscErrorCode TSInitializePackage(void)
37: {
38: char logList[256];
39: PetscBool opt,pkg,cls;
43: if (TSPackageInitialized) return(0);
44: TSPackageInitialized = PETSC_TRUE;
45: /* Inialize subpackages */
46: TSAdaptInitializePackage();
47: TSGLLEInitializePackage();
48: TSRKInitializePackage();
49: TSGLEEInitializePackage();
50: TSARKIMEXInitializePackage();
51: TSRosWInitializePackage();
52: TSSSPInitializePackage();
53: TSGLLEAdaptInitializePackage();
54: TSBasicSymplecticInitializePackage();
55: /* Register Classes */
56: PetscClassIdRegister("TS",&TS_CLASSID);
57: PetscClassIdRegister("DMTS",&DMTS_CLASSID);
58: PetscClassIdRegister("TSTrajectory",&TSTRAJECTORY_CLASSID);
59: /* Register Constructors */
60: TSRegisterAll();
61: TSTrajectoryRegisterAll();
62: /* Register Events */
63: PetscLogEventRegister("TSStep", TS_CLASSID,&TS_Step);
64: PetscLogEventRegister("TSFunctionEval", TS_CLASSID,&TS_FunctionEval);
65: PetscLogEventRegister("TSJacobianEval", TS_CLASSID,&TS_JacobianEval);
66: PetscLogEventRegister("TSForwardStep", TS_CLASSID,&TS_ForwardStep);
67: PetscLogEventRegister("TSAdjointStep", TS_CLASSID,&TS_AdjointStep);
68: PetscLogEventRegister("TSTrajectorySet", TSTRAJECTORY_CLASSID,&TSTrajectory_Set);
69: PetscLogEventRegister("TSTrajectoryGet", TSTRAJECTORY_CLASSID,&TSTrajectory_Get);
70: PetscLogEventRegister("TSTrajDiskWrite", TSTRAJECTORY_CLASSID,&TSTrajectory_DiskWrite);
71: PetscLogEventRegister("TSTrajDiskRead", TSTRAJECTORY_CLASSID,&TSTrajectory_DiskRead);
72: PetscLogEventRegister("TSPseudoCmptTStp",TS_CLASSID,&TS_PseudoComputeTimeStep);
73: /* Process info exclusions */
74: PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
75: if (opt) {
76: PetscStrInList("ts",logList,',',&pkg);
77: if (pkg) {PetscInfoDeactivateClass(TS_CLASSID);}
78: PetscStrInList("dm",logList,',',&cls);
79: if (pkg || cls) {PetscInfoDeactivateClass(DMTS_CLASSID);}
80: PetscStrInList("tsadapt",logList,',',&cls);
81: if (pkg || cls) {PetscInfoDeactivateClass(TSADAPT_CLASSID);}
82: PetscStrInList("tstrajectory",logList,',',&cls);
83: if (pkg || cls) {PetscInfoDeactivateClass(TSTRAJECTORY_CLASSID);}
84: }
85: /* Process summary exclusions */
86: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
87: if (opt) {
88: PetscStrInList("ts",logList,',',&pkg);
89: if (pkg) {PetscLogEventExcludeClass(TS_CLASSID);}
90: PetscStrInList("dm",logList,',',&cls);
91: if (pkg || cls) {PetscLogEventExcludeClass(DMTS_CLASSID);}
92: PetscStrInList("tsadapt",logList,',',&cls);
93: if (pkg || cls) {PetscLogEventExcludeClass(TSADAPT_CLASSID);}
94: PetscStrInList("tstrajectory",logList,',',&cls);
95: if (pkg || cls) {PetscLogEventExcludeClass(TSTRAJECTORY_CLASSID);}
96: }
97: /* Register package finalizer */
98: PetscRegisterFinalize(TSFinalizePackage);
99: return(0);
100: }
102: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
103: /*
104: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
106: This one registers all the TS methods that are in the basic PETSc libpetscts library.
108: */
109: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void); /*prototype*/
110: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void)
111: {
115: TSInitializePackage();
116: return(0);
117: }
120: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */