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