meshMatlab.hh

Go to the documentation of this file.
1 
6 #ifndef graphMeshMatlab_hh
7 #define graphMeshMatlab_hh
8 
9 #include <string>
10 #include <fstream>
11 #include <memory>
12 #include "basics/typedefs.hh"
14 #include "basics/exceptions.hh"
15 #include "toolbox/dynArray.hh"
16 #include "space/postProcess.hh"
17 
18 namespace concepts {
19  // forward declartions
20  class Mesh2;
21  class Mesh3;
22 } // namespace concepts
23 
24 namespace graphics {
25 
26  using concepts::Real;
27 
28  // ************************************************************ MeshMatlab **
29 
50  template<typename F>
51  class MeshMatlab {
52  public:
55  MeshMatlab(concepts::Mesh& msh, std::string filename);
58  MeshMatlab(concepts::Space<F>& spc, std::string filename);
60  private:
62  void createStreams_(std::string filename);
64  void closeStreams_();
66  std::unique_ptr<std::ofstream> ofs1_, ofs2_, ofs3_;
67  };
68 
72  void drawMeshMatlab(concepts::Mesh& msh, std::string filename);
73 
77  template<class F>
78  void drawMeshMatlab(concepts::Space<F>& spc, std::string filename);
79 
80  // ******************************************************** MeshMatlabCell **
81 
96  template<typename F>
98  public:
100  MeshMatlabCell(std::ostream* os1, std::ostream* os2, std::ostream* os3);
101  virtual ~MeshMatlabCell();
102  virtual void operator() (const concepts::Element<F>& elm)
104  virtual void operator() (const concepts::Cell& cell)
106  private:
108  std::ostream *os1_, *os2_, *os3_;
110  std::unique_ptr<concepts::DynArray<uint> > map_;
112  uint cnt_;
113  };
114 
115 } // namespace graphics
116 
117 #endif // graphMeshMatlab_hh
An abstract class for an element of a space.
Definition: exceptions.hh:15
MeshMatlab(concepts::Space< F > &spc, std::string filename)
Constructor.
void createStreams_(std::string filename)
Creates the streams and prints the header.
void drawMeshMatlab(concepts::Mesh &msh, std::string filename)
Trampoline function to create an instance of MeshMatlab.
std::unique_ptr< std::ofstream > ofs1_
The streams.
Definition: meshMatlab.hh:66
virtual void operator()(const concepts::Element< F > &elm)
Application operator.
Abstract class for a space.
A cell in a mesh consist of topological information (neighbours, connectivity, orientation) and geome...
Definition: cell.hh:39
std::unique_ptr< std::ofstream > ofs2_
Definition: meshMatlab.hh:66
Creates data for Matlab to draw the mesh.
Definition: meshMatlab.hh:51
Writes the data which describe the elements to the three streams.
Definition: meshMatlab.hh:97
Graphics.
Definition: basis.hh:33
MeshMatlab(concepts::Mesh &msh, std::string filename)
Constructor.
std::unique_ptr< std::ofstream > ofs3_
Definition: meshMatlab.hh:66
MeshMatlabCell(std::ostream *os1, std::ostream *os2, std::ostream *os3)
Constructor.
void closeStreams_()
Prints the footer and closes the streams.
Exception class to express a missing feature.
Definition: exceptions.hh:206
std::unique_ptr< concepts::DynArray< uint > > map_
Map for vertices of the elements.
Definition: meshMatlab.hh:110
An abstract class for meshes.
Definition: mesh.hh:76
Abstract class for per cell postprocessing.
Definition: postProcess.hh:38
std::ostream * os1_
Output streams.
Definition: meshMatlab.hh:108
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
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