Actual source code: dlregispetsc.c

petsc-3.7.4 2016-10-02
Report Typos and Errors
  2: #include <petscdraw.h>
  3: #include <petscviewer.h>

  5: extern PetscLogEvent PETSC_Barrier,PETSC_BuildTwoSided,PETSC_BuildTwoSidedF;

  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:   PetscLogEventRegister("BuildTwoSided",PETSC_SMALLEST_CLASSID,&PETSC_BuildTwoSided);
 55:   PetscLogEventRegister("BuildTwoSidedF",PETSC_SMALLEST_CLASSID,&PETSC_BuildTwoSidedF);
 56:   /* Process info exclusions */
 57:   PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);
 58:   if (opt) {
 59:     PetscStrstr(logList, "null", &className);
 60:     if (className) {
 61:       PetscInfoDeactivateClass(0);
 62:     }
 63:   }
 64:   /* Process summary exclusions */
 65:   PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);
 66:   if (opt) {
 67:     PetscStrstr(logList, "null", &className);
 68:     if (className) {
 69:       PetscLogEventDeactivateClass(0);
 70:     }
 71:   }
 72:   PetscRegisterFinalize(PetscSysFinalizePackage);
 73:   return(0);
 74: }

 76: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)

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

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

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

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

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

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