Actual source code: dlregisrand.c

      2: #include <../src/sys/classes/random/randomimpl.h>

      4: static PetscBool PetscRandomPackageInitialized = PETSC_FALSE;
      5: /*@C
      6:   PetscRandomFinalizePackage - This function destroys everything in the Petsc interface to the Random package. It is
      7:   called from PetscFinalize().

      9:   Level: developer

     11: .seealso: PetscFinalize()
     12: @*/
     13: PetscErrorCode  PetscRandomFinalizePackage(void)
     14: {

     18:   PetscFunctionListDestroy(&PetscRandomList);
     19:   PetscRandomPackageInitialized = PETSC_FALSE;
     20:   PetscRandomRegisterAllCalled  = PETSC_FALSE;
     21:   return(0);
     22: }

     24: /*@C
     25:   PetscRandomInitializePackage - This function initializes everything in the PetscRandom package. It is called
     26:   from PetscDLLibraryRegister_petsc() when using dynamic libraries, and on the first call to PetscRandomCreate()
     27:   when using shared or static libraries.

     29:   Level: developer

     31: .seealso: PetscInitialize()
     32: @*/
     33: PetscErrorCode  PetscRandomInitializePackage(void)
     34: {
     35:   char           logList[256];
     36:   PetscBool      opt,pkg;

     40:   if (PetscRandomPackageInitialized) return(0);
     41:   PetscRandomPackageInitialized = PETSC_TRUE;
     42:   /* Register Class */
     43:   PetscClassIdRegister("PetscRandom",&PETSC_RANDOM_CLASSID);
     44:   /* Register Constructors */
     45:   PetscRandomRegisterAll();
     46:   /* Process Info */
     47:   {
     48:     PetscClassId  classids[1];

     50:     classids[0] = PETSC_RANDOM_CLASSID;
     51:     PetscInfoProcessClass("random", 1, classids);
     52:   }
     53:   /* Process summary exclusions */
     54:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
     55:   if (opt) {
     56:     PetscStrInList("random",logList,',',&pkg);
     57:     if (pkg) {PetscLogEventExcludeClass(PETSC_RANDOM_CLASSID);}
     58:   }
     59:   /* Register package finalizer */
     60:   PetscRegisterFinalize(PetscRandomFinalizePackage);
     61:   return(0);
     62: }