Actual source code: taopetsc.c

  1: #include "private/fortranimpl.h"
  2: #include "petscksp.h"
  3: #include "tao.h"


  6: #ifdef PETSC_HAVE_FORTRAN_CAPS

  8: #define taopetscapplicationcreate_     TAOPETSCAPPLICATIONCREATE
  9: #define taoapplicationcreate_          TAOAPPLICATIONCREATE
 10: #define taoapplicationdestroy_          TAOAPPLICATIONDESTROY
 11: #define taosetapplication_          TAOSETAPPLICATION

 13: #define taoappsetobjectiveandgradientroutine_    TAOAPPSETOBJECTIVEANDGRADIENTROUTINE
 14: #define taoappsetobjectiveandgradientro_         TAOAPPSETOBJECTIVEANDGRADIENTRO
 15: #define taoappsetobjectiveroutine_               TAOAPPSETOBJECTIVEROUTINE
 16: #define taoappsetgradientroutine_                TAOAPPSETGRADIENTROUTINE
 17: #define taoappsethessianroutine_                 TAOAPPSETHESSIANROUTINE
 18: #define taoappsetvariableboundsroutine_          TAOAPPSETVARIABLEBOUNDSROUTINE
 19: #define taoappsetjacobianroutine_                TAOAPPSETJACOBIANROUTINE
 20: #define taoappsetconstraintroutine_              TAOAPPSETCONSTRAINTROUTINE
 21: #define taoappsetmonitor_                        TAOAPPSETMONITOR
 22: #define taoappgetksp_                            TAOAPPGETKSP

 24: /* Grid application */
 25: #define daappsethessianroutine_                         DAAPPSETHESSIANROUTINE
 26: #define daappsetobjectiveandgradientroutine_            DAAPPSETOBJECTIVEANDGRADIENTROUTINE
 27: #define daappsetobjectiveandgradientrou_                DAAPPSETOBJECTIVEANDGRADIENTROU
 28: #define daappsetgradientroutine_                        DAAPPSETGRADIENTROUTINE
 29: #define daappsetobjectiveroutine_                       DAAPPSETOBJECTIVEROUTINE
 30: #define daappsetvariableboundsroutine_                  DAAPPSETVARIABLEBOUNDSROUTINE
 31: #define daappsetconstraintroutine_                      DAAPPSETCONSTRAINTROUTINE
 32: #define daappsetjacobianroutine_                        DAAPPSETJACOBIANROUTINE
 33: #define daappsetbeforemonitor_                          DAAPPSETBEFOREMONITOR
 34: #define daappsetaftermonitor_                           DAAPPSETAFTERMONITOR
 35: #define daappsetelementobjectiveandgradientroutine_     DAAPPSETELEMENTOBJECTIVEANDGRADIENTROUTINE
 36: #define daappsetelementobjectiveandgrad_                DAAPPSETELEMENTOBJECTIVEANDGRAD
 37: #define daappsetelementhessianroutine_                  DAAPPSETELEMENTHESSIANROUTINE


 40: #define taodefaultcomputehessian_   TAODEFAULTCOMPUTEHESSIAN
 41: #define taodefaultcomputehessiancolor_ TAODEFAULTCOMPUTEHESSIANCOLOR

 43: #define taogetksp_                      TAOGETKSP

 45: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)

 47: #define taopetscapplicationcreate_     taopetscapplicationcreate 
 48: #define taoapplicationcreate_                taoapplicationcreate 
 49: #define taoapplicationdestroy_                taoapplicationdestroy 
 50: #define taosetapplication_                taosetapplication 


 53: #define taoappsetobjectiveandgradientroutine_    taoappsetobjectiveandgradientroutine
 54: #define taoappsetobjectiveandgradientro_         taoappsetobjectiveandgradientro
 55: #define taoappsetobjectiveroutine_               taoappsetobjectiveroutine
 56: #define taoappsetgradientroutine_                taoappsetgradientroutine
 57: #define taoappsethessianroutine_                 taoappsethessianroutine
 58: #define taoappsetvariableboundsroutine_          taoappsetvariableboundsroutine
 59: #define taoappsetjacobianroutine_                taoappsetjacobianroutine
 60: #define taoappsetconstraintroutine_              taoappsetconstraintroutine
 61: #define taoappsetmonitor_                        taoappsetmonitor
 62: #define taoappgetksp_                            taoappgetksp


 65: /* Grid application */
 66: #define daappsethessianroutine_                         daappsethessianroutine
 67: #define daappsetobjectiveandgradientroutine_            daappsetobjectiveandgradientroutine
 68: #define daappsetobjectiveandgradientrou_                daappsetobjectiveandgradientrou
 69: #define daappsetgradientroutine_                        daappsetgradientroutine
 70: #define daappsetobjectiveroutine_                       daappsetobjectiveroutine
 71: #define daappsetvariableboundsroutine_                  daappsetvariableboundsroutine
 72: #define daappsetconstraintroutine_                      daappsetconstraintroutine
 73: #define daappsetjacobianroutine_                        daappsetjacobianroutine
 74: #define daappsetbeforemonitor_                          daappsetbeforemonitor
 75: #define daappsetaftermonitor_                           daappsetaftermonitor
 76: #define daappsetelementobjectiveandgradientroutine_     daappsetelementobjectiveandgradientroutine
 77: #define daappsetelementobjectiveandgrad_                daappsetelementobjectiveandgrad
 78: #define daappsetelementhessianroutine_                  daappsetelementhessianroutine

 80: #define taodefaultcomputehessian_   taodefaultcomputehessian
 81: #define taodefaultcomputehessiancolor_ taodefaultcomputehessiancolor

 83: #define taogetksp_                      taogetksp

 85: #endif


 89: void PETSC_STDCALL taopetscapplicationcreate_(MPI_Comm *comm,TAO_APPLICATION  *outtao,int *ierr){

 91:   *TaoPetscApplicationCreate(MPI_Comm_f2c(*(MPI_Fint *)&*comm),outtao);

 93: }

 95: void PETSC_STDCALL taoapplicationcreate_(MPI_Comm *comm,TAO_APPLICATION  *outtao,int *ierr){

 97:   *TaoApplicationCreate(MPI_Comm_f2c(*(MPI_Fint *)&*comm),outtao);

 99: }

101: void PETSC_STDCALL taoapplicationdestroy_(TAO_APPLICATION  *outtao,int *ierr){

103:   *TaoApplicationDestroy(*outtao);

105: }

107: /* -------------- Setting call-back routines ---------------- */



112: static int ourtaominfunctiongradientroutine(TAO_APPLICATION taoapp,Vec x,double *f,Vec r,void *ctx)
113: {
114:   int 0;
115:   (*(void (PETSC_STDCALL *)(TAO_APPLICATION*,Vec*,double*,Vec*,void*,int*))(((PetscObject)taoapp)->fortran_func_pointers[1]))(&taoapp,&x,f,&r,ctx,&ierr);
116:   return 0;
117: }



122: void PETSC_STDCALL taoappsetobjectiveandgradientroutine_(TAO_APPLICATION  *taoapp,void (PETSC_STDCALL *func)(TAO_APPLICATION*,Vec*,double*,Vec*,void*,int*),void *ctx,int *ierr){
123:   CHKFORTRANNULLFUNCTION(func);
124:   PetscObjectAllocateFortranPointers(*taoapp,12);
125:   ((PetscObject)*taoapp)->fortran_func_pointers[1] = (PetscVoidFunction)func;
126:   *TaoAppSetObjectiveAndGradientRoutine(*taoapp,ourtaominfunctiongradientroutine,ctx);
127: }
128: void PETSC_STDCALL taoappsetobjectiveandgradientro_(TAO_APPLICATION  *taoapp,void (PETSC_STDCALL *func)(TAO_APPLICATION*,Vec*,double*,Vec*,void*,int*),void *ctx,int *ierr){
129:   CHKFORTRANNULLFUNCTION(func);
130:   PetscObjectAllocateFortranPointers(*taoapp,12);
131:   ((PetscObject)*taoapp)->fortran_func_pointers[1] = (PetscVoidFunction)func;
132:   *TaoAppSetObjectiveAndGradientRoutine(*taoapp,ourtaominfunctiongradientroutine,ctx);
133: }


137: static int ourtaominfunction(TAO_APPLICATION taoapp,Vec x,double* d,void *ctx)
138: {
139:   int 0;
140:   (*(void (PETSC_STDCALL *)(TAO_APPLICATION*,Vec*,double*,void*,int*))(((PetscObject)taoapp)->fortran_func_pointers[2]))(&taoapp,&x,d,ctx,&ierr);
141:   return 0;
142: }


146: void PETSC_STDCALL taoappsetobjectiveroutine_(TAO_APPLICATION  *taoapp,
147:           void (PETSC_STDCALL *func)(TAO_APPLICATION*,Vec*,double*,void*,int*),void *ctx,int *ierr){
148:   CHKFORTRANNULLFUNCTION(func);
149:   PetscObjectAllocateFortranPointers(*taoapp,12);
150:   ((PetscObject)*taoapp)->fortran_func_pointers[2] = (PetscVoidFunction)func;
151:   *TaoAppSetObjectiveRoutine(*taoapp,ourtaominfunction,ctx);
152: }




158: static int ourtaogradientfunction(TAO_APPLICATION taoapp,Vec x,Vec d,void *ctx)
159: {
160:   int 0;
161:   (*(void (PETSC_STDCALL *)(TAO_APPLICATION*,Vec*,Vec*,void*,int*))(((PetscObject)taoapp)->fortran_func_pointers[3]))(&taoapp,&x,&d,ctx,&ierr);
162:   return 0;
163: }


167: void PETSC_STDCALL taoappsetgradientroutine_(TAO_APPLICATION *taoapp,void (PETSC_STDCALL *func)(TAO_APPLICATION*,Vec*,Vec*,void*,int*),void *ctx,int *ierr){
168:   CHKFORTRANNULLFUNCTION(func);
169:   PetscObjectAllocateFortranPointers(*taoapp,12);
170:   ((PetscObject)*taoapp)->fortran_func_pointers[3] = (PetscVoidFunction)func;
171:   *TaoAppSetGradientRoutine(*taoapp,ourtaogradientfunction,ctx);
172: }


175: /* ---------------------------------------------------------*/
176: /*
177:   taodefaultcomputehessian() and taodefaultcomputehessiancolor().
178:   These routines can be used directly from Fortran, but the following is done
179:   primarily so that a Fortran call to TaoAppSetPetscHessian() will properly handle the
180:   defaults being passed in.

182:   functions, hence no STDCALL
183: */
184: void taodefaultcomputehessian_(TAO_APPLICATION *tao,Vec *x,Mat *m,Mat *p,MatStructure* type,
185:                                void *ctx,int *ierr)
186: {
187:   *TaoAppDefaultComputeHessian(*tao,*x,m,p,type,ctx);
188: }

190: void  taodefaultcomputehessiancolor_(TAO_APPLICATION *tao,Vec *x,Mat *m,Mat *p,
191:                                      MatStructure* type,void *ctx,int *ierr)
192: {
193:   *TaoAppDefaultComputeHessianColor(*tao,*x,m,p,type,*(MatFDColoring*)ctx);
194: }


198: static int ourtaohessian(TAO_APPLICATION taoapp,Vec x,Mat* m,Mat* p,MatStructure* type,void*ctx)
199: {
200:   int 0;
201:   (*(void (PETSC_STDCALL *)(TAO_APPLICATION*,Vec*,Mat*,Mat*,MatStructure*,void*,int*))(((PetscObject)taoapp)->fortran_func_pointers[4]))(&taoapp,&x,m,p,type,ctx,&ierr);
202:   return 0;
203: }



208: void PETSC_STDCALL taoappsethessianroutine_(TAO_APPLICATION  *taoapp,void (PETSC_STDCALL *func)(TAO_APPLICATION*,Vec*,Mat*,Mat*,
209:                                   MatStructure*,void*,int*),void *ctx,int *ierr)
210: {
211:   CHKFORTRANNULLFUNCTION(func);
212:   PetscObjectAllocateFortranPointers(*taoapp,12);
213:   if ((void(*)())func == (void(*)()) taodefaultcomputehessian_) {
214:     *TaoAppSetHessianRoutine(*taoapp,TaoAppDefaultComputeHessian,ctx);
215:   } else if ( (void(*)()) func == (void(*)()) taodefaultcomputehessiancolor_) {
216:     *TaoAppSetHessianRoutine(*taoapp,TaoAppDefaultComputeHessianColor,*(MatFDColoring*)ctx);
217:   } else {

219:   ((PetscObject)*taoapp)->fortran_func_pointers[4] = (PetscVoidFunction)func;
220:     *TaoAppSetHessianRoutine(*taoapp,ourtaohessian,ctx);
221:   }
222: }




228: static int ourtaovariableboundsroutine(TAO_APPLICATION taoapp, Vec x,Vec d,void *ctx)
229: {
230:   int 0;
231:   (*(void (PETSC_STDCALL *)(TAO_APPLICATION*,Vec*,Vec*,void*,int*))(((PetscObject)taoapp)->fortran_func_pointers[5]))(&taoapp,&x,&d,ctx,&ierr);
232:   return 0;
233: }



238: void PETSC_STDCALL taoappsetvariableboundsroutine_(TAO_APPLICATION *taoapp,void (PETSC_STDCALL *func)(TAO_APPLICATION*,Vec*,Vec*,void*,int*),void *ctx,int *ierr){
239:   CHKFORTRANNULLFUNCTION(func);
240:   PetscObjectAllocateFortranPointers(*taoapp,12);
241:   ((PetscObject)*taoapp)->fortran_func_pointers[5] = (PetscVoidFunction)func;
242:   *TaoAppSetVariableBoundsRoutine(*taoapp,ourtaovariableboundsroutine,ctx);
243: }


247: static int ourtaoconstraintsfunction(TAO_APPLICATION taoapp,Vec x,Vec d,void *ctx)
248: {
249:   int 0;
250:   (*(void (PETSC_STDCALL *)(TAO_APPLICATION*,Vec*,Vec*,void*,int*))(((PetscObject)taoapp)->fortran_func_pointers[6]))(&taoapp,&x,&d,ctx,&ierr);
251:   return 0;
252: }

254: static int ourtaoappsetmonitor(TAO_APPLICATION taoapp, void *ctx) {
255:   int 0;
256:   (*(void (PETSC_STDCALL *)(TAO_APPLICATION*,void*,int*))(((PetscObject)taoapp)->fortran_func_pointers[7]))(&taoapp,ctx,&ierr); 
257:   return 0;
258: }


262: void PETSC_STDCALL taoappsetconstraintroutine_(TAO_APPLICATION  *taoapp,void (PETSC_STDCALL *func)(TAO_APPLICATION*,Vec*,Vec*,void*,int*),void *ctx,int *ierr){
263:   CHKFORTRANNULLFUNCTION(func);
264:   PetscObjectAllocateFortranPointers(*taoapp,12);
265:   ((PetscObject)*taoapp)->fortran_func_pointers[6] = (PetscVoidFunction)func;
266:   *TaoAppSetConstraintRoutine(*taoapp,ourtaoconstraintsfunction,ctx);
267: }

269: void PETSC_STDCALL taoappsetmonitor_(TAO_APPLICATION *taoapp, void (PETSC_STDCALL *func)(TAO_APPLICATION*,void *, int*), void *ctx, int *ierr){
270:   CHKFORTRANNULLFUNCTION(func);
271:   PetscObjectAllocateFortranPointers(*taoapp,12);
272:   ((PetscObject)*taoapp)->fortran_func_pointers[7] = (PetscVoidFunction)func;
273:   *TaoAppSetMonitor(*taoapp,ourtaoappsetmonitor,ctx);
274: }



279: static int ourtaojacobianfunction(TAO_APPLICATION taoapp,Vec x,Mat *J,Mat *JP, MatStructure *flag,void *ctx)
280: {
281:   int 0;
282:   (*(void (PETSC_STDCALL *)(TAO_APPLICATION*,Vec*,Mat*,Mat*,MatStructure*,void*,int*))(((PetscObject)taoapp)->fortran_func_pointers[8]))(&taoapp,&x,J,JP,flag,ctx,&ierr);
283:   return 0;
284: }


288: void PETSC_STDCALL taoappsetjacobianroutine_(TAO_APPLICATION  *taoapp,void (PETSC_STDCALL *func)(TAO_APPLICATION*,Vec*,Mat*,Mat*,MatStructure*,void*,int*),void *ctx,int *ierr){
289:   CHKFORTRANNULLFUNCTION(func);
290:   PetscObjectAllocateFortranPointers(*taoapp,12);
291:   ((PetscObject)*taoapp)->fortran_func_pointers[8] = (PetscVoidFunction)func;
292:   *TaoAppSetJacobianRoutine(*taoapp,ourtaojacobianfunction,ctx);
293: }
294: void PETSC_STDCALL taoappgetksp_(TAO_APPLICATION *taoapp,KSP *tksp, int *ierr ){
295:   *TaoAppGetKSP(*taoapp,tksp);
296: }


299: void PETSC_STDCALL taogetksp_(TAO_SOLVER  *tao,KSP *tksp, int *ierr ){
300:   *TaoGetKSP(*tao,tksp);
301: }



306: #include "taodaapplication.h"

308: /* Grid Application routines */
310: static void (PETSC_STDCALL *grid1)(TAO_APPLICATION*, DA*, Vec*, Mat*, void*, int*);
311: static void (PETSC_STDCALL *grid2)(TAO_APPLICATION*, DA*, Vec*, double*, Vec*, void*, int*);
312: static void (PETSC_STDCALL *grid3)(TAO_APPLICATION*, DA*, Vec*, Vec*, void*, int*);
313: static void (PETSC_STDCALL *grid4)(TAO_APPLICATION*, DA*, Vec*, double*, void*, int*);
314: static void (PETSC_STDCALL *grid5)(TAO_APPLICATION*, DA*, Vec*, Vec*, void*, int*);
315: static void (PETSC_STDCALL *grid6)(TAO_APPLICATION*, DA*, Vec*, Vec*, void*, int*);
316: static void (PETSC_STDCALL *grid7)(TAO_APPLICATION*, DA*, Vec*, Mat*, void*, int*);
317: static void (PETSC_STDCALL *grid8)(TAO_APPLICATION*, DA*, TaoInt*, void*, int*);
318: static void (PETSC_STDCALL *grid9)(TAO_APPLICATION*, DA*, TaoInt*, void*, int*);
319: /* Grid Application Element routines */
320: static void (PETSC_STDCALL *grid10)(TaoInt[2], double[4], double*, double[4], void*, int*);
321: static void (PETSC_STDCALL *grid11)(TaoInt[2], double[4], double[4][4], void*, int*);
323: static int ourdaappsethessianroutine(TAO_APPLICATION daapp, DA da, Vec x, Mat H, void *ctx) {
324:   int 0;
325:   (*grid1)(&daapp, &da, &x, &H, ctx, &ierr);
326:   return ierr;
327: }
328: static int ourdaappsetobjectiveandgradientroutine(TAO_APPLICATION daapp, DA da, Vec x, double *f, Vec G, void *ctx) {
329:   int 0;
330:   (*grid2)(&daapp, &da, &x, f, &G, ctx, &ierr);
331:   return ierr;
332: }
333: static int ourdaappsetgradientroutine(TAO_APPLICATION daapp, DA da, Vec x, Vec g, void *ctx) {
334:   int 0;
335:   (*grid3)(&daapp, &da, &x, &g, ctx, &ierr);
336:   return ierr;
337: }
338: static int ourdaappsetobjectiveroutine(TAO_APPLICATION daapp, DA da, Vec x, double *f, void *ctx) {
339:   int 0;
340:   (*grid4)(&daapp, &da, &x, f, ctx, &ierr);
341:   return ierr;
342: }
343: static int ourdaappsetvariableboundsroutine(TAO_APPLICATION daapp, DA da, Vec L, Vec U, void *ctx) {
344:   int 0;
345:   (*grid5)(&daapp, &da, &L, &U, ctx, &ierr);
346:   return ierr;
347: }
348: static int ourdaappsetconstraintroutine(TAO_APPLICATION daapp, DA da, Vec X, Vec R, void *ctx) {
349:   int 0;
350:   (*grid6)(&daapp, &da, &X, &R, ctx, &ierr);
351:   return ierr;
352: }
353: static int ourdaappsetjacobianroutine(TAO_APPLICATION daapp, DA da, Vec X, Mat J, void *ctx) {
354:   int 0;
355:   (*grid7)(&daapp, &da, &X, &J, ctx, &ierr);
356:   return ierr;
357: }
358: static int ourdaappsetbeforemonitor(TAO_APPLICATION daapp, DA da, TaoInt levels, void *ctx) {
359:   int 0;
360:   (*grid8)(&daapp, &da, &levels, ctx, &ierr);
361:   return ierr;
362: }
363: static int ourdaappsetaftermonitor(TAO_APPLICATION daapp, DA da, TaoInt levels, void *ctx) {
364:   int 0;
365:   (*grid9)(&daapp, &da, &levels, ctx, &ierr);
366:   return ierr;
367: }
368: static int ourdaappsetelementobjectiveandgradientroutine(PetscInt coord[2], double x[4], double *f, double g[4], void *ctx) {
369:   int 0;
370:   (*grid10)(coord, x, f, g, ctx, &ierr);
371:   return ierr;
372: }
373: static int ourdaappsetelementhessianroutine(PetscInt coord[2], double x[4], double H[4][4], void *ctx) {
374:   int 0;
375:   (*grid11)(coord, x, H, ctx, &ierr);
376:   return ierr;
377: }
379: void PETSC_STDCALL daappsethessianroutine_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(TAO_APPLICATION*,DA*,Vec*, Mat*, void*, int*),void *ctx, int *ierr) {
380:   grid1 = func;
381:   *DAAppSetHessianRoutine(*daapp, ourdaappsethessianroutine, ctx);
382: }
383: void PETSC_STDCALL daappsetobjectiveandgradientroutine_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(TAO_APPLICATION*, DA*, Vec*, double*, Vec*, void*, int*), void *ctx, int *ierr) {
384:   grid2 = func;
385:   *DAAppSetObjectiveAndGradientRoutine(*daapp, ourdaappsetobjectiveandgradientroutine, ctx);
386: }
387: void PETSC_STDCALL daappsetobjectiveandgradientrou_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(TAO_APPLICATION*, DA*, Vec*, double*, Vec*, void*, int*), void *ctx, int *ierr) {
388:   grid2 = func;
389:   *DAAppSetObjectiveAndGradientRoutine(*daapp, ourdaappsetobjectiveandgradientroutine, ctx);
390: }

392: void PETSC_STDCALL daappsetgradientroutine_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(TAO_APPLICATION*, DA*, Vec*, Vec*, void*, int*), void *ctx, int *ierr) {
393:   grid3 = func;
394:   *DAAppSetGradientRoutine(*daapp, ourdaappsetgradientroutine, ctx);
395: }
396: void PETSC_STDCALL daappsetobjectiveroutine_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(TAO_APPLICATION*, DA*, Vec*, double*, void*, int*), void *ctx, int *ierr) {
397:   grid4 = func;
398:   *DAAppSetObjectiveRoutine(*daapp, ourdaappsetobjectiveroutine, ctx);
399: }
400: void PETSC_STDCALL daappsetvariableboundsroutine_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(TAO_APPLICATION*, DA*, Vec*, Vec*, void*, int*), void *ctx, int *ierr) {
401:   grid5 = func;
402:   *DAAppSetVariableBoundsRoutine(*daapp, ourdaappsetvariableboundsroutine, ctx);
403: }
404: void PETSC_STDCALL daappsetconstraintroutine_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(TAO_APPLICATION*, DA*, Vec*, Vec*, void*, int*), void *ctx, int *ierr) {
405:   grid6 = func;
406:   *DAAppSetConstraintRoutine(*daapp, ourdaappsetconstraintroutine, ctx);
407: }
408: void PETSC_STDCALL daappsetjacobianroutine_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(TAO_APPLICATION*, DA*, Vec*, Mat*, void*, int*), void *ctx, int *ierr) {
409:   grid7 = func;
410:   *DAAppSetJacobianRoutine(*daapp, ourdaappsetjacobianroutine, ctx);
411: }
412: void PETSC_STDCALL daappsetbeforemonitor_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(TAO_APPLICATION*, DA*, PetscInt*, void*, int*), void *ctx, int *ierr) {
413:   grid8 = func;
414:   *DAAppSetBeforeMonitor(*daapp, ourdaappsetbeforemonitor, ctx);
415: }
416: void PETSC_STDCALL daappsetaftermonitor_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(TAO_APPLICATION*, DA*, PetscInt*, void*, int*), void *ctx, int *ierr) {
417:   grid9 = func;
418:   *DAAppSetAfterMonitor(*daapp, ourdaappsetaftermonitor, ctx);
419: }
420: void PETSC_STDCALL daappsetelementobjectiveandgradientroutine_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(PetscInt[2], double[4], double*, double[4], void*, int*), PetscInt *flops, void *ctx, int *ierr) {
421:   grid10 = func;
422:   *DAAppSetElementObjectiveAndGradientRoutine(*daapp, ourdaappsetelementobjectiveandgradientroutine, *flops, ctx);
423: }
424: void PETSC_STDCALL daappsetelementobjectiveandgrad_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(PetscInt[2], double[4], double*, double[4], void*, int*), PetscInt *flops, void *ctx, int *ierr) {
425:   grid10 = func;
426:   *DAAppSetElementObjectiveAndGradientRoutine(*daapp, ourdaappsetelementobjectiveandgradientroutine, *flops, ctx);
427: }
428: void PETSC_STDCALL daappsetelementhessianroutine_(TAO_APPLICATION *daapp, void (PETSC_STDCALL *func)(PetscInt[2], double[4], double[4][4], void*, int*), PetscInt *flops, void *ctx, int *ierr) {
429:   grid11 = func;
430:   *DAAppSetElementHessianRoutine(*daapp, ourdaappsetelementhessianroutine, *flops, ctx);
431: }