#include "petscts.h" PetscErrorCode TSSetCostIntegrand(TS ts,PetscInt numcost,Vec costintegral,PetscErrorCode (*rf)(TS,PetscReal,Vec,Vec,void*), PetscErrorCode (*drdyf)(TS,PetscReal,Vec,Vec*,void*), PetscErrorCode (*drdpf)(TS,PetscReal,Vec,Vec*,void*), PetscBool fwd,void *ctx)Logically Collective on TS
ts | - the TS context obtained from TSCreate() | |
numcost | - number of gradients to be computed, this is the number of cost functions | |
costintegral | - vector that stores the integral values | |
rf | - routine for evaluating the integrand function | |
drdyf | - function that computes the gradients of the r's with respect to y | |
drdpf | - function that computes the gradients of the r's with respect to p, can be NULL if parametric sensitivity is not desired (mu=NULL) | |
fwd | - flag indicating whether to evaluate cost integral in the forward run or the adjoint run | |
ctx | - [optional] user-defined context for private data for the function evaluation routine (may be NULL) |
PetscErrorCode rf(TS ts,PetscReal t,Vec y,Vec f,void *ctx);
PetscErroCode drdyf(TS ts,PetscReal t,Vec y,Vec *drdy,void *ctx);
PetscErroCode drdpf(TS ts,PetscReal t,Vec y,Vec *drdp,void *ctx);