Actual source code: dlregispetsc.c

petsc-master 2019-08-19
Report Typos and Errors

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

  6: static PetscBool PetscSysPackageInitialized = PETSC_FALSE;

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

 12:   Level: developer

 14: .seealso: PetscFinalize()
 15: @*/
 16: PetscErrorCode  PetscSysFinalizePackage(void)
 17: {

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

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

 33:   Level: developer

 35: .seealso: PetscInitialize()
 36: @*/
 37: PetscErrorCode  PetscSysInitializePackage(void)
 38: {
 39:   char           logList[256];
 40:   PetscBool      opt,pkg;

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

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

 70: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)

 72: #if defined(PETSC_USE_SINGLE_LIBRARY)
 73: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscvec(void);
 74: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscmat(void);
 75: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void);
 76: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscksp(void);
 77: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscsnes(void);
 78: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscts(void);
 79: #endif

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

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

 89:  */
 90: #if defined(PETSC_USE_SINGLE_LIBRARY)
 91: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petsc(void)
 92: #else
 93: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscsys(void)
 94: #endif
 95: {

 99:   /*
100:       If we got here then PETSc was properly loaded
101:   */
102:   PetscSysInitializePackage();
103:   PetscDrawInitializePackage();
104:   PetscViewerInitializePackage();
105:   PetscRandomInitializePackage();

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