C++ main module for stochmagnet Package  1.0
SM_StratonovichSystem.h
Go to the documentation of this file.
1 #ifndef SM_StratonovichSystem_H
2 #define SM_StratonovichSystem_H
3 
4 #include "SM_TemplatedSystem.h"
5 
12 class SM_StratonovichSystem : public SM_TemplatedSystem<SM_StratonovichSystem> {
13 
14  //attributes
15 private :
16 
17  tReal mK;//the stratonovich constant for LL function
18 
19 
20 
21 public:
22  // CONSTRUCTORS
26 
27 
28  }
29 
30  // DESTRUCTORS
33  virtual ~SM_StratonovichSystem(void) {
34  }
35 
36 
37 public :
38 
44  p->getLandauLifschitzFunction().setIsMuNormalized(true);
45  return p;
46  }
47 
48  //MEMORY
49 
63  virtual tMemSize getMemorySize() const {
64  return sizeof(*this)+getContentsMemorySize();
65  }
66 
67 
68 public:
69 
70 
71 
76  inline const tReal& getK() const {
77  return mK;
78  }
79 
80 public:
84  virtual void discretize() override {
87  const tReal& alpha=ll.getAlpha();
88  const tReal& beta=ll.getBeta();
89  mK=alpha*alpha*(1+beta*beta);
90 
91  }
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  tBoolean succeeds =true;
108  tIndex i,N=nParticles*dim;
109  const tReal *mu_t_i=mu_t;
110  tReal *mu_tpdt_i=mu_tpdt;
111  for (i=0;i<N;i++) {
112  //update mu(t+dt)
113  (*mu_tpdt_i)+=(1-mK*epsilon_t*epsilon_t*dt)*(*mu_t_i);
114 
115  //verify the convergence of the algorithm
116  succeeds=succeeds && (fabs(*mu_tpdt_i)<10);
117 
118  //next element
119  mu_t_i++;
120  mu_tpdt_i++;
121  }
122 
123  return succeeds;
124 
125  }
126 
127 };
128 
129 
130 #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_StratonovichSystem.h:12
const tReal & getK() const
return the stratonovich constant
Definition: SM_StratonovichSystem.h:76
tReal mK
Definition: SM_StratonovichSystem.h:17
virtual void discretize() override
discretize the system It computes the Stratonovich constant depending on the parameters of the Landau...
Definition: SM_StratonovichSystem.h:84
SM_StratonovichSystem(void)
create a class
Definition: SM_StratonovichSystem.h:25
virtual ~SM_StratonovichSystem(void)
destroy the class
Definition: SM_StratonovichSystem.h:33
static CORE_UniquePointer< SM_StratonovichSystem > New()
build a new instance of a system
Definition: SM_StratonovichSystem.h:42
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_StratonovichSystem.h:63
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_StratonovichSystem.h:103
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