monitoring.h

Go to the documentation of this file.
00001 #ifndef __monitoring_h
00002 #define __monitoring_h
00003 
00004 #include "nvector.h"
00005 
00006 /*---------------------------------------------------------*/
00007 
00008 namespace Gascoigne
00009 {
00010 class Monitoring
00011 {
00012  protected:
00013 
00014   std::vector<DoubleVector > Juh, Je;
00015   DoubleVector               eta, nnodes, ncells;
00016   DoubleVector               Ju;
00017   int                        niter;
00018   int                        _i_show_status_on_destruct;
00019 
00020  public:
00021 
00022   Monitoring() {
00023     _i_show_status_on_destruct = 1;
00024   }
00025   ~Monitoring() 
00026     {
00027       if(_i_show_status_on_destruct)
00028         {
00029           std::cout << "Monitor" << std::endl;
00030           std::cout << "----------------------------------" << std::endl;
00031           std::cout << "-- nn   nc   j   eta   je   eff --" << std::endl;
00032           std::cout << "----------------------------------" << std::endl;
00033           for (int i=0; i<Juh.size(); i++)
00034             {
00035               std::cout << nnodes[i] << " ";
00036               std::cout << ncells[i] << " ";
00037               std::cout << Juh[i] << " ";
00038               std::cout << eta[i] << " ";
00039               std::cout << Je[i] << " ";
00040               std::cout << eff(i) << std::endl;
00041             }
00042           std::cout << "----------------------------------" << std::endl;
00043         }
00044     }
00045   void BasicInit(const DoubleVector& ju) 
00046     { 
00047       Ju = ju; 
00048     }
00049   void ShowStatusOnDestruct(int i_showvalue)
00050     {
00051       _i_show_status_on_destruct = i_showvalue;
00052     }
00053   void SetMeshInformation(int iter, int nodes, int cells)
00054     {
00055       assert(iter>=1);
00056       niter = iter;
00057       Juh.resize(niter);
00058       Je .resize(niter);
00059       eta.resize(niter);
00060       nnodes.resize(niter); nnodes[iter-1] = nodes;
00061       ncells.resize(niter); ncells[iter-1] = cells;
00062     }
00063   void SetSolutionInformation(int iter, DoubleVector juh, double et)
00064     {
00065       assert(niter==iter);
00066       Juh[iter-1] = juh;
00067       Je [iter-1] = Ju;
00068       Je [iter-1].add(-1,juh);
00069       eta[iter-1] = et;
00070     }
00071   double eff(int i) const { if(Je[i].size()==0) return -1.; else return eta[i]/Je[i][0];}
00072   void output() const
00073     {
00074       int i = ncells.size()-1;
00075       std::cout << "## " << nnodes[i] << " ";
00076       std::cout << ncells[i] << " ";
00077       std::cout << Juh[i] << " ";
00078       std::cout << eta[i] << " ";
00079       std::cout << Je[i] << " ";
00080       std::cout << eff(i) << std::endl;
00081     }
00082 };
00083 }
00084 
00085 /*---------------------------------------------------------*/
00086 
00087 #endif

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