JEMRIS 2.9.2
open-source MRI simulations
Loading...
Searching...
No Matches
Bloch_McConnell_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 * 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
32struct 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//CVODE includes:
55#ifdef HAVE_CVODE_CVODE_H
56 #include "cvode/cvode.h"
57#endif
58#ifdef HAVE_NVECTOR_NVECTOR_SERIAL_H
59 #include "nvector/nvector_serial.h"
60#endif
61#ifdef HAVE_CVODE_CVODE_DIAG_H
62 #include "cvode/cvode_diag.h" /* prototypes for CVODE diagonal solver (required since CVODE 5.x) */
63#endif
64
65#define NEQ 3 // number of equations
66#ifndef RTOL
67 #define RTOL 1e-6 // scalar relative tolerance
68#endif
69#ifndef ATOL1
70 #define ATOL1 1e-8 // vector absolute tolerance components
71#endif
72#ifndef ATOL2
73 #define ATOL2 1e-8
74#endif
75#ifndef ATOL3
76 #define ATOL3 1e-8
77#endif
78
79
81struct bmnvec {
82 N_Vector y;
83 N_Vector abstol;
84};
85
95
96 public:
97
102 CVodeFree(&m_cvode_mem);
103 };
104
109
110
111 protected:
112
118 virtual void InitSolver ();
119
125 virtual void FreeSolver ();
126
132 void PrintFinalStats ();
133
134
138 virtual bool Calculate (double next_tStop);
139
140 private:
141
142 void* m_cvode_mem;
143 double m_tpoint;
144 double m_reltol;
145
146 int m_nprops;
147 int m_ncomp ;
148 BMAux m_bmaux;
149
150};
151
152#endif //BLOCH_MCCONNELL_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_McConnell_CV_Model.h:94
virtual bool Calculate(double next_tStop)
Definition Bloch_McConnell_CV_Model.cpp:414
virtual void FreeSolver()
Free solver.
Definition Bloch_McConnell_CV_Model.cpp:406
virtual ~Bloch_McConnell_CV_Model()
Default destructor.
Definition Bloch_McConnell_CV_Model.h:101
void PrintFinalStats()
Summery output.
Definition Bloch_McConnell_CV_Model.cpp:475
virtual void InitSolver()
Initialize solver.
Definition Bloch_McConnell_CV_Model.cpp:333
Bloch_McConnell_CV_Model()
Constructor.
Definition Bloch_McConnell_CV_Model.cpp:254
Base class for MR model solver.
Definition Model.h:48
Definition Bloch_McConnell_CV_Model.h:32
Structure keeping the vectors for cvode.
Definition Bloch_McConnell_CV_Model.h:81
N_Vector abstol
Definition Bloch_McConnell_CV_Model.h:83
N_Vector y
Definition Bloch_McConnell_CV_Model.h:82

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