nlinfo.h

Go to the documentation of this file.
00001 #ifndef __nlinfo_h
00002 #define __nlinfo_h
00003 
00004 #include "cginfo.h"
00005 
00006 /*************************************************************/
00007 
00008 namespace Gascoigne
00009 {
00010 class NLStatisticData : public StatisticData
00011 {
00012   int  _newmatrix;
00013   int  _totalmatrix;
00014 
00015  public:
00016 
00017   int& totalmatrix()       { return _totalmatrix; }
00018   int  totalmatrix() const { return _totalmatrix; }
00019   int& newmatrix()       { return _newmatrix; }
00020   int  newmatrix() const { return _newmatrix; }
00021 
00022   void reset();
00023 
00024   friend std::ostream& operator<<(std::ostream &s, const NLStatisticData& A);
00025 };
00026 
00027 /*************************************************************/
00028 
00029 class NLControlData : public ControlData
00030 {
00031   int _relax, _newmatrix, _laststepbad, _matrixmustbebuild;
00032 
00033  public:
00034 
00035   NLControlData();
00036   int  relax()     const { return _relax;}
00037   int& relax()           { return _relax;}
00038   int  newmatrix() const { return _newmatrix;}
00039   int& newmatrix()       { return _newmatrix;}
00040   int  laststepbad() const { return _laststepbad;}
00041   int& laststepbad()       { return _laststepbad;}
00042 
00043   int  matrixmustbebuild() const { return _matrixmustbebuild;}
00044   int& matrixmustbebuild()       { return _matrixmustbebuild;}
00045 
00046   void reset();
00047 
00048   friend std::ostream& operator<<(std::ostream &s, const NLControlData& A);
00049 };
00050 
00051 /*************************************************************/
00052 
00053 class NLUserData : public UserData
00054 {
00055   double _rho, _linrho, _maxresincrease;
00056   int    _maxrelax;
00057 
00058  public:
00059 
00060   NLUserData();
00061 
00062   double  rho()      const { return _rho;}
00063   double& rho()            { return _rho;}
00064   double  linrho()      const { return _linrho;}
00065   double& linrho()            { return _linrho;}
00066   int     maxrelax() const { return _maxrelax;}
00067   int&    maxrelax()       { return _maxrelax;}
00068 
00069   double  maxresincrease() const { return _maxresincrease;}
00070   double& maxresincrease()       { return _maxresincrease;}
00071 
00072   friend std::ostream& operator<<(std::ostream &s, const NLUserData& A);
00073 };
00074 
00075 /*************************************************************/
00076 
00077 class NLInfo
00078 {
00079   CGInfo&        Linfo;
00080 
00081   NLStatisticData SD;
00082   NLControlData   CD;
00083   NLUserData      UD;
00084 
00085   void compute_reduction_rate();
00086   void matrix_control();
00087 
00088  public:
00089 
00090   NLInfo(CGInfo&, double f = 1.e-8, double r=1.e-15, int p = 10, 
00091          int m = 5000, const std::string& txt = "NLIt: ");
00092 
00093   CGInfo& GetLinearInfo() {return Linfo;}
00094   const CGInfo& GetLinearInfo() const {return Linfo;}
00095 
00096   friend std::ostream& operator<<(std::ostream &s, const NLInfo& A);
00097 
00098   const NLStatisticData& statistics() const { return SD; }
00099         NLStatisticData& statistics()       { return SD; }
00100   const NLControlData&   control()    const { return CD; }
00101         NLControlData&   control()          { return CD; }
00102   const NLUserData&      user()       const { return UD; }
00103         NLUserData&      user()             { return UD; }
00104 
00105  bool   check         (double res, double cor = 0.);
00106  bool   check         (int iter, double res, double cor = 0.);
00107  std::string check_damping (int, double);
00108  void reset();
00109  void new_matrix();
00110 
00111  std::string CheckMatrix();
00112 };
00113 
00114 /*************************************************************/
00115 }
00116 
00117 #endif

Generated on Thu Sep 14 10:34:35 2006 for Gascoigne by  doxygen 1.4.7