C++ main module for emicrom Package  1.0
EMMG_SLDemagnetizedOperator.h
Go to the documentation of this file.
1 #ifndef EMMG_SLDemagnetizedOperator_H
2 #define EMMG_SLDemagnetizedOperator_H
3 
4 
6 
7 #include "MATSGN_FFT.h"
8 #include "MATSGN_ComplexArray.h"
9 
10 #include "EMMG_RealField.h"
11 
13 
125 
127  // ATTRIBUTES
128 
129 
130 private:
131 
132  //fftw method
133  SP::MATSGN_FFT mFFT;
135 
136  //size of symmetric matrix at each cell
139 
143 
147 
148 
149  SP::EMMG_SLPeriodicMultiScale mMultiScaleGrid;
150 
151 
152 public:
153 
154 
155  // ASSOCIATION
156 
157 
158 protected:
159 
160  // METHODS
161 
162  // CONSTRUCTORS
163 
167 
168  // DESTRUCTORS
169 
172  virtual ~EMMG_SLDemagnetizedOperator(void);
173 
174 
175 public:
176 
180  inline static SP::EMMG_SLDemagnetizedOperator New() {
181  SP::EMMG_SLDemagnetizedOperator p(new EMMG_SLDemagnetizedOperator(),
183  p->setThis(p);
184  return p;
185  };
186 
187  // SET methods
188  // ===========
189 
190  // GET methods
191  // ===========
195  virtual tULLInt getMemorySize() const {
196  return EMM_MagneticExcitationLinearOperator::getMemorySize()+mWM.getMemorySize()+(mMatrix.getSize()+mFFTarray.getSize()+mHwork.getSize())*sizeof(fftw_complex);
197  }
201  virtual SP::MATSGN_FFT NewFFTInstance() const {
202  return MATSGN_FFT::New();
203  }
204 
205 
209  virtual tUSInt getDataFieldsNumber() const {
210  return 0;
211  }
212 
222  virtual tBoolean getDataFieldSpace(const tUSInt& index,tString& dataName,tFlag& supportType,tString& dFieldType,tUIndex& n,tUSInt& dim) const {
223  return false;
224  }
233  virtual tBoolean getDataField(const tUSInt& index,tString& dataName,tUIndex& n,tUSInt& dim,const float *& values) const {
234  return false;
235  }
244  virtual tBoolean getDataField(const tUSInt& index,tString& dataName,tUIndex& n,tUSInt& dim,const double *& values) const {
245  return false;
246  }
255  virtual tBoolean getDataField(const tUSInt& index,tString& dataName,tUIndex& n,tUSInt& dim,const long double *& values) const {
256  return false;
257 
258  }
259 
264  virtual tBoolean discretize(const EMM_LandauLifschitzSystem& system);
265 
266 private:
268  const tUIndex& Ny,
269  const tUIndex& Nz,
271  void localAssembly(const EMM_IndexArray& iTab,
272  const EMM_IndexArray& jTab,
273  const EMM_IndexArray& kTab,
274  MATSGN_ComplexArray& C_loc2);
275 
276 public:
284  const EMM_RealField& M,
285  EMM_RealField& H) const {
286  const tDimension& dim=M.getDimension();
287  H.setDimension(dim);
288  H.setSize(M.getSize());
289  //verify the type of H
290  const EMMG_RealField *gM=dynamic_cast<const EMMG_RealField *>(&M);
291  if (gM==null) throw EMM_Exception("generic","EMMG_SLDemagnetizedOperator:: computeMagneticExcitationField(..)",
292  "M is an incompatible real field");
293 
294  //verify the type of H
295  EMMG_RealField *gH=dynamic_cast<EMMG_RealField *>(&H);
296  if (gH==null) throw EMM_Exception("generic","EMMG_SLDemagnetizedOperator:: computeMagneticExcitationField(..)",
297  "H is an incompatible real field");
298 
299  if (mMultiScaleGrid.get()==null) {
300  if (sigma.getSize()>1) {
301  computeWeightM(sigma,M,mWM);
302  product(mNx,mNy,mNz,dim,&mWM[0],mFFTmethod,mFFTarray,mHwork,&(*gH)[0]);
303  } else {
304  product(mNx,mNy,mNz,dim,&(*gM)[0],mFFTmethod,mFFTarray,mHwork,&(*gH)[0]);
305  }
306  } else {
307 
308 
309  mMultiScaleGrid->computeMultiGridExcitationField(M.getSize(),dim,&(*gM)[0],&(*gH)[0]);
310  }
311  }
312 
318  inline void dot(const tUSInt& dim,const tReal *M,tReal *H) {
319  product(mNx,mNy,mNz,dim,M,mFFTmethod,mFFTarray,mHwork,H);
320  }
321 
324  virtual tString toString() const;
325 
326 private:
327 
328  void product(const tUInteger& nx,const tUInteger& ny,const tUInteger& nz,
329  const tUSInt& dim,
330  const tReal *M,
331  const tFlag& fftMethod,
332  MATSGN_ComplexArray& fftArray,
333  MATSGN_ComplexArray& Hwork,
334  tReal* H) const;
335 
336  void computeWeightM(const EMM_RealArray& sigma,
337  const EMM_RealField& M,
338  EMM_RealField& weightM) const;
339 
340 };
341 
342 #endif
343 
tUIndex mNz
Definition: EMMG_SLDemagnetizedOperator.h:142
const tUIndex & getSize() const
return the size of the array for reading
Definition: CORE_Array.h:1018
virtual tUIndex getSize() const =0
return the size of the field
virtual tULLInt getMemorySize() const
return the memory size in bytes
Definition: EMMG_SLDemagnetizedOperator.h:195
This class describes a generic real field.
Definition: EMMG_RealField.h:17
This class describes the linear demagnetized operator of the Landau Lifschitz system EMM_LandauLifsch...
Definition: EMM_DemagnetizedOperator.h:81
void computeWeightM(const EMM_RealArray &sigma, const EMM_RealField &M, EMM_RealField &weightM) const
Definition: EMMG_SLDemagnetizedOperator.cpp:956
#define tUInteger
Definition: types.h:91
This class describes FFT complex array based on fft_complex structure.
Definition: MATSGN_ComplexArray.h:16
virtual tString toString() const
return the string representation of the operator
Definition: EMMG_SLDemagnetizedOperator.cpp:1008
tBoolean projectionOnSpectralSpace(const tUIndex &Nx, const tUIndex &Ny, const tUIndex &Nz, MATSGN_ComplexArray &C)
Definition: EMMG_SLDemagnetizedOperator.cpp:616
MATSGN_ComplexArray mMatrix
Definition: EMMG_SLDemagnetizedOperator.h:138
#define tUSInt
Definition: types.h:28
EMMG_RealField mWM
Definition: EMMG_SLDemagnetizedOperator.h:144
virtual tUSInt getDataFieldsNumber() const
get the number of field used in the operator
Definition: EMMG_SLDemagnetizedOperator.h:209
#define tBoolean
Definition: types.h:139
#define null
Definition: types.h:144
#define tDimension
Definition: EMM_Types.h:10
virtual tBoolean getDataField(const tUSInt &index, tString &dataName, tUIndex &n, tUSInt &dim, const float *&values) const
get the data field at index for saving data in vtk,txt,... files.
Definition: EMMG_SLDemagnetizedOperator.h:233
tUSInt mLD
Definition: EMMG_SLDemagnetizedOperator.h:137
const tUIndex & getSize() const
get the size
Definition: MATSGN_ComplexArray.h:385
static SP::EMMG_SLDemagnetizedOperator New()
create a demagnetized operator
Definition: EMMG_SLDemagnetizedOperator.h:180
tUIndex mNx
Definition: EMMG_SLDemagnetizedOperator.h:140
DEFINE_SPTR(EMMG_SLDemagnetizedOperator)
This class describes the linear demagnetized operator of the landau lifschitz system EMM_LandauLifsch...
Definition: EMMG_SLDemagnetizedOperator.h:124
tFlag mFFTmethod
Definition: EMMG_SLDemagnetizedOperator.h:134
virtual void computeMagneticExcitationField(const EMM_RealArray &sigma, const EMM_RealField &M, EMM_RealField &H) const
compute the normalized excitation magnetic field at M
Definition: EMMG_SLDemagnetizedOperator.h:283
This class describes a resolution of landau-lifschitz system of the Core Package for E-MicroM...
Definition: EMM_LandauLifschitzSystem.h:88
virtual tBoolean discretize(const EMM_LandauLifschitzSystem &system)
discretize the operator depending on method
Definition: EMMG_SLDemagnetizedOperator.cpp:26
static SP::MATSGN_FFT New()
create a FFT class
Definition: MATSGN_FFT.h:63
void dot(const tUSInt &dim, const tReal *M, tReal *H)
dot method used in multi scale grid
Definition: EMMG_SLDemagnetizedOperator.h:318
#define tUIndex
Definition: types.h:126
This class describes a real array.
Definition: EMM_RealArray.h:16
virtual tBoolean getDataField(const tUSInt &index, tString &dataName, tUIndex &n, tUSInt &dim, const long double *&values) const
get the data field at index for saving data in vtk,txt,... files.
Definition: EMMG_SLDemagnetizedOperator.h:255
const tDimension & getDimension() const
get the dimension
Definition: EMM_RealField.h:553
EMMG_SLDemagnetizedOperator(void)
create
Definition: EMMG_SLDemagnetizedOperator.cpp:14
virtual SP::MATSGN_FFT NewFFTInstance() const
void create an FFT class for the demagnetized toeplitz matrix computation
Definition: EMMG_SLDemagnetizedOperator.h:201
void localAssembly(const EMM_IndexArray &iTab, const EMM_IndexArray &jTab, const EMM_IndexArray &kTab, MATSGN_ComplexArray &C_loc2)
Definition: EMMG_SLDemagnetizedOperator.cpp:387
#define tString
Definition: types.h:135
SP::EMMG_SLPeriodicMultiScale mMultiScaleGrid
Definition: EMMG_SLDemagnetizedOperator.h:149
SP_OBJECT(EMMG_SLDemagnetizedOperator)
virtual tBoolean getDataField(const tUSInt &index, tString &dataName, tUIndex &n, tUSInt &dim, const double *&values) const
get the data field at index for saving data in vtk,txt,... files.
Definition: EMMG_SLDemagnetizedOperator.h:244
this class describes the exceptions raised for E-MicromM package
Definition: EMM_Exception.h:14
tUIndex mNy
Definition: EMMG_SLDemagnetizedOperator.h:141
void setDimension(const tDimension &d)
set the dimension
Definition: EMM_RealField.h:158
SP::MATSGN_FFT mFFT
Definition: EMMG_SLDemagnetizedOperator.h:133
MATSGN_ComplexArray mHwork
Definition: EMMG_SLDemagnetizedOperator.h:146
#define tULLInt
Definition: types.h:45
This class describes a real field.
Definition: EMM_RealField.h:21
virtual tBoolean getDataFieldSpace(const tUSInt &index, tString &dataName, tFlag &supportType, tString &dFieldType, tUIndex &n, tUSInt &dim) const
get the data field at index for saving data in vtk,txt,... files.
Definition: EMMG_SLDemagnetizedOperator.h:222
void product(const tUInteger &nx, const tUInteger &ny, const tUInteger &nz, const tUSInt &dim, const tReal *M, const tFlag &fftMethod, MATSGN_ComplexArray &fftArray, MATSGN_ComplexArray &Hwork, tReal *H) const
compute ani field Cani*M at each point
Definition: EMMG_SLDemagnetizedOperator.cpp:647
This class describes a general array.
Definition: EMM_Array.h:18
MATSGN_ComplexArray mFFTarray
Definition: EMMG_SLDemagnetizedOperator.h:145
virtual void setSize(const tUIndex &n)=0
set the size
virtual tULLInt getMemorySize() const
return the memory size in bytes
Definition: EMMG_RealField.h:341
#define tReal
Definition: types.h:118
virtual ~EMMG_SLDemagnetizedOperator(void)
destroy
Definition: EMMG_SLDemagnetizedOperator.cpp:22
virtual tULLInt getMemorySize() const
return the memory size in byte
Definition: EMM_Operator.h:71
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141
#define tFlag
Definition: types.h:74