C++ main module for emicrom Package  1.0
EMM_MultiScaleGrid.h
Go to the documentation of this file.
1 #ifndef EMM_MultiScaleGrid_H
2 #define EMM_MultiScaleGrid_H
3 
4 #include "EMM_Object.h"
5 #include "EMM_Array.h"
6 #include "EMM_RealField.h"
8 
9 
62 class EMM_MultiScaleGrid : public virtual EMM_Object {
63 
65  // ATTRIBUTES
66 
67 public:
69 
70 private:
71 
72  //dicretization of the grid
74 
75  //periodicity of the grid
77 
78 
79 
80 
81  // the associated toeplitz matrix common for all grids
82  SP::MATH_MultiLevelsToeplitzMatrix mToeplitzMatrix;
83 
84  //levels nuumber
86 
87  //working array M at level l+1 and at level l
88  SP::EMM_RealField mMlp1,mMl;
89 
90  //working M on field z
91  SP::EMM_RealField mMz;
92 
93  //number of cells of the fine grid into the coarse grid
95 
96  //number of calls of level computation
98 
99 
100 
101 public:
102  // METHODS
103 
104  // CONSTRUCTORS
105 
108  EMM_MultiScaleGrid(void);
109 
110  // DESTRUCTORS
111 
114  virtual ~EMM_MultiScaleGrid(void);
115 
116 
117 public:
118 
119 
120 
121  // SET methods
122 public:
123 
124 
128  inline void setToeplitzMatrix(SP::MATH_MultiLevelsToeplitzMatrix toeplitz) {
129  mToeplitzMatrix=toeplitz;
130  }
131 
132 
133 
134 
150  const tUInteger& Ny,
151  const tUInteger& Nz,
152  const tBoolean & isXPeriodic,
153  const tBoolean & isYPeriodic,
154  const tBoolean & isZPeriodic) const;
155 
169  virtual void initialize(const tDimension& dim,
170  const tUInteger& Nx,
171  const tUInteger& Ny,
172  const tUInteger& Nz,
173  const tBoolean& Px,
174  const tBoolean& Py,
175  const tBoolean& Pz,
176  const tUInteger& l);
177 
183  }
184 
190  inline void getSegmentsNumber(tUInteger& Nx,tUInteger& Ny,tUInteger& Nz) const {
191  Nx=mN[0];
192  Ny=mN[1];
193  Nz=mN[2];
194  }
198  inline const tUInteger* getSegmentsNumber() const {
199  return mN;
200  }
201 
205  inline const tBoolean* getPeriodicDirections() const {
206  return mIsPeriodic;
207 
208  }
214  inline void getPeriodicDirections(tBoolean& isXPeriodic,
215  tBoolean& isYPeriodic,
216  tBoolean& isZPeriodic) const {
217  isXPeriodic=mIsPeriodic[0];
218  isYPeriodic=mIsPeriodic[1];
219  isZPeriodic=mIsPeriodic[2];
220 
221  }
222 
223 
224 
228  inline const tUInteger& getLevelsNumber() const {
229  return mLevelsNumber;
230  }
231 
232 
237  return *mToeplitzMatrix.get();
238  }
239 
244  return *mMl.get();
245  }
250  return *mMlp1.get();
251  }
256  return *mMz.get();
257  }
258 
259 
277  static tBoolean resetBlockValues(const tDimension& dim,
278  const tUInteger& Nx,const tUInteger& Ny,const tUInteger& Nz,
279  const tUInteger& iMin,const tUInteger& iMax,
280  const tUInteger& jMin,const tUInteger& jMax,
281  const tUInteger& kMin,const tUInteger& kMax,
282  tReal* M);
283 
284 
285 
286 
320  virtual void computeMultiGridExcitationField(const tUIndex& nCells,
321  const tDimension& dim,
322  const tReal* sigmaM,
323  tReal * H);
324 
325 
326 protected:
327 
342  const tUIndex& nCells,
343  const tDimension& dim,
344  const tReal* Ml,
345  tReal *Mz,
346  tReal *Mlp1,
347  tReal *H0) const=0;
348 
360  virtual void computeZonalCenteredDemagnetizedFieldFromLevel(const tUInteger& twoPowerL,
361  const tUIndex& nCells,
362  const tDimension& dim,
363  tReal* Ml,
364  tReal *Mz,
365  tReal *H0) const=0;
366 
367 
368 
369 protected:
375  }
379  inline const tUInteger& getLevelComputationsNumber() const {
381  }
382 
383 public:
384 
385  //OTHER methods
386 
389  virtual tString toString() const;
390 
391 };
392 
393 #endif
EMM_RealField & getLevelMagnetizationField()
get the magnetization field at level l
Definition: EMM_MultiScaleGrid.h:243
virtual void computeZonalDemagnetizedFieldAndNextLevelMagnetizationField(const tUInteger &twoPowerL, const tUIndex &nCells, const tDimension &dim, const tReal *Ml, tReal *Mz, tReal *Mlp1, tReal *H0) const =0
compute the zonal demagnetized field added to demagnetized field at level 0 and compute the magnetiza...
This class is a base class of E-MicromM core package.
Definition: EMM_Object.h:21
tBoolean mIsPeriodic[3]
Definition: EMM_MultiScaleGrid.h:76
EMM_RealField & getZonalMagnetizationField()
get the magnetization field at zone
Definition: EMM_MultiScaleGrid.h:255
tUCInt mFineElementsNumberPerCoarseElement
Definition: EMM_MultiScaleGrid.h:94
tUInteger mLevelComputationsNumber
Definition: EMM_MultiScaleGrid.h:97
This class describes the building of fields on multiscale grid initialized by the initialize() method...
Definition: EMM_MultiScaleGrid.h:62
const tUInteger * getSegmentsNumber() const
get the segments number per dierction
Definition: EMM_MultiScaleGrid.h:198
#define tUInteger
Definition: types.h:91
const tBoolean * getPeriodicDirections() const
get the periodicity per direction
Definition: EMM_MultiScaleGrid.h:205
SP::EMM_RealField mMz
Definition: EMM_MultiScaleGrid.h:91
This class is multi levels toeplitz matrix. The matrix at level k is composed by toeplitz block matr...
Definition: MATH_MultiLevelsToeplitzMatrix.h:57
virtual void computeMultiGridExcitationField(const tUIndex &nCells, const tDimension &dim, const tReal *sigmaM, tReal *H)
compute the magnetic excitation field by superposition of multi scale grids
Definition: EMM_MultiScaleGrid.cpp:294
#define tUCInt
Definition: types.h:21
#define tBoolean
Definition: types.h:139
EMM_RealField & getLevelUpMagnetizationField()
get the magnetization field at level l+1
Definition: EMM_MultiScaleGrid.h:249
DEFINE_SPTR(EMM_MultiScaleGrid)
#define tDimension
Definition: EMM_Types.h:10
SP::EMM_RealField mMl
Definition: EMM_MultiScaleGrid.h:88
tUInteger & getLevelComputationsNumber()
return the number of calls of the level computations only for debug
Definition: EMM_MultiScaleGrid.h:373
tUInteger computeLevelsNumber(const tUInteger &Nx, const tUInteger &Ny, const tUInteger &Nz, const tBoolean &isXPeriodic, const tBoolean &isYPeriodic, const tBoolean &isZPeriodic) const
compute the optimal levels number
Definition: EMM_MultiScaleGrid.cpp:47
EMM_MultiScaleGrid(void)
create
Definition: EMM_MultiScaleGrid.cpp:16
const MATH_MultiLevelsToeplitzMatrix & getToeplitzMatrix() const
get the toeplitz matrix
Definition: EMM_MultiScaleGrid.h:236
virtual void initialize(const tDimension &dim, const tUInteger &Nx, const tUInteger &Ny, const tUInteger &Nz, const tBoolean &Px, const tBoolean &Py, const tBoolean &Pz, const tUInteger &l)
set the discretization
Definition: EMM_MultiScaleGrid.cpp:82
SP_OBJECT(EMM_MultiScaleGrid)
virtual tString toString() const
return the class information in a tString
Definition: EMM_MultiScaleGrid.cpp:435
SP::MATH_MultiLevelsToeplitzMatrix mToeplitzMatrix
Definition: EMM_MultiScaleGrid.h:82
#define tUIndex
Definition: types.h:126
static tBoolean resetBlockValues(const tDimension &dim, const tUInteger &Nx, const tUInteger &Ny, const tUInteger &Nz, const tUInteger &iMin, const tUInteger &iMax, const tUInteger &jMin, const tUInteger &jMax, const tUInteger &kMin, const tUInteger &kMax, tReal *M)
reset the values in a block grid [iMin,iMax[x[jMin,jMax[x[kMin,kMax[ of dimension dim per point insid...
Definition: EMM_MultiScaleGrid.cpp:184
void setToeplitzMatrix(SP::MATH_MultiLevelsToeplitzMatrix toeplitz)
setthe toeplitz associated matrix
Definition: EMM_MultiScaleGrid.h:128
void getSegmentsNumber(tUInteger &Nx, tUInteger &Ny, tUInteger &Nz) const
get the segments number in all directions
Definition: EMM_MultiScaleGrid.h:190
#define tString
Definition: types.h:135
virtual ~EMM_MultiScaleGrid(void)
destroy
Definition: EMM_MultiScaleGrid.cpp:44
void getPeriodicDirections(tBoolean &isXPeriodic, tBoolean &isYPeriodic, tBoolean &isZPeriodic) const
get the periodicity per direction
Definition: EMM_MultiScaleGrid.h:214
virtual void computeZonalCenteredDemagnetizedFieldFromLevel(const tUInteger &twoPowerL, const tUIndex &nCells, const tDimension &dim, tReal *Ml, tReal *Mz, tReal *H0) const =0
compute the centered demagnetized field of level l outside zone anad add it to demagnetized field at ...
const tUInteger & getLevelComputationsNumber() const
return the number of calls of the level computations only for debug
Definition: EMM_MultiScaleGrid.h:379
tUInteger mLevelsNumber
Definition: EMM_MultiScaleGrid.h:85
SP::EMM_RealField mMlp1
Definition: EMM_MultiScaleGrid.h:88
const tUCInt & getFineElementsNumberPerCoarseElement() const
get the number of elements of the fine grid per cell of the corse grid
Definition: EMM_MultiScaleGrid.h:181
This class describes a real field.
Definition: EMM_RealField.h:21
const tUInteger & getLevelsNumber() const
get the leves number
Definition: EMM_MultiScaleGrid.h:228
#define tReal
Definition: types.h:118
tUInteger mN[3]
Definition: EMM_MultiScaleGrid.h:73
static tBoolean SAVE_H_M_AT_LEVEL_1
Definition: EMM_MultiScaleGrid.h:68