JEMRIS  2.8.1
open-source MRI simulations
Bloch_CV_Model.h
Go to the documentation of this file.
1 
5 /*
6  * JEMRIS Copyright (C)
7  * 2006-2015 Tony Stoecker
8  * 2007-2015 Kaveh Vahedipour
9  * 2009-2015 Daniel Pflugfelder
10  *
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  */
26 
27 #ifndef BLOCH_CV_MODEL_H_
28 #define BLOCH_CV_MODEL_H_
29 
30 #include "Model.h"
31 #include "config.h"
32 
33 //CVODE2.5 includes:
34 #ifdef HAVE_CVODE_CVODE_H
35  #include "cvode/cvode.h"
36 #endif
37 #ifdef HAVE_CVODE_H
38  #include "cvode.h"
39 #endif
40 #ifdef HAVE_NVECTOR_NVECTOR_SERIAL_H
41  #include "nvector/nvector_serial.h"
42 #endif
43 #ifdef HAVE_NVECTOR_SERIAL_H
44  #include "nvector_serial.h"
45 #endif
46 
47 
48 
49 
50 #define NEQ 3 // number of equations
51 #define RTOL 1e-15 // scalar relative tolerance
52 #define ATOL1 1e-6 // vector absolute tolerance components
53 #define ATOL2 1e-6
54 #define ATOL3 1e-6
55 #define BEPS 1e-10
56 
58 struct nvec {
59  N_Vector y;
60  N_Vector abstol;
61 };
62 
70 class Bloch_CV_Model : public Model {
72 
73  public:
74 
78  virtual ~Bloch_CV_Model () {
79  CVodeFree(&m_cvode_mem);
80  };
81 
85  Bloch_CV_Model ();
86 
87 
88  protected:
89 
95  virtual void InitSolver ();
96 
102  virtual void FreeSolver ();
103 
109  void PrintFinalStats ();
110 
111 
115  virtual bool Calculate (double next_tStop);
116 
117  private:
118 
119  // CVODE related
120  void* m_cvode_mem;
121  double m_tpoint;
122  double m_reltol;
124 };
125 
126 #endif /*BLOCH_CV_MODEL_H_*/
Numerical solving of Bloch equations As an application of the CVODE solver by Lawrence Livermore Nati...
Definition: Bloch_CV_Model.h:71
Structure keeping the vectors for cvode.
Definition: Bloch_CV_Model.h:58
Implementation of JEMRIS Model.
virtual ~Bloch_CV_Model()
Default destructor.
Definition: Bloch_CV_Model.h:78
N_Vector abstol
Definition: Bloch_CV_Model.h:60
double m_tpoint
current time point
Definition: Bloch_CV_Model.h:121
Base class for MR model solver.
Definition: Model.h:48
double m_reltol
relative error tolerance for CVODE
Definition: Bloch_CV_Model.h:122
N_Vector y
Definition: Bloch_CV_Model.h:59
void * m_cvode_mem
pointer to cvode malloc
Definition: Bloch_CV_Model.h:120

-- last change 17.06.2016 | Tony Stoecker | Imprint --