C++ main module for emicrom Package  1.0
EMM_BlockEquilibriumMatrix.h
Go to the documentation of this file.
1 #ifndef EMM_BlockEquilibriumMatrix_H
2 #define EMM_BlockEquilibriumMatrix_H
3 
4 //matrix inheritance : mask vector not used
5 #include "MATH_Matrix.h"
6 #include "MATH_ArrayVector.h"
7 
8 //field
9 #include "EMM_RealField.h"
10 
11 class MATH_Solver;
13 
26 class EMM_BlockEquilibriumMatrix : public virtual MATH_Matrix {
27 
29  // ATTRIBUTES
30 public:
31 
32 
33 
34 private:
35  //size of the matrix : nBlocks x blockSize
37 
38  //block size
40 
41  //for solve A.Y=B with work vector W
42  SP::MATH_Vector mW,mY,mB;
43  //preconditionner
44  SP::MATH_Vector mD;
45 
46  mutable SP::MATH_Vector mZ;
47 
48  WPC::EMM_DisplacementOperator mOperator;
49 
50 protected:
51  // METHODS
52 
53  // CONSTRUCTORS
54 
58 
59 
60 
61  // DESTRUCTORS
62 
63 
66  virtual ~EMM_BlockEquilibriumMatrix(void);
67 
68 public:
69 
73  virtual SP::MATH_Matrix NewInstance() const {
74  return New();
75  }
76 
80  inline static SP::EMM_BlockEquilibriumMatrix New(SPC::EMM_DisplacementOperator op,
81  const tDimension& dim) {
82  SP::EMM_BlockEquilibriumMatrix p(new EMM_BlockEquilibriumMatrix(),
84  p->setThis(p);
85  p->mOperator=op;
86  p->mDimension=dim;
87  return p;
88  };
89 
93  inline static SP::EMM_BlockEquilibriumMatrix New() {
94  SP::EMM_BlockEquilibriumMatrix p(new EMM_BlockEquilibriumMatrix(),
96  p->setThis(p);
97  return p;
98  };
99 
100  // SET methods
101 
102 public:
103 
108  virtual void setSize(const tUIndex& nRows,const tUIndex& nCols) {
109  mSize=((nRows>nCols)?nRows:nCols)*mDimension;
110  mW->setSize(mSize);
111  }
112 
116  inline const MATH_Vector& getWorkArray() const {
117  return *mW.get();
118  }
119 
120 
121 
122  // GET methods
126  virtual tUIndex getRowsNumber() const {
127  return mSize;
128  }
132  virtual tUIndex getColumnsNumber() const {
133  return mSize;
134  }
135 
136 public:
137 
146  virtual tULLInt getMemorySize() const {
147  return MATH_Matrix::getMemorySize()+mW->getMemorySize()+mB->getMemorySize()+mY->getMemorySize()+mZ->getMemorySize();
148  }
149 
150 
151 public:
152 
153 
154 protected:
155 
156 
157 public:
164  virtual void product(const tReal& beta,const MATH_Vector& x,const tReal& alpha, MATH_Vector& y) const;
165 
166 
174  virtual void product(const tReal& alpha,const MATH_Vector& x,MATH_Vector& y) const;
175 
180  virtual void product(const MATH_Vector& x,MATH_Vector& y) const;
181 
182 
183 
184 
185 
186 public:
187 
198  virtual tBoolean solve(MATH_Solver& solver,EMM_RealField& X,EMM_RealField& B);
199 
200 
201 
208  virtual const MATH_Vector& conditioning(const MATH_Vector& x) const;
209 
210 
215 
216 
217 };
218 
219 #endif
virtual void product(const tReal &beta, const MATH_Vector &x, const tReal &alpha, MATH_Vector &y) const
y:=alpha.y+beta. T . x where T is this
Definition: EMM_BlockEquilibriumMatrix.cpp:125
virtual ~EMM_BlockEquilibriumMatrix(void)
destroy
Definition: EMM_BlockEquilibriumMatrix.cpp:60
virtual tUIndex getColumnsNumber() const
get the columns number of the matrix
Definition: EMM_BlockEquilibriumMatrix.h:132
virtual const MATH_Vector & conditioning(const MATH_Vector &x) const
conditioning of a vector : suppose A is conditioned by C. It solves
Definition: EMM_BlockEquilibriumMatrix.cpp:175
This class describes a general matrix interface used in solver.
Definition: MATH_Matrix.h:20
SP::MATH_Vector mD
Definition: EMM_BlockEquilibriumMatrix.h:44
static SP::EMM_BlockEquilibriumMatrix New(SPC::EMM_DisplacementOperator op, const tDimension &dim)
create a mass matrix
Definition: EMM_BlockEquilibriumMatrix.h:80
SP::MATH_Vector mZ
Definition: EMM_BlockEquilibriumMatrix.h:46
virtual tULLInt getMemorySize() const
return the memory size in byte
Definition: EMM_BlockEquilibriumMatrix.h:146
void computeDiagonalConditioner()
compute the digonal conditioner compute a diagonal conditioner D. If no conditioning, the diagonal D contains no values
Definition: EMM_BlockEquilibriumMatrix.cpp:186
virtual tBoolean solve(MATH_Solver &solver, EMM_RealField &X, EMM_RealField &B)
sole AX=B thanks to the solver
Definition: EMM_BlockEquilibriumMatrix.cpp:69
#define tBoolean
Definition: types.h:139
virtual SP::MATH_Matrix NewInstance() const
return a share pointer to a new instance of this
Definition: EMM_BlockEquilibriumMatrix.h:73
This class describes the equilibrium matrix coressponding to the linear symmetric definite positive o...
Definition: EMM_BlockEquilibriumMatrix.h:26
virtual void setSize(const tUIndex &nRows, const tUIndex &nCols)
set the number of points in all directions
Definition: EMM_BlockEquilibriumMatrix.h:108
#define tDimension
Definition: EMM_Types.h:10
tUIndex mSize
Definition: EMM_BlockEquilibriumMatrix.h:36
static SP::EMM_BlockEquilibriumMatrix New()
create a mass matrix
Definition: EMM_BlockEquilibriumMatrix.h:93
SP_OBJECT(EMM_BlockEquilibriumMatrix)
This class describes the displacement operator defined on the data of the mesh.
Definition: EMM_DisplacementOperator.h:193
WPC::EMM_DisplacementOperator mOperator
Definition: EMM_BlockEquilibriumMatrix.h:48
DEFINE_SPTR(EMM_DisplacementOperator)
SP::MATH_Vector mY
Definition: EMM_BlockEquilibriumMatrix.h:42
SP::MATH_Vector mB
Definition: EMM_BlockEquilibriumMatrix.h:42
This class describes a masked vector.
Definition: MATH_Vector.h:16
virtual tULLInt getMemorySize() const
return the memory size in byte
Definition: MATH_Matrix.h:68
#define tUIndex
Definition: types.h:126
This class describes a solver of Ax=b.
Definition: MATH_Solver.h:18
SP::MATH_Vector mW
Definition: EMM_BlockEquilibriumMatrix.h:42
DEFINE_SVPTR(EMM_BlockEquilibriumMatrix)
const MATH_Vector & getWorkArray() const
return the work array
Definition: EMM_BlockEquilibriumMatrix.h:116
#define tULLInt
Definition: types.h:45
This class describes a real field.
Definition: EMM_RealField.h:21
EMM_BlockEquilibriumMatrix(void)
create
Definition: EMM_BlockEquilibriumMatrix.cpp:10
virtual tUIndex getRowsNumber() const
get the rows number of the matrix
Definition: EMM_BlockEquilibriumMatrix.h:126
#define tReal
Definition: types.h:118
tDimension mDimension
Definition: EMM_BlockEquilibriumMatrix.h:39
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141