C++ mpi module for stochmagnet_main Package
SM_LinearSliceOperator.h
1 #ifndef SM_LinearSliceOperator_H
2 #define SM_LinearSliceOperator_H
3 
4 //super class header
5 #include "SM_Object.h"
6 
17 class SM_LinearSliceOperator : public virtual SM_Object {
18 
19  //attributes
20 private :
21 
22 
23 protected:
24  // CONSTRUCTORS
28 
29  }
30 
31  // DESTRUCTORS
34  virtual ~SM_LinearSliceOperator(void) {
35  }
36 
37 public :
38 
52  virtual tMemSize getMemorySize() const {
53  return sizeof(*this)+this->getContentsMemorySize();
54  }
55 
68  inline static tReal ComputeEnergy(const SM_Network& network,
69  const SM_Material& material,
70  const tIndex& startIndex,
71  const tIndex& endIndex,
72  const tReal *S,
73  const tInteger& nH,
74  const tReal *H) {
75 
76  tReal E=0;
77  if ((S==null) || (H==null) || (nH==0)) return E;
78 
79  //number of particles of the slice
80  tIndex s=endIndex-startIndex;
81 
82  //H values
83  const tReal *iH=H;
84  if (nH>s) iH+=startIndex*SM_Constants::DIM;
85 
86  //begin iterator on S
87  const tReal *iS=S;iS+=startIndex*SM_Constants::DIM;
88 
89  //end iterator on S
90  const tReal *eS=S;eS+=endIndex*SM_Constants::DIM;
91 
92 
93  while (iS!=eS) {
94  E+=functions_array::scalarProduct<tReal,SM_Constants::DIM>(iS,iH);
97 
98 
99  }
100 
101 
102  E*=-0.5;
103 
104  //adimensionized spin moment
105  E*=material.getAtomicSpinMoment();
106 
107  //material.getAdimensionizedDerivativeEnergyFactor()=
108  // - 1/Mu_B for dimensionized variable
109  // - 1 for adimensionized variable
110  //E*=Mu_B or 1
112 
113  return E;
114  }
115 
116 
117 };
118 
119 
120 #endif
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:278
static constexpr tDimension DIM
space dimension
Definition: SM_Constants.h:80
This class is describes a linear operator interface in a slice of particles of a network.
Definition: SM_LinearSliceOperator.h:17
SM_LinearSliceOperator(void)
create a network class
Definition: SM_LinearSliceOperator.h:27
static tReal ComputeEnergy(const SM_Network &network, const SM_Material &material, const tIndex &startIndex, const tIndex &endIndex, const tReal *S, const tInteger &nH, const tReal *H)
compute the energy by virtual method
Definition: SM_LinearSliceOperator.h:68
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_LinearSliceOperator.h:52
virtual ~SM_LinearSliceOperator(void)
destroy
Definition: SM_LinearSliceOperator.h:34
This class describes a materials defined by state attributes:
Definition: SM_Material.h:61
const tReal & getAtomicSpinMoment() const
get the atomic spin moment in unit of Bohr magneton
Definition: SM_Material.h:242
const tReal & getAdimensionizedDerivativeEnergyFactor() const
get the characteristic dipolar energy factor
Definition: SM_Material.h:401
This class is describes a network composed by.
Definition: SM_Network.h:66
This class is a base class for Stoch Microm package.
Definition: SM_Object.h:36