Actual source code: dlregists.c

petsc-master 2019-06-18
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: .seealso: PetscFinalize()
 11: @*/
 12: PetscErrorCode  TSFinalizePackage(void)
 13: {

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

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

 29:   Level: developer

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

 40:   if (TSPackageInitialized) return(0);
 41:   TSPackageInitialized = PETSC_TRUE;
 42:   /* Inialize subpackages */
 43:   TSAdaptInitializePackage();
 44:   TSGLLEInitializePackage();
 45:   TSRKInitializePackage();
 46:   TSGLEEInitializePackage();
 47:   TSARKIMEXInitializePackage();
 48:   TSRosWInitializePackage();
 49:   TSSSPInitializePackage();
 50:   TSGLLEAdaptInitializePackage();
 51:   TSBasicSymplecticInitializePackage();
 52:   /* Register Classes */
 53:   PetscClassIdRegister("TS",&TS_CLASSID);
 54:   PetscClassIdRegister("DMTS",&DMTS_CLASSID);
 55:   PetscClassIdRegister("TSTrajectory",&TSTRAJECTORY_CLASSID);

 57:   /* Register Constructors */
 58:   TSRegisterAll();
 59:   TSTrajectoryRegisterAll();
 60:   /* Register Events */
 61:   PetscLogEventRegister("TSStep",          TS_CLASSID,&TS_Step);
 62:   PetscLogEventRegister("TSFunctionEval",  TS_CLASSID,&TS_FunctionEval);
 63:   PetscLogEventRegister("TSJacobianEval",  TS_CLASSID,&TS_JacobianEval);
 64:   PetscLogEventRegister("TSForwardStep",   TS_CLASSID,&TS_ForwardStep);
 65:   PetscLogEventRegister("TSAdjointStep",   TS_CLASSID,&TS_AdjointStep);
 66:   PetscLogEventRegister("TSTrajectorySet", TSTRAJECTORY_CLASSID,&TSTrajectory_Set);
 67:   PetscLogEventRegister("TSTrajectoryGet", TSTRAJECTORY_CLASSID,&TSTrajectory_Get);
 68:   PetscLogEventRegister("TSTrajGetVecs",   TSTRAJECTORY_CLASSID,&TSTrajectory_GetVecs);
 69:   PetscLogEventRegister("TSTrajDiskWrite", TSTRAJECTORY_CLASSID,&TSTrajectory_DiskWrite);
 70:   PetscLogEventRegister("TSTrajDiskRead",  TSTRAJECTORY_CLASSID,&TSTrajectory_DiskRead);
 71:   PetscLogEventRegister("TSPseudoCmptTStp",TS_CLASSID,&TS_PseudoComputeTimeStep);
 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) {PetscLogEventExcludeClass(TS_CLASSID);}
 89:     PetscStrInList("dm",logList,',',&cls);
 90:     if (pkg || cls) {PetscLogEventExcludeClass(DMTS_CLASSID);}
 91:     PetscStrInList("tsadapt",logList,',',&cls);
 92:     if (pkg || cls) {PetscLogEventExcludeClass(TSADAPT_CLASSID);}
 93:     PetscStrInList("tstrajectory",logList,',',&cls);
 94:     if (pkg || cls) {PetscLogEventExcludeClass(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: }
117: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */