Actual source code: dlregisrand.c

petsc-3.12.5 2020-03-29
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: .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 exclusions */
 47:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
 48:   if (opt) {
 49:     PetscStrInList("random",logList,',',&pkg);
 50:     if (pkg) {PetscInfoDeactivateClass(PETSC_RANDOM_CLASSID);}
 51:   }
 52:   /* Process summary exclusions */
 53:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
 54:   if (opt) {
 55:     PetscStrInList("random",logList,',',&pkg);
 56:     if (pkg) {PetscLogEventExcludeClass(PETSC_RANDOM_CLASSID);}
 57:   }
 58:   /* Register package finalizer */
 59:   PetscRegisterFinalize(PetscRandomFinalizePackage);
 60:   return(0);
 61: }