00001 /* graphics of the mesh in Gnuplot 00002 */ 00003 00004 #ifndef graphMeshGnuplot_hh 00005 #define graphMeshGnuplot_hh 00006 00007 #include <string> 00008 #include <fstream> 00009 #include <memory> 00010 #include "basics/typedefs.hh" 00011 #include "basics/vectorsMatricesForward.hh" 00012 #include "basics/exceptions.hh" 00013 #include "space/postProcess.hh" 00014 00015 namespace graphics { 00016 using concepts::Real; 00017 00018 // ******************************************************* MeshGnuplotCell ** 00019 00023 template<typename F> 00024 class MeshGnuplotCell : public concepts::CellPostprocess<F> { 00025 public: 00026 MeshGnuplotCell(std::ofstream* ofs) : ofs_(ofs) {} 00027 virtual ~MeshGnuplotCell(); 00028 virtual void operator() (const concepts::Element<F>& elm) 00029 throw(concepts::MissingFeature); 00030 virtual void operator() (const concepts::Cell& cell) 00031 throw(concepts::MissingFeature); 00032 std::ofstream* write() { return ofs_; } 00033 private: 00034 std::ofstream* ofs_; 00035 }; 00036 00037 // *********************************************************** MeshGnuplot ** 00038 00043 template<typename T> 00044 void drawMeshGnuplot(T& msh_spc, std::string filename) { 00045 std::ofstream ofs(filename.c_str()); 00046 concepts::GlobalPostprocess<Real> postProcess(msh_spc); 00047 MeshGnuplotCell<Real> gnu(&ofs); 00048 postProcess(gnu); 00049 } 00050 00051 } // namespace graphics 00052 00053 #endif // graphMeshGnuplot_hh