Actual source code: dlregispetsc.c

petsc-master 2020-07-09
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 */
 55:   {
 56:     PetscClassId  classids[1];

 58:     classids[0] = PETSC_SMALLEST_CLASSID;
 59:     PetscInfoProcessClass("sys", 1, classids);
 60:   }
 61:   /* Process summary exclusions */
 62:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
 63:   if (opt) {
 64:     PetscStrInList("null",logList,',',&pkg);
 65:     if (pkg) {PetscLogEventExcludeClass(PETSC_SMALLEST_CLASSID);}
 66:   }
 67:   PetscRegisterFinalize(PetscSysFinalizePackage);
 68:   return(0);
 69: }

 71: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)

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

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

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

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

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

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