Actual source code: dlregis_taolinesearch.c

petsc-3.9.4 2018-09-11
Report Typos and Errors
  1: #define TAOLINESEARCH_DLL
  2:  #include <petsc/private/taolinesearchimpl.h>


  5: PETSC_EXTERN PetscErrorCode TaoLineSearchCreate_Unit(TaoLineSearch);
  6: PETSC_EXTERN PetscErrorCode TaoLineSearchCreate_MT(TaoLineSearch);
  7: PETSC_EXTERN PetscErrorCode TaoLineSearchCreate_GPCG(TaoLineSearch);
  8: PETSC_EXTERN PetscErrorCode TaoLineSearchCreate_Armijo(TaoLineSearch);
  9: PETSC_EXTERN PetscErrorCode TaoLineSearchCreate_OWArmijo(TaoLineSearch);
 10: static PetscBool TaoLineSearchPackageInitialized = PETSC_FALSE;

 12: /*@C
 13:   TaoLineSearchFinalizePackage - This function destroys everything in the PETSc/TAO
 14:   interface to the TaoLineSearch package. It is called from PetscFinalize().

 16:   Level: developer
 17: @*/
 18: PetscErrorCode TaoLineSearchFinalizePackage(void)
 19: {

 23:   PetscFunctionListDestroy(&TaoLineSearchList);
 24:   TaoLineSearchPackageInitialized = PETSC_FALSE;
 25:   return(0);
 26: }

 28: /*@C
 29:   TaoLineSearchInitializePackage - This function registers the line-search
 30:   algorithms in TAO.
 31:   When using static libraries, this function is called from the
 32:   first entry to TaoCreate(); when using shared libraries, it is called
 33:   from PetscDLLibraryRegister()

 35:   Level: developer

 37: .seealso: TaoLineSearchCreate()
 38: @*/
 39: PetscErrorCode TaoLineSearchInitializePackage(void)
 40: {

 44:   if (TaoLineSearchPackageInitialized) return(0);
 45:   TaoLineSearchPackageInitialized=PETSC_TRUE;
 46: #if !defined(PETSC_USE_COMPLEX)
 47:   PetscClassIdRegister("TaoLineSearch",&TAOLINESEARCH_CLASSID);
 48:   TaoLineSearchRegister("unit",TaoLineSearchCreate_Unit);
 49:   TaoLineSearchRegister("more-thuente",TaoLineSearchCreate_MT);
 50:   TaoLineSearchRegister("gpcg",TaoLineSearchCreate_GPCG);
 51:   TaoLineSearchRegister("armijo",TaoLineSearchCreate_Armijo);
 52:   TaoLineSearchRegister("owarmijo",TaoLineSearchCreate_OWArmijo);
 53:   PetscLogEventRegister("TaoLineSearchApply",TAOLINESEARCH_CLASSID,&TaoLineSearch_ApplyEvent);
 54:   PetscLogEventRegister("TaoLineSearchComputeObjective[Gradient]",TAOLINESEARCH_CLASSID,&TaoLineSearch_EvalEvent);
 55: #endif
 56:   PetscRegisterFinalize(TaoLineSearchFinalizePackage);
 57:   return(0);
 58: }