xref: /petsc/src/ts/tutorials/autodiff/adolc-utils/contexts.cxx (revision 9d47de495d3c23378050c1b4a410c12a375cb6c6)
1 #include <petscsys.h>
2 
3 /*
4    REQUIRES configuration of PETSc with option --download-adolc.
5 
6    For documentation on ADOL-C, see
7      $PETSC_ARCH/externalpackages/ADOL-C-2.6.0/ADOL-C/doc/adolc-manual.pdf
8 */
9 
10 #if !defined(ADOLCCTX)
11   #define ADOLCCTX
12 typedef struct {
13   /* No ADOL-C annotation */
14   PetscBool no_an;
15 
16   /* Compressed Jacobian computation */
17   PetscBool     sparse, sparse_view, sparse_view_done;
18   PetscScalar **Seed, **Rec, *rec;
19   PetscInt      p;
20 
21   /* Matrix dimensions, number of parameters */
22   PetscInt m, n, num_params;
23 } AdolcCtx;
24 #endif
25 
26 /* Matrix (free) context */
27 #if !defined(MATCTX)
28   #define MATCTX
29 typedef struct {
30   PetscReal     time;
31   Vec           X;
32   Vec           Xdot;
33   Vec           localX0;
34   PetscReal     shift;
35   PetscInt      m, n;
36   PetscInt      tag1, tag2;
37   TS            ts;
38   PetscBool     flg;
39   PetscLogEvent event1, event2, event3, event4;
40 } AdolcMatCtx;
41 #endif
42