C++ main module for emicrom Package  1.0
EMM_MultiScaleSDGrid.h
Go to the documentation of this file.
1 #ifndef EMM_MultiScaleSDGrid_H
2 #define EMM_MultiScaleSDGrid_H
3 
4 #include "EMM_MultiScaleCDGrid.h"
5 
6 
121 
123  // ATTRIBUTES
124 
126 
127  //H at level l for debug
129 
130  //ASSOCIATIONS
131 
132 
133 public:
134  // METHODS
135 
136  // CONSTRUCTORS
137 
140  EMM_MultiScaleSDGrid(void);
141 
142  // DESTRUCTORS
143 
146  virtual ~EMM_MultiScaleSDGrid(void);
147 
148 
149 public:
153  inline static SP::EMM_MultiScaleSDGrid New() {
154  SP::EMM_MultiScaleSDGrid ret(new EMM_MultiScaleSDGrid(),
156  ret->setThis(ret);
157  return ret;
158  };
159 
160 
176  virtual void initialize(const tDimension& dim,
177  const tUInteger& Nx,
178  const tUInteger& Ny,
179  const tUInteger& Nz,
180  const tBoolean& Px,
181  const tBoolean& Py,
182  const tBoolean& Pz,
183  const tUInteger& l);
184 
190  inline void setZonalLevelsNumber(const tUInteger& nLevels) {
191  mTwoPowerZonalLevelsNumber=pow(2,nLevels);
192 
193  }
194 
195 
196 
197 
198 
199 public:
200 
201  //OTHER methods
219  inline static tUCInt getShiftZone(const tUInteger& Nx,const tUInteger& Ny,const tUInteger& Nz,
220  const tUCInt& z) {
221  tUCInt sz=7-z;
222  if (isZoneEmpty(Nx,Ny,Nz,sz)) sz=(sz<4)?sz+4:sz-4;
223  return sz;
224  }
239  inline tUCInt getShiftZone(const tUCInt& z) const {
240  const tUInteger *N=getSegmentsNumber();
241  return getShiftZone(N[0],N[1],N[2],z);
242  }
252  inline static tBoolean isZoneEmpty(const tUInteger& Nx,const tUInteger& Ny,const tUInteger& Nz,
253  const tUCInt& z) {
254 
255  return ! ( ( ( ((z) & 1) ==1 ) || (Nx/2!=0)) &&
256  ( ( ((z) & 2) ==2 ) || (Ny/2!=0)) &&
257  ( ( ((z) & 4) ==4 ) || (Nz/2!=0)) );
258 
259 
260  }
268  inline static tBoolean isZoneEmpty(const tUInteger N[],
269  const tUCInt& z) {
270 
271  return ! ( ( ( ((z) & 1) ==1 ) || (N[0]/2!=0)) &&
272  ( ( ((z) & 2) ==2 ) || (N[1]/2!=0)) &&
273  ( ( ((z) & 4) ==4 ) || (N[2]/2!=0)) );
274 
275 
276  }
277 
278 
279 
307  tBoolean computeValuesOnShiftFineGrid(const tUIndex& nCells,const tDimension& dim,const tReal *M,
308  const tUCInt& z,tReal *Mz) const;
309 
367  void meanValuesFromShiftFineGridToCoarseGrid(const tUIndex& nCells,const tDimension& dim,
368  const tUCInt& z,const tReal *Mz,
369  tReal *M) const;
370 
371  /* \brief reset the the value of the field M at shift zone
372  * @param[in] nCells : number of cells of the mesh
373  * @param[in] dim: dimension of each point of the mesh
374  * @param[in] z: zone of the grid
375  * @param[out] Mz: magnetization values of size nCells x dim at zone z of the grid to set to 0
376  * @return false if the volume of the zone z is null
377  *
378  * Set to 0 the values of M at zone z
379 
380  * the algorithm is as follow:
381  * - the segment indices of zone z is in \f$ [i_{min},i_{max}[ \times [j_{min},j_{max}[ \times [k_{min},k_{max}[ \f$
382  * - for zone 0 \f$ [i_{min},i_{max}[=[0,N_x/2[\f$
383  * - for zone 1 \f$ [i_{min},i_{max}[=[N_x/2,N_x[\f$
384  * - the zone is considered as a sequence of N blocks of size S.
385  * - Each block are set to 0. the first element of block is at index \f$(i_s,j_s,k_s) \f$ where
386  * - \f$ \forall s, i_s=i_{min} \f$ and \f$ \forall s,j_{s+1}=j_s+1 ,k_{s+1}=k_s+1 \f$ if the blocks are oriented in the x-direction (\f$N_x \neq 1\f$)
387  * - \f$ \forall s, j_s=j_{min} \f$ and \f$ \forall s,i_{s+1}=i_s+1 ,k_{s+1}=k_s+1 \f$ if the blocks are oriented in the y-direction (\f$N_x \eq 1 \f$ and\f$N_y \neq 1 \f$ )
388  * - \f$ \forall s, k_s=k_{min} \f$ and \f$ \forall s, i_{s+1}=i_s+1 ,j_{s+1}=j_s+1 \f$ if the blocks are oriented in the z-direction (\f$N_x \eq 1 \f$ and\f$N_y \eq 1 \f$ and \f$ $N_z \neq 1 \f$)
389  * - if \f$ i_{s+1}>=i_{max} \f$ then \f$ i_{s+1}=i_{min} \f$
390  * - if \f$ j_{s+1}>=j_{max} \f$ then \f$ j_{s+1}=j_{min} \f$
391  * - if \f$ k_{s+1}>=j_{max} \f$ then \f$ k_{s+1}=k_{min} \f$
392  */
393  tBoolean resetValuesWithinShiftZone(const tUIndex& nCells,const tDimension& dim,
394  const tUCInt& z,tReal *Mz) const;
395 
396 
397 
427  const tDimension& dim,
428  const tUInteger& Nx,
429  const tUInteger& Ny,
430  const tUInteger& Nz,
431  const tUCInt& z,
432  tInteger& Sx,
433  tInteger& Sy,
434  tInteger& Sz,
435  const tReal *Hz,
436  tReal *H) const;
437 
469  tBoolean addValuesFromShiftFineGridToFinestGrid(const tUIndex& nCells,const tDimension& dim,const tUInteger& twoPowerL,
470  const tUCInt& z,const tReal *Hz,tReal *H) const;
471 
492  const tUInteger& twoPowerL,
493  const tUCInt& z,const tReal *Hz,tReal *H) const;
494 
495 protected:
508  const tUIndex& nCells,
509  const tDimension& dim,
510  const tReal* Ml,
511  tReal *Mz,
512  tReal *Mlp1,
513  tReal *H0) const;
514 
515 
525  virtual void computeZonalCenteredDemagnetizedFieldFromLevel(const tUInteger& twoPowerL,
526  const tUIndex& nCells,
527  const tDimension& dim,
528  tReal* Ml,
529  tReal *Mz,
530  tReal *H0) const;
531 
532  //old version to be removed
533  // virtual void computeMultiGridExcitationField(const tUIndex& nCells,
534  // const tDimension& dim,
535  // const tReal* sigmaM,
536  // tReal * H);
537 
538 };
539 
540 #endif
static SP::EMM_MultiScaleSDGrid New()
build a new instance of class
Definition: EMM_MultiScaleSDGrid.h:153
static tUCInt getShiftZone(const tUInteger &Nx, const tUInteger &Ny, const tUInteger &Nz, const tUCInt &z)
compute the shift zone
Definition: EMM_MultiScaleSDGrid.h:219
void meanValuesFromShiftFineGridToCoarseGrid(const tUIndex &nCells, const tDimension &dim, const tUCInt &z, const tReal *Mz, tReal *M) const
compute M at zone z of the coarse grid from the shift fine grid
Definition: EMM_MultiScaleSDGrid.cpp:287
static tBoolean isZoneEmpty(const tUInteger &Nx, const tUInteger &Ny, const tUInteger &Nz, const tUCInt &z)
return true if the zone is empty
Definition: EMM_MultiScaleSDGrid.h:252
const tUInteger * getSegmentsNumber() const
get the segments number per dierction
Definition: EMM_MultiScaleGrid.h:198
void setZonalLevelsNumber(const tUInteger &nLevels)
set the number of levels with are divied in zones
Definition: EMM_MultiScaleSDGrid.h:190
#define tUInteger
Definition: types.h:91
#define tUCInt
Definition: types.h:21
#define tBoolean
Definition: types.h:139
tUCInt getShiftZone(const tUCInt &z) const
compute the shift zone
Definition: EMM_MultiScaleSDGrid.h:239
#define tDimension
Definition: EMM_Types.h:10
This class describes the building of fields on multiscale shift dioptic grids initialized by the init...
Definition: EMM_MultiScaleSDGrid.h:120
virtual ~EMM_MultiScaleSDGrid(void)
destroy
Definition: EMM_MultiScaleSDGrid.cpp:26
SP_OBJECT(EMM_MultiScaleSDGrid)
tBoolean computeValuesOnShiftFineGrid(const tUIndex &nCells, const tDimension &dim, const tReal *M, const tUCInt &z, tReal *Mz) const
compute M on shift grid at zone z by periodicity
Definition: EMM_MultiScaleSDGrid.cpp:47
DEFINE_SPTR(EMM_MultiScaleSDGrid)
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_MultiScaleSDGrid.cpp:30
tBoolean addValuesFromGridToZoneFinestGrid(const tUInteger &twoPowerLp1, const tDimension &dim, const tUInteger &Nx, const tUInteger &Ny, const tUInteger &Nz, const tUCInt &z, tInteger &Sx, tInteger &Sy, tInteger &Sz, const tReal *Hz, tReal *H) const
add values from a large grid to the finest grid by zone
Definition: EMM_MultiScaleSDGrid.cpp:502
CORE_Array< tReal > CORE_RealArray
Definition: CORE_Array.h:1075
tBoolean resetValuesWithinShiftZone(const tUIndex &nCells, const tDimension &dim, const tUCInt &z, tReal *Mz) const
Definition: EMM_MultiScaleSDGrid.cpp:227
virtual void computeZonalDemagnetizedFieldAndNextLevelMagnetizationField(const tUInteger &twoPowerL, const tUIndex &nCells, const tDimension &dim, const tReal *Ml, tReal *Mz, tReal *Mlp1, tReal *H0) const
compute the zonal demagnetized field added to demagnetized field at level 0 and compute the magnetiza...
Definition: EMM_MultiScaleSDGrid.cpp:827
static tBoolean isZoneEmpty(const tUInteger N[], const tUCInt &z)
return true if the zone is empty
Definition: EMM_MultiScaleSDGrid.h:268
#define tUIndex
Definition: types.h:126
EMM_MultiScaleSDGrid(void)
create
Definition: EMM_MultiScaleSDGrid.cpp:16
tBoolean addValuesFromShiftFineGridToFinestGrid(const tUIndex &nCells, const tDimension &dim, const tUInteger &twoPowerL, const tUCInt &z, const tReal *Hz, tReal *H) const
add the contribution of Hz from shift grid of zone z at level l to H on zone z at level 0 ...
Definition: EMM_MultiScaleSDGrid.cpp:739
This class describes the building of fields on multiscale centered dioptic grids initialized by the i...
Definition: EMM_MultiScaleCDGrid.h:127
SP::CORE_RealArray mHl
Definition: EMM_MultiScaleSDGrid.h:128
tUInteger mTwoPowerZonalLevelsNumber
Definition: EMM_MultiScaleSDGrid.h:125
virtual void computeZonalCenteredDemagnetizedFieldFromLevel(const tUInteger &twoPowerL, const tUIndex &nCells, const tDimension &dim, tReal *Ml, tReal *Mz, tReal *H0) const
compute the centered demagnetized field of level l outside zone anad add it to demagnetized field at ...
Definition: EMM_MultiScaleSDGrid.cpp:925
tBoolean addValuesFromCoarseGridToFinestGrid(const tUIndex &nCells, const tDimension &dim, const tUInteger &twoPowerL, const tUCInt &z, const tReal *Hz, tReal *H) const
add the contribution of H at level l reset to 0 on zone z to H on finest grid at level 0 in zone z ...
Definition: EMM_MultiScaleSDGrid.cpp:794
#define tReal
Definition: types.h:118
#define tInteger
Definition: types.h:90
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141