Actual source code: dlregistao.c
petsc-3.8.4 2018-03-24
1: #define TAO_DLL
3: #include <petsc/private/taoimpl.h>
5: static PetscBool TaoPackageInitialized = PETSC_FALSE;
7: /*@C
8: TaoFinalizePackage - This function destroys everything in the PETSc/TAO
9: interface to the Tao package. It is called from PetscFinalize().
11: Level: developer
12: @*/
13: PetscErrorCode TaoFinalizePackage(void)
14: {
18: PetscFunctionListDestroy(&TaoList);
19: TaoPackageInitialized = PETSC_FALSE;
20: return(0);
21: }
23: /*@C
24: TaoInitializePackage - This function sets up PETSc to use the Tao
25: package. When using static libraries, this function is called from the
26: first entry to TaoCreate(); when using shared libraries, it is called
27: from PetscDLLibraryRegister()
29: Level: developer
31: .seealso: TaoCreate()
32: @*/
33: PetscErrorCode TaoInitializePackage(void)
34: {
39: if (TaoPackageInitialized) return(0);
40: TaoPackageInitialized = PETSC_TRUE;
42: PetscClassIdRegister("Tao",&TAO_CLASSID);
44: /* Tell PETSc what solvers are available */
45: TaoRegisterAll();
47: /* Tell PETSc what events are associated with Tao */
48: PetscLogEventRegister("TaoSolve",TAO_CLASSID,&Tao_Solve);
49: PetscLogEventRegister("TaoObjectiveEval",TAO_CLASSID,&Tao_ObjectiveEval);
50: PetscLogEventRegister("TaoGradientEval",TAO_CLASSID,&Tao_GradientEval);
51: PetscLogEventRegister("TaoHessianEval",TAO_CLASSID,&Tao_HessianEval);
52: PetscLogEventRegister("TaoConstraintsEval",TAO_CLASSID,&Tao_ConstraintsEval);
53: PetscLogEventRegister("TaoJacobianEval",TAO_CLASSID,&Tao_JacobianEval);
55: PetscRegisterFinalize(TaoFinalizePackage);
56: return(0);
57: }
59: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
60: /*
61: PetscDLLibraryRegister - this function is called when the dynamic library it
62: is in is opened.
64: This registers all of the Tao methods that are in the libtao
65: library.
67: Input Parameter:
68: . path - library path
69: */
71: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_tao(void)
72: {
76: TaoInitializePackage();
77: TaoLineSearchInitializePackage();
78: return(0);
79: }
81: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */