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