PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
Static Public Member Functions | Static Protected Member Functions | List of all members
pism::taoutil::TaoObjGradCallback< Problem, Callback > Class Template Reference

Adaptor to connect a TAO objective and gradient function callback to a C++ object method. More...

#include <TaoUtil.hh>

Static Public Member Functions

static void connect (Tao tao, Problem &p)
 

Static Protected Member Functions

static PetscErrorCode callback (Tao tao, Vec x, double *value, Vec gradient, void *ctx)
 

Detailed Description

template<class Problem, void(Problem::*)(Tao, Vec, double *, Vec) Callback>
class pism::taoutil::TaoObjGradCallback< Problem, Callback >

Adaptor to connect a TAO objective and gradient function callback to a C++ object method.

The TAO library interfaces with user code via C-style callback functions. This class makes it convenient to associate a TAO combined objective value and gradient callback with a C++ object method. To assign

void MyObject::someObjectiveFunction(Tao tao,Vec x, double *value, Vec gradient);

as the convergence test function to a Tao tao,

MyObject obj;
typedef TaoObjGradCallback<MyObject,&MyObject::someObjectiveFunction> ObjGradCallback;
ObjGradCallback::connect(tao,obj);

Note that the method name for the callback must be specified explicitly via a template argument.

Definition at line 411 of file TaoUtil.hh.


The documentation for this class was generated from the following file: