~ubuntu-branches/ubuntu/warty/petsc/warty

« back to all changes in this revision

Viewing changes to src/sys/src/adic/adintrinsics/adintr_max.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam C. Powell, IV
  • Date: 2004-06-07 13:41:43 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040607134143-92p586zrauvie0le
Tags: 2.2.0-2
* Upstream patch level 2.
* New PETSC_BOPT_EXTRA option for different BOPT and lib names, with _c++
  symlinks only for plain and single (closes: #249617).
* New DEBIAN_DIST=contrib option to link with hypre, parmetis (closes:
  #249619).
* Combined petsc-c and petsc-fortran substvars into petsc-compilers.
* Extra quote in -dev prerm eliminates "too many arguments" problem.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  macro expansion:
 
3
  function_driver -> adintr_max
 
4
  exception number -> ADINTR_MAX
 
5
  exceptional code -> 
 
6
*fx = ADIntr_Partials[ADINTR_MAX][ADINTR_FX];
 
7
*fy = ADIntr_Partials[ADINTR_MAX][ADINTR_FY];
 
8
 
 
9
  */
 
10
 
 
11
#include <stdarg.h>
 
12
#include "adintrinsics.h"
 
13
#include "knr-compat.h"
 
14
#if defined(__cplusplus)
 
15
extern "C" {
 
16
#endif
 
17
 
 
18
/* #include "report-once.h" */
 
19
void reportonce_accumulate Proto((int,int,int));
 
20
 
 
21
 
 
22
/* The fy must be on a line by itself to be removed for funcs like sin(x). */
 
23
void
 
24
adintr_max (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;
 
32
 
 
33
     const int exception = ADINTR_MAX;
 
34
 
 
35
     va_list argptr;
 
36
     va_start(argptr,fy);
 
37
 
 
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
     }
 
44
 
 
45
     /* Here is where exceptional partials should be set. */
 
46
*fx = ADIntr_Partials[ADINTR_MAX][ADINTR_FX];
 
47
*fy = ADIntr_Partials[ADINTR_MAX][ADINTR_FY];
 
48
 *fxx = ADIntr_Partials[ADINTR_MAX][ADINTR_FXX];
 
49
 *fxy = ADIntr_Partials[ADINTR_MAX][ADINTR_FXY];
 
50
 *fyy = ADIntr_Partials[ADINTR_MAX][ADINTR_FYY];
 
51
 
 
52
 
 
53
     /* Here is where we perform the action appropriate to the current mode. */
 
54
     if (ADIntr_Mode == ADINTR_REPORTONCE)
 
55
     {
 
56
          reportonce_accumulate(file_number, line_number, exception);
 
57
     }
 
58
     
 
59
     va_end(argptr);
 
60
}
 
61
#if defined(__cplusplus)
 
62
}
 
63
#endif
 
64