00001
00005 class LinEqMatrix : public HandleId
00006
00007 {
00008 MatSimplest(HandleT_Matrix(NUMT)) matmat;
00009
00010 bool single_mat;
00011 bool factorized;
00012
00013 void trace ();
00014
00015 public:
00016
00017 LinEqMatrix () {}
00018 LinEqMatrix (int nblockrows, int nblockcolumns);
00019 LinEqMatrix (const LinEqMatrix& M);
00020 LinEqMatrix (Matrix(NUMT)& mat);
00021 ~LinEqMatrix ();
00022
00023 void size (int& nblockrows, int& nblockcolumns) const {
00024 matmat.size(nblockrows,nblockcolumns);
00025 }
00026
00027 int getNoRows () const;
00028 int getNoColumns () const;
00029
00030 bool redim (int nblockrows = 1, int nblockcolumns = 1);
00031 bool redim (const LinEqMatrix_prm& matprm);
00032 bool redim (const LinEqMatrix& M);
00033
00034 void optimizeDataStructure ();
00035
00036 int getWork (const MatrixWork work_tp = MATVEC_WORK) const;
00037 real getStorage() const;
00038
00039 bool ok () const;
00040 bool single () const;
00041
00042 TransposeMode transposeMode (int i = 1, int j = 1) const {
00043 return matmat(i,j).tpmode;
00044 }
00045
00046 Matrix(NUMT)& mat (int i = 1, int j = 1)
00047 { return matmat(i,j).getRef(); }
00048
00049 const Matrix(NUMT)& mat (int i = 1, int j = 1) const
00050 { return matmat(i,j).getRef(); }
00051
00052 void attach (const Matrix(NUMT)& mat, int i = 1, int j = 1,
00053 TransposeMode tpmode = NOT_TRANSPOSED);
00054
00055 LinEqMatrix& operator = (const LinEqMatrix& M);
00056 LinEqMatrix& operator = (NUMT a);
00057
00058 void assemble
00059 (
00060 const Mat(NUMT)& em,
00061 const VecSimple(int)& idx_row_trans,
00062 const VecSimple(int)& idx_col_trans,
00063 int elm_no,
00064 int i = 1,
00065 int j = 1
00066 );
00067
00068 void assemble
00069 (
00070 const Mat(NUMT)& em,
00071 const VecSimple(int)& idx_trans,
00072 int elm_no,
00073 int i = 1,
00074 int j = 1
00075 );
00076
00077 bool blockCompatible (const LinEqVector& x, const LinEqVector& b,
00078 TransposeMode tpmode = NOT_TRANSPOSED) const;
00079
00080 void prod
00081 (
00082 const LinEqVector& x,
00083 LinEqVector& y,
00084 TransposeMode tpmode = NOT_TRANSPOSED,
00085 bool add_to_yb = false
00086 ) const;
00087
00088 void resetFact ();
00089 bool factorize (const FactStrategy& fstrategy);
00090 void forwBack (LinEqVector& b, LinEqVector& x);
00091
00092 void SSOR1it (LinEqVector& xnew, const LinEqVector& xold,
00093 const LinEqVector& b, real omega,
00094 TransposeMode tpmode = NOT_TRANSPOSED) const;
00095 void SSORsolve (LinEqVector& y, const LinEqVector& c, real omega,
00096 TransposeMode tpmode = NOT_TRANSPOSED) const;
00097
00098 void SOR1it (LinEqVector& xnew, const LinEqVector& xold,
00099 const LinEqVector& b, real omega,
00100 TransposeMode tpmode = NOT_TRANSPOSED) const;
00101 void SORsolve (LinEqVector& y, const LinEqVector& c, real omega,
00102 TransposeMode tpmode = NOT_TRANSPOSED) const;
00103
00104 void Jacobi1it (LinEqVector& xnew, const LinEqVector& xold,
00105 const LinEqVector& b,
00106 TransposeMode tpmode = NOT_TRANSPOSED) const;
00107 void Jacobisolve (LinEqVector& y, const LinEqVector& c,
00108 TransposeMode tpmode = NOT_TRANSPOSED) const;
00109
00110 const MatDense(NUMT)& getMatDense (int i = 1, int j = 1) const;
00111 MatDense(NUMT)& getMatDense (int i = 1, int j = 1);
00112 const MatBand(NUMT)& getMatBand (int i = 1, int j = 1) const;
00113 MatBand(NUMT)& getMatBand (int i = 1, int j = 1);
00114 const MatDiag(NUMT)& getMatDiag (int i = 1, int j = 1) const;
00115 MatDiag(NUMT)& getMatDiag (int i = 1, int j = 1);
00116 const MatTri(NUMT)& getMatTri (int i = 1, int j = 1) const;
00117 MatTri(NUMT)& getMatTri (int i = 1, int j = 1);
00118 const MatStructSparse(NUMT)& getMatStructSparse (int i = 1, int j = 1) const;
00119 MatStructSparse(NUMT)& getMatStructSparse (int i = 1, int j = 1);
00120 const MatSparse(NUMT)& getMatSparse (int i = 1, int j = 1) const;
00121 MatSparse(NUMT)& getMatSparse (int i = 1, int j = 1);
00122
00123
00124
00125
00126
00127 void debugPrint (Os os, const char* header) const;
00128 friend Os& operator << (Os& os, const LinEqMatrix& m);
00129 };
00130
00131