visualization.h

Go to the documentation of this file.
00001 #ifndef __visualization_h
00002 #define __visualization_h
00003 
00004 #include  "meshinterface.h"
00005 #include  "visudata.h"
00006 #include  "visudatainfo.h"
00007 #include  "gnuplot.h"
00008 #include  "paramfile.h"
00009 
00010 #include  <stdio.h>
00011 #include  <fstream>
00012 
00013 /*--------------------------------------------------*/
00014 
00015 namespace Gascoigne
00016 {
00017 class Visualization
00018 {
00019  protected:
00020 
00021   /* Data */
00022 
00023   const MeshInterface*   mesh;
00024   const VisuData*        PointData;
00025   const VisuData*        CellData;
00026   const VisuDataInfo*    PointDataInfo;
00027   const VisuDataInfo*    CellDataInfo;
00028 
00029   std::string  filename;
00030   std::string  stepname;
00031   std::string  title;
00032 
00033   std::vector<GnuplotData> GP;
00034 
00035   bool    avsa, gmva, vigiea, vua, gnua, teca, vtka, compress;
00036   int     pstep, showoutput;
00037   double  time, tstep, nexttime;
00038 
00039   /* Functions */
00040 
00041   void   BasicInit();
00042 
00043   void   avs    (const std::string&)  const;
00044   void   vu     (const std::string&)  const;
00045   void   gnuplot(const std::string&)  const;
00046   void   gmv    (const std::string&)  const;
00047   void   vtk    (const std::string&)  const;
00048 
00049   void   output_vertexs             (std::ofstream&) const;
00050   void   output_quads               (std::ofstream&, const std::string& s="") const;
00051   void   output_hexs                (std::ofstream&, const std::string& s="") const;
00052   void   output_vertexs_by_component(std::ofstream&) const;
00053 
00054   int    CheckPointData() const;
00055   int    CheckCellData() const;
00056   
00057   void output_solution(std::ofstream&, int) const;
00058 
00059 
00060   void _vtk_pointdata(std::ofstream& out) const;
00061   void _vtk_celldata(std::ofstream& out) const;
00062   virtual void _vtk_points(std::ofstream& out) const;
00063   void _vtk_cells(std::ofstream& out) const;
00064 
00065 
00066  public:
00067 
00068   void SetPointData(const VisuData* VD) {
00069     assert(VD);
00070     PointData = VD;
00071   }
00072   void SetCellData(const VisuData* VD) {
00073     assert(VD);
00074     CellData = VD;
00075   }
00076   void SetPointDataInfo(const VisuDataInfo* VDI) {
00077     assert(VDI);
00078     PointDataInfo = VDI;
00079   }
00080   void SetCellDataInfo(const VisuDataInfo* VDI) {
00081     assert(VDI);
00082     CellDataInfo = VDI;
00083   }
00084 
00085   void NoOutput() {showoutput=0;}
00086 
00087   Visualization();
00088   virtual ~Visualization();
00089   Visualization(const Visualization&);
00090   Visualization& operator=(const Visualization&);
00091 
00092   void SetMesh(const MeshInterface* M) {mesh = M;}
00093 
00094   /* Functions */
00095 
00096   const std::string& get_name() const { return stepname;}
00097   void set_name       (const std::string&);
00098 
00099   void read_parameters(const ParamFile* pf);
00100 
00101   void set_time(double t)       
00102     {
00103       char ctitle[50];
00104       sprintf(ctitle,"Time: %6.4e",t); 
00105       title = ctitle; 
00106       time = t;
00107     }
00108   void set_pstep(int i)         { pstep = i; }
00109   void set_tstep(double t)      { pstep = -1; tstep = t; nexttime += t;}
00110   void set_gnuplotdata(const std::vector<GnuplotData>& gp) { GP=gp; }
00111 
00112   void  step   (int);
00113   int   active (int) const;
00114   void  format(const std::string&);
00115 
00116   void write();
00117 };
00118 }
00119 
00120 #endif

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