meshDX.hh

Go to the documentation of this file.
1 
6 #ifndef graphMeshDX_hh
7 #define graphMeshDX_hh
8 
9 #include <iostream>
10 #include <string>
11 #include <list>
12 #include "space/postProcess.hh"
13 #include "basics/typedefs.hh"
14 #include "basics/exceptions.hh"
15 #include "spaceTraits.hh"
16 #include "geometry/topology.hh"
17 
18 namespace hp2D {
19  // forward declaration
20  class Space;
21 }
22 
23 namespace hp3D {
24  // forward declaration
25  class Space;
26 }
27 
28 namespace graphics {
29 
30  using concepts::Real;
31 
32  // forward declartions
33  class VertexList;
34 
35  // ********************************************************** Space traits **
36 
42  template<typename T, typename traits = spaceTraits<T> >
43  struct spcDim {
44  static inline uint dim() { return traits::dim(); }
45  };
46 
59  template<typename T>
60  uint spaceDimension(const T& spc) {
61  return spcDim<T>::dim();
62  }
63 
64  // **************************************************************** MeshDX **
65 
88  template<class F>
89  class MeshDX {
90  public:
96  MeshDX(concepts::Mesh& msh, std::string filename)
97  throw(concepts::Assertion);
98 
108  MeshDX(concepts::Space<F>& spc, std::string filename, uint dim)
109  throw(concepts::Assertion);
110  private:
113 
116 
118  std::string filename_;
119 
122  std::string& filename, uint nelm, uint dim);
123  };
124 
133  MeshDX<Real> drawMeshDX(concepts::Mesh& msh, std::string filename);
134 
146  template<typename T>
147  MeshDX<Real> drawMeshDX(T& spc, std::string filename) {
148  return MeshDX<Real>(spc, filename, spaceDimension(spc));
149  }
150 
151  // ************************************************************ MeshDXCell **
152 
164  template<class F>
166  public:
181  MeshDXCell(std::ostream& os, VertexList& vtxList, uint nelms, uint nfaces,
182  uint dim = 2);
183 
184  virtual ~MeshDXCell();
185 
186  virtual void operator() (const concepts::Element<F>& elm)
188  virtual void operator() (const concepts::Cell& cell)
190  private:
192  std::ostream& os_;
193 
196 
198  uint dim_;
199  };
200 
201  // ******************************************************** BoundaryDXCell **
202 
213  template<typename F>
215  public:
216  BoundaryDXCell(VertexList& vtxList) : vtxList_(vtxList) {}
217  virtual ~BoundaryDXCell();
218 
219  virtual void operator() (const concepts::Element<F>& elm)
221  virtual void operator() (const concepts::Cell& cell)
223 
225  const std::list<const concepts::Connector*>& faces() const
226  { return faces_; }
227  private:
230 
232  std::list<const concepts::Connector*> faces_;
233  };
234 
235 } // namespace graphics
236 
237 #endif // graphMeshDX_hh
MeshDX(concepts::Space< F > &spc, std::string filename, uint dim)
Constructor.
An abstract class for an element of a space.
Definition: exceptions.hh:15
MeshDX(concepts::Mesh &msh, std::string filename)
Constructor.
concepts::Space< F > * spc_
The space.
Definition: meshDX.hh:112
std::string filename_
Filename.
Definition: meshDX.hh:118
Abstract class for a space.
Global Postprocessing.
Definition: postProcess.hh:70
A cell in a mesh consist of topological information (neighbours, connectivity, orientation) and geome...
Definition: cell.hh:39
Determines the traits class belonging to a space by a default template parameter.
Definition: meshDX.hh:43
A 3D hp FEM space with continuous, picewise polynomial basis functions.
Definition: space.hh:84
2D hp-FEM for H1-conforming elements.
concepts::Mesh * msh_
The mesh.
Definition: meshDX.hh:115
MeshDX< Real > drawMeshDX(concepts::Mesh &msh, std::string filename)
Trampoline function to create a MeshDX.
uint dim_
Spatial dimension of the mesh or space.
Definition: meshDX.hh:198
Exception class for assertions.
Definition: exceptions.hh:258
Graphics.
Definition: basis.hh:33
Gathers information about boundary faces (or edges in 2D) and prepares information to be written to a...
Definition: meshDX.hh:214
std::list< const concepts::Connector * > faces_
List of faces (or edges) which have boundary attribute != 0.
Definition: meshDX.hh:232
static uint dim()
Definition: meshDX.hh:44
uint spaceDimension(const T &spc)
Trampoline function for the class spcDim.
Definition: meshDX.hh:60
virtual void operator()(const concepts::Element< F > &elm)
Application operator.
virtual void operator()(const concepts::Element< F > &elm)
Application operator.
void constructor_(concepts::GlobalPostprocess< F > &postProcess, std::string &filename, uint nelm, uint dim)
Private constructor.
Class containing a list of vertices.
Definition: vertexList.hh:97
const std::list< const concepts::Connector * > & faces() const
Returns the list of faces.
Definition: meshDX.hh:225
BoundaryDXCell(VertexList &vtxList)
Definition: meshDX.hh:216
Draws a picture of a mesh in DX.
Definition: meshDX.hh:165
Exception class to express a missing feature.
Definition: exceptions.hh:206
VertexList & vtxList_
List of vertices.
Definition: meshDX.hh:195
VertexList & vtxList_
List of vertices.
Definition: meshDX.hh:229
MeshDXCell(std::ostream &os, VertexList &vtxList, uint nelms, uint nfaces, uint dim=2)
Constructor.
An abstract class for meshes.
Definition: mesh.hh:76
std::ostream & os_
Output stream.
Definition: meshDX.hh:192
3D hp-FEM for H1-conforming elements.
Definition: meshDX.hh:23
Abstract class for per cell postprocessing.
Definition: postProcess.hh:38
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Draws a picture of a mesh in DX format and stores the result in a file.
Definition: meshDX.hh:89
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich