Actual source code: tsimpl.h
1: /* $Id: tsimpl.h,v 1.23 2001/01/15 21:48:24 bsmith Exp $ */
3: #ifndef __TSIMPL_H
5: #include "petscts.h"
7: /*
8: Timesteping context.
9: General case: U_t = F(t,U) <-- the right-hand-side function
10: Linear case: U_t = A(t) U <-- the right-hand-side matrix
11: Linear (no time) case: U_t = A U <-- the right-hand-side matrix
12: */
14: /*
15: Maximum number of monitors you can run with a single TS
16: */
17: #define MAXTSMONITORS 5
19: struct _p_TS {
20: PETSCHEADER(int)
22: TSProblemType problem_type;
24: Vec vec_sol,vec_sol_always;
26: /* ---------------- User (or PETSc) Provided stuff ---------------------*/
27: int (*monitor[MAXTSMONITORS])(TS,int,double,Vec,void*); /* returns control to user after */
28: int (*mdestroy[MAXTSMONITORS])(void*);
29: void *monitorcontext[MAXTSMONITORS]; /* residual calculation, allows user */
30: int numbermonitors; /* to, for instance, print residual norm, etc. */
32: int (*rhsmatrix)(TS,double,Mat*,Mat*,MatStructure *,void*);
33: Mat A,B; /* user provided matrix and preconditioner */
34: Mat Ashell; /* if user provided a Shell matrix */
36: int (*rhsfunction)(TS,double,Vec,Vec,void*);
37: void *funP;
38: int (*rhsjacobian)(TS,double,Vec,Mat*,Mat*,MatStructure *,void*);
39: void *jacP;
40: int (*rhsbc)(TS,double,Vec,void*);
41: void *bcP;
43: /* ---------Inner nonlinear or linear solvers ---------------------------*/
45: SNES snes;
46: SLES sles;
48: /* --- Routines and data that are unique to each particular solver --- */
50: int (*setup)(TS); /* sets up the nonlinear solver */
51: int setupcalled; /* true if setup has been called */
52: int (*step)(TS,int*,double*); /* stepping routine */
53: int (*setfromoptions)(TS); /* sets options from database */
54: void *data; /* implementationspecific data */
56: void *user; /* user context */
58: /* ------------------ Parameters -------------------------------------- */
60: int max_steps; /* max number of steps */
61: double max_time;
62: double time_step;
63: double initial_time_step;
64: int steps; /* steps taken so far */
65: double ptime; /* time taken so far */
66: int linear_its; /* total number of linear solver iterations */
67: int nonlinear_its; /* total number of nonlinear solver iterations */
69: /* ------------------- Default work-area management ------------------ */
71: int nwork;
72: Vec *work;
73: int (*destroy)(TS);
74: int (*view)(TS,PetscViewer);
75: };
77: EXTERN int TSMonitor(TS,int,double,Vec);
78: EXTERN int TSComputeRHSBoundaryConditions(TS,double,Vec);
80: #endif