Actual source code: dlregisrand.c

petsc-3.3-p7 2013-05-11
  2: #include <../src/sys/random/randomimpl.h>
  3: #if defined (PETSC_HAVE_STDLIB_H)
  4: #include <stdlib.h>
  5: #endif

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

 14:   Level: developer

 16: .keywords: Petsc, destroy, package, mathematica
 17: .seealso: PetscFinalize()
 18: @*/
 19: PetscErrorCode  PetscRandomFinalizePackage(void)
 20: {
 22:   PetscRandomPackageInitialized = PETSC_FALSE;
 23:   PetscRandomList               = PETSC_NULL;
 24:   PetscRandomRegisterAllCalled  = PETSC_FALSE;
 25:   return(0);
 26: }

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

 35:   Input Parameter:
 36:   path - The dynamic library path, or PETSC_NULL

 38:   Level: developer

 40: .keywords: PetscRandom, initialize, package
 41: .seealso: PetscInitialize()
 42: @*/
 43: PetscErrorCode  PetscRandomInitializePackage(const char path[])
 44: {
 45:   PetscErrorCode    ierr;

 48:   if (PetscRandomPackageInitialized) return(0);
 49:   PetscRandomPackageInitialized = PETSC_TRUE;
 50:   /* Register Class */
 51:   PetscClassIdRegister("PetscRandom",&PETSC_RANDOM_CLASSID);
 52:   PetscRandomRegisterAll(path);
 53:   PetscRegisterFinalize(PetscRandomFinalizePackage);
 54:   return(0);
 55: }