Actual source code: dlregists.c

petsc-3.4.4 2014-03-13
  2: #include <petsc-private/tsimpl.h>

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

 11:   Level: developer

 13: .keywords: Petsc, destroy, package, mathematica
 14: .seealso: PetscFinalize()
 15: @*/
 16: PetscErrorCode  TSFinalizePackage(void)
 17: {

 21:   PetscFunctionListDestroy(&TSList);
 22:   TSPackageInitialized = PETSC_FALSE;
 23:   TSRegisterAllCalled  = PETSC_FALSE;
 24:   return(0);
 25: }

 29: /*@C
 30:   TSInitializePackage - This function initializes everything in the TS package. It is called
 31:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to TSCreate()
 32:   when using static libraries.

 34:   Level: developer

 36: .keywords: TS, initialize, package
 37: .seealso: PetscInitialize()
 38: @*/
 39: PetscErrorCode  TSInitializePackage(void)
 40: {
 41:   char           logList[256];
 42:   char           *className;
 43:   PetscBool      opt;

 47:   if (TSPackageInitialized) return(0);
 48:   TSPackageInitialized = PETSC_TRUE;
 49:   /* Inialize subpackages */
 50:   TSGLInitializePackage();
 51:   TSARKIMEXInitializePackage();
 52:   TSRosWInitializePackage();
 53:   TSSSPInitializePackage();
 54:   TSAdaptInitializePackage();
 55:   TSGLAdaptInitializePackage();
 56:   /* Register Classes */
 57:   PetscClassIdRegister("TS",&TS_CLASSID);
 58:   PetscClassIdRegister("DMTS",&DMTS_CLASSID);
 59:   /* Register Constructors */
 60:   TSRegisterAll();
 61:   /* Register Events */
 62:   PetscLogEventRegister("TSStep",           TS_CLASSID,&TS_Step);
 63:   PetscLogEventRegister("TSPseudoCmptTStp", TS_CLASSID,&TS_PseudoComputeTimeStep);
 64:   PetscLogEventRegister("TSFunctionEval",   TS_CLASSID,&TS_FunctionEval);
 65:   PetscLogEventRegister("TSJacobianEval",   TS_CLASSID,&TS_JacobianEval);
 66:   /* Process info exclusions */
 67:   PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);
 68:   if (opt) {
 69:     PetscStrstr(logList, "ts", &className);
 70:     if (className) {
 71:       PetscInfoDeactivateClass(TS_CLASSID);
 72:     }
 73:   }
 74:   /* Process summary exclusions */
 75:   PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);
 76:   if (opt) {
 77:     PetscStrstr(logList, "ts", &className);
 78:     if (className) {
 79:       PetscLogEventDeactivateClass(TS_CLASSID);
 80:     }
 81:   }
 82:   PetscRegisterFinalize(TSFinalizePackage);
 83:   return(0);
 84: }

 86: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
 89: /*
 90:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

 94:  */
 95: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void)
 96: {

100:   TSInitializePackage();
101:   return(0);
102: }


105: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */