Actual source code: dlregistao.c
petsc-dev 2014-02-02
1: #define TAO_DLL
3: #include <petsc-private/taoimpl.h>
4: #include <petsc-private/taodmimpl.h>
6: static PetscBool TaoPackageInitialized = PETSC_FALSE;
10: /*@C
11: TaoFinalizePackage - This function destroys everything in the PETSc/TAO
12: interface to the Tao package. It is called from PetscFinalize().
14: Level: developer
15: @*/
16: PetscErrorCode TaoFinalizePackage(void)
17: {
21: PetscFunctionListDestroy(&TaoList);
22: TaoPackageInitialized = PETSC_FALSE;
23: return(0);
24: }
28: /*@C
29: TaoInitializePackage - This function sets up PETSc to use the Tao
30: package. When using static libraries, this function is called from the
31: first entry to TaoCreate(); when using shared libraries, it is called
32: from PetscDLLibraryRegister()
34: Level: developer
36: .seealso: TaoCreate()
37: @*/
38: PetscErrorCode TaoInitializePackage(void)
39: {
44: if (TaoPackageInitialized) return(0);
45: TaoPackageInitialized = PETSC_TRUE;
47: PetscClassIdRegister("Tao",&TAO_CLASSID);
49: /* Tell PETSc what solvers are available */
50: TaoRegisterAll();
52: /* Tell PETSc what events are associated with Tao */
53: PetscLogEventRegister("TaoSolve",TAO_CLASSID,&Tao_Solve);
54: PetscLogEventRegister("TaoObjectiveEval",TAO_CLASSID,&Tao_ObjectiveEval);
55: PetscLogEventRegister("TaoGradientEval",TAO_CLASSID,&Tao_GradientEval);
56: PetscLogEventRegister("TaoHessianEval",TAO_CLASSID,&Tao_HessianEval);
57: PetscLogEventRegister("TaoConstraintsEval",TAO_CLASSID,&Tao_ConstraintsEval);
58: PetscLogEventRegister("TaoJacobianEval",TAO_CLASSID,&Tao_JacobianEval);
60: PetscRegisterFinalize(TaoFinalizePackage);
61: return(0);
62: }
64: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
67: /*
68: PetscDLLibraryRegister - this function is called when the dynamic library it
69: is in is opened.
71: This registers all of the Tao methods that are in the libtao
72: library.
74: Input Parameter:
75: . path - library path
76: */
78: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_tao(void)
79: {
83: TaoInitializePackage();
84: TaoLineSearchInitializePackage();
85: return(0);
86: }
88: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */