C++ mpi module for stochmagnet_main Package
SM_MacroCellsExternalDemagnetizedOperator.h
1 #ifndef SM_MacroCellsExternalDemagnetizedOperator_H
2 #define SM_MacroCellsExternalDemagnetizedOperator_H
3 
4 //base classes
5 #include "SM_MacroCellsDemagnetizedOperator.h"
6 
7 
21 
22 
23 public:
24 
25 private :
26 
27  //type class
30 
31  //single attributes
32  //-----------------
33 
34 
35  //number of steps to update demagnetized field
36  tInteger mUpdateDemagnetizedSteps;
37 
38  //multiple attributes
39  //------------------
40 
41  //single associations
42  //-------------------
43 
44 
45 
46  //multiple associations
47  //---------------------
48 
49 
50 
51 protected:
52  // CONSTRUCTORS
56 
57  // DESTRUCTORS
61 
62 public :
63 
64  //Instance building
65  //=================
66 
67 
81  virtual tMemSize getMemorySize() const {
82  return sizeof(*this)+this->getContentsMemorySize();
83  }
84 
93  virtual tMemSize getContentsMemorySize() const {
94  tMemSize mem=SuperClass::getContentsMemorySize();
95  return mem;
96  }
97 public:
98 
99  //New Instance
100 
104  inline static CORE_UniquePointer<SelfClass> New(const CORE_OptionsList& arguments) {
105  return CORE_UniquePointer<SelfClass>(new SelfClass(arguments),
107  }
111  inline static CORE_UniquePointer<SelfClass> New() {
112  CORE_OptionsList arguments;
113  return New(arguments);
114  }
115 
116 
117 
121  virtual CORE_UniquePointer<SM_SliceOperator> NewInstance() const override {
122  CORE_UniquePointer<SelfClass> op=New();
123  op->setMacroCellsNetwork(getMacroCellsNetwork().newInstance());
124  op->setMacroCellsMagnetizationField(getMacroCellsMagnetizationField().newInstance());
125  op->setMacroCellsDemagnetizedField(getMacroCellsDemagnetizedField().newInstance());
126  return std::move(op);
127  }
128 
129 
130 
134  inline void setDemagnetizedUpdatingStepsNumber(const tInteger& n) {
135  mUpdateDemagnetizedSteps=n;
136  }
139  inline const tInteger& getDemagnetizedUpdatingStepsNumber() const {
140  return mUpdateDemagnetizedSteps;
141  }
142 
143 public:
144 
145  //discretize the operator
146  //======================
147 
152  virtual void discretize(const SM_Network& network,
153  const SM_Material& material) final {
154 
155  SuperClass::discretize(network,material);
156 
157 
158  }
159 public:
160  //Fields computation
161  //==================
168  virtual void updateState(const tIndex& timeIndex,
169  const SM_Network& network,
170  const SM_Material& material,
171  const SM_RealField& S) final {
172 
173  if (timeIndex%mUpdateDemagnetizedSteps==0) {
174  SuperClass::updateState(timeIndex,network,material,S);
175  }
176 
177  }
178 
179 
180 
190  virtual tReal computeSpinEnergy(const tIndex& i,
191  const tIndex& timeIndex,
192  const SM_Network& network,
193  const SM_Material& material,
194  const SM_RealField& S) const final;
195 
196 
208  virtual tReal computeEnergySlice(const tIndex& stepIndex,
209  const SM_Network& network,
210  const SM_Material& material,
211  const tIndex& startIndex,
212  const tIndex& endIndex,
213  const tReal *S) const final;
214 
215 
218  virtual tString toString() const final {
219  std::stringstream ret;
220  ret<<SuperClass::toString()<<"\n";
221  ret<<"Hdem update steps:"<< mUpdateDemagnetizedSteps<<"\n";
222  return ret.str();
223  }
224 };
225 
226 
227 #endif
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class is an list of options.
Definition: CORE_OptionsList.h:36
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
SM_MacroCellsDemagnetizedField & getMacroCellsDemagnetizedField()
get the macro cells demagnetized field
Definition: SM_MacroCellsDemagnetizedOperator.h:172
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
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_MacroCellsDemagnetizedOperator.h:117
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
This class describes a demagnetized operator consided as external applied field.
Definition: SM_MacroCellsExternalDemagnetizedOperator.h:20
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_MacroCellsExternalDemagnetizedOperator.h:81
virtual tString toString() const final
return string representaton of the operator
Definition: SM_MacroCellsExternalDemagnetizedOperator.h:218
virtual ~SM_MacroCellsExternalDemagnetizedOperator(void)
destroy
Definition: SM_MacroCellsExternalDemagnetizedOperator.cpp:14
virtual CORE_UniquePointer< SM_SliceOperator > NewInstance() const override
create a New instance of this
Definition: SM_MacroCellsExternalDemagnetizedOperator.h:121
void setDemagnetizedUpdatingStepsNumber(const tInteger &n)
set the number of steps to update demagnetized field
Definition: SM_MacroCellsExternalDemagnetizedOperator.h:134
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_MacroCellsExternalDemagnetizedOperator.h:93
static CORE_UniquePointer< SelfClass > New(const CORE_OptionsList &arguments)
build a new instance of the operator
Definition: SM_MacroCellsExternalDemagnetizedOperator.h:104
virtual void updateState(const tIndex &timeIndex, const SM_Network &network, const SM_Material &material, const SM_RealField &S) final
uopdate the state of the operator at time index
Definition: SM_MacroCellsExternalDemagnetizedOperator.h:168
const tInteger & getDemagnetizedUpdatingStepsNumber() const
get the number of steps to update demagnetized field
Definition: SM_MacroCellsExternalDemagnetizedOperator.h:139
virtual tReal computeEnergySlice(const tIndex &stepIndex, const SM_Network &network, const SM_Material &material, const tIndex &startIndex, const tIndex &endIndex, const tReal *S) const final
compute the energy by virtual method
Definition: SM_MacroCellsExternalDemagnetizedOperator.cpp:60
virtual void discretize(const SM_Network &network, const SM_Material &material) final
discretize the operator on the netowek
Definition: SM_MacroCellsExternalDemagnetizedOperator.h:152
static CORE_UniquePointer< SelfClass > New()
build a new instance of the operator
Definition: SM_MacroCellsExternalDemagnetizedOperator.h:111
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: SM_MacroCellsExternalDemagnetizedOperator.cpp:17
SM_MacroCellsExternalDemagnetizedOperator(const CORE_OptionsList &arguments)
create a network class
Definition: SM_MacroCellsExternalDemagnetizedOperator.cpp:8
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