Actual source code: dlregisrand.c
petsc-3.10.5 2019-03-28
Report Typos and Errors

      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: .keywords: Petsc, destroy, package, mathematica
     12: .seealso: PetscFinalize()
     13: @*/
     14: PetscErrorCode  PetscRandomFinalizePackage(void)
     15: {

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

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

     30:   Level: developer

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

     42:   if (PetscRandomPackageInitialized) return(0);
     43:   PetscRandomPackageInitialized = PETSC_TRUE;
     44:   /* Register Class */
     45:   PetscClassIdRegister("PetscRandom",&PETSC_RANDOM_CLASSID);
     46:   /* Register Constructors */
     47:   PetscRandomRegisterAll();
     48:   /* Process info exclusions */
     49:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
     50:   if (opt) {
     51:     PetscStrInList("random",logList,',',&pkg);
     52:     if (pkg) {PetscInfoDeactivateClass(PETSC_RANDOM_CLASSID);}
     53:   }
     54:   /* Process summary exclusions */
     55:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
     56:   if (opt) {
     57:     PetscStrInList("random",logList,',',&pkg);
     58:     if (pkg) {PetscLogEventExcludeClass(PETSC_RANDOM_CLASSID);}
     59:   }
     60:   /* Register package finalizer */
     61:   PetscRegisterFinalize(PetscRandomFinalizePackage);
     62:   return(0);
     63: }