C++ mpi module for stochmagnet_main Package
SMOMPI_DipolarOperator.h
1 #ifndef SMOMPI_DipolarOperator_H
2 #define SMOMPI_DipolarOperator_H
3 
4 //base classes
5 #include "SM_DipolarOperator.h"
6 
7 //MPI environment
8 #include "MPI_Run.h"
9 #include "MPI_Environment.h"
10 //#include "MPI_WorldToWorldMessage.h"
11 #include "MPI_CoreToCoreIMessage.h"
12 
22 
23 
24 private :
25 
26  //type class
29 
30  //attributes
31 
32  static constexpr tMPITag TAG_P=0;
33  static constexpr tMPITag TAG_S=1;
34  static constexpr tMPITag TAG_H=2;
35 
36  mutable std::valarray<tReal> mPc;//particles points P of network at core c
37  mutable std::valarray<tReal> mSc;//S at points P of network at core c
38 
39 protected:
40  // CONSTRUCTORS
44 
45  }
46 
47  // DESTRUCTORS
50  virtual ~SMOMPI_DipolarOperator(void) {
51  }
52 
53 
54 public :
55 
56  //Instance building
57  //=================
58 
62  inline static CORE_UniquePointer<SelfClass> New() {
63  return CORE_UniquePointer<SelfClass>(new SelfClass(),
65  }
66 
70  virtual CORE_UniquePointer<SM_SliceOperator> NewInstance() const override {
71  return New();
72  }
73 
74 
88  virtual tMemSize getMemorySize() const {
89  return sizeof(*this)+this->getContentsMemorySize();
90  }
91 
100  virtual tMemSize getContentsMemorySize() const {
101  tMemSize mem=SuperClass::getContentsMemorySize();
102  return mem;
103  }
104 public:
105 
106 
107  //discretize the operator
108  //=======================
109 
110 
111 protected:
112 
113 
114  //Fields computation
115  //==================
116 public:
117 
118 
119 
134  virtual void computeMagneticFieldSlice(const tIndex& timeIndex,
135  const SM_Network& network,
136  const SM_Material& material,
137  const tIndex& startIndex,
138  const tIndex& endIndex,
139  const tReal *S,
140  const tBoolean& alpha,
141  const tIndex& nH,
142  tReal *H) const final {
143  computeMagneticFieldAtNetwork(material,network,S,network,alpha,nH,H);
144  }
145 
158  void computeMagneticFieldAtNetwork(const SM_Material& material,
159  const SM_Network& networkP,
160  const tReal *S_P,
161  const SM_Network& networkX,
162  const tBoolean& alpha,
163  const tInteger& nH,
164  tReal *H) const ;
165 
166  //Spin energy computation
167  //=======================
168 
178  virtual tReal computeSpinEnergy(const tIndex& i,
179  const tIndex& timeIndex,
180  const SM_Network& network,
181  const SM_Material& material,
182  const SM_RealField& S) const final;
183 
184 
185  //Total energy computation
186  //========================
187 public:
188 
189 
200  virtual tReal computeEnergySlice(const tIndex& timeIndex,
201  const SM_Network& network,
202  const SM_Material& material,
203  const tIndex& startIndex,
204  const tIndex& endIndex,
205  const tReal *S) const final;
206 
207 };
208 
209 
210 #endif
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class is describes a SMOMPI implementation of dipolar operator.
Definition: SMOMPI_DipolarOperator.h:21
virtual ~SMOMPI_DipolarOperator(void)
destroy
Definition: SMOMPI_DipolarOperator.h:50
void computeMagneticFieldAtNetwork(const SM_Material &material, const SM_Network &networkP, const tReal *S_P, const SM_Network &networkX, const tBoolean &alpha, const tInteger &nH, tReal *H) const
compute the anisotropy magnetic field by virtual method
Definition: SMOMPI_DipolarOperator.cpp:5
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 spin energy by virtual method
Definition: SMOMPI_DipolarOperator.cpp:126
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SMOMPI_DipolarOperator.h:88
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 final
compute the anisotropy magnetic field by virtual method
Definition: SMOMPI_DipolarOperator.h:134
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SMOMPI_DipolarOperator.h:100
SMOMPI_DipolarOperator(void)
create a network class
Definition: SMOMPI_DipolarOperator.h:43
virtual CORE_UniquePointer< SM_SliceOperator > NewInstance() const override
create a New instance of this
Definition: SMOMPI_DipolarOperator.h:70
virtual tReal computeEnergySlice(const tIndex &timeIndex, const SM_Network &network, const SM_Material &material, const tIndex &startIndex, const tIndex &endIndex, const tReal *S) const final
compute the energy at time t by virtual method for all particles in [startIndex,endIndex[
Definition: SMOMPI_DipolarOperator.cpp:251
static CORE_UniquePointer< SelfClass > New()
build a new instance of the operator
Definition: SMOMPI_DipolarOperator.h:62
This class is describes a demagnetized operator.
Definition: SM_DipolarOperator.h:44
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_DipolarOperator.h:107
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