C++ mpi module for stochmagnet_main Package
SM_DMIOperator.h
1 #ifndef SM_DMIOperator_H
2 #define SM_DMIOperator_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 
53 
54  //attributes
55 private :
56 
57 
58  //association
59 
60 
61 
62 protected:
63  // CONSTRUCTORS
66  SM_DMIOperator(void);
67 
68  // DESTRUCTORS
71  virtual ~SM_DMIOperator(void);
72 
73 public :
74 
75  //Instance building
76  //=================
77 
81  inline static CORE_UniquePointer<SM_DMIOperator> New() {
82  return CORE_UniquePointer<SM_DMIOperator>(new SM_DMIOperator(),SM_DMIOperator::Delete());
83  }
84 
88  virtual CORE_UniquePointer<SM_SliceOperator> NewInstance() const override {
89  return New();
90  }
91 public:
92 
93  //MEMORY
94 
108  virtual tMemSize getMemorySize() const {
109  return sizeof(*this)+getContentsMemorySize();
110  }
111 
112 
113  //Fields computation
114  //==================
115 
131  virtual void computeMagneticFieldSlice(const tIndex& timeIndex,
132  const SM_Network& network,
133  const SM_Material& material,
134  const tIndex& startIndex,
135  const tIndex& endIndex,
136  const tReal *S,
137  const tBoolean& alpha,
138  const tIndex& nH,
139  tReal *H) const;
140 
141 
142  //Spin energy computation
143  //=======================
144 
153  virtual tReal computeSpinEnergy(const tIndex& i,
154  const tIndex& timeIndex,
155  const SM_Network& network,
156  const SM_Material& material,
157  const SM_RealField& S) const final;
158 
168  inline static void ComputeSpinEnergy(const tIndex& nNeighbors,
169  const tIndex* neighboringParticles,
170  const tReal* vD,const tBoolean& incD,
171  const tReal* S,
172  const tReal* Si,
173  tReal& Ei) {
174 
175 
176  Ei=0;
177 
178  //end iterator on index of neighbors
179  const tIndex *eNeighbors=neighboringParticles;
180  eNeighbors+=nNeighbors;
181 
182 
183 
184  //loop on neighbors
185  while (neighboringParticles!=eNeighbors) {
186 
187 
188  //Ei=\sum_j Dij.Si^Sj
189  Ei+=functions_array::mixedProduct<tReal,SM_Constants::DIM>(Si,&S[(*neighboringParticles)*SM_Constants::DIM],vD);
190 
191 
192  //next neighbor
193  neighboringParticles++;
194  vD+=incD*SM_Constants::DIM;
195  }
196 
197 
198  Ei*=-1;
199 
200  }
201 
202  //Total energy computation
203  //========================
204 public:
205 
216  virtual tReal computeEnergySlice(const tIndex& timeIndex,
217  const SM_Network& network,
218  const SM_Material& material,
219  const tIndex& startIndex,
220  const tIndex& endIndex,
221  const tReal *S) const;
222 
223 
224 
225 
226 };
227 
228 
229 #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 anti-symmetric Dzyaloshinskii–Moriya interaction operator.
Definition: SM_DMIOperator.h:52
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_DMIOperator.cpp:10
virtual ~SM_DMIOperator(void)
destroy
Definition: SM_DMIOperator.cpp:7
SM_DMIOperator(void)
create a network class
Definition: SM_DMIOperator.cpp:3
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_DMIOperator.cpp:135
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_DMIOperator.cpp:164
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_DMIOperator.h:108
virtual CORE_UniquePointer< SM_SliceOperator > NewInstance() const override
create a New instance of this
Definition: SM_DMIOperator.h:88
static void ComputeSpinEnergy(const tIndex &nNeighbors, const tIndex *neighboringParticles, const tReal *vD, const tBoolean &incD, const tReal *S, const tReal *Si, tReal &Ei)
computes the exchange energy of a spin i and all its neighboring spins.
Definition: SM_DMIOperator.h:168
static CORE_UniquePointer< SM_DMIOperator > New()
build a new instance of the operator
Definition: SM_DMIOperator.h:81
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