Actual source code: dlregists.c

petsc-3.11.4 2019-09-28
Report Typos and Errors
  1:  #include <petsc/private/tsimpl.h>

  3: static PetscBool TSPackageInitialized = PETSC_FALSE;
  4: /*@C
  5:   TSFinalizePackage - This function destroys everything in the Petsc interface to Mathematica. It is
  6:   called from PetscFinalize().

  8:   Level: developer

 10: .keywords: Petsc, destroy, package, mathematica
 11: .seealso: PetscFinalize()
 12: @*/
 13: PetscErrorCode  TSFinalizePackage(void)
 14: {

 18:   PetscFunctionListDestroy(&TSList);
 19:   PetscFunctionListDestroy(&TSTrajectoryList);
 20:   TSPackageInitialized = PETSC_FALSE;
 21:   TSRegisterAllCalled  = PETSC_FALSE;
 22:   return(0);
 23: }

 25: /*@C
 26:   TSInitializePackage - This function initializes everything in the TS package. It is called
 27:   from PetscDLLibraryRegister_petscts() when using dynamic libraries, and on the first call to TSCreate()
 28:   when using shared or static libraries.

 30:   Level: developer

 32: .keywords: TS, initialize, package
 33: .seealso: PetscInitialize()
 34: @*/
 35: PetscErrorCode  TSInitializePackage(void)
 36: {
 37:   char           logList[256];
 38:   PetscBool      opt,pkg,cls;

 42:   if (TSPackageInitialized) return(0);
 43:   TSPackageInitialized = PETSC_TRUE;
 44:   /* Inialize subpackages */
 45:   TSAdaptInitializePackage();
 46:   TSGLLEInitializePackage();
 47:   TSRKInitializePackage();
 48:   TSGLEEInitializePackage();
 49:   TSARKIMEXInitializePackage();
 50:   TSRosWInitializePackage();
 51:   TSSSPInitializePackage();
 52:   TSGLLEAdaptInitializePackage();
 53:   TSBasicSymplecticInitializePackage();
 54:   /* Register Classes */
 55:   PetscClassIdRegister("TS",&TS_CLASSID);
 56:   PetscClassIdRegister("DMTS",&DMTS_CLASSID);
 57:   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("TSTrajGetVecs",   TSTRAJECTORY_CLASSID,&TSTrajectory_GetVecs);
 71:   PetscLogEventRegister("TSTrajDiskWrite", TSTRAJECTORY_CLASSID,&TSTrajectory_DiskWrite);
 72:   PetscLogEventRegister("TSTrajDiskRead",  TSTRAJECTORY_CLASSID,&TSTrajectory_DiskRead);
 73:   PetscLogEventRegister("TSPseudoCmptTStp",TS_CLASSID,&TS_PseudoComputeTimeStep);
 74:   /* Process info exclusions */
 75:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
 76:   if (opt) {
 77:     PetscStrInList("ts",logList,',',&pkg);
 78:     if (pkg) {PetscInfoDeactivateClass(TS_CLASSID);}
 79:     PetscStrInList("dm",logList,',',&cls);
 80:     if (pkg || cls) {PetscInfoDeactivateClass(DMTS_CLASSID);}
 81:     PetscStrInList("tsadapt",logList,',',&cls);
 82:     if (pkg || cls) {PetscInfoDeactivateClass(TSADAPT_CLASSID);}
 83:     PetscStrInList("tstrajectory",logList,',',&cls);
 84:     if (pkg || cls) {PetscInfoDeactivateClass(TSTRAJECTORY_CLASSID);}
 85:   }
 86:   /* Process summary exclusions */
 87:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
 88:   if (opt) {
 89:     PetscStrInList("ts",logList,',',&pkg);
 90:     if (pkg) {PetscLogEventExcludeClass(TS_CLASSID);}
 91:     PetscStrInList("dm",logList,',',&cls);
 92:     if (pkg || cls) {PetscLogEventExcludeClass(DMTS_CLASSID);}
 93:     PetscStrInList("tsadapt",logList,',',&cls);
 94:     if (pkg || cls) {PetscLogEventExcludeClass(TSADAPT_CLASSID);}
 95:     PetscStrInList("tstrajectory",logList,',',&cls);
 96:     if (pkg || cls) {PetscLogEventExcludeClass(TSTRAJECTORY_CLASSID);}
 97:   }
 98:   /* Register package finalizer */
 99:   PetscRegisterFinalize(TSFinalizePackage);
100:   return(0);
101: }

103: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
104: /*
105:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

107:   This one registers all the TS methods that are in the basic PETSc libpetscts library.

109:  */
110: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void); /*prototype*/
111: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void)
112: {

116:   TSInitializePackage();
117:   return(0);
118: }
119: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */