JEMRIS  2.8.2
open-source MRI simulations
World.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  *
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 WORLD_H_
28 #define WORLD_H_
29 
30 #include "Declarations.h"
31 #include <string>
32 #include <sstream>
33 #include <iostream>
34 #include <iomanip>
35 #include <cstdlib>
36 #include <fstream>
37 #include <vector>
38 #include <map>
39 
40 
41 using namespace std;
42 
43 //forward declarations
44 class AtomicSequence;
45 class ConcatSequence;
46 class SequenceTree;
47 class EddyPulse;
48 
50 
51 class World {
52 
53  public:
54 
55  //MODIF
59  bool logFile;
60 
61 
66 
67 
71  void setTrajLoading(int firstSpin, int paketSize) { m_trajBegin=firstSpin; m_trajSize=paketSize; };
72 
73 
77  long getTrajBegin() { return m_trajBegin; };
78 
79  long getTrajNumber() { return m_trajSize; };
80  //MODIF***
81 
82 
86  virtual ~World ();
87 
91  static World* instance ();
92 
99  double ConcomitantField (double* G);
100 
106  void SetNoOfSpinProps (int n);
107 
113  int GetNoOfSpinProps () {return m_noofspinprops;};
114 
115 
119  double* Helper () {
120  return &helper[0];
121  };
122 
123 
129  void InitHelper (long size);
130 
131 
137  int GetNoOfCompartments ();
138 
139 
145  void SetNoOfCompartments (int n);
146 
147 
154  void (*saveEvolFunPtr)(long l, bool b) ;
155 
156  void* solverSettings ;
159  void* auxiliary;
161  //members for solution of a particular spin
162  long SpinNumber;
166  double* Values;
167  double time;
168  double total_time;
169  double phase;
170  double PhaseLock;
171  double deltaB;
172  std::vector<double> solution;
174  double RandNoise;
175  double GMAXoverB0;
178  //members for the current sequence
183  //members for saving the magnetization evolution of the spins
186  ofstream* saveEvolOfstream;
188  int m_myRank;
192  //MODIF
193  long m_trajBegin;
194  long m_trajSize;
195  //MODIF***
196 
197  long m_startSpin;
200  int m_noofspincompartments;
202  std::vector<double> helper;
203  //double* helper; /** @brief Any additional data necessary for solving the model. (i.e. Global MT exchange matrix) */
204 
205  multimap<EddyPulse*,double> m_eddies;
207  private:
208 
212  World () {};
213 
214  static World* m_instance;
216 };
217 
218 #endif /*WORLD_H_*/
Implementation of JEMRIS Declarations.
bool logFile
Write or not a log file.
Definition: World.h:59
double phase
Receiver phase taken from the TPOIs.
Definition: World.h:169
double deltaB
Any off-resonance terms.
Definition: World.h:171
Concat sequence prototype.
Definition: ConcatSequence.h:37
long m_startSpin
start calculation with this spin ( in case of restart)
Definition: World.h:197
Singleton with information about the simulation of the current spin.
Definition: World.h:51
void * auxiliary
Auxiliary data any kind of container needed for static methods can go here.
Definition: World.h:159
bool solverSuccess
true, if last calculation successful
Definition: World.h:157
double time
Current time point (in atom)
Definition: World.h:167
int m_noofspinprops
of spin properties
Definition: World.h:199
ofstream * saveEvolOfstream
Output stream for saving the evolutions.
Definition: World.h:186
AtomicSequence * pStaticAtom
Atomic sequence responsible for all time points.
Definition: World.h:181
multimap< EddyPulse *, double > m_eddies
map of remaining eddies still to be played out (duration,pointer)
Definition: World.h:205
World()
Default constructor.
Definition: World.h:212
double * Values
Values of the current spin (position and physical parameters)
Definition: World.h:166
long TotalADCNumber
Total number of spins.
Definition: World.h:164
int GetNoOfSpinProps()
Get number of spin properties.
Definition: World.h:113
double RandNoise
percentage of random noise added to the signal
Definition: World.h:174
long TotalSpinNumber
Total number of spins.
Definition: World.h:163
bool logTrajectories
Write or not a log file for trajectories.
Definition: World.h:65
AtomicSequence * pAtom
Atomic sequence responsible for the current time point.
Definition: World.h:180
double PhaseLock
Locked Phase (the phase set by the last RF pulse)
Definition: World.h:170
void * solverSettings
Arbitrary solver settings.
Definition: World.h:156
long m_trajBegin
First trajectory to load for current MPI sample paket.
Definition: World.h:193
int saveEvolStepSize
Step-size (in numbers of ADC) at which the evolution is stored.
Definition: World.h:184
int m_no_processes
number of parallel processes; used by load balancing
Definition: World.h:190
string saveEvolFileName
Filename in which the evolution is stored.
Definition: World.h:185
double GMAXoverB0
Constant for the concomitant field term.
Definition: World.h:175
double * Helper()
Reference to helper array.
Definition: World.h:119
long m_trajSize
Number of trajectories to load for current MPI sample paket.
Definition: World.h:194
Tree representation of the sequence.
Definition: SequenceTree.h:45
double NonLinGradField
Non-linear contribution to B_z from gradients.
Definition: World.h:176
double total_time
Current time point (absolut time)
Definition: World.h:168
SequenceTree * pSeqTree
The main sequence tree.
Definition: World.h:179
bool m_useLoadBalancing
use load balancing (send sample in small packages top slaves)
Definition: World.h:189
Prototype of an Eddy pulse.
Definition: EddyPulse.h:35
std::vector< double > helper
Definition: World.h:202
long SpinNumber
Number of the current spin.
Definition: World.h:162
int m_myRank
MPI rank of this process. if m_myRank<0 process is serial jemris.
Definition: World.h:188
void setTrajLoading(int firstSpin, int paketSize)
Set trajectory parameters for MPI current sample paket.
Definition: World.h:71
long getTrajBegin()
Get trajectory parameters for MPI current sample paket.
Definition: World.h:77
std::vector< double > solution
Solution [M_r, phi, M_z] at the current time point.
Definition: World.h:172
Atomic sequence prototype.
Definition: AtomicSequence.h:40

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