xref: /petsc/src/sys/classes/random/interface/dlregisrand.c (revision 8135c375e96a7bf70d67c02f02cd826154817056)
1 
2 #include <../src/sys/classes/random/randomimpl.h>
3 
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().
8 
9   Level: developer
10 
11 .keywords: Petsc, destroy, package, mathematica
12 .seealso: PetscFinalize()
13 @*/
14 PetscErrorCode  PetscRandomFinalizePackage(void)
15 {
16   PetscErrorCode ierr;
17 
18   PetscFunctionBegin;
19   ierr = PetscFunctionListDestroy(&PetscRandomList);CHKERRQ(ierr);
20   PetscRandomPackageInitialized = PETSC_FALSE;
21   PetscRandomRegisterAllCalled  = PETSC_FALSE;
22   PetscFunctionReturn(0);
23 }
24 
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.
29 
30   Level: developer
31 
32 .keywords: PetscRandom, initialize, package
33 .seealso: PetscInitialize()
34 @*/
35 PetscErrorCode  PetscRandomInitializePackage(void)
36 {
37   PetscErrorCode ierr;
38 
39   PetscFunctionBegin;
40   if (PetscRandomPackageInitialized) PetscFunctionReturn(0);
41   PetscRandomPackageInitialized = PETSC_TRUE;
42   /* Register Class */
43   ierr = PetscClassIdRegister("PetscRandom",&PETSC_RANDOM_CLASSID);CHKERRQ(ierr);
44   ierr = PetscRandomRegisterAll();CHKERRQ(ierr);
45   ierr = PetscRegisterFinalize(PetscRandomFinalizePackage);CHKERRQ(ierr);
46   PetscFunctionReturn(0);
47 }
48 
49 
50 
51