JEMRIS  2.8.1
open-source MRI simulations
TrajectoryDiffusion.h
1 /*
2  * TrajectoryDiffusion.h
3  *
4  * Created on: Dec 10, 2009
5  * Author: dpflug
6  */
7 
8 
9 /*
10  * JEMRIS Copyright (C)
11  * 2006-2015 Tony Stoecker
12  * 2007-2015 Kaveh Vahedipour
13  * 2009-2015 Daniel Pflugfelder
14  *
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 2 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29  */
30 
31 #ifndef TRAJECTORYDIFFUSION_H_
32 #define TRAJECTORYDIFFUSION_H_
33 
34 #include "TrajectoryInterface.h"
35 #include "rng.h"
36 #include "XMLIO.h"
37 
38 
39 enum modes{BOTH, INTERNAL, EXTERNAL};
40 
41 using namespace std;
42 
43 class Microstructure;
44 
46 struct triple {
47  double x,y,z;
48 };
49 
52 public:
54  virtual ~TrajectoryDiffusion();
55 
56 //load diffusion definition file
57  virtual void LoadFile(string filename) ;
58 
59  virtual void GetValueDerived(double time, double *pos);
60 
61  virtual void UpdateTrajectory(bool init);
62 
63  void DumpTrajectory(string filename);
64 
65 private:
66 
67  // xml access functions
68  string GetAttr (DOMElement* element, string key);
69  DOMElement* GetElem (string name);
70 
71  void GenerateDiffusionTrajectory();
72  void CalcY(); // calc information for cubic spline interpolation.
73 
74  void SetSeed(long seed);
75 
76  Microstructure *m_microstruct;
77 
78  vector<triple> m_pos;
79  // vector for cubic splines interpolation:
80  vector<triple> m_y;
81 
82  unsigned long m_seed;
83  RNG* m_rng;
84 
85  double m_timestep;
86  long m_max_timesteps;
87 
88  // mode ==0 simulate internal and external, mode ==1 only internal, mode == 2 only external
89  modes m_mode;
90 
91  vector<int> m_dump_index; //dump the trajectory of these spins
92 
93  int m_diff_dimension; // flag for 3-dimensional, 2-dim or 1-dim diffusion; default: 3-dim
94  void ProjectPosition(triple &pos, triple dir);
95 
96  // variables for xml reader:
97  DOMTreeErrorReporter* m_domtree_error_rep;
98  XMLIO* m_xio;
99  DOMDocument* m_dom_doc;
100 
101 
102 };
103 
104 #endif /* TRAJECTORYDIFFUSION_H_ */
XML file-IO class.
Definition: XMLIO.h:61
Implementation of JEMRIS TrajectoryInterface.
Microsructure base class.
Definition: Microstructure.h:55
pure virtual base class for all Trajectories
Definition: TrajectoryInterface.h:48
Cartesians positions for diffusion trajectory of a spin.
Definition: TrajectoryDiffusion.h:46
Implementation of JEMRIS XMLIO.
Diffusion trajectory of a spin.
Definition: TrajectoryDiffusion.h:51

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