Class documentation of Concepts

Loading...
Searching...
No Matches
dataMatlab.hh
Go to the documentation of this file.
1
6#ifndef graphDataMatlab_hh
7#define graphDataMatlab_hh
8
9#include <string>
10#include <fstream>
11#include <sstream>
12#include <memory>
13#include <vector>
14#include "basics/typedefs.hh"
16#include "basics/exceptions.hh"
18#include "toolbox/dynArray.hh"
19#include "function/vector.hh"
20#include "geometry/formula.hh"
21#include "space/postProcess.hh"
22#include "space/function.hh"
23#include "basis.hh"
24
25// debugging
26#include "basics/debug.hh"
27
28#define Matlab2Constr_D 0
29
30namespace concepts {
31 template<class F>
32 class Vector;
33}
34
35namespace graphics {
36
37 using concepts::Real;
38 using concepts::Real2d;
39
40 // ******************************************************** DataMatlabCell **
41
46 public:
56 DataMatlabCell(std::ofstream* ofsmsh, std::ofstream* ofs1,
57 std::ofstream* ofs2, std::ofstream* ofs3,
58 uint dim, Real scl);
59
65 DataMatlabCell(std::ofstream* ofs, uint dim, Real scl);
66
69 virtual void operator()(const concepts::Element<Real>& elm);
71 virtual void operator()(const concepts::Cell& cell);
72
74 void write(std::ofstream** ofsmsh, std::ofstream** ofs1,
75 std::ofstream** ofs2, std::ofstream** ofs3);
79 const concepts::Array<Real>& coeff() const {return coeff_;}
81 const concepts::Vector<Real>* solution() const {return sol_;}
82 Real offset() const {return offset_;}
83 Real range() const {return range_;}
85 uint& count() {return cnt_;}
86 uint dim() const {return dim_;}
87 Real scale() const {return scl_;}
88 concepts::DynArray<uint>& map() {return *map_;}
89 private:
91 uint dim_;
93 Real offset_, range_;
95 std::ofstream *ofsmsh_, *ofs1_, *ofs2_, *ofs3_;
99 const concepts::Vector<Real>* sol_;
101 uint cnt_;
103 Real scl_;
104
106 std::unique_ptr<concepts::DynArray<uint> > map_;
107 };
108
109 // ************************************************************ DataMatlab **
110
130 public:
137 DataMatlab(concepts::Space<Real>& spc, const std::string filename,
138 uint dim = 2, Real scl = 1.0);
139 ~DataMatlab() {closeStreams_();}
140
145
146 private:
148 void createStreams_(std::string filename);
150 void closeStreams_();
151
153 uint dim_;
155 uint cnt_;
157 std::unique_ptr<std::ofstream> ofsmsh_;
159 std::unique_ptr<std::ofstream> ofs1_, ofs2_, ofs3_;
160
163 std::unique_ptr<DataMatlabCell> mtlb_;
164 };
165
166} // namespace graphics
167
168#endif // graphDataMatlab_hh
const concepts::Array< Real > & coeff() const
Returns the coefficients of the elements shape functions.
Definition dataMatlab.hh:79
const concepts::Vector< Real > * solution() const
Returns pointer to vector to plot.
Definition dataMatlab.hh:81
uint & count()
Number of points written to the files, used for mesh representation.
Definition dataMatlab.hh:85
DataMatlabCell(std::ofstream *ofs, uint dim, Real scl)
virtual void operator()(const concepts::Element< Real > &elm)
void write(std::ofstream **ofsmsh, std::ofstream **ofs1, std::ofstream **ofs2, std::ofstream **ofs3)
Returns the streams to write the data to.
void setVec(const concepts::Vector< Real > *sol)
Sets the vector of the variable to plot.
virtual void operator()(const concepts::Cell &cell)
not operational
DataMatlabCell(std::ofstream *ofsmsh, std::ofstream *ofs1, std::ofstream *ofs2, std::ofstream *ofs3, uint dim, Real scl)
void operator()(const concepts::Vector< Real > &sol)
DataMatlab(concepts::Space< Real > &spc, const std::string filename, uint dim=2, Real scl=1.0)
double Real
Definition typedefs.hh:39