JEMRIS  2.8.2
open-source MRI simulations
Bloch_McConnell_CV_Model.h
Go to the documentation of this file.
1 
5 /*
6  * JEMRIS Copyright (C)
7  * 2006-2018 Tony Stoecker
8  * 2007-2018 Kaveh Vahedipour
9  * 2009-2018 Daniel Pflugfelder
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24  */
25 
26 #ifndef BLOCH_MCCONNELL_CV_MODEL_H_
27 #define BLOCH_MCCONNELL_CV_MODEL_H_
28 
29 #include "Model.h"
30 #include "config.h"
31 
32 struct BMAux {
33 
34  double* exrates;
35  bool single;
36 
37  BMAux () {
38 
39  exrates = 0;
40  single = false;
41 
42  };
43 
44  void Init (int npools) {
45 
46  exrates = (double*) malloc (npools * npools * sizeof(double));
47 
48  };
49 
50 };
51 
52 
53 
54 //CVODE2.5 includes:
55 #ifdef HAVE_CVODE_CVODE_H
56  #include "cvode/cvode.h"
57 #endif
58 #ifdef HAVE_CVODE_H
59  #include "cvode.h"
60 #endif
61 #ifdef HAVE_NVECTOR_NVECTOR_SERIAL_H
62  #include "nvector/nvector_serial.h"
63 #endif
64 #ifdef HAVE_NVECTOR_SERIAL_H
65  #include "nvector_serial.h"
66 #endif
67 
68 #define NEQ 3 // number of equations
69 #ifndef RTOL
70  #define RTOL 1e-4 // scalar relative tolerance
71 #endif
72 #define ATOL1 1e-6 // vector absolute tolerance components
73 #define ATOL2 1e-6
74 #define ATOL3 1e-6
75 #define BEPS 1e-10
76 
78 struct bmnvec {
79  N_Vector y;
80  N_Vector abstol;
81 };
82 
90 class Bloch_McConnell_CV_Model : public Model {
92 
93  public:
94 
99  CVodeFree(&m_cvode_mem);
100  };
101 
106 
107 
108  protected:
109 
115  virtual void InitSolver ();
116 
122  virtual void FreeSolver ();
123 
129  void PrintFinalStats ();
130 
131 
135  virtual bool Calculate (double next_tStop);
136 
137  private:
138 
139  void* m_cvode_mem;
140  double m_tpoint;
141  double m_reltol;
142 
143  int m_nprops;
144  int m_ncomp ;
145  BMAux m_bmaux;
146 
147 };
148 
149 #endif //BLOCH_MCCONNELL_CV_MODEL_H_
N_Vector y
Definition: Bloch_McConnell_CV_Model.h:79
Structure keeping the vectors for cvode.
Definition: Bloch_McConnell_CV_Model.h:78
N_Vector abstol
Definition: Bloch_McConnell_CV_Model.h:80
Implementation of JEMRIS Model.
Definition: Bloch_McConnell_CV_Model.h:32
Numerical solving of Bloch equations As an application of the CVODE solver by Lawrence Livermore Nati...
Definition: Bloch_McConnell_CV_Model.h:91
Base class for MR model solver.
Definition: Model.h:48
virtual ~Bloch_McConnell_CV_Model()
Default destructor.
Definition: Bloch_McConnell_CV_Model.h:98

-- last change 24.05.2018 | Tony Stoecker | Imprint | Data Protection --