C++ mpi module for stochmagnet_main Package
SM_MacroCellsDemagnetizedOperator.h
1 #ifndef SM_MacroCellDemagnetizedOperator_H
2 #define SM_MacroCellDemagnetizedOperator_H
3 
4 //base classes
5 #include "SM_SliceOperator.h"
6 
7 //macro cell demagnetized field header
8 #include "SM_MacroCellsNetwork.h"
9 #include "SM_MacroCellsMagnetizationField.h"
10 #include "SM_MacroCellsDemagnetizedField.h"
11 
12 
47 
48 
49 public:
50 
51 private :
52 
53  //type class
56 
57  //single attributes
58  //-----------------
59 
60  //multiple attributes
61  //------------------
62 
63  //single associations
64  //-------------------
65 
66  CORE_UniquePointer<SM_MacroCellsNetwork> mMC_Network;
67  CORE_UniquePointer<SM_MacroCellsMagnetizationField> mMC_M;
68  CORE_UniquePointer<SM_MacroCellsDemagnetizedField> mMC_Hdem;
69 
70  //multiple associations
71  //---------------------
72 
73 
74 
75 protected:
76  // CONSTRUCTORS
80 
81  // DESTRUCTORS
85 
86 public :
87 
88  //Instance building
89  //=================
90 
91 
105  virtual tMemSize getMemorySize() const {
106  return sizeof(*this)+this->getContentsMemorySize();
107  }
108 
117  virtual tMemSize getContentsMemorySize() const {
118  tMemSize mem=SuperClass::getContentsMemorySize();
119  mem+=(mMC_Hdem.get()==null)?0:mMC_Hdem->getContentsMemorySize();
120  mem+=(mMC_M.get()==null)?0:mMC_M->getContentsMemorySize();
121  mem+=(mMC_Network.get()==null)?0:mMC_Network->getContentsMemorySize();
122  return mem;
123  }
124 
125  //New instance
126  //===========
127 
128 
129 
130 public:
133  inline void setMacroCellsNetwork(CORE_UniquePointer<SM_MacroCellsNetwork> network) {
134  mMC_Network=std::move(network);
135  }
139  return *mMC_Network.get();
140  }
144  return *mMC_Network.get();
145  }
146 
147 
150  inline void setMacroCellsMagnetizationField(CORE_UniquePointer<SM_MacroCellsMagnetizationField> f) {
151  mMC_M=std::move(f);
152  }
156  return *mMC_M.get();
157  }
161  return *mMC_M.get();
162  }
163 
164 
167  inline void setMacroCellsDemagnetizedField(CORE_UniquePointer<SM_MacroCellsDemagnetizedField> f) {
168  mMC_Hdem=std::move(f);
169  }
173  return *mMC_Hdem.get();
174  }
178  return *mMC_Hdem.get();
179  }
180 
181 
182 
183 
184 public:
185 
186  //discretize the operator
187  //======================
188 
197  virtual void discretize(const SM_Network& network,
198  const SM_Material& material) override;
199 public:
200  //Fields computation
201  //==================
208  virtual void updateState(const tIndex& timeIndex,
209  const SM_Network& network,
210  const SM_Material& material,
211  const SM_RealField& S) override;
212 
213 
229  virtual void computeMagneticFieldSlice(const tIndex& timeIndex,
230  const SM_Network& network,
231  const SM_Material& material,
232  const tIndex& startIndex,
233  const tIndex& endIndex,
234  const tReal *S,
235  const tBoolean& alpha,
236  const tIndex& nH,
237  tReal *H) const final ;
238 
248  virtual tReal computeSpinEnergy(const tIndex& i,
249  const tIndex& timeIndex,
250  const SM_Network& network,
251  const SM_Material& material,
252  const SM_RealField& S) const override;
253 
254 
266  virtual tReal computeEnergySlice(const tIndex& stepIndex,
267  const SM_Network& network,
268  const SM_Material& material,
269  const tIndex& startIndex,
270  const tIndex& endIndex,
271  const tReal *S) const override;
272 
273 
276  virtual tString toString() const override {
277  std::stringstream ret;
278  ret<<SuperClass::toString()<<"\n";
279  ret<<"MCs network:"<<mMC_Network->toString()<<"\n";
280  ret<<"MCs M:"<<mMC_M->toString()<<"\n";
281  ret<<"MCs Hdem:"<<mMC_Hdem->toString()<<"\n";
282  return ret.str();
283  }
284 
285 };
286 
287 
288 #endif
This class is an list of options.
Definition: CORE_OptionsList.h:36
This class is describes a demagnetized operator.
Definition: SM_MacroCellsDemagnetizedField.h:50
This class is describes a demagnetized operator.
Definition: SM_MacroCellsDemagnetizedOperator.h:46
SM_MacroCellsMagnetizationField & getMacroCellsMagnetizationField()
get the macro cells Magnetization field
Definition: SM_MacroCellsDemagnetizedOperator.h:155
const SM_MacroCellsNetwork & getMacroCellsNetwork() const
get the macro cell network
Definition: SM_MacroCellsDemagnetizedOperator.h:143
const SM_MacroCellsMagnetizationField & getMacroCellsMagnetizationField() const
get the macro cells Magnetization field
Definition: SM_MacroCellsDemagnetizedOperator.h:160
SM_MacroCellsDemagnetizedField & getMacroCellsDemagnetizedField()
get the macro cells demagnetized field
Definition: SM_MacroCellsDemagnetizedOperator.h:172
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_MacroCellsDemagnetizedOperator.h:105
SM_MacroCellsNetwork & getMacroCellsNetwork()
get the macro cell network
Definition: SM_MacroCellsDemagnetizedOperator.h:138
virtual void updateState(const tIndex &timeIndex, const SM_Network &network, const SM_Material &material, const SM_RealField &S) override
uodate the state of the operator at time index
Definition: SM_MacroCellsDemagnetizedOperator.cpp:55
void setMacroCellsMagnetizationField(CORE_UniquePointer< SM_MacroCellsMagnetizationField > f)
set the macro cell Magnetization field
Definition: SM_MacroCellsDemagnetizedOperator.h:150
virtual tReal computeEnergySlice(const tIndex &stepIndex, const SM_Network &network, const SM_Material &material, const tIndex &startIndex, const tIndex &endIndex, const tReal *S) const override
compute the energy by virtual method
Definition: SM_MacroCellsDemagnetizedOperator.cpp:197
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_MacroCellsDemagnetizedOperator.h:117
const SM_MacroCellsDemagnetizedField & getMacroCellsDemagnetizedField() const
get the macro cells demagnetized field
Definition: SM_MacroCellsDemagnetizedOperator.h:177
virtual tReal computeSpinEnergy(const tIndex &i, const tIndex &timeIndex, const SM_Network &network, const SM_Material &material, const SM_RealField &S) const override
compute the spin energy by virtual method
Definition: SM_MacroCellsDemagnetizedOperator.cpp:155
SM_MacroCellsDemagnetizedOperator(const CORE_OptionsList &arguments)
create a network class
Definition: SM_MacroCellsDemagnetizedOperator.cpp:9
void setMacroCellsDemagnetizedField(CORE_UniquePointer< SM_MacroCellsDemagnetizedField > f)
set the macro cell demagnetized field
Definition: SM_MacroCellsDemagnetizedOperator.h:167
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: SM_MacroCellsDemagnetizedOperator.cpp:66
void setMacroCellsNetwork(CORE_UniquePointer< SM_MacroCellsNetwork > network)
set the macro cell network
Definition: SM_MacroCellsDemagnetizedOperator.h:133
virtual void discretize(const SM_Network &network, const SM_Material &material) override
discretize the operator on the netowek
Definition: SM_MacroCellsDemagnetizedOperator.cpp:37
virtual tString toString() const override
return string representaton of the operator
Definition: SM_MacroCellsDemagnetizedOperator.h:276
virtual ~SM_MacroCellsDemagnetizedOperator(void)
destroy
Definition: SM_MacroCellsDemagnetizedOperator.cpp:34
This class is describes a Magnetization field.
Definition: SM_MacroCellsMagnetizationField.h:23
This class is describes a macro cell network.
Definition: SM_MacroCellsNetwork.h:25
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 tString toString() const override
return string representaton of the operator
Definition: SM_SliceOperator.h:227
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: SM_SliceOperator.h:97