C++ main module for stochmagnet Package  1.0
SM_StratonovichNormalizedSystem.h
Go to the documentation of this file.
1 #ifndef SM_StratonovichNormalizedSystem_H
2 #define SM_StratonovichNormalizedSystem_H
3 
4 #include "SM_TemplatedSystem.h"
5 
12 class SM_StratonovichNormalizedSystem : public SM_TemplatedSystem<SM_StratonovichNormalizedSystem> {
13 
14  //attributes
15 private :
16 
17 
18 
19  tReal mK;//the stratonovich constant for LL function
20 
21 public:
22  // CONSTRUCTORS
26 
27  }
28 
29  // DESTRUCTORS
33  }
34 
35 
36 public :
37 
44  }
45 
46  //MEMORY
47 
61  virtual tMemSize getMemorySize() const {
62  return sizeof(*this)+getContentsMemorySize();
63  }
64 
65 
66 public:
67 
72  inline const tReal& getK() const {
73  return mK;
74  }
75 
76 public:
80  virtual void discretize() override {
83  const tReal& alpha=ll.getAlpha();
84  const tReal& beta=ll.getBeta();
85  mK=alpha*alpha*(1+beta*beta);
86 
87  }
88 
89 
90 
91 public:
92 
103  inline tBoolean computeTemplatedMuAtNextTimeStep(const tReal& dt,const tReal& epsilon_t,
104  const tIndex& nParticles,const tDimension& dim,
105  const tReal* mu_t,
106  tReal *mu_tpdt) const {
107 
108  const tReal &K=this->getK();
109 
110  //inverse of norm of Mu
111  tReal invNormMu=0;
112 
113  //iterator on point
114  tIndex p;
115 
116  //iterator on dimension
117  tDimension k;
118 
119  //iterator on mu(t+dt)
120  tReal *mu_tpdt_p,*mu_tpdt_i=mu_tpdt;
121 
122  //iterator on mu(t)
123  const tReal *mu_t_i=mu_t;
124 
125 
126  for (p=0;p<nParticles;p++) {
127  //mu(t+dt) at particule p
128  mu_tpdt_p=mu_tpdt_i;
129  //inverse of norm of mu
130  invNormMu=0;
131 
132  for (k=0;k<dim;k++) {
133  //mu(t+dt) at element i=(p,k)
134  (*mu_tpdt_i)+=(1-K*epsilon_t*epsilon_t*dt)*(*mu_t_i);
135  //norm of mu(t+dt) at p
136  invNormMu+=(*mu_tpdt_i)*(*mu_tpdt_i);
137 
138  //next element
139  mu_tpdt_i++;
140  mu_t_i++;
141 
142  }
143  if (invNormMu>EPSILON<tReal>) {
144  //normlize mu(t+dt) at p
145  invNormMu=1./sqrt(invNormMu);
146  mu_tpdt_i=mu_tpdt_p;
147  for (k=0;k<3;k++) {
148  (*mu_tpdt_i)*=invNormMu;
149  mu_tpdt_i++;
150  }
151  }
152 
153  }
154 
155 
156 
157  //because of nomalization the norm of mu is never greater than 1
158  return true;
159  }
160 
161 };
162 
163 
164 #endif
tUCInt tDimension
Definition: CORE_StdPtrField.h:567
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:94
This class describes a landau lifschitz function of the form :
Definition: SM_LandauLifschitzFunction.h:26
const tReal & getAlpha() const
get the alpha parameter
Definition: SM_LandauLifschitzFunction.h:130
const tReal & getBeta() const
get the beta parameter
Definition: SM_LandauLifschitzFunction.h:137
This class is a simulation of one trajectory class for Stoch Microm package based on Stratonovich sys...
Definition: SM_StratonovichNormalizedSystem.h:12
virtual void discretize() override
discretize the system It computes the Stratonovich constant depending on the parameters of the Landau...
Definition: SM_StratonovichNormalizedSystem.h:80
virtual ~SM_StratonovichNormalizedSystem(void)
destroy the class
Definition: SM_StratonovichNormalizedSystem.h:32
SM_StratonovichNormalizedSystem(void)
create a class
Definition: SM_StratonovichNormalizedSystem.h:25
const tReal & getK() const
return the stratonovich constant
Definition: SM_StratonovichNormalizedSystem.h:72
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_StratonovichNormalizedSystem.h:61
tBoolean computeTemplatedMuAtNextTimeStep(const tReal &dt, const tReal &epsilon_t, const tIndex &nParticles, const tDimension &dim, const tReal *mu_t, tReal *mu_tpdt) const
compute mu at time step
Definition: SM_StratonovichNormalizedSystem.h:103
static CORE_UniquePointer< SM_StratonovichNormalizedSystem > New()
build a new instance of a system
Definition: SM_StratonovichNormalizedSystem.h:41
tReal mK
Definition: SM_StratonovichNormalizedSystem.h:19
const SM_LandauLifschitzFunction & getLandauLifschitzFunction() const
get the Landau Lifschitz function return the Landau lifschitz function for reading
Definition: SM_System.h:262
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_System.h:140
Definition: SM_TemplatedSystem.h:19
virtual void discretize()
discretize the system
Definition: SM_TemplatedSystem.h:97
typename std::unique_ptr< T, CORE_Object::Delete > CORE_UniquePointer
Definition: sp.h:8
#define tIndex
Definition: types.h:157
#define tMemSize
Definition: types.h:166
#define tBoolean
Definition: types.h:151
#define tReal
Definition: types.h:137