xref: /petsc/src/sys/classes/random/interface/dlregisrand.c (revision c5b75c40f2b03d062403f886ebcfc3786a9d710b) !
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   Level: developer
33 
34 .keywords: PetscRandom, initialize, package
35 .seealso: PetscInitialize()
36 @*/
37 PetscErrorCode  PetscRandomInitializePackage(void)
38 {
39   PetscErrorCode ierr;
40 
41   PetscFunctionBegin;
42   if (PetscRandomPackageInitialized) PetscFunctionReturn(0);
43   PetscRandomPackageInitialized = PETSC_TRUE;
44   /* Register Class */
45   ierr = PetscClassIdRegister("PetscRandom",&PETSC_RANDOM_CLASSID);CHKERRQ(ierr);
46   ierr = PetscRandomRegisterAll();CHKERRQ(ierr);
47   ierr = PetscRegisterFinalize(PetscRandomFinalizePackage);CHKERRQ(ierr);
48   PetscFunctionReturn(0);
49 }
50 
51 
52 
53