00001 00005 class MatEBE(Type) : public Matrix(Type) 00006 00007 { 00008 00009 private: 00010 00011 Type dummy_entry; 00012 00013 virtual void copy_matrix_attributes (const Matrix(Type)& X); 00014 00015 virtual void reset (); 00016 00017 Type* startOfAlloc () const; 00018 Type* endOfAlloc () const; 00019 Type& entry (Type* ap) const; 00020 00021 protected: 00022 00023 ArrayGen(Type) a; 00024 00025 ArrayGenSimple(int) loc2glob_eqs; 00026 ArrayGenSimple(int) loc2glob_dof; 00027 00028 00029 int no_eqs; 00030 int no_dof; 00031 int no_elms; 00032 int maxno_elmeqs; 00033 int maxno_elmdof; 00034 00035 bool all_elms_of_same_type; 00036 00037 00038 00039 void copy_simple_parameters (const MatEBE(Type)& X); 00040 00041 public: 00042 00043 00044 00045 MatEBE(Type) () 00046 : Matrix(Type) () { reset(); } 00047 00048 MatEBE(Type) (const Matrix(prm_Type)& pm); 00049 MatEBE(Type) (const MatEBE(Type)& X); 00050 MatEBE(Type) (int no_eqs, int no_dof, int no_elms, int maxno_elmeqs, 00051 int maxno_elmdof, bool all_elms_of_same_type = true); 00052 virtual ~MatEBE(Type) (); 00053 00054 00055 00056 00057 virtual int getNoRows () const { 00058 return no_eqs; 00059 } 00060 00061 virtual int getNoColumns () const { 00062 return no_dof; 00063 } 00064 00065 virtual int getNoNonzeroes () const { 00066 return size(); 00067 } 00068 00069 virtual int getMaxNoElmEqs () const { 00070 return maxno_elmeqs; 00071 } 00072 00073 virtual int getMaxNoElmDof () const { 00074 return maxno_elmdof; 00075 } 00076 00077 virtual void size (int& m, int& n) const; 00078 00079 int size() const; 00080 00081 virtual int getWork (const MatrixWork work_tp = MATVEC_WORK) const; 00082 virtual real getStorage() const; 00083 00084 00085 00086 00087 virtual bool makeItSimilar (Handle(Matrix(Type))& M) const; 00088 virtual bool redim (const Matrix(prm_Type)& pm); 00089 00090 bool redim(int no_eqs, int no_dof, int no_elms, int maxno_elmeqs, 00091 int maxno_elmdof, bool all_elms_of_same_type = true); 00092 00093 00094 00095 00096 virtual bool redim (const VecSimple(int)& ivec, 00097 const VecSimple(int)& jvec, 00098 int new_nrows, 00099 int new_ncolumns); 00100 virtual void getIndexSet (VecSimple(int)& ivec, 00101 VecSimple(int)& jvec) const; 00102 virtual bool validIndexSet (const VecSimple(int)& ivec, 00103 const VecSimple(int)& jvec, 00104 const int new_nrows, 00105 const int new_ncolumns); 00106 00107 00108 00109 00110 virtual Type& elm (int i, int j); 00111 00112 Type& operator () (int e, int i, int j); 00113 const Type& operator () (int e, int i, int j) const; 00114 00115 virtual void fill (const Matrix(Type)& X); 00116 virtual void fill (Type b) { a.fill(b); } 00117 00118 MatEBE(Type)& operator = (const MatEBE(Type)& X); 00119 MatEBE(Type)& operator = (Type b) { a.fill(b); return *this; } 00120 00121 virtual void assemble (const Mat(Type)& em, 00122 const VecSimple(int)& idx_row_trans, 00123 const VecSimple(int)& idx_col_trans, int e); 00124 00125 00126 00127 virtual void add (Matrix(Type)& bb, Matrix(Type)& cb); 00128 virtual void add (Matrix(Type)& bb, char s, Matrix(Type)& cb); 00129 virtual void add (Matrix(Type)& bb, Type b, Matrix(Type)& cb); 00130 virtual void add (Type a, Matrix(Type)& bb, Type b, Matrix(Type)& cb); 00131 00132 00133 virtual void mult (Type value); 00134 00135 virtual void prod 00136 ( 00137 const Vector(Type)& xb, 00138 Vector(Type)& yb, 00139 TransposeMode tpmode = NOT_TRANSPOSED, 00140 bool add_to_yb = false 00141 ) const; 00142 00143 00144 00145 00146 00147 bool factChol (bool zero_upper_part = true); 00148 void forwBackChol (Vec(Type)& b, Vec(Type)& x); 00149 00150 bool factLU (); 00151 void forwBackLU (Vec(Type)& b, Vec(Type)& x); 00152 00153 bool factRILU (real omega = 0.0, int level = 0); 00154 void forwBackRILU (Vec(Type)& b, Vec(Type)& x); 00155 00156 virtual bool factorize (const FactStrategy& fstrategy); 00157 virtual void forwBack (Vector(Type)& b, Vector(Type)& x); 00158 00159 virtual void inverse (Mat(Type)& inv); 00160 void inverse (MatEBE(Type)& inv); 00161 00162 Type det(); 00163 00164 00165 00166 00167 virtual void SSOR1it (Vector(Type)& xnew, const Vector(Type)& xold, 00168 const Vector(Type)& b, real omega, 00169 TransposeMode tpmode = NOT_TRANSPOSED) const; 00170 virtual void SSORsolve (Vector(Type)& y, const Vector(Type)& c, 00171 real omega, 00172 TransposeMode tpmode = NOT_TRANSPOSED) const; 00173 00174 virtual void SOR1it (Vector(Type)& xnew, const Vector(Type)& xold, 00175 const Vector(Type)& b, real omega, 00176 TransposeMode tpmode = NOT_TRANSPOSED) const; 00177 virtual void SORsolve (Vector(Type)& y, const Vector(Type)& c, 00178 real omega, 00179 TransposeMode tpmode = NOT_TRANSPOSED) const; 00180 00181 virtual void Jacobi1it (Vector(Type)& xnew, const Vector(Type)& xold, 00182 const Vector(Type)& b, 00183 TransposeMode tpmode = NOT_TRANSPOSED) const; 00184 virtual void Jacobisolve (Vector(Type)& y, const Vector(Type)& c, 00185 TransposeMode tpmode = NOT_TRANSPOSED) const; 00186 00187 00188 00189 00190 virtual void print (Os os, const char* header = NULL, 00191 int nentries_per_line = 3 ) const; 00192 virtual void printAscii (Os os, const char* header = NULL) const; 00193 00194 virtual void scan (Is is); 00195 00196 friend Os& operator << (Os& os, const MatEBE(Type)& X); 00197 friend Is& operator >> (Is& is, MatEBE(Type)& X); 00198 00199 virtual void save (const char* filename, const char* name = "X") const; 00200 virtual void load (const char* filename, const char* name = "X"); 00201 00202 CLASS_INFO 00203 00204 VIRTUAL_CAST(MatEBE(Type)); 00205 00206 00207 }; 00208 00209