Date: 2022-03-04T17:37:00+00:00

Actual source code: dlregispetsc.c

      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: /*
     83:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

     85:   This one registers all the system level objects.

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

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

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