Actual source code: adintrinsics.h

      1: #ifndef ADINTRINSICS_H
      2: #define ADINTRINSICS_H 1

      4: /* stdio.h: For adintr_ehsout(FILE*) prototype below. */
      5: #include <stdio.h>

      7: #undef ADINTR_EXTERN
      8: #ifdef ADINTRINSICS_C
      9: #define ADINTR_EXTERN
     10: #else
     11: #define ADINTR_EXTERN extern
     12: #endif

     14: #if defined(__cplusplus)
     15: #undef ADINTR_EXTERN
     17: #endif

     19: enum ADIntr_Modes
     20: {
     21:         ADINTR_IGNORE = -1,
     22:         ADINTR_PERFORMANCE = 1,
     23:         ADINTR_REPORTONCE = 2
     24: };

     26: enum ADIntr_Partials
     27: {
     28:         ADINTR_FX = 0,
     29:         ADINTR_FY,
     30:         ADINTR_FXX,
     31:         ADINTR_FXY,
     32:         ADINTR_FYY,
     33:         ADINTR_MAX_PARTIALS
     34: };

     36: /*** This information now in an automatically generated include file ***/
     37: /*
     38: enum ADIntr_Funcs
     39: {
     40:         ADINTR_FABS = x,
     41:         ADINTR_MAX_FUNC
     42: };
     43: */
     44: #include "initenum.h"

     47: /* Global Variables */
     48: #ifndef ADINTRINSICS_C   /* initialized in adintrinsics.c */
     49: ADINTR_EXTERN double ADIntr_Partials[ADINTR_MAX_FUNC][ADINTR_MAX_PARTIALS];
     50: ADINTR_EXTERN enum ADIntr_Modes ADIntr_Mode;
     51: #endif

     53: /* Prototypes */
     54: #include "knr-compat.h"

     56: /* All ADIntrinsics function prototypes */
     57: #include "adintr_proto.h"

     59: #ifdef ADINTRINSICS_WITH_ADIC
     60: #include "g_proto.h"
     61: #endif

     63: /* Prototypes for mode switching functions */

     65: ADINTR_EXTERN enum ADIntr_Modes adintr_current_mode Proto((void));
     66: ADINTR_EXTERN void adintr_mode_push Proto((enum ADIntr_Modes new_mode));
     67: ADINTR_EXTERN void adintr_mode_pop Proto((void));

     69: /* Prototypes for ADIntrinsics interface functions */

     71: ADINTR_EXTERN void adintr_ehsup Proto((enum ADIntr_Funcs func,
     72:                                 enum ADIntr_Partials partial,
     73:                                 double value));

     75: ADINTR_EXTERN double adintr_ehgup Proto((enum ADIntr_Funcs func,
     76:                                   enum ADIntr_Partials partial));

     78: ADINTR_EXTERN void adintr_ehsout Proto((FILE *the_file));
     79: ADINTR_EXTERN void adintr_ehrpt Proto((void));
     80: ADINTR_EXTERN void adintr_ehrst Proto((void));

     82: ADINTR_EXTERN void adintr_ehsfid Proto((int *g_ehfid, char *routine, char *filename));

     84: #if 0
     85: #ifdef ADINTRINSICS_INLINE
     86: /* Support is easy, but who needs it? */
     87: /* #include "inline defininitions for mode switching functions" */
     88: #endif /* ADINTRINSICS_INLINE */
     89: #endif

     92: #endif /* ndef ADINTRINSICS_H */

     94: #if ad_GRAD_MAX == 1
     97: #  define admf_PetscGlobalMax(a,b,c) MPI_Allreduce(a,b,2,MPIU_SCALAR,PetscADMax_Op,c)
     98: #  define admf_PetscGlobalMin(a,b,c) MPI_Allreduce(a,b,2,MPIU_SCALAR,PetscADMin_Op,c)
     99: #  define admf_PetscGlobalSum(a,b,c) MPI_Allreduce(a,b,2,MPIU_SCALAR,PetscSum_Op,c)
    100: #else
    101: #  define ad_PetscGlobalMax(a,b,c) 1   /* 1 generates error to indicate not implemented */
    102: #  define ad_PetscGlobalMin(a,b,c) 1
    103: #  define ad_PetscGlobalSum(a,b,c) 1
    104: #endif