Actual source code: dlregis_taolinesearch.c

petsc-3.7.7 2017-09-25
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;

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

 18:   Level: developer
 19: @*/
 20: PetscErrorCode TaoLineSearchFinalizePackage(void)
 21: {

 25:   PetscFunctionListDestroy(&TaoLineSearchList);
 26:   TaoLineSearchPackageInitialized = PETSC_FALSE;
 27:   return(0);
 28: }

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

 39:   Level: developer

 41: .seealso: TaoLineSearchCreate()
 42: @*/
 43: PetscErrorCode TaoLineSearchInitializePackage(void)
 44: {

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