Actual source code: dlregisrand.c


  2: #include <petsc/private/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: {
 15:   PetscFunctionListDestroy(&PetscRandomList);
 16:   PetscRandomPackageInitialized = PETSC_FALSE;
 17:   PetscRandomRegisterAllCalled  = PETSC_FALSE;
 18:   return 0;
 19: }

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

 26:   Level: developer

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

 35:   if (PetscRandomPackageInitialized) return 0;
 36:   PetscRandomPackageInitialized = PETSC_TRUE;
 37:   /* Register Class */
 38:   PetscClassIdRegister("PetscRandom",&PETSC_RANDOM_CLASSID);
 39:   /* Register Constructors */
 40:   PetscRandomRegisterAll();
 41:   /* Process Info */
 42:   {
 43:     PetscClassId  classids[1];

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