Date: 2022-03-04T17:39:32+00:00

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("TSTrajSetUp", TSTRAJECTORY_CLASSID,&TSTrajectory_SetUp);
     70:   PetscLogEventRegister("TSTrajDiskWrite", TSTRAJECTORY_CLASSID,&TSTrajectory_DiskWrite);
     71:   PetscLogEventRegister("TSTrajDiskRead",  TSTRAJECTORY_CLASSID,&TSTrajectory_DiskRead);
     72:   PetscLogEventRegister("TSPseudoCmptTStp",TS_CLASSID,&TS_PseudoComputeTimeStep);
     73:   /* Process Info */
     74:   {
     75:     PetscClassId  classids[4];

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