Actual source code: dlregissnes.c
petsc-3.5.4 2015-05-23
2: #include <petsc-private/snesimpl.h>
3: #include <petsc-private/linesearchimpl.h>
5: static PetscBool SNESPackageInitialized = PETSC_FALSE;
9: /*@C
10: SNESFinalizePackage - This function destroys everything in the Petsc interface to the SNES package. It is
11: called from PetscFinalize().
13: Level: developer
15: .keywords: Petsc, destroy, package, mathematica
16: .seealso: PetscFinalize()
17: @*/
18: PetscErrorCode SNESFinalizePackage(void)
19: {
23: PetscFunctionListDestroy(&SNESList);
24: PetscFunctionListDestroy(&SNESLineSearchList);
25: SNESPackageInitialized = PETSC_FALSE;
26: SNESRegisterAllCalled = PETSC_FALSE;
27: return(0);
28: }
32: /*@C
33: SNESInitializePackage - This function initializes everything in the SNES package. It is called
34: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to SNESCreate()
35: when using static libraries.
37: Level: developer
39: .keywords: SNES, initialize, package
40: .seealso: PetscInitialize()
41: @*/
42: PetscErrorCode SNESInitializePackage(void)
43: {
44: char logList[256];
45: char *className;
46: PetscBool opt;
50: if (SNESPackageInitialized) return(0);
51: SNESPackageInitialized = PETSC_TRUE;
52: /* Initialize subpackages */
53: SNESMSInitializePackage();
54: /* Register Classes */
55: PetscClassIdRegister("SNES",&SNES_CLASSID);
56: PetscClassIdRegister("SNESLineSearch",&SNESLINESEARCH_CLASSID);
57: PetscClassIdRegister("DMSNES",&DMSNES_CLASSID);
58: /* Register Constructors */
59: SNESRegisterAll();
60: SNESLineSearchRegisterAll();
61: /* Register Events */
62: PetscLogEventRegister("SNESSolve", SNES_CLASSID,&SNES_Solve);
63: PetscLogEventRegister("SNESFunctionEval", SNES_CLASSID,&SNES_FunctionEval);
64: PetscLogEventRegister("SNESNGSEval", SNES_CLASSID,&SNES_NGSEval);
65: PetscLogEventRegister("SNESNGSFuncEval", SNES_CLASSID,&SNES_NGSFuncEval);
66: PetscLogEventRegister("SNESJacobianEval", SNES_CLASSID,&SNES_JacobianEval);
67: PetscLogEventRegister("SNESLineSearch", SNESLINESEARCH_CLASSID,&SNESLineSearch_Apply);
68: PetscLogEventRegister("SNESNPCSolve", SNES_CLASSID,&SNES_NPCSolve);
69: /* Process info exclusions */
70: PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);
71: if (opt) {
72: PetscStrstr(logList, "snes", &className);
73: if (className) {
74: PetscInfoDeactivateClass(SNES_CLASSID);
75: }
76: }
77: /* Process summary exclusions */
78: PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);
79: if (opt) {
80: PetscStrstr(logList, "snes", &className);
81: if (className) {
82: PetscLogEventDeactivateClass(SNES_CLASSID);
83: }
84: }
85: PetscRegisterFinalize(SNESFinalizePackage);
86: return(0);
87: }
89: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
92: /*
93: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
95: This registers all of the SNES methods that are in the basic PETSc libpetscsnes library.
97: */
98: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscsnes(void)
99: {
103: SNESInitializePackage();
104: return(0);
105: }
107: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */