Actual source code: dlregists.c

      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 */
     73:   {
     74:     PetscClassId  classids[4];

     76:     classids[0] = TS_CLASSID;
     77:     classids[1] = DMTS_CLASSID;
     78:     classids[2] = TSADAPT_CLASSID;
     79:     classids[3] = TSTRAJECTORY_CLASSID;
     80:     PetscInfoProcessClass("ts", 1, classids);
     81:     PetscInfoProcessClass("dm", 1, &classids[1]);
     82:     PetscInfoProcessClass("tsadapt", 1, &classids[2]);
     83:     PetscInfoProcessClass("tstrajectory", 1, &classids[3]);
     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: }
    118: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */