C++ mpi module for stochmagnet_main Package
SM_AnisotropyOperator.h
1 #ifndef SM_AnisotropyOperator_H
2 #define SM_AnisotropyOperator_H
3 
4 //base classes
5 #include "SM_SliceOperator.h"
6 
7 //network class
8 #include "SM_Network.h"
9 
10 //array utilities
11 #include "functions_array.h"
12 
31 template<class I>
33 
34  //attributes
35 private :
36 
37 
38 
39 protected:
40  // CONSTRUCTORS
44  }
45 
46 
47  // DESTRUCTORS
50  virtual ~SM_AnisotropyOperator(void) {
51  }
52 
53 public :
54 
55  //Instance building
56  //=================
57 
58 public:
59 
60  //MEMORY
61 
75  virtual tMemSize getMemorySize() const {
76  return sizeof(*this)+this->getContentsMemorySize();
77  }
78 
79 
80  //Fields computation
81  //==================
82 
98  virtual void computeMagneticFieldSlice(const tIndex& stepIndex,
99  const SM_Network& network,
100  const SM_Material& material,
101  const tIndex& startIndex,
102  const tIndex& endIndex,
103  const tReal *S,
104  const tBoolean& alpha,
105  const tIndex& nH,
106  tReal *H) const;
107 
108  //Spin energy computation
109  //=======================
110 
111 
120  virtual tReal computeSpinEnergy(const tIndex& i,
121  const tIndex& stepIndex,
122  const SM_Network& network,
123  const SM_Material& material,
124  const SM_RealField& S) const final {
125  //begin ietratro oanisotropy direction
126  const tReal *U=&material.getAnisotropyDirections()[0];
127 
128  //end anisotropy direction
129  const tReal *eU=U;
130  eU+=material.getAnisotropyDirections().size();
131 
132  tReal Ei,W;
133  const tReal *iS=&S[i*SM_Constants::DIM];
134  const tReal *eS=iS;eS+=SM_Constants::DIM;
135  computeSpinEnergy(material.getAdimensionizedAnisotropyEnergyFactor(),U,eU,
136  iS,eS,Ei,W);
137  return Ei;
138 
139  }
140 
141 
151  inline void computeSpinEnergy(const tReal &K,const tReal *iU,const tReal *eU,
152  const tReal *iS,const tReal* eS,
153  tReal& Ei,tReal& W) const {
154 
155 
156  computePhi(iU,eU,iS,eS,Ei,W);
157  Ei*=K;
158  }
159 
160 
161 
162  //Total energy computation
163  //========================
164 
165 
166 
177  virtual tReal computeEnergySlice(const tIndex& timeIndex,
178  const SM_Network& network,
179  const SM_Material& material,
180  const tIndex& startIndex,
181  const tIndex& endIndex,
182  const tReal *S) const;
183 
184 
185 
186  //general anisotropy expression
187  //=============================
188 
197  inline void computePhi(const tReal *U,const tReal *eU,
198  const tReal*S,const tReal *eS,
199  tReal& phi,tReal& W) const {
200  return static_cast<const I*>(this)->computePhi(U,eU,S,eS,phi,W);
201  }
202 
214  inline void computePhiDerivatives(const tReal *U,const tReal *eU,
215  const tReal*S,const tReal* eS,
216  tReal& phi,std::array<tReal,SM_Constants::DIM>& gradPhi,
217  tReal& W,tReal& W3) const {
218  return static_cast<const I*>(this)->computePhiDerivatives(U,eU,S,eS,phi,gradPhi,W,W3);
219  }
220 
221 };
222 
223 #include "SM_AnisotropyOperator.hpp"
224 #endif
This class is describes the general anisotropy operatoor.
Definition: SM_AnisotropyOperator.h:32
SM_AnisotropyOperator(void)
create a network class
Definition: SM_AnisotropyOperator.h:43
virtual void computeMagneticFieldSlice(const tIndex &stepIndex, const SM_Network &network, const SM_Material &material, const tIndex &startIndex, const tIndex &endIndex, const tReal *S, const tBoolean &alpha, const tIndex &nH, tReal *H) const
compute the anisotropy magnetic field by virtual method
Definition: SM_AnisotropyOperator.hpp:5
virtual tReal computeSpinEnergy(const tIndex &i, const tIndex &stepIndex, const SM_Network &network, const SM_Material &material, const SM_RealField &S) const final
compute the i-th spin anisotropy energy
Definition: SM_AnisotropyOperator.h:120
void computeSpinEnergy(const tReal &K, const tReal *iU, const tReal *eU, const tReal *iS, const tReal *eS, tReal &Ei, tReal &W) const
compute the anisotropy spin energy
Definition: SM_AnisotropyOperator.h:151
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_AnisotropyOperator.h:75
virtual tReal computeEnergySlice(const tIndex &timeIndex, const SM_Network &network, const SM_Material &material, const tIndex &startIndex, const tIndex &endIndex, const tReal *S) const
compute the energy at time t by virtual method for all particles in [startIndex,endIndex[
Definition: SM_AnisotropyOperator.hpp:93
void computePhiDerivatives(const tReal *U, const tReal *eU, const tReal *S, const tReal *eS, tReal &phi, std::array< tReal, SM_Constants::DIM > &gradPhi, tReal &W, tReal &W3) const
compute the function
Definition: SM_AnisotropyOperator.h:214
void computePhi(const tReal *U, const tReal *eU, const tReal *S, const tReal *eS, tReal &phi, tReal &W) const
compute the function
Definition: SM_AnisotropyOperator.h:197
virtual ~SM_AnisotropyOperator(void)
destroy
Definition: SM_AnisotropyOperator.h:50
static constexpr tDimension DIM
space dimension
Definition: SM_Constants.h:80
This class describes a materials defined by state attributes:
Definition: SM_Material.h:61
This class is describes a network composed by.
Definition: SM_Network.h:66
This class is describes an operator operating on slice of particles of a network SM_Network.
Definition: SM_SliceOperator.h:32
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: SM_SliceOperator.h:97