Actual source code: dlregis_taolinesearch.c

petsc-3.14.6 2021-03-30
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.  When using shared or static libraries, this function is called from the
 31:   first entry to TaoCreate(); when using dynamic, it is called
 32:   from PetscDLLibraryRegister_tao()

 34:   Level: developer

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

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