C++ main module for emicrom Package  1.0
EMM_MassMatrix.h
Go to the documentation of this file.
1 #ifndef EMM_MassMatrix_H
2 #define EMM_MassMatrix_H
3 
4 #include "EMM_Object.h"
5 
6 #include "EMM_Array.h"
7 #include "EMM_RealField.h"
8 
9 class EMM_Grid3D;
10 
11 class MATH_Solver;
12 
23 class EMM_MassMatrix : public virtual EMM_Object {
24 
26  // ATTRIBUTES
27 public:
28 
29 
30 
31  /* \brief computes \f$ \int_{\hat \omega} \hat \Phi_i \har \Phi_j d{\hat \omega} = |\hat \omega| INT_PHI2[i+8.j]/(H_i . H_j . INT_PHI2_FACTOR) \f$ with \f$ i \leq j \f$in a pack storage by column
32  */
33  static const tUCInt INT_PHI2[];
34  static const tUCInt INT_PHI2_FACTOR;
35 
36 private:
37 
38  //size of the matrix : nBlocks x size of blocks
40 
41  //number of points in all directions
43 
44 
45  //periodicity indicator in 6 bytes
47 
48  //indicator number of neighbors at each cell
50 
51 
53 
55 
57 
58 
59 protected:
60  // METHODS
61 
62  // CONSTRUCTORS
63 
66  EMM_MassMatrix(void);
67 
68 
69  // DESTRUCTORS
70 
71 
74  virtual ~EMM_MassMatrix(void) ;
75 
76 public:
77 
78 
79 
80  // SET methods
81 
82 protected:
86  inline void setBlockSize(const tUSInt& b) {
87  mBlockSize=b;
88  }
89 
90 public:
91 
95  mLimitConditionPoints=pts;
96  }
97 
101  inline void setPeriodicIndicator(const tCellFlag& p) {
102  mPeriodicity=p;
103  }
104 
105 
110  virtual void setSize(const tUIndex& nRows,const tUIndex& nCols) {
111  mSize=nRows;
112  }
113 
114 
120  inline void setPointsNumber(const tUInteger& Px,const tUInteger& Py,const tUInteger& Pz) {
121  mSize=1;
123  *Ps=Px;mSize*=*Ps;Ps++;
124  *Ps=Py;mSize*=*Ps;Ps++;
125  *Ps=Pz;mSize*=*Ps;
126  mSize*=mBlockSize;
127 
128  }
129 
134  mNeighborsIndicator=neighbors;
135  }
136 
137 
138  /* \brief set the volume of a cell of a mesh
139  * @param vol: volume of a cell
140  */
141  inline void setElementVolume(const tReal & v) {
142  mVolume=v;
143  }
144 
145  // GET methods
146 public:
147 
152  return *mLimitConditionPoints.get();
153  }
154 
158  inline const tUSInt& getBlockSize() const {
159  return mBlockSize;
160  }
169  virtual tULLInt getMemorySize() const {
170  return 0;
171  }
176  if (mNeighborsIndicator.get()==null) throw CORE_Exception("emicrom/operators/magnetostriction",
177  "EMM_MassMatrix::getNeighborsIndicators()",
178  "neighbors indicators array is not set");
179  return *mNeighborsIndicator.get();
180  }
181 
182 
186  inline const tUInteger& getPointsNumber(const tDimension& k) const {
187  return mPointsNumber[k];
188  }
191  inline const tUInteger* getPointsNumber() const {
192  return mPointsNumber;
193  }
194 
198  virtual tUIndex getRowsNumber() const {
199  return mSize;
200  }
204  virtual tUIndex getColumnsNumber() const {
205  return mSize;
206  }
207 
211  inline const tCellFlag& getPeriodicIndicator() const {
212  return mPeriodicity;
213  }
214 
217  inline tBoolean isXPeriodic() const {
218  return ((mPeriodicity&3)!=0);
219  }
222  inline tBoolean isYPeriodic() const {
223  return ((mPeriodicity&12)!=0);
224  }
227  inline tBoolean isZPeriodic() const {
228  return ((mPeriodicity&48)!=0);
229  }
230 
231 
232  /* \brief @return the volume of a cell of a mesh
233 
234  */
235  inline const tReal& getElementVolume() const {
236  return mVolume;
237  }
238 
239 public:
240  // OTHERS methods
241 
244  virtual void discretize(const EMM_Grid3D& mesh,SPC::EMM_LimitConditionArray lc);
245 
248  virtual tBoolean isSymmetric() const=0;
257  virtual tBoolean solve(MATH_Solver& solver,EMM_RealField& B)=0;
258 
265  virtual void product(const tReal& alpha,const EMM_RealField& X,
266  const tReal& beta,EMM_RealField& Y) const=0;
267 
268 
273  virtual tReal symmetricDot(const EMM_RealArray& D,const EMM_RealField& X) const=0;
274 
278  virtual tReal symmetricDot(const EMM_RealField& X) const=0;
279 
280 
281 
282 
283 
284 };
285 
286 #endif
void setBlockSize(const tUSInt &b)
set the block size of the matrix
Definition: EMM_MassMatrix.h:86
SPC::EMM_LimitConditionArray mLimitConditionPoints
Definition: EMM_MassMatrix.h:52
This class is a base class of E-MicromM core package.
Definition: EMM_Object.h:21
DEFINE_SVPTR(EMM_MassMatrix)
This class describes a grid3d mesh.
Definition: EMM_Grid3D.h:48
virtual ~EMM_MassMatrix(void)
destroy
Definition: EMM_MassMatrix.cpp:41
static const tDimension Y
Definition: EMM_Object.h:34
tUIndex mSize
Definition: EMM_MassMatrix.h:39
tUSInt mBlockSize
Definition: EMM_MassMatrix.h:56
const tReal & getElementVolume() const
Definition: EMM_MassMatrix.h:235
#define tUInteger
Definition: types.h:91
SPC::EMM_CellFlagArray mNeighborsIndicator
Definition: EMM_MassMatrix.h:49
static const tDimension X
Definition: EMM_Object.h:33
virtual tBoolean solve(MATH_Solver &solver, EMM_RealField &B)=0
solve AX=B thanks to the solver
void setPointsNumber(const tUInteger &Px, const tUInteger &Py, const tUInteger &Pz)
set the number of points in all directions
Definition: EMM_MassMatrix.h:120
tReal mVolume
Definition: EMM_MassMatrix.h:54
void setLimitConditionPoints(SPC::EMM_LimitConditionArray pts)
set the limit condition points
Definition: EMM_MassMatrix.h:94
T & get(const tUIndex &i)
get the value of the array at index i
Definition: CORE_Array.h:555
virtual tReal symmetricDot(const EMM_RealArray &D, const EMM_RealField &X) const =0
compute
void setNeighborsIndicator(SPC::EMM_CellFlagArray neighbors)
set the neighbor indicator of each cell
Definition: EMM_MassMatrix.h:133
#define tUCInt
Definition: types.h:21
#define tUSInt
Definition: types.h:28
#define tBoolean
Definition: types.h:139
void setElementVolume(const tReal &v)
Definition: EMM_MassMatrix.h:141
DEFINE_SPTR(EMM_MassMatrix)
virtual void setSize(const tUIndex &nRows, const tUIndex &nCols)
set the size of the matrix
Definition: EMM_MassMatrix.h:110
#define null
Definition: types.h:144
#define tDimension
Definition: EMM_Types.h:10
EMM_MassMatrix(void)
create
Definition: EMM_MassMatrix.cpp:33
EMM_Array< tCellFlag > EMM_CellFlagArray
Definition: EMM_Array.h:278
tUInteger mPointsNumber[3]
Definition: EMM_MassMatrix.h:42
void setPeriodicIndicator(const tCellFlag &p)
set the periodicity indicator
Definition: EMM_MassMatrix.h:101
const tUInteger & getPointsNumber(const tDimension &k) const
get the number of points in the direction k
Definition: EMM_MassMatrix.h:186
const EMM_LimitConditionArray & getLimitConditionPoints() const
get the limit condition for each points
Definition: EMM_MassMatrix.h:151
static const tUCInt INT_PHI2[]
Definition: EMM_MassMatrix.h:33
virtual void discretize(const EMM_Grid3D &mesh, SPC::EMM_LimitConditionArray lc)
discretize the matrix
Definition: EMM_MassMatrix.cpp:46
virtual tUIndex getColumnsNumber() const
get the columns number of the matrix
Definition: EMM_MassMatrix.h:204
#define tCellFlag
Definition: EMM_Types.h:16
this class describes the exceptions raised for CORE package
Definition: CORE_Exception.h:15
This interface class describes the mass matrix where is the Q1 function with is 1 on the point i an...
Definition: EMM_MassMatrix.h:23
EMM_Array< tLimitCondition > EMM_LimitConditionArray
Definition: EMM_Array.h:279
virtual tBoolean isSymmetric() const =0
return true if the matrix is symmetric
#define tUIndex
Definition: types.h:126
This class describes a real array.
Definition: EMM_RealArray.h:16
const tUInteger * getPointsNumber() const
get the number of points in all directions
Definition: EMM_MassMatrix.h:191
This class describes a solver of Ax=b.
Definition: MATH_Solver.h:18
static const tUCInt INT_PHI2_FACTOR
Definition: EMM_MassMatrix.h:34
const EMM_CellFlagArray & getNeighborsIndicator() const
get the neighbor indicator of each cell
Definition: EMM_MassMatrix.h:175
tBoolean isXPeriodic() const
Definition: EMM_MassMatrix.h:217
const tUSInt & getBlockSize() const
get the block size
Definition: EMM_MassMatrix.h:158
tBoolean isZPeriodic() const
Definition: EMM_MassMatrix.h:227
#define tULLInt
Definition: types.h:45
tBoolean isYPeriodic() const
Definition: EMM_MassMatrix.h:222
This class describes a real field.
Definition: EMM_RealField.h:21
virtual tULLInt getMemorySize() const
return the memory size in byte
Definition: EMM_MassMatrix.h:169
SP_OBJECT(EMM_MassMatrix)
#define tReal
Definition: types.h:118
tCellFlag mPeriodicity
Definition: EMM_MassMatrix.h:46
virtual void product(const tReal &alpha, const EMM_RealField &X, const tReal &beta, EMM_RealField &Y) const =0
compute Y=alpha.A.X +beta Y
virtual tUIndex getRowsNumber() const
get the rows number of the matrix
Definition: EMM_MassMatrix.h:198
const tCellFlag & getPeriodicIndicator() const
get the periodicity indicator
Definition: EMM_MassMatrix.h:211