Actual source code: dlregistao.c

petsc-3.6.1 2015-08-06
Report Typos and Errors
  1: #define TAO_DLL

  3: #include <petsc/private/taoimpl.h>

  5: static PetscBool TaoPackageInitialized = PETSC_FALSE;

  9: /*@C
 10:   TaoFinalizePackage - This function destroys everything in the PETSc/TAO
 11:   interface to the Tao package. It is called from PetscFinalize().

 13:   Level: developer
 14: @*/
 15: PetscErrorCode TaoFinalizePackage(void)
 16: {

 20:   PetscFunctionListDestroy(&TaoList);
 21:   TaoPackageInitialized = PETSC_FALSE;
 22:   return(0);
 23: }

 27: /*@C
 28:   TaoInitializePackage - This function sets up PETSc to use the Tao
 29:   package.  When using static libraries, this function is called from the
 30:   first entry to TaoCreate(); when using shared libraries, it is called
 31:   from PetscDLLibraryRegister()

 33:   Level: developer

 35: .seealso: TaoCreate()
 36: @*/
 37: PetscErrorCode TaoInitializePackage(void)
 38: {


 43:   if (TaoPackageInitialized) return(0);
 44:   TaoPackageInitialized = PETSC_TRUE;

 46:   PetscClassIdRegister("Tao",&TAO_CLASSID);

 48:   /* Tell PETSc what solvers are available */
 49:   TaoRegisterAll();

 51:   /* Tell PETSc what events are associated with Tao */
 52:   PetscLogEventRegister("TaoSolve",TAO_CLASSID,&Tao_Solve);
 53:   PetscLogEventRegister("TaoObjectiveEval",TAO_CLASSID,&Tao_ObjectiveEval);
 54:   PetscLogEventRegister("TaoGradientEval",TAO_CLASSID,&Tao_GradientEval);
 55:   PetscLogEventRegister("TaoHessianEval",TAO_CLASSID,&Tao_HessianEval);
 56:   PetscLogEventRegister("TaoConstraintsEval",TAO_CLASSID,&Tao_ConstraintsEval);
 57:   PetscLogEventRegister("TaoJacobianEval",TAO_CLASSID,&Tao_JacobianEval);

 59:   PetscRegisterFinalize(TaoFinalizePackage);
 60:   return(0);
 61: }

 63: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
 66: /*
 67:   PetscDLLibraryRegister - this function is called when the dynamic library it
 68:   is in is opened.

 70:   This registers all of the Tao methods that are in the libtao
 71:   library.

 73:   Input Parameter:
 74: . path - library path
 75: */

 77: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_tao(void)
 78: {

 82:     TaoInitializePackage();
 83:     TaoLineSearchInitializePackage();
 84:     return(0);
 85: }

 87: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */