Actual source code: adintr_pow.c
petsc-3.3-p7 2013-05-11
1: /*
2: macro expansion:
3: function_driver -> adintr_pow
4: exception number -> ADINTR_POW
5: exceptional code ->
6: *fx = ADIntr_Partials[ADINTR_POW][ADINTR_FX];
7: *fy = ADIntr_Partials[ADINTR_POW][ADINTR_FY];
8: *fxx = ADIntr_Partials[ADINTR_POW][ADINTR_FXX];
9: *fxy = ADIntr_Partials[ADINTR_POW][ADINTR_FXY];
10: *fyy = ADIntr_Partials[ADINTR_POW][ADINTR_FYY];
12: */
14: #include <stdarg.h>
15: #include <adintrinsics.h>
16: #include <knr-compat.h>
17: #if defined(__cplusplus)
18: extern "C" {
19: #endif
21: /* #include "report-once.h" */
22: void reportonce_accumulate Proto((int,int,int));
25: /* The fy must be on a line by itself to be removed for funcs like sin(x). */
26: void
27: adintr_pow (int deriv_order, int file_number, int line_number,
28: double*fx, double*fy,...)
29: {
30: /* Hack to make assignments to (*fxx) et alia OK, regardless */
31: double scratch;
32: double *fxx = &scratch;
33: double *fxy = &scratch;
34: double *fyy = &scratch;
36: const int exception = ADINTR_POW;
38: va_list argptr;
39: va_start(argptr,fy);
41: if (deriv_order == 2)
42: {
43: fxx = va_arg(argptr, double *);
44: fxy = va_arg(argptr, double *);
45: fyy = va_arg(argptr, double *);
46: }
48: /* Here is where exceptional partials should be set. */
49: *fx = ADIntr_Partials[ADINTR_POW][ADINTR_FX];
50: *fy = ADIntr_Partials[ADINTR_POW][ADINTR_FY];
51: *fxx = ADIntr_Partials[ADINTR_POW][ADINTR_FXX];
52: *fxy = ADIntr_Partials[ADINTR_POW][ADINTR_FXY];
53: *fyy = ADIntr_Partials[ADINTR_POW][ADINTR_FYY];
56: /* Here is where we perform the action appropriate to the current mode. */
57: if (ADIntr_Mode == ADINTR_REPORTONCE)
58: {
59: reportonce_accumulate(file_number, line_number, exception);
60: }
61:
62: va_end(argptr);
63: }
64: #if defined(__cplusplus)
65: }
66: #endif