Actual source code: dlregispetsc.c

petsc-3.6.1 2015-08-06
Report Typos and Errors
  2: #include <petscdraw.h>
  3: #include <petscviewer.h>

  5: extern PetscLogEvent PETSC_Barrier;

  7: static PetscBool PetscSysPackageInitialized = PETSC_FALSE;
 10: /*@C
 11:   PetscSysFinalizePackage - This function destroys everything in the Petsc interface to Mathematica. It is
 12:   called from PetscFinalize().

 14:   Level: developer

 16: .keywords: Petsc, destroy, package, mathematica
 17: .seealso: PetscFinalize()
 18: @*/
 19: PetscErrorCode  PetscSysFinalizePackage(void)
 20: {
 22:   PetscSysPackageInitialized = PETSC_FALSE;
 23:   return(0);
 24: }

 28: /*@C
 29:   PetscSysInitializePackage - This function initializes everything in the main Petsc package. It is called
 30:   from PetscDLLibraryRegister() when using dynamic libraries, and on the call to PetscInitialize()
 31:   when using static libraries.

 33:   Level: developer

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

 46:   if (PetscSysPackageInitialized) return(0);
 47:   PetscSysPackageInitialized = PETSC_TRUE;
 48:   /* Register Classes */
 49:   PetscClassIdRegister("Object",&PETSC_OBJECT_CLASSID);
 50:   PetscClassIdRegister("Container",&PETSC_CONTAINER_CLASSID);

 52:   /* Register Events */
 53:   PetscLogEventRegister("PetscBarrier", PETSC_SMALLEST_CLASSID,&PETSC_Barrier);
 54:   /* Process info exclusions */
 55:   PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);
 56:   if (opt) {
 57:     PetscStrstr(logList, "null", &className);
 58:     if (className) {
 59:       PetscInfoDeactivateClass(0);
 60:     }
 61:   }
 62:   /* Process summary exclusions */
 63:   PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);
 64:   if (opt) {
 65:     PetscStrstr(logList, "null", &className);
 66:     if (className) {
 67:       PetscLogEventDeactivateClass(0);
 68:     }
 69:   }
 70:   PetscRegisterFinalize(PetscSysFinalizePackage);
 71:   return(0);
 72: }

 74: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)

 76: #if defined(PETSC_USE_SINGLE_LIBRARY)
 77: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscvec(void);
 78: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscmat(void);
 79: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void);
 80: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscksp(void);
 81: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscsnes(void);
 82: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void);
 83: #endif

 86: #if defined(PETSC_USE_SINGLE_LIBRARY)
 88: #else
 90: #endif
 91: /*
 92:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

 94:   This one registers all the draw and PetscViewer objects.

 96:  */
 97: #if defined(PETSC_USE_SINGLE_LIBRARY)
 98: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petsc(void)
 99: #else
100: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscsys(void)
101: #endif
102: {

106:   /*
107:       If we got here then PETSc was properly loaded
108:   */
109:   PetscSysInitializePackage();
110:   PetscDrawInitializePackage();
111:   PetscViewerInitializePackage();
112:   PetscRandomInitializePackage();

114: #if defined(PETSC_USE_SINGLE_LIBRARY)
115:   PetscDLLibraryRegister_petscvec();
116:   PetscDLLibraryRegister_petscmat();
117:   PetscDLLibraryRegister_petscdm();
118:   PetscDLLibraryRegister_petscksp();
119:   PetscDLLibraryRegister_petscsnes();
120:   PetscDLLibraryRegister_petscts();
121: #endif
122:   return(0);
123: }
124: #endif  /* PETSC_HAVE_DYNAMIC_LIBRARIES */