C++ mpi module for stochmagnet_main Package
SM_HeisenbergOperator.h
1 #ifndef SM_HeisenbergOperator_H
2 #define SM_HeisenbergOperator_H
3 
4 //base classes
5 #include "SM_SliceOperator.h"
6 #include "SM_LinearSliceOperator.h"
7 
8 //network class
9 #include "SM_Network.h"
10 
11 
52 
53  //attributes
54 private :
55 
56 
57  //association
58 
59 
60 
61 protected:
62  // CONSTRUCTORS
65  SM_HeisenbergOperator(void);
66 
67  // DESTRUCTORS
70  virtual ~SM_HeisenbergOperator(void);
71 
72 public :
73 
74  //Instance building
75  //=================
76 
80  inline static CORE_UniquePointer<SM_HeisenbergOperator> New() {
81  return CORE_UniquePointer<SM_HeisenbergOperator>(new SM_HeisenbergOperator(),SM_HeisenbergOperator::Delete());
82  }
83 
87  virtual CORE_UniquePointer<SM_SliceOperator> NewInstance() const override {
88  return New();
89  }
90 public:
91 
92  //MEMORY
93 
107  virtual tMemSize getMemorySize() const {
108  return sizeof(*this)+getContentsMemorySize();
109  }
110 
111 
112  //Fields computation
113  //==================
114 
130  virtual void computeMagneticFieldSlice(const tIndex& timeIndex,
131  const SM_Network& network,
132  const SM_Material& material,
133  const tIndex& startIndex,
134  const tIndex& endIndex,
135  const tReal *S,
136  const tBoolean& alpha,
137  const tIndex& nH,
138  tReal *H) const;
139 
140 
141  //Spin energy computation
142  //=======================
143 
152  virtual tReal computeSpinEnergy(const tIndex& i,
153  const tIndex& timeIndex,
154  const SM_Network& network,
155  const SM_Material& material,
156  const SM_RealField& S) const final;
157 
167  inline static void ComputeSpinEnergy(const tIndex& nNeighbors,
168  const tIndex* neighboringParticles,
169  const tReal* vJ,const tBoolean& incJ,
170  const tReal* S,
171  const tReal* Si,
172  tReal& Ei) {
173 
174  Ei=0;
175 
176  //end iterator on index of neighbors
177  const tIndex *eNeighbors=neighboringParticles;
178  eNeighbors+=nNeighbors;
179 
180  //loop on neighbors
181  while (neighboringParticles!=eNeighbors) {
182 
183 
184  //Ei=\sum_j Jij.<Si,Sj>
185  Ei+=(*vJ)*functions_array::scalarProduct<tReal,SM_Constants::DIM>(Si,
186  &S[(*neighboringParticles)*SM_Constants::DIM]);
187 
188 
189  //next neighbor
190  neighboringParticles++;
191  vJ+=incJ;
192  }
193 
194 
195  Ei*=-1;
196 
197  }
198 
199  //Total energy computation
200  //========================
201 public:
202 
213  virtual tReal computeEnergySlice(const tIndex& timeIndex,
214  const SM_Network& network,
215  const SM_Material& material,
216  const tIndex& startIndex,
217  const tIndex& endIndex,
218  const tReal *S) const;
219 
220 
221 
222 
223 };
224 
225 
226 #endif
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
static constexpr tDimension DIM
space dimension
Definition: SM_Constants.h:80
This class is describes the exchange operator.
Definition: SM_HeisenbergOperator.h:51
virtual CORE_UniquePointer< SM_SliceOperator > NewInstance() const override
create a New instance of this
Definition: SM_HeisenbergOperator.h:87
virtual void computeMagneticFieldSlice(const tIndex &timeIndex, 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_HeisenbergOperator.cpp:10
static void ComputeSpinEnergy(const tIndex &nNeighbors, const tIndex *neighboringParticles, const tReal *vJ, const tBoolean &incJ, const tReal *S, const tReal *Si, tReal &Ei)
computes the exchange energy of a spin i and all its neighboring spins.
Definition: SM_HeisenbergOperator.h:167
static CORE_UniquePointer< SM_HeisenbergOperator > New()
build a new instance of the operator
Definition: SM_HeisenbergOperator.h:80
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_HeisenbergOperator.h:107
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_HeisenbergOperator.cpp:207
SM_HeisenbergOperator(void)
create a network class
Definition: SM_HeisenbergOperator.cpp:3
virtual ~SM_HeisenbergOperator(void)
destroy
Definition: SM_HeisenbergOperator.cpp:7
virtual tReal computeSpinEnergy(const tIndex &i, const tIndex &timeIndex, const SM_Network &network, const SM_Material &material, const SM_RealField &S) const final
compute the i-th spin heisenberg energy
Definition: SM_HeisenbergOperator.cpp:171
This class is describes a linear operator interface in a slice of particles of a network.
Definition: SM_LinearSliceOperator.h:17
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