C++ main module for emicrom Package  1.0
EMM_DisplacementFVM_Interpolator.h
Go to the documentation of this file.
1 #ifndef EMM_DisplacementFVM_Interpolator_H
2 #define EMM_DisplacementFVM_Interpolator_H
3 
4 #include "EMM_Object.h"
5 
6 #include "CORE_MorseArray.h"
7 #include "EMM_RealField.h"
8 
9 
17 
19  // ATTRIBUTES
20 
21 
22 private:
23 
24 protected:
25 
26  static const tUIndex NEUMANN_FACE;
27  static const tUIndex DIRICHLET_FACE;
28 
29 public:
30 
31 
32  // ASSOCIATION
33 
34 private:
35 
36 
37 
38 
39 protected:
40 
41  // METHODS
42 
43  // CONSTRUCTORS
44 
48 
49  // DESTRUCTORS
50 
53  virtual ~EMM_DisplacementFVM_Interpolator(void);
54 
55 
56 public:
57 
58  //Get methods
59 
60  //neighbors
61  //=========
64  static tUSInt computeNeighborCellsNumber(const tUInteger& iP,const tUInteger& jP,const tUInteger& kP,
65  const tUInteger& Nx,const tUInteger& Ny,const tUInteger& Nz,
66  const tBoolean *periodicity,
67  const CORE_UIndexMorseArray& neighbors);
68  //Vertex interpolations
69  //=====================
70 
71 private:
72  /* brief interpolate U at vertices when U at all cells is given
73  * @param[in] xP: index if the point in the x-direction
74  * @param[in] yP: index if the point in the y-direction
75  * @param[in] zP: index if the point in the z-direction
76  * @param[in] Nx: number of segments in the x-direction
77  * @param[in] Ny: number of segments in the y-direction
78  * @param[in] Nz: number of segments in the z-direction
79  * @param[in] isPeriodic : the periodicity on each direction
80  * @param[in] neighborIndices : to indicates if the cell has neighbors
81  * @param[in] dim : dimension of each point of fields
82  * @param[in] Ucells : the displacement field at the center of each cell
83  * @param[in] iCell : index of cell in which U not null
84  * @param[in] Ui : value of U at cell icell
85  * @param[in] lc : limit condition on all points
86  * @param[in] incU0 : 0 for constyant 1 for not constant field U0
87  * @param[in] U0 : values of U at dirichlet points
88  * @param[in] LCp : limite conditiopn on point P(xP,yP,zP)
89  * @param[out] Up : the displacement field at each point of the mesh
90  *
91  * \f$ U(P) = \frac{1}{N} \sum_{w in \Omega | P \in w } U(w) \f$ with \f$ N=card(w \in \Omega | P \in \Omega) \f$
92  */
94  const tUInteger& Nx,const tUInteger& Ny,const tUInteger& Nz,
95  const tBoolean isPeriodic[3],
96  const CORE_UIndexMorseArray& neighborIndices,
97  const tDimension& dim,
98  const tReal* Ucells,
99  const tUIndex& iCell,const tReal* Ui,
100  const tLimitCondition* lc,
101  const tBoolean& incU0,
102  const tReal *U0,
103  const tLimitCondition& LCp,
104  tReal *Up);
105 public:
106 
107 
108  /* brief interpolate U at vertices when U at all cells is given
109  * @param[in] xP: index if the point in the x-direction
110  * @param[in] yP: index if the point in the y-direction
111  * @param[in] zP: index if the point in the z-direction
112  * @param[in] Nx: number of segments in the x-direction
113  * @param[in] Ny: number of segments in the y-direction
114  * @param[in] Nz: number of segments in the z-direction
115  * @param[in] isPeriodic : the periodicity on each direction
116  * @param[in] neighborIndices : to indicates if the cell has neighbors
117  * @param[in] dim : dimension of each point of fields
118  * @param[in] Ucells : the displacement field at the center of each cell
119  * @param[in] lc : limit condition on all points
120  * @param[in] incU0 : 0 for constant 1 for not constant field U0
121  * @param[in] U0 : values of U at dirichlet points
122  * @param[in] LCp : limite condition on point P(xP,yP,zP)
123  * @param[out] Up : the displacement field at each point of the mesh
124  *
125  * \f$ U(P) = \frac{1}{N} \sum_{w in \Omega | P \in w } U(w) \f$ with \f$ N=card(w \in \Omega | P \in \Omega) \f$
126  *
127  */
128 
129  static inline void interpolateUAtVertex(tUInteger xP,tUInteger yP,tUInteger zP,
130  const tUInteger& Nx,const tUInteger& Ny,const tUInteger& Nz,
131  const tBoolean isPeriodic[3],
132  const CORE_UIndexMorseArray& neighborIndices,
133  const tDimension& dim,
134  const tReal* Ucells,
135  const tLimitCondition* lc,
136  const tBoolean& incU0,
137  const tReal *U0,
138  const tLimitCondition& LCp,
139  tReal *Up) {
140  interpolateUAtVertex(xP,yP,zP,
141  Nx,Ny,Nz,
142  isPeriodic,
143  neighborIndices,
144  dim,Ucells,
145  0,null,
146  lc,incU0,U0,
147  LCp,
148  Up);
149  }
150  /* brief interpolate U at vertices when U is null at only one cell and null on dirichlet points
151  * @param[in] xP: index if the point in the x-direction
152  * @param[in] yP: index if the point in the y-direction
153  * @param[in] zP: index if the point in the z-direction
154  * @param[in] Nx: number of segments in the x-direction
155  * @param[in] Ny: number of segments in the y-direction
156  * @param[in] Nz: number of segments in the z-direction
157  * @param[in] isPeriodic : the periodicity on each direction
158  * @param[in] neighborIndices : to indicates if the cell has neighbors and if the cell is magnetized
159  * @param[in] dim : dimension of each point of fields
160  * @param[in] iCell: index o the cell where U is not null
161  * @param[in] Ui: values of U at cell iCell
162  * @param[in] LC : limit condition on all points
163  * @param[in] LCp : limit condition on point P(xP,yP,zP)
164  * @param[out] Up : the displacement field at each point of the mesh
165  *
166  * \f$ U(P) = U(w_i) \frac{1}{N} \f$ with \f$ N=card(w \in \Omega | P \in \Omega) \f$
167  */
168  static void interpolateAlmostNullUAtVertex(const tUInteger& xP,const tUInteger& yP,const tUInteger& zP,
169  const tUInteger& Nx,const tUInteger& Ny,const tUInteger& Nz,
170  const tBoolean isPeriodic[3],
171  const CORE_UIndexMorseArray& neighborIndices,
172  const tDimension& dim,
173  const tUIndex& iCell,const tReal *Ui,
174  const tLimitCondition* lc,
175  const tLimitCondition& LCp,
176  tReal *Up) {
177  interpolateUAtVertex(xP,yP,zP,
178  Nx,Ny,Nz,
179  isPeriodic,
180  neighborIndices,
181  dim,null,
182  iCell,Ui,
183  lc,
184  0,null,//null value for dirichlet points
185  LCp,
186  Up);
187  }
188 
189  /* brief interpolate U at vertices
190  * @param[in] withDirichlet Points : true to use the values on Dirichlet points (false, the values on dirichlet points is suppoed to be null)
191  * @param[in] N : the number of segments in each direction
192  * @param[in] isPeriodic : the periodicity on each direction
193  * @param[in] neighborIndices : to indicates if the cell has neighbors and if the cell is magnetized
194  * @param[in] Ucells : the displacement field at the center of each cell
195  * @param[in] limitConditionOnPoints : the limit condition at each point of mesh
196  * @param[in] U0 : the value of the displacement on each dirichlet points
197  * @param[out] Up : the displacement field at each point of the mesh
198  *
199  * \f$ U(P) = U(w_i) \frac{1}{N} \f$ with \f$ N=card(w \in \Omega | P \in \Omega) \f$
200  * \f$ U(P) = U^0(P) \f$ for dirichlet point P
201  */
202  inline static void interpolateUAtVertices(const tBoolean& withDirichletPoints,
203  const tUInteger N[3],
204  const tBoolean isPeriodic[3],
205  const CORE_UIndexMorseArray& neighborIndices,
206  const EMM_RealField& Ucells,
207  const EMM_LimitConditionArray& limitConditionOnPoints,const EMM_RealField& U0,
208  EMM_RealField& Up) {
209  const tReal *vU;
210  tUIndex nV;
211  Ucells.getValues(nV,vU);
212  interpolateUAtVertices(withDirichletPoints,
213  N,isPeriodic,neighborIndices,
214  Ucells.getSize(),Ucells.getDimension(),vU,
215  limitConditionOnPoints,U0,
216  Up);
217  }
218 
219  /* brief interpolate U at vertices
220  * @param withDirichlet Points : true to use the values on Dirichlet points (false, the values on dirichlet points is suppoed to be null)
221  * @param N : the number of segments in each direction
222  * @param isPeriodic : the periodicity on each direction
223  * @param neighborIndices : to indicates if the cell has neighbors
224  * @param U : the displacement field at the center of each cell
225  * @param limitConditionOnPoints : the limit condition at each point of mesh
226  * @param U0 : the value of the displacement on each dirichlet points
227  * @param[out] Up : the displacement field at each point of the mesh
228  *
229  * \f$ U(P) = U(w_i) \frac{1}{N} \f$ with \f$ N=card(w \in \Omega | P \in \Omega) \f$
230  * \f$ U(P) = U^0(P) \f$ for dirichlet point P
231  */
232  static void interpolateUAtVertices(const tBoolean& withDirichletPoints,
233  const tUInteger N[3],
234  const tBoolean isPeriodic[3],
235  const CORE_UIndexMorseArray& neighborIndices,
236  const tUIndex& nCells,const tDimension& dim,const tReal *U,
237  const EMM_LimitConditionArray& limitConditionOnPoints,const EMM_RealField& U0,
238  EMM_RealField& Up);
239 
240 
241  //edges interpolations
242  //====================
243 public:
244 
245 
272  void interpolateUAtEdge(const tBoolean& withConstraints,
273  const tUInteger& xCell,const tUInteger& yCell,const tUInteger& zCell,
274  const tUInteger& Px,const tUInteger& Py,const tUInteger& Pz,
275  const tBoolean* periodicity,
276  const tDimension& dim,
277  const tUCInt& l,const tUCInt& r,
278  const tReal *Ucells,const tReal* Uc,
279  const tLimitCondition* lc,
280  const tBoolean& incU0,const tReal* U0,
281  const tUIndex* Nc,const CORE_UIndexMorseArray& neighbors,
282  tReal *iUc,
283  const tReal* &iU) const;
284 
285 
306  static tBoolean edgeMean(const tUInteger& xCell,
307  const tUInteger& yCell,
308  const tUInteger& zCell,
309  const tUCInt& f,
310  const tUCInt& g,
311  const tBoolean *isPeriodic,
312  const tUInteger& Px,
313  const tUInteger& Py,
314  const tUInteger& Pz,
315  const tDimension& dim,
316  const tLimitCondition* lc,
317  const tBoolean& incU,
318  const tReal* Upoints,
319  tReal *Um);
320 
321  //faces interpolations
322  //====================
323 public:
324 
348  static inline void interpolateUAtFace(const tUInteger& xCell,const tUInteger& yCell,const tUInteger& zCell,
349  const tUInteger& Px,const tUInteger& Py,const tUInteger& Pz,
350  const tBoolean periodicity[3],
351  const CORE_UIndexMorseArray& neighborsIndices,//neighbor indicesof cells
352  const tUCInt& f,
353  const tDimension& dim,//dimension of the point
354  const tReal* Ucells,//U at all the cells
355  const tLimitCondition *lc,const tBoolean& incU0, const tReal* U0,
356  tReal *Umean) {
357  interpolateUAtFace(xCell,yCell,zCell,Px,Py,Pz,
358  periodicity,neighborsIndices,f,dim,
359  Ucells,
360  null,
361  lc,incU0,U0,
362  Umean);
363  }
364 
388  static void interpolateAlmostNullUAtFace(const tUInteger& xCell,const tUInteger& yCell,const tUInteger& zCell,
389  const tUInteger& Px,const tUInteger& Py,const tUInteger& Pz,
390  const tBoolean periodicity[3],
391  const CORE_UIndexMorseArray& neighborsIndices,//neighbor indicesof cells
392  const tUCInt& f,
393  const tDimension& dim,//dimension of the point
394  const tReal* Ui,//U at cell (xCell,yCell,zCell)
395  const tLimitCondition *lc,const tBoolean& incU0, const tReal* U0,
396  tReal *Umean) {
397  interpolateUAtFace(xCell,yCell,zCell,
398  Px,Py,Pz,
399  periodicity,
400  neighborsIndices,
401  f,
402  dim,
403  null,
404  Ui,
405  lc,incU0,U0,
406  Umean);
407  }
408 
409 private:
410 
435  static void interpolateUAtFace(const tUInteger& xCell,const tUInteger& yCell,const tUInteger& zCell,
436  const tUInteger& Px,const tUInteger& Py,const tUInteger& Pz,
437  const tBoolean periodicity[3],
438  const CORE_UIndexMorseArray& neighborsIndices,//neighbor indicesof cells
439  const tUCInt& f,
440  const tDimension& dim,//dimension of the point
441  const tReal *Ucells,//U at cells
442  const tReal* Ui,//U at cell (xCell,yCell,zCell)
443  const tLimitCondition *lc,const tBoolean& incU0, const tReal* U0,
444  tReal *Umean) ;
445 
446 public:
467  static tBoolean faceMean(const tUInteger& xCell,
468  const tUInteger& yCell,
469  const tUInteger& zCell,
470  const tUCInt& f,
471  const tBoolean* isPeriodic,
472  const tUInteger& Px,
473  const tUInteger& Py,
474  const tUInteger& Pz,
475  const tDimension& dim,
476  const tLimitCondition* lc,
477  const tBoolean& incU,
478  const tReal* Upoints,
479  tReal *Um);
480 
481 
482 
483 
484  //cell interpolations
485  //====================
486 public:
487 
507  static tBoolean cellMean(const tUInteger& xCell,
508  const tUInteger& yCell,
509  const tUInteger& zCell,
510  const tBoolean* isPeriodic,
511  const tUInteger& Px,
512  const tUInteger& Py,
513  const tUInteger& Pz,
514  const tDimension& dim,
515  const tLimitCondition* lc,
516  const tBoolean& incU,
517  const tReal* Upoints,
518  tReal *Um);
519 
520 
521 
522 };
523 
524 #endif
525 
This class is a base class of E-MicromM core package.
Definition: EMM_Object.h:21
virtual tUIndex getSize() const =0
return the size of the field
#define tLimitCondition
Definition: EMM_Types.h:19
#define tUInteger
Definition: types.h:91
static const tUIndex DIRICHLET_FACE
Definition: EMM_DisplacementFVM_Interpolator.h:27
static void interpolateUAtVertex(tUInteger xP, tUInteger yP, tUInteger zP, const tUInteger &Nx, const tUInteger &Ny, const tUInteger &Nz, const tBoolean isPeriodic[3], const CORE_UIndexMorseArray &neighborIndices, const tDimension &dim, const tReal *Ucells, const tLimitCondition *lc, const tBoolean &incU0, const tReal *U0, const tLimitCondition &LCp, tReal *Up)
Definition: EMM_DisplacementFVM_Interpolator.h:129
#define tUCInt
Definition: types.h:21
#define tUSInt
Definition: types.h:28
#define tBoolean
Definition: types.h:139
static void interpolateAlmostNullUAtVertex(const tUInteger &xP, const tUInteger &yP, const tUInteger &zP, const tUInteger &Nx, const tUInteger &Ny, const tUInteger &Nz, const tBoolean isPeriodic[3], const CORE_UIndexMorseArray &neighborIndices, const tDimension &dim, const tUIndex &iCell, const tReal *Ui, const tLimitCondition *lc, const tLimitCondition &LCp, tReal *Up)
Definition: EMM_DisplacementFVM_Interpolator.h:168
static tBoolean faceMean(const tUInteger &xCell, const tUInteger &yCell, const tUInteger &zCell, const tUCInt &f, const tBoolean *isPeriodic, const tUInteger &Px, const tUInteger &Py, const tUInteger &Pz, const tDimension &dim, const tLimitCondition *lc, const tBoolean &incU, const tReal *Upoints, tReal *Um)
compute the mean value of U defined on points at face f of the cell (xCell,yCell,zCell) ...
Definition: EMM_DisplacementFVM_Interpolator.cpp:973
static void interpolateUAtVertices(const tBoolean &withDirichletPoints, const tUInteger N[3], const tBoolean isPeriodic[3], const CORE_UIndexMorseArray &neighborIndices, const EMM_RealField &Ucells, const EMM_LimitConditionArray &limitConditionOnPoints, const EMM_RealField &U0, EMM_RealField &Up)
Definition: EMM_DisplacementFVM_Interpolator.h:202
#define null
Definition: types.h:144
#define tDimension
Definition: EMM_Types.h:10
DEFINE_SPTR(EMM_DisplacementFVM_Interpolator)
static void interpolateAlmostNullUAtFace(const tUInteger &xCell, const tUInteger &yCell, const tUInteger &zCell, const tUInteger &Px, const tUInteger &Py, const tUInteger &Pz, const tBoolean periodicity[3], const CORE_UIndexMorseArray &neighborsIndices, const tUCInt &f, const tDimension &dim, const tReal *Ui, const tLimitCondition *lc, const tBoolean &incU0, const tReal *U0, tReal *Umean)
compute interpolation of U at Face
Definition: EMM_DisplacementFVM_Interpolator.h:388
static void interpolateUAtVertex(tUInteger xP, tUInteger yP, tUInteger zP, const tUInteger &Nx, const tUInteger &Ny, const tUInteger &Nz, const tBoolean isPeriodic[3], const CORE_UIndexMorseArray &neighborIndices, const tDimension &dim, const tReal *Ucells, const tUIndex &iCell, const tReal *Ui, const tLimitCondition *lc, const tBoolean &incU0, const tReal *U0, const tLimitCondition &LCp, tReal *Up)
Definition: EMM_DisplacementFVM_Interpolator.cpp:89
EMM_DisplacementFVM_Interpolator(void)
create
Definition: EMM_DisplacementFVM_Interpolator.cpp:13
SP_OBJECT(EMM_DisplacementFVM_Interpolator)
Definition: EMM_DisplacementFVM_Interpolator.h:16
static const tUIndex NEUMANN_FACE
Definition: EMM_DisplacementFVM_Interpolator.h:26
virtual tBoolean getValues(tUIndex &size, const float *&values) const
get the values
Definition: EMM_RealField.h:585
#define tUIndex
Definition: types.h:126
static tBoolean cellMean(const tUInteger &xCell, const tUInteger &yCell, const tUInteger &zCell, const tBoolean *isPeriodic, const tUInteger &Px, const tUInteger &Py, const tUInteger &Pz, const tDimension &dim, const tLimitCondition *lc, const tBoolean &incU, const tReal *Upoints, tReal *Um)
compute the mean value of U defined on points at cell (xCell,yCell,zCell)
Definition: EMM_DisplacementFVM_Interpolator.cpp:1076
const tDimension & getDimension() const
get the dimension
Definition: EMM_RealField.h:553
static tBoolean edgeMean(const tUInteger &xCell, const tUInteger &yCell, const tUInteger &zCell, const tUCInt &f, const tUCInt &g, const tBoolean *isPeriodic, const tUInteger &Px, const tUInteger &Py, const tUInteger &Pz, const tDimension &dim, const tLimitCondition *lc, const tBoolean &incU, const tReal *Upoints, tReal *Um)
compute the mean value of U defined on points at edge between face f and face g of the cell (xCell...
Definition: EMM_DisplacementFVM_Interpolator.cpp:751
virtual ~EMM_DisplacementFVM_Interpolator(void)
destroy
Definition: EMM_DisplacementFVM_Interpolator.cpp:17
This class describes a real field.
Definition: EMM_RealField.h:21
#define tReal
Definition: types.h:118
void interpolateUAtEdge(const tBoolean &withConstraints, const tUInteger &xCell, const tUInteger &yCell, const tUInteger &zCell, const tUInteger &Px, const tUInteger &Py, const tUInteger &Pz, const tBoolean *periodicity, const tDimension &dim, const tUCInt &l, const tUCInt &r, const tReal *Ucells, const tReal *Uc, const tLimitCondition *lc, const tBoolean &incU0, const tReal *U0, const tUIndex *Nc, const CORE_UIndexMorseArray &neighbors, tReal *iUc, const tReal *&iU) const
interpolate U at edge
Definition: EMM_DisplacementFVM_Interpolator.cpp:451
static void interpolateUAtFace(const tUInteger &xCell, const tUInteger &yCell, const tUInteger &zCell, const tUInteger &Px, const tUInteger &Py, const tUInteger &Pz, const tBoolean periodicity[3], const CORE_UIndexMorseArray &neighborsIndices, const tUCInt &f, const tDimension &dim, const tReal *Ucells, const tLimitCondition *lc, const tBoolean &incU0, const tReal *U0, tReal *Umean)
compute interpolation of U at Face
Definition: EMM_DisplacementFVM_Interpolator.h:348
static tUSInt computeNeighborCellsNumber(const tUInteger &iP, const tUInteger &jP, const tUInteger &kP, const tUInteger &Nx, const tUInteger &Ny, const tUInteger &Nz, const tBoolean *periodicity, const CORE_UIndexMorseArray &neighbors)
compute the number of cells connected to vertex
Definition: EMM_DisplacementFVM_Interpolator.cpp:24