Class documentation of Concepts

Loading...
Searching...
No Matches
dataGnuplot.hh
Go to the documentation of this file.
1
6#ifndef graphDataGnuplot_hh
7#define graphDataGnuplot_hh
8
9#include <string>
10#include <fstream>
11#include <memory>
12#include "basics/typedefs.hh"
14#include "basics/exceptions.hh"
15#include "space/postProcess.hh"
16#include "space/formula.hh"
17#include "space/function.hh"
18#include "function/vector.hh"
19
20
21namespace concepts {
22 // forward declaration
23 template<class F>
24 class Formula;
25
26 template<class F, class G>
27 class ElementFormula;
28}
29
30namespace graphics {
31 using concepts::Real;
32
33 // ******************************************************* DataGnuplotCell **
34
38 template<typename F>
40 public:
47 DataGnuplotCell(std::ofstream* ofs,
48 const concepts::Vector<Real>& solution,
49 const concepts::ElementFunction<Real>* fun = 0);
54 DataGnuplotCell(std::ofstream* ofs, const concepts::Formula<Real>& frm,
55 const concepts::ElementFunction<Real>* fun = 0);
60 DataGnuplotCell(std::ofstream* ofs,
62 const concepts::ElementFunction<Real>* fun = 0);
63 virtual ~DataGnuplotCell();
64 virtual void operator() (const concepts::Element<F>& elm);
65 virtual void operator() (const concepts::Cell& cell);
67 std::ofstream* write() { return ofs_; }
69 const concepts::Array<Real>& coeff() const { return coeff_; }
71 const concepts::Formula<Real>* formula() const { return frm_.get(); }
74 return frmElm_;
75 }
78 return fun_;
79 }
80 private:
82 std::ofstream* ofs_;
86 const concepts::Vector<Real>* solution_;
88 std::unique_ptr<const concepts::Formula<Real> > frm_;
90 const concepts::ElementFormula<F>* frmElm_;
93 };
94
95 // *********************************************************** DataGnuplot **
96
106 template<typename T, typename S>
107 void drawDataGnuplot(T& msh_spc, std::string filename, const S& sol,
108 const concepts::ElementFunction<Real>* fun = 0) {
109 std::ofstream ofs(filename.c_str());
110 concepts::GlobalPostprocess<Real> postProcess(msh_spc);
111 DataGnuplotCell<Real> gnu(&ofs, sol, fun);
112 postProcess(gnu);
113 }
114
115} // namespace graphics
116
117#endif // graphDataGnuplot_hh
DataGnuplotCell(std::ofstream *ofs, const concepts::Vector< Real > &solution, const concepts::ElementFunction< Real > *fun=0)
DataGnuplotCell(std::ofstream *ofs, const concepts::Formula< Real > &frm, const concepts::ElementFunction< Real > *fun=0)
virtual void operator()(const concepts::Element< F > &elm)
const concepts::Array< Real > & coeff() const
Returns the coefficients of the elements shape functions.
DataGnuplotCell(std::ofstream *ofs, const concepts::ElementFormula< F > &frm, const concepts::ElementFunction< Real > *fun=0)
const concepts::ElementFunction< F > * elementFunction() const
Returns the function of the solution.
const concepts::ElementFormula< F > * elementFormula() const
Returns the formula to plot (given elementwise)
std::ofstream * write()
Returns the stream to write the data to.
const concepts::Formula< Real > * formula() const
Returns the formula to plot.
double Real
Definition typedefs.hh:39
void drawDataGnuplot(T &msh_spc, std::string filename, const S &sol, const concepts::ElementFunction< Real > *fun=0)