Go to the documentation of this file.00001
00002
00003
00004 #ifndef graphDataMatlab_hh
00005 #define graphDataMatlab_hh
00006
00007 #include <string>
00008 #include <fstream>
00009 #include <sstream>
00010 #include <memory>
00011 #include <vector>
00012 #include "basics/typedefs.hh"
00013 #include "basics/vectorsMatricesForward.hh"
00014 #include "basics/exceptions.hh"
00015 #include "toolbox/elementGraphics.hh"
00016 #include "toolbox/dynArray.hh"
00017 #include "function/vector.hh"
00018 #include "geometry/formula.hh"
00019 #include "space/postProcess.hh"
00020 #include "space/function.hh"
00021 #include "basis.hh"
00022
00023
00024 #include "basics/debug.hh"
00025
00026 #define Matlab2Constr_D 0
00027
00028 namespace concepts {
00029 template<class F>
00030 class Vector;
00031 }
00032
00033 namespace graphics {
00034
00035 using concepts::Real;
00036 using concepts::Real2d;
00037
00038
00039
00043 class DataMatlabCell : public concepts::CellPostprocess<Real> {
00044 public:
00054 DataMatlabCell(std::ofstream* ofsmsh, std::ofstream* ofs1,
00055 std::ofstream* ofs2, std::ofstream* ofs3,
00056 uint dim, Real scl);
00057
00063 DataMatlabCell(std::ofstream* ofs, uint dim, Real scl);
00064
00067 virtual void operator()(const concepts::Element<Real>& elm)
00068 throw(concepts::MissingFeature);
00070 virtual void operator()(const concepts::Cell& cell)
00071 throw(concepts::MissingFeature);
00072
00074 void write(std::ofstream** ofsmsh, std::ofstream** ofs1,
00075 std::ofstream** ofs2, std::ofstream** ofs3);
00077 void setVec(const concepts::Vector<Real>* sol);
00079 const concepts::Array<Real>& coeff() const {return coeff_;}
00081 const concepts::Vector<Real>* solution() const {return sol_;}
00082 Real offset() const {return offset_;}
00083 Real range() const {return range_;}
00085 uint& count() {return cnt_;}
00086 uint dim() const {return dim_;}
00087 Real scale() const {return scl_;}
00088 concepts::DynArray<uint>& map() {return *map_;}
00089 private:
00091 uint dim_;
00093 Real offset_, range_;
00095 std::ofstream *ofsmsh_, *ofs1_, *ofs2_, *ofs3_;
00097 concepts::Array<Real> coeff_;
00099 const concepts::Vector<Real>* sol_;
00101 uint cnt_;
00103 Real scl_;
00104
00106 std::auto_ptr<concepts::DynArray<uint> > map_;
00107 };
00108
00109
00110
00129 class DataMatlab {
00130 public:
00137 DataMatlab(concepts::Space<Real>& spc, const std::string filename,
00138 uint dim = 2, Real scl = 1.0);
00139 ~DataMatlab() {closeStreams_();}
00140
00144 void operator()(const concepts::Vector<Real>& sol);
00145
00146 private:
00148 void createStreams_(std::string filename);
00150 void closeStreams_();
00151
00153 concepts::Space<Real>* spc_;
00155 uint dim_;
00157 uint cnt_;
00159 std::auto_ptr<std::ofstream> ofsmsh_;
00161 std::auto_ptr<std::ofstream> ofs1_, ofs2_, ofs3_;
00162
00164 concepts::GlobalPostprocess<Real> postProcess_;
00165 std::auto_ptr<DataMatlabCell> mtlb_;
00166 };
00167
00168 }
00169
00170 #endif // graphDataMatlab_hh