Actual source code: dlregists.c
petsc-3.9.4 2018-09-11
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: /* Register Classes */
55: PetscClassIdRegister("TS",&TS_CLASSID);
56: PetscClassIdRegister("DMTS",&DMTS_CLASSID);
57: PetscClassIdRegister("TSTrajectory",&TSTRAJECTORY_CLASSID);
58: /* Register Constructors */
59: TSRegisterAll();
60: TSTrajectoryRegisterAll();
61: /* Register Events */
62: PetscLogEventRegister("TSAdjointStep",TS_CLASSID,&TS_AdjointStep);
63: PetscLogEventRegister("TSForwardStep",TS_CLASSID,&TS_ForwardStep);
64: PetscLogEventRegister("TSTrajSet",TSTRAJECTORY_CLASSID,&TSTrajectory_Set);
65: PetscLogEventRegister("TSTrajGet",TSTRAJECTORY_CLASSID,&TSTrajectory_Get);
66: PetscLogEventRegister("TSTrajDiskWrite",TS_CLASSID,&TSTrajectory_DiskWrite);
67: PetscLogEventRegister("TSTrajDiskRead",TS_CLASSID,&TSTrajectory_DiskRead);
68: PetscLogEventRegister("TSStep",TS_CLASSID,&TS_Step);
69: PetscLogEventRegister("TSPseudoCmptTStp",TS_CLASSID,&TS_PseudoComputeTimeStep);
70: PetscLogEventRegister("TSFunctionEval",TS_CLASSID,&TS_FunctionEval);
71: PetscLogEventRegister("TSJacobianEval",TS_CLASSID,&TS_JacobianEval);
72: /* Process info exclusions */
73: PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
74: if (opt) {
75: PetscStrInList("ts",logList,',',&pkg);
76: if (pkg) {PetscInfoDeactivateClass(TS_CLASSID);}
77: PetscStrInList("dm",logList,',',&cls);
78: if (pkg || cls) {PetscInfoDeactivateClass(DMTS_CLASSID);}
79: PetscStrInList("tsadapt",logList,',',&cls);
80: if (pkg || cls) {PetscInfoDeactivateClass(TSADAPT_CLASSID);}
81: PetscStrInList("tstrajectory",logList,',',&cls);
82: if (pkg || cls) {PetscInfoDeactivateClass(TSTRAJECTORY_CLASSID);}
83: }
84: /* Process summary exclusions */
85: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
86: if (opt) {
87: PetscStrInList("ts",logList,',',&pkg);
88: if (pkg) {PetscLogEventDeactivateClass(TS_CLASSID);}
89: PetscStrInList("dm",logList,',',&cls);
90: if (pkg || cls) {PetscLogEventDeactivateClass(DMTS_CLASSID);}
91: PetscStrInList("tsadapt",logList,',',&cls);
92: if (pkg || cls) {PetscLogEventDeactivateClass(TSADAPT_CLASSID);}
93: PetscStrInList("tstrajectory",logList,',',&cls);
94: if (pkg || cls) {PetscLogEventDeactivateClass(TSTRAJECTORY_CLASSID);}
95: }
96: /* Register package finalizer */
97: PetscRegisterFinalize(TSFinalizePackage);
98: return(0);
99: }
101: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
102: /*
103: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
105: This one registers all the TS methods that are in the basic PETSc libpetscts library.
107: */
108: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void); /*prototype*/
109: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void)
110: {
114: TSInitializePackage();
115: return(0);
116: }
119: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */