00001 00005 class LinEqAdm : public HandleId 00006 00007 { 00008 protected: 00009 00010 static bool menu_changes_allowed; 00011 static bool full_menu_in_use; 00012 static int max_value_of_ncm; 00013 00014 bool hasblocks; 00015 int rowblocks, colblocks; 00016 00017 CPUclock cpu; 00018 double cpu_time_solve; 00019 00020 bool compute_A; 00021 bool compute_RHS; 00022 bool compute_prec; 00023 00024 bool attach_prec_prm; 00025 bool attached_solver; 00026 00027 LinEqStorageMode storage_mode; 00028 00029 LinEqMatrix_prm mat_prm; 00030 LinEqVector_prm vec_prm; 00031 00032 Handle(LinEqSolver_prm) solver_prm; 00033 Handle(Precond_prm) prec_prm; 00034 00035 Handle(ConvMonitorList_prm) cmlist_prm; 00036 Handle(LinEqSolver) solver; 00037 Handle(LinEqSystemPrec) msys; 00038 00039 LinEqStatBlk performance_info; 00040 int performance_updated; 00041 00042 Handle(SubdCommAdm) comm_adm; 00043 00044 void cputime(); 00045 void computePerformance (); 00046 void okSystem (const char* func_name); 00047 00048 public: 00049 00050 LinEqAdm (LinEqStorageMode storage_mode = EXTERNAL_SOLUTION); 00051 LinEqAdm (int rows, int cols, 00052 LinEqStorageMode storage_mode = EXTERNAL_SOLUTION); 00053 ~LinEqAdm (); 00054 00055 00056 void setBlockStructure(int i, int j); 00057 00058 bool ok (bool after_solve = false) const; 00059 00060 bool computeA () const { return compute_A; } 00061 bool computeRHS () const { return compute_RHS; } 00062 bool computePrec () const { return compute_prec; } 00063 00064 bool hasBlocks() ; 00065 00066 void attach (LinEqSystemPrec& system); 00067 00068 void attach (LinEqMatrix& A, LinEqVector& x, LinEqVector& b); 00069 void attach (LinEqVector& x); 00070 00071 void attach (Matrix(NUMT)& A, Vector(NUMT)& x, Vector(NUMT)& b); 00072 void attach (Vector(NUMT)& x); 00073 00074 void attach (ConvMonitorList_prm& cmlist_prm); 00075 00076 void attach (Precond_prm& prec_prm); 00077 void attach (Precond_prm& prec_prm, PrecBasis& Apb); 00078 00079 void attach (Precond_prm& prec_prm, LinEqMatrix& Apb_mat, 00080 bool Apb_is_A = true); 00081 00082 void attach (Precond_prm& prec_prm, Matrix(NUMT)& Apb_mat, 00083 bool Apb_is_A = true); 00084 00085 void attach (Precond& prec); 00086 void attach (Precond& prec, PrecBasis& Apb); 00087 void attach (Precond& prec, LinEqMatrix& Apb_mat, bool Apb_is_A = true); 00088 void attach (Precond& prec, Matrix(NUMT)& Apb_mat, bool Apb_is_A = true); 00089 00090 void attach (LinEqSolver& solver_); 00091 00092 void detach (); 00093 00094 Precond& getPrec (const bool left = true); 00095 00096 void getPrec (LinEqMatrix& precmat, String& precname, 00097 const bool left = true) const; 00098 00099 LinEqSystemPrec& getLinEqSystem () { return msys.getRef(); } 00100 LinEqSolver& getSolver () { return solver.getRef(); } 00101 int getConvMonitors (Handle(ConvMonitorList)& monitors) const; 00102 00103 const Matrix(prm_NUMT)& getMatrixPrm () const { return mat_prm.mat(); } 00104 const LinEqSolver_prm& getSolverPrm () const { return *solver_prm; } 00105 const Precond_prm& getPrecondPrm() const; 00106 const ConvMonitorList_prm& getMonitorListPrm () const; 00107 00108 bool solve (bool A_has_changed = true); 00109 00110 00111 LinEqMatrix& Al (); 00112 LinEqVector& xl (); 00113 LinEqVector& bl (); 00114 00115 Matrix(NUMT)& A (); 00116 Vector(NUMT)& x (); 00117 Vector(NUMT)& b (); 00118 00119 00120 bool getStatistics (int& niterations, bool& converged); 00121 LinEqStatBlk& getPerformance(); 00122 00123 void print (Os os) const; 00124 void scan (Is is); 00125 00126 static void allowMenuChanges (); 00127 00128 static void fullMenu (bool onoff = ON, int maxNoMonitors = 0); 00129 static bool fullMenuInUse () { return full_menu_in_use; } 00130 00131 static void defineStatic (MenuSystem& menu, int level); 00132 static void defineStatic0 (MenuSystem& menu, int level); 00133 virtual void define (MenuSystem& menu, int level = MAIN); 00134 00135 virtual void scan (MenuSystem& menu); 00136 00137 void scan (const LinEqAdm& lineq); 00138 00139 void debugPrint (Os os, int amount_of_output = 1) const; 00140 00141 double getCPUtime4solve () const { return cpu_time_solve; } 00142 00143 void attachCommAdm (const SubdCommAdm& adm_); 00144 00145 CLASS_INFO 00146 00147 DEF_VIRTUAL_CAST(LinEqAdmFE) 00148 DEF_VIRTUAL_CAST(LinEqAdmFV) 00149 }; 00150 00151