-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIntegratorCVode.h
74 lines (59 loc) · 2.03 KB
/
IntegratorCVode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once
/* ----------------------------------------------------
NOTICE OF COPYRIGHT AND OWNERSHIP OF SOFTWARE
Copyright 2004, The Johns Hopkins University
School of Medicine. All rights reserved.
For research use only; commercial use prohibited.
Distribution without permission of Raimond L. Winslow
not permitted. rwinslow@bme.jhu.edu
Name of Program: Guinea Pig C++: Coupled, Algbraic, BB, MCA
Version: Documented Version, version 1.0.1
Date: August 2004
-----------------------------------------------------
*/
#include "integrator.h"
#include "model.h"
#include "fileIO.h"
#include <sundialstypes.h> /* definitions of types realtype and */
/* integertype, and the constant FALSE */
#include <cvode.h> /* prototypes for CVodeMalloc, CVode, and CVodeFree, */
/* constants OPT_SIZE, BDF, NEWTON, SV, SUCCESS, */
/* NST, NFE, NSETUPS, NNI, NCFN, NETF */
#include <cvdense.h> /* prototype for CVDense, constant DENSE_NJE */
#include <nvector.h> /* definitions of type N_Vector and macro N_VIth, */
#include <nvector_serial.h> /* definitions of type N_Vector and macro N_VIth, */
/* prototypes for N_VNew, N_VFree */
#include <dense.h> /* definitions of type DenseMat, macro DENSE_ELEM */
#include <stdlib.h>
#include <iostream>
using namespace std;
class IntegratorCVode :
public Integrator
{
public:
IntegratorCVode(void);
virtual ~IntegratorCVode(void);
void setParameters(fileIO& data);
void setupCVode(Model *model);
void integrateModel(Model *model, fileIO *out, int runNumber);
protected:
void iterateToTime(double time);
void refreshCVode(Model *model);
//Internal variables
double cvode_t;
bool usingErrorWeights;
N_Vector ew;
N_Vector cvode_y;
N_Vector cvode_ic;
void* cvode_mem;
double* ropt;
long* iopt;
M_Env machEnv;
//Parameters
double reltol;
double abstol;
double step_max;
double step_min;
double start_time;
double stepsize;
};