C++ main module for emicrom Package  1.0
EMM_ZeemanOperator.h
Go to the documentation of this file.
1 #ifndef EMM_ZeemanOperator_H
2 #define EMM_ZeemanOperator_H
3 
5 
6 
26 
28  // ATTRIBUTES
29 
30 
31 private:
32 
33 
34 
35 public:
36 
37 
38  // ASSOCIATION
39 
40 private:
41 
42  SP::EMM_RealField mHext;
43 
44  //initialization data file
46  SP::EMM_RealField mInitialData;
47 
48 protected:
49 
50  // METHODS
51 
52  // CONSTRUCTORS
53 
56  EMM_ZeemanOperator(void);
57 
58  // DESTRUCTORS
59 
62  virtual ~EMM_ZeemanOperator(void);
63 
64 
65 public:
68  inline static SP::EMM_ZeemanOperator New() {
69  SP::EMM_ZeemanOperator p(new EMM_ZeemanOperator(),
71  p->setThis(p);
72  return p;
73  };
74 
78  virtual tBoolean isAffine() const {
79  return true;
80  };
85  return true;
86  };
87 
91  inline void setInitialMagneticExcitation(const tString& dataFile) {
92  mInitialDataFile=dataFile;
93  }
97  inline void setInitialMagneticExcitation(const tReal data[3]) {
98  mInitialData->setSize(1);
99  EMM_RealField &H=*mInitialData.get();
100  H.setValue(0,data);
101  mInitialDataFile="";
102  }
107  inline void setInitialMagneticExcitation(const CORE_RealArray& data) {
109  }
113  inline void setInitialMagneticExcitation(const EMM_RealField& data) {
114  mInitialData->copy(data);
115  mInitialDataFile="";
116  }
117 
118 private:
124  if (Hext.getSize()==0) {
125  mHext->initField(0.,0.,0.);
126  }
127  else {
128  mHext->copy(Hext);
129  }
130  }
135  inline void setExternalMagneticExcitationField(const tReal H[3]) {
136  mHext->setSize(1);
137  mHext->initField(H[0],H[1],H[2]);
138 
139  }
140 
146  return mHext->loadFromFile(HextFile);
147  }
148 
149 public:
153  tBoolean isNull() const {
154  tUIndex index;
155  return (mHext->normMax(index)<1.e-12);
156  }
157 
158 
159  //FIELDS methods
160  //================
161 
173  const tFlag& order,
174  const EMM_RealArray& sigma,
175  const EMM_RealField& dM_dt0,
176  const EMM_RealField& M0) {
177  return true;
178  }
179 
189  const EMM_RealArray& sigma,
190  const EMM_RealField& dM_dt0,
191  const EMM_RealField& M0) {
192  return true;
193  }
203  const EMM_RealArray& sigma,
204  const EMM_RealField& Mt) {
205  return true;
206  }
207 
211  virtual tUSInt getDataFieldsNumber() const {
212  return 1;
213  }
214 
224  virtual tBoolean getDataFieldSpace(const tUSInt& index,tString& dataName,tFlag& supportType,tString& dFieldType,tUIndex& n,tDimension& dim) const {
225  if (index>1) return false;
226 
227  dataName="Hext";
228  supportType=EMM_Grid3D::ELEMENT;
229  n=mHext->getSize();
230  dim=3;
231  dFieldType=mHext->getTypeToString();
232  return true;
233  }
242  virtual tBoolean getDataField(const tUSInt& index,tString& dataName,tUIndex& n,tDimension& dim,const float *& values) const {
243  if (index>1) return false;
244  dataName="Hext";
245  dim=mHext->getDimension();
246  tBoolean succeeds=mHext->getValues(n,values);
247  n/=dim;
248  return succeeds;
249  }
258  virtual tBoolean getDataField(const tUSInt& index,tString& dataName,tUIndex& n,tDimension& dim,const double *& values) const {
259  if (index>1) return false;
260  dataName="Hext";
261  dim=mHext->getDimension();
262  tBoolean succeeds=mHext->getValues(n,values);
263  n/=dim;
264  return succeeds;
265 
266  }
275  virtual tBoolean getDataField(const tUSInt& index,tString& dataName,tUIndex& n,tDimension& dim,const long double *& values) const {
276  if (index>1) return false;
277  dataName="Hext";
278  dim=mHext->getDimension();
279  tBoolean succeeds=mHext->getValues(n,values);
280  n/=dim;
281  return succeeds;
282 
283  }
284 
285 
286  //DATA methods
287  //============
288 
296  virtual tBoolean discretize(const EMM_LandauLifschitzSystem& system);
297 
298 
306 
307 
308  //MAGNETIC Excitation methods
309  //==========================
310 
311 
319  const EMM_RealField& M,
320  EMM_RealField& H) const {
321 
322  H.copy(*mHext.get());
323  }
324 
334  const EMM_RealField& M,
335  const EMM_RealField& D,
336  EMM_RealField& gradH) const {
337  return false;
338  }
339 
340 
341 
342  //ENERGY methods
343  //===============
344 
345 
346 protected:
365  const EMM_RealArray& sigma,
366  const EMM_RealField& Mt,
367  const EMM_RealField& Ht) const {
368  return -2*getElementVolume()*Mt.dot(sigma,*mHext.get());
369  }
370 
371 
372 public:
373 
386  virtual tReal computeEnergy(const tReal& t,
387  const EMM_RealArray& sigma,
388  const EMM_RealField& Mt,
389  EMM_RealField& W) const {
390  return -2*getElementVolume()*Mt.dot(sigma,*mHext.get());
391  }
392 
393 };
394 
395 #endif
396 
virtual tBoolean getDataFieldSpace(const tUSInt &index, tString &dataName, tFlag &supportType, tString &dFieldType, tUIndex &n, tDimension &dim) const
get the data field at index for saving data in vtk,txt,... files.
Definition: EMM_ZeemanOperator.h:224
virtual tBoolean updateAtNextTimeStep(const tReal &dt, const EMM_RealArray &sigma, const EMM_RealField &Mt)
update the data of operator at next time step
Definition: EMM_ZeemanOperator.h:202
virtual tUIndex getSize() const =0
return the size of the field
void setInitialMagneticExcitation(const tReal data[3])
set the initialization data for external magnetic excitation field
Definition: EMM_ZeemanOperator.h:97
void setInitialMagneticExcitation(const tString &dataFile)
set the initialization data for external magnetic excitation field
Definition: EMM_ZeemanOperator.h:91
virtual tBoolean resetToInitialState(const EMM_LandauLifschitzSystem &system)
initialize the operator
Definition: EMM_ZeemanOperator.cpp:46
virtual tBoolean computeMagneticExcitationFieldGradient(const EMM_RealArray &sigma, const EMM_RealField &M, const EMM_RealField &D, EMM_RealField &gradH) const
compute the gradient of the magnetic excitation field at M in the direction D
Definition: EMM_ZeemanOperator.h:333
const tReal & getElementVolume() const
return the adimensionized volume of the element
Definition: EMM_Operator.h:110
virtual tUSInt getDataFieldsNumber() const
get the number of field used in the operator
Definition: EMM_ZeemanOperator.h:211
T & get(const tUIndex &i)
get the value of the array at index i
Definition: CORE_Array.h:555
virtual ~EMM_ZeemanOperator(void)
destroy
Definition: EMM_ZeemanOperator.cpp:29
#define tUSInt
Definition: types.h:28
virtual tBoolean isGradientComputationable() const
return true if the gradient of the magnetic excitation is computationable
Definition: EMM_ZeemanOperator.h:84
#define tBoolean
Definition: types.h:139
virtual tBoolean computeFieldsAtTime(const tReal &t, const tFlag &order, const EMM_RealArray &sigma, const EMM_RealField &dM_dt0, const EMM_RealField &M0)
compute the fields of operator at time
Definition: EMM_ZeemanOperator.h:172
void setExternalMagneticExcitationField(const tReal H[3])
set the normalized external magnetic excitation not necessary normed
Definition: EMM_ZeemanOperator.h:135
virtual tReal computeEnergyWithMagneticExcitation(const tReal &t, const EMM_RealArray &sigma, const EMM_RealField &Mt, const EMM_RealField &Ht) const
compute the energy E of the operator
Definition: EMM_ZeemanOperator.h:364
static const tFlag ELEMENT
Definition: EMM_Grid3D.h:69
#define tDimension
Definition: EMM_Types.h:10
tBoolean isNull() const
return true if zeeman is null
Definition: EMM_ZeemanOperator.h:153
SP::EMM_RealField mInitialData
Definition: EMM_ZeemanOperator.h:46
void setInitialMagneticExcitation(const EMM_RealField &data)
set initial data for external magnetic excitation field
Definition: EMM_ZeemanOperator.h:113
void setExternalMagneticExcitationField(const EMM_RealField &Hext)
set the normalized external magnetic excitation not necessary normed
Definition: EMM_ZeemanOperator.h:123
virtual tBoolean discretize(const EMM_LandauLifschitzSystem &system)
discretize the operator
Definition: EMM_ZeemanOperator.cpp:31
void setInitialMagneticExcitation(const CORE_RealArray &data)
set the initialization data for external magnetic excitation field
Definition: EMM_ZeemanOperator.h:107
EMM_ZeemanOperator(void)
create
Definition: EMM_ZeemanOperator.cpp:6
virtual tReal dot(const EMM_RealField &F) const
compute the scalar product
Definition: EMM_RealField.h:315
virtual tReal computeEnergy(const tReal &t, const EMM_RealArray &sigma, const EMM_RealField &Mt, EMM_RealField &W) const
compute the energy E of the operator
Definition: EMM_ZeemanOperator.h:386
SP::EMM_RealField mHext
Definition: EMM_ZeemanOperator.h:42
DEFINE_SPTR(EMM_ZeemanOperator)
virtual tBoolean isAffine() const
return true if the operator is either constant or linear
Definition: EMM_ZeemanOperator.h:78
This class describes a resolution of landau-lifschitz system of the Core Package for E-MicroM...
Definition: EMM_LandauLifschitzSystem.h:88
#define tUIndex
Definition: types.h:126
This class describes a real array.
Definition: EMM_RealArray.h:16
virtual void copy(const EMM_RealField &f)=0
copy the real vector
#define tString
Definition: types.h:135
void setValue(const tUIndex &i, const tDimension &k, const tReal &v)
set the value at point i and for coordinate k
Definition: EMM_RealField.h:253
virtual tBoolean computeFieldsAtNextTimeStep(const tReal &dt, const EMM_RealArray &sigma, const EMM_RealField &dM_dt0, const EMM_RealField &M0)
compute the fields of operator at next time step
Definition: EMM_ZeemanOperator.h:188
SP_OBJECT(EMM_ZeemanOperator)
virtual tBoolean getDataField(const tUSInt &index, tString &dataName, tUIndex &n, tDimension &dim, const double *&values) const
get the data field at index for saving data in vtk,txt,... files.
Definition: EMM_ZeemanOperator.h:258
tBoolean setExternalMagneticExcitationField(const tString &HextFile)
set the normalized external magnetic excitation not necessary normed
Definition: EMM_ZeemanOperator.h:145
tString mInitialDataFile
Definition: EMM_ZeemanOperator.h:45
This class describes the Zeeman operator which is the exterior excitation magnetic field from the E-M...
Definition: EMM_ZeemanOperator.h:25
This class is an operator of a E-MicromM package wich compute a magnetic excitation operator...
Definition: EMM_MagneticExcitationOperator.h:15
This class describes a real field.
Definition: EMM_RealField.h:21
virtual tBoolean getDataField(const tUSInt &index, tString &dataName, tUIndex &n, tDimension &dim, const float *&values) const
get the data field at index for saving data in vtk,txt,... files.
Definition: EMM_ZeemanOperator.h:242
#define tReal
Definition: types.h:118
static SP::EMM_ZeemanOperator New()
create a geometry class
Definition: EMM_ZeemanOperator.h:68
virtual void computeMagneticExcitationField(const EMM_RealArray &sigma, const EMM_RealField &M, EMM_RealField &H) const
compute the normalized excitation magnetic field at M for reading
Definition: EMM_ZeemanOperator.h:318
virtual tBoolean getDataField(const tUSInt &index, tString &dataName, tUIndex &n, tDimension &dim, const long double *&values) const
get the data field at index for saving data in vtk,txt,... files.
Definition: EMM_ZeemanOperator.h:275
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141
#define tFlag
Definition: types.h:74