Actual source code: adintr_fmin.c

petsc-3.3-p7 2013-05-11
  1: /*
  2:   macro expansion:
  3:   function_driver -> adintr_fmin
  4:   exception number -> ADINTR_FMIN
  5:   exceptional code -> 
  6: *fx = ADIntr_Partials[ADINTR_FMIN][ADINTR_FX];
  7: *fy = ADIntr_Partials[ADINTR_FMIN][ADINTR_FY];

  9:   */

 11: #include <stdarg.h>
 12: #include <adintrinsics.h>
 13: #include <knr-compat.h>
 14: #if defined(__cplusplus)
 15: extern "C" {
 16: #endif

 18: /* #include "report-once.h" */
 19: void reportonce_accumulate Proto((int,int,int));


 22: /* The fy must be on a line by itself to be removed for funcs like sin(x). */
 23: void
 24: adintr_fmin (int deriv_order, int file_number, int line_number,
 25:                  double*fx, double*fy,...)
 26: {
 27:      /* Hack to make assignments to (*fxx) et alia OK, regardless */
 28:      double scratch;
 29:      double *fxx = &scratch;
 30:      double *fxy = &scratch;
 31:      double *fyy = &scratch;

 33:      const int exception = ADINTR_FMIN;

 35:      va_list argptr;
 36:      va_start(argptr,fy);

 38:      if (deriv_order == 2)
 39:      {
 40:           fxx = va_arg(argptr, double *);
 41:           fxy = va_arg(argptr, double *);
 42:           fyy = va_arg(argptr, double *);
 43:      }

 45:      /* Here is where exceptional partials should be set. */
 46:      *fx = ADIntr_Partials[ADINTR_FMIN][ADINTR_FX];
 47:      *fy = ADIntr_Partials[ADINTR_FMIN][ADINTR_FY];
 48:      *fxx = ADIntr_Partials[ADINTR_FMIN][ADINTR_FXX];
 49:      *fxy = ADIntr_Partials[ADINTR_FMIN][ADINTR_FXY];
 50:      *fyy = ADIntr_Partials[ADINTR_FMIN][ADINTR_FYY];



 54:      /* Here is where we perform the action appropriate to the current mode. */
 55:      if (ADIntr_Mode == ADINTR_REPORTONCE)
 56:      {
 57:           reportonce_accumulate(file_number, line_number, exception);
 58:      }
 59: 
 60:      va_end(argptr);
 61: }
 62: #if defined(__cplusplus)
 63: }
 64: #endif