1 2 #include <../src/sys/classes/random/randomimpl.h> 3 4 static PetscBool PetscRandomPackageInitialized = PETSC_FALSE; 5 #undef __FUNCT__ 6 #define __FUNCT__ "PetscRandomFinalizePackage" 7 /*@C 8 PetscRandomFinalizePackage - This function destroys everything in the Petsc interface to the Random package. It is 9 called from PetscFinalize(). 10 11 Level: developer 12 13 .keywords: Petsc, destroy, package, mathematica 14 .seealso: PetscFinalize() 15 @*/ 16 PetscErrorCode PetscRandomFinalizePackage(void) 17 { 18 PetscFunctionBegin; 19 PetscRandomPackageInitialized = PETSC_FALSE; 20 PetscRandomList = NULL; 21 PetscRandomRegisterAllCalled = PETSC_FALSE; 22 PetscFunctionReturn(0); 23 } 24 25 #undef __FUNCT__ 26 #define __FUNCT__ "PetscRandomInitializePackage" 27 /*@C 28 PetscRandomInitializePackage - This function initializes everything in the PetscRandom package. It is called 29 from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscRandomCreate() 30 when using static libraries. 31 32 Input Parameter: 33 path - The dynamic library path, or NULL 34 35 Level: developer 36 37 .keywords: PetscRandom, initialize, package 38 .seealso: PetscInitialize() 39 @*/ 40 PetscErrorCode PetscRandomInitializePackage(const char path[]) 41 { 42 PetscErrorCode ierr; 43 44 PetscFunctionBegin; 45 if (PetscRandomPackageInitialized) PetscFunctionReturn(0); 46 PetscRandomPackageInitialized = PETSC_TRUE; 47 /* Register Class */ 48 ierr = PetscClassIdRegister("PetscRandom",&PETSC_RANDOM_CLASSID);CHKERRQ(ierr); 49 ierr = PetscRandomRegisterAll(path);CHKERRQ(ierr); 50 ierr = PetscRegisterFinalize(PetscRandomFinalizePackage);CHKERRQ(ierr); 51 PetscFunctionReturn(0); 52 } 53 54 55 56