Actual source code: dlregispetsc.c

petsc-3.9.4 2018-09-11
Report Typos and Errors

  2:  #include <petscdraw.h>
  3:  #include <petscviewer.h>
  4:  #include <petsc/private/viewerimpl.h>

  6: extern PetscLogEvent PETSC_Barrier,PETSC_BuildTwoSided,PETSC_BuildTwoSidedF;
  7: static PetscBool PetscSysPackageInitialized = PETSC_FALSE;

  9: /*@C
 10:   PetscSysFinalizePackage - This function destroys everything in the PETSc created internally in the system library portion of PETSc.
 11:   It is called from PetscFinalize().

 13:   Level: developer

 15: .keywords: Petsc, destroy, package
 16: .seealso: PetscFinalize()
 17: @*/
 18: PetscErrorCode  PetscSysFinalizePackage(void)
 19: {

 23:   if (Petsc_Seq_keyval != MPI_KEYVAL_INVALID) {
 24:     MPI_Comm_free_keyval(&Petsc_Seq_keyval);
 25:   }
 26:   PetscSysPackageInitialized = PETSC_FALSE;
 27:   return(0);
 28: }

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

 35:   Level: developer

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

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

 53:   /* Register Events */
 54:   PetscLogEventRegister("PetscBarrier", PETSC_SMALLEST_CLASSID,&PETSC_Barrier);
 55:   PetscLogEventRegister("BuildTwoSided",PETSC_SMALLEST_CLASSID,&PETSC_BuildTwoSided);
 56:   PetscLogEventRegister("BuildTwoSidedF",PETSC_SMALLEST_CLASSID,&PETSC_BuildTwoSidedF);
 57:   /* Process info exclusions */
 58:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
 59:   if (opt) {
 60:     PetscStrInList("null",logList,',',&pkg);
 61:     if (pkg) {PetscInfoDeactivateClass(0);}
 62:   }
 63:   /* Process summary exclusions */
 64:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
 65:   if (opt) {
 66:     PetscStrInList("null",logList,',',&pkg);
 67:     if (pkg) {PetscLogEventDeactivateClass(0);}
 68:   }
 69:   PetscRegisterFinalize(PetscSysFinalizePackage);
 70:   return(0);
 71: }

 73: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)

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

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

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

 92:  */
 93: #if defined(PETSC_USE_SINGLE_LIBRARY)
 94: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petsc(void)
 95: #else
 96: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscsys(void)
 97: #endif
 98: {

102:   /*
103:       If we got here then PETSc was properly loaded
104:   */
105:   PetscSysInitializePackage();
106:   PetscDrawInitializePackage();
107:   PetscViewerInitializePackage();
108:   PetscRandomInitializePackage();

110: #if defined(PETSC_USE_SINGLE_LIBRARY)
111:   PetscDLLibraryRegister_petscvec();
112:   PetscDLLibraryRegister_petscmat();
113:   PetscDLLibraryRegister_petscdm();
114:   PetscDLLibraryRegister_petscksp();
115:   PetscDLLibraryRegister_petscsnes();
116:   PetscDLLibraryRegister_petscts();
117: #endif
118:   return(0);
119: }
120: #endif  /* PETSC_HAVE_DYNAMIC_LIBRARIES */