JEMRIS 2.9.2
open-source MRI simulations
Loading...
Searching...
No Matches
Bloch_CV_Model.h
Go to the documentation of this file.
1
5/*
6 * JEMRIS Copyright (C)
7 * 2006-2025 Tony Stoecker
8 * 2007-2018 Kaveh Vahedipour
9 * 2009-2019 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//CVODE includes:
34#ifdef HAVE_CVODE_CVODE_H
35 #include "cvode/cvode.h"
36#endif
37#ifdef HAVE_NVECTOR_NVECTOR_SERIAL_H
38 #include "nvector/nvector_serial.h"
39#endif
40#ifdef HAVE_CVODE_CVODE_DIAG_H
41 #include "cvode/cvode_diag.h" /* prototypes for CVODE diagonal solver (required since CVODE 5.x) */
42#endif
43
44
45#define NEQ 3 // number of equations
46#define RTOL 1e-6 // scalar relative tolerance
47#define ATOL1 1e-8 // vector absolute tolerance components
48#define ATOL2 1e-8
49#define ATOL3 1e-8
50
52struct nvec {
53 N_Vector y;
54 N_Vector abstol;
55};
56
65class Bloch_CV_Model : public Model {
66
67 public:
68
72 virtual ~Bloch_CV_Model () {
73 CVodeFree(&m_cvode_mem);
74 };
75
80
81
82 protected:
83
89 virtual void InitSolver ();
90
96 virtual void FreeSolver ();
97
103 void PrintFinalStats ();
104
105
109 virtual bool Calculate (double next_tStop);
110
111 private:
112
113 // CVODE related
115 double m_tpoint;
116 double m_reltol;
118};
119
120#endif /*BLOCH_CV_MODEL_H_*/
Implementation of JEMRIS Model.
Numerical solving of Bloch equations As an application of the CVODE solver by Lawrence Livermore Nati...
Definition Bloch_CV_Model.h:65
double m_reltol
relative error tolerance for CVODE
Definition Bloch_CV_Model.h:116
virtual void FreeSolver()
Free solver.
Definition Bloch_CV_Model.cpp:280
Bloch_CV_Model()
Constructor.
Definition Bloch_CV_Model.cpp:170
virtual ~Bloch_CV_Model()
Default destructor.
Definition Bloch_CV_Model.h:72
void PrintFinalStats()
Summery output.
Definition Bloch_CV_Model.cpp:328
virtual bool Calculate(double next_tStop)
Definition Bloch_CV_Model.cpp:288
void * m_cvode_mem
pointer to cvode malloc
Definition Bloch_CV_Model.h:114
virtual void InitSolver()
Initialise solver.
Definition Bloch_CV_Model.cpp:248
double m_tpoint
current time point
Definition Bloch_CV_Model.h:115
Base class for MR model solver.
Definition Model.h:48
Structure keeping the vectors for cvode.
Definition Bloch_CV_Model.h:52
N_Vector abstol
Definition Bloch_CV_Model.h:54
N_Vector y
Definition Bloch_CV_Model.h:53

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