matlabBinaryGraphics.hh

Go to the documentation of this file.
1 
7 #ifndef matlab_binary_hh
8 #define matlab_binary_hh
9 
10 #include "matfile/matfileIO.hh"
11 
12 #include "basics/outputMatlab.hh"
15 #include "denseMatrixGraphics.hh"
16 #include "matfile/matfileIO.hh"
17 
18 namespace graphics {
19 
20  // ************************************************** MatlabBinaryGraphics **
21 
28  public DenseMatrixGraphics {
29  public:
30 
35  MatlabBinaryGraphics(const std::string filename);
36 
41  template<class G>
43  const std::string filename);
44 
50  MatlabBinaryGraphics(concepts::Mesh& msh, const std::string filename,
51  const uint points = 5);
52 
59  template<class G, class F>
61  const std::string filename,
62  const concepts::Vector<F>& sol,
63  const concepts::ElementFunction<F, G>* fun = 0);
64 
72  template<class G, class F>
74  const std::string filename,
75  const concepts::Vector<F>& sol,
76  const std::string varName,
77  const concepts::ElementFunction<F, G>* fun = 0);
78 
85  template<class G, class F>
87  const std::string filename,
88  std::vector<concepts::Vector<F> >& sol,
89  const concepts::ElementFunction<F, G>* fun = 0);
90 
96  template<class G, class F>
98  const std::string filename,
100 
102 
109  template<class F, class G>
110  void addSolution(const concepts::Space<G>& spc, const std::string name,
111  const concepts::Vector<F>& sol,
112  const concepts::ElementFunction<F, G>* fun = 0);
113 
119  template<class F, class G>
120  void addFunction(const concepts::Space<G>& spc, const std::string name,
121  const concepts::ElementFormula<F, G>& frm);
122  protected:
126  template<class G>
127  void addSpace_(const concepts::Space<G>& spc);
128 
130  template<class G>
131  void storeData_(DenseMatrixCollection<G>& dense_ptr_);
132 
134  uint data_;
135  };
136 
137  template<class G, class F>
139  const std::string filename,
140  const concepts::Vector<F>& sol,
142  : concepts::MatfileIO(filename), DenseMatrixGraphics()
143  {
144  this->addSpace_(spc);
145  this->addSolution(spc, "u", sol, fun);
146  }
147 
148 
149  template<class G, class F>
151  const std::string filename,
152  const concepts::Vector<F>& sol,
153  const std::string varName,
155  :concepts::MatfileIO(filename), DenseMatrixGraphics()
156  {
157  this->addSpace_(spc);
158  this->addSolution(spc, varName, sol, fun);
159  }
160 
161  template<class G>
163  const std::string filename) :
164  concepts::MatfileIO(filename), DenseMatrixGraphics() {
165 
166  this->addSpace_(spc);
167  }
168 
169  template<class G, class F>
171  const std::string filename, const concepts::ElementFormula<F, G>& frm) :
172  concepts::MatfileIO(filename) {
173  this->addSpace_(spc);
174  this->addFunction(spc, "u", frm);
175  }
176 
177  template<class F, class G>
179  const std::string name,
180  const concepts::Vector<F>& sol,
182  {
183  // get matrix of the solution
185  function = this->getSolution(spc, sol, fun);
186  // store matrix
187  this->add(*function, name);
188  }
189 
190  template<class F, class G>
192  const std::string name, const concepts::ElementFormula<F, G>& frm) {
193  // get matrix for the formula
195  this->getFunction(spc, frm);
196  // store matrix
197  this->add(*function, name);
198  }
199 
200  template<class G>
202  DenseMatrixCollection<G> dmc = this->getSpace(spc);
203  //store matrix
204  this->storeData_(dmc);
205  }
206 
207  //Save the matrices that hold informations
208  template<class G>
210  typename DenseMatrixCollection<G>::iterator i = dense_ptr.begin();
211  for (; i != dense_ptr.end(); ++i)
212  this->add(*i->second, i->first);
213  } // storeData_
214 
215 }
216 // namespace graphics
217 
218 #endif // matlab_binary_hh
MatlabBinaryGraphics(const std::string filename)
Constructor that only creates a Matlab binary file of filename filename for further adding of space,...
std::string filename() const
Returns the name of the current open *.mat-file.
Definition: matfileIO.hh:304
An abstract class for a function in a FE space.
uint data_
Information which data should be stored.
void storeData_(DenseMatrixCollection< G > &dense_ptr_)
Stores data hold by dense_ptr.
concepts::RCP< concepts::ElementMatrix< F > > getSolution(const concepts::Space< G > &spc, const concepts::Vector< F > &sol, const concepts::ElementFunction< F, G > *fun=0)
Returns a vector with the value of the solution on the quadrature-points of a given space using a giv...
Concepts *.mat-file tool.
Definition: matfileIO.hh:112
MatlabBinaryGraphics(const concepts::Space< G > &spc, const std::string filename, std::vector< concepts::Vector< F > > &sol, const concepts::ElementFunction< F, G > *fun=0)
Constructor for output of solutions and functions of it.
void addSpace_(const concepts::Space< G > &spc)
Adds informations of a given Space to the matfile.
void addSolution(const concepts::Space< G > &spc, const std::string name, const concepts::Vector< F > &sol, const concepts::ElementFunction< F, G > *fun=0)
Adds a solution vector to the current matfile.
Class that allows to store graphical infomations in .mat files to use them in Matlab.
Graphics.
Definition: basis.hh:33
Interface for a formula defined element by element.
Reference-counting pointer.
Definition: bf_iddiv.hh:15
DenseMatrixCollection< G > getSpace(const concepts::Space< G > &spc)
Returns a graphics::DenseMatrixCollection<G> that contains informations for graphical output of the g...
Class that collects data for graphical output and stores it in concepts::ElementMatrices and graphics...
An abstract class for meshes.
Definition: mesh.hh:76
MatlabBinaryGraphics(concepts::Mesh &msh, const std::string filename, const uint points=5)
Constructor for output of mesh only.
concepts::RCP< concepts::ElementMatrix< typename concepts::Datatype< F >::type > > getFunction(const concepts::Space< G > &spc, const concepts::ElementFormula< F, G > &frm)
Returns a vector with the value of the function on the quadrature-points of a given space using the g...
Class that hold and manage a std::map with concepts::ElementMatrices for graphical output,...
void addFunction(const concepts::Space< G > &spc, const std::string name, const concepts::ElementFormula< F, G > &frm)
Adds a solution vector to the current matfile.
void add(const T &u, const std::string varName, enum matio_compression compress=MAT_COMPRESSION_NONE)
Method to add various objects to a current open MatfileIO.
Definition: matfileIO.hh:160
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich