xref: /petsc/src/ts/tutorials/autodiff/adolc-utils/contexts.cxx (revision a69119a591a03a9d906b29c0a4e9802e4d7c9795)
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 #ifndef 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 #ifndef 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