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