Actual source code: dlregissnes.c
2: #include <private/snesimpl.h>
4: static PetscBool SNESPackageInitialized = PETSC_FALSE;
7: /*@C
8: SNESFinalizePackage - This function destroys everything in the Petsc interface to the SNES package. It is
9: called from PetscFinalize().
11: Level: developer
13: .keywords: Petsc, destroy, package, mathematica
14: .seealso: PetscFinalize()
15: @*/
16: PetscErrorCode SNESFinalizePackage(void)
17: {
19: SNESPackageInitialized = PETSC_FALSE;
20: SNESRegisterAllCalled = PETSC_FALSE;
21: SNESList = PETSC_NULL;
22: return(0);
23: }
27: /*@C
28: SNESInitializePackage - This function initializes everything in the SNES package. It is called
29: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to SNESCreate()
30: when using static libraries.
32: Input Parameter:
33: path - The dynamic library path, or PETSC_NULL
35: Level: developer
37: .keywords: SNES, initialize, package
38: .seealso: PetscInitialize()
39: @*/
40: PetscErrorCode SNESInitializePackage(const char path[])
41: {
42: char logList[256];
43: char *className;
44: PetscBool opt;
45: PetscErrorCode ierr;
48: if (SNESPackageInitialized) return(0);
49: SNESPackageInitialized = PETSC_TRUE;
50: /* Register Classes */
51: PetscClassIdRegister("SNES",&SNES_CLASSID);
52: /* Register Constructors */
53: SNESRegisterAll(path);
54: /* Register Events */
55: PetscLogEventRegister("SNESSolve", SNES_CLASSID,&SNES_Solve);
56: PetscLogEventRegister("SNESLineSearch", SNES_CLASSID,&SNES_LineSearch);
57: PetscLogEventRegister("SNESFunctionEval", SNES_CLASSID,&SNES_FunctionEval);
58: PetscLogEventRegister("SNESJacobianEval", SNES_CLASSID,&SNES_JacobianEval);
59: /* Process info exclusions */
60: PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
61: if (opt) {
62: PetscStrstr(logList, "snes", &className);
63: if (className) {
64: PetscInfoDeactivateClass(SNES_CLASSID);
65: }
66: }
67: /* Process summary exclusions */
68: PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
69: if (opt) {
70: PetscStrstr(logList, "snes", &className);
71: if (className) {
72: PetscLogEventDeactivateClass(SNES_CLASSID);
73: }
74: }
75: PetscRegisterFinalize(SNESFinalizePackage);
76: return(0);
77: }
79: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
83: /*
84: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
86: This registers all of the SNES methods that are in the basic PETSc libpetscsnes library.
88: Input Parameter:
89: path - library path
91: */
92: PetscErrorCode PetscDLLibraryRegister_petscsnes(const char path[])
93: {
97: SNESInitializePackage(path);
98: return(0);
99: }
102: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */