Actual source code: dlregistao.c

  1: #define TAOSOLVER_DLL

  3: #include "include/private/taosolver_impl.h"
  4: #include "include/private/taodm_impl.h"

  6: static PetscBool TaoPackageInitialized = PETSC_FALSE;

 10: /*@C
 11:   TaoInitializePackage - This function sets up PETSc to use the TaoSolver 
 12:   package.  When using static libraries, this function is called from the
 13:   first entry to TaoCreate(); when using shared libraries, it is called
 14:   from PetscDLLibraryRegister()

 16:   Input parameter:
 17: . path - The dynamic library path or PETSC_NULL

 19:   Level: developer

 21: .seealso: TaoCreate()
 22: @*/
 23: PetscErrorCode TaoInitializePackage(const char path[])
 24: {


 29:   if (TaoPackageInitialized) return(0);
 30:   TaoPackageInitialized = PETSC_TRUE;

 32:   PetscClassIdRegister("TaoSolver",&TAOSOLVER_CLASSID); 
 33:   
 34:   /* Tell PETSc what solvers are available */
 35:   TaoSolverRegisterAll(path); 

 37:   /* Tell PETSc what events are associated with TaoSolver */
 38:   PetscLogEventRegister("TaoSolve",TAOSOLVER_CLASSID,&TaoSolver_Solve); 
 39:   PetscLogEventRegister("TaoObjectiveEval",TAOSOLVER_CLASSID,&TaoSolver_ObjectiveEval); 
 40:   PetscLogEventRegister("TaoGradientEval",TAOSOLVER_CLASSID,&TaoSolver_GradientEval); 
 41:   PetscLogEventRegister("TaoHessianEval",TAOSOLVER_CLASSID,&TaoSolver_HessianEval); 
 42:   PetscLogEventRegister("TaoConstraintsEval",TAOSOLVER_CLASSID,&TaoSolver_ConstraintsEval); 
 43:   PetscLogEventRegister("TaoJacobianEval",TAOSOLVER_CLASSID,&TaoSolver_JacobianEval); 


 46:   return(0);
 47: }

 49: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
 53: /*
 54:   PetscDLLibraryRegister - this function is called when the dynamic library it
 55:   is in is opened.

 57:   This registers all of the TaoSolver methods that are in the libtaosolver
 58:   library.

 60:   Input Parameter:
 61: . path - library path
 62: */

 64: PetscErrorCode PetscDLLibraryRegister_tao(const char path[])
 65: {

 68:     PetscInitializeNoArguments();
 69:     if (ierr)
 70:         return 1;
 72:     TaoInitializePackage(path); 
 73:     return(0);
 74: }
 76: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */