Hermes2D  3.0
mesh_view.h
1 // This file is part of Hermes2D.
2 // Hermes2D is free software: you can redistribute it and/or modify
3 // it under the terms of the GNU General Public License as published by
4 // the Free Software Foundation, either version 2 of the License, or
5 // (at your option) any later version.
6 //
7 // Hermes2D is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License for more details.
11 //
12 // You should have received a copy of the GNU General Public License
13 // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
14 
15 // $Id: view.h 1086 2008-10-21 09:05:44Z jakub $
16 
17 #ifndef __H2D_MESH_VIEW_H
18 #define __H2D_MESH_VIEW_H
19 #include "view.h"
20 #include "linearizer.h"
21 
22 namespace Hermes
23 {
24  namespace Hermes2D
25  {
26  namespace Views
27  {
28  // you can define NOGLUT to turn off all OpenGL stuff in Hermes2D
29 #ifndef NOGLUT
30 
36  class HERMES_API MeshView : public View
37  {
38  public:
39 
40  MeshView(const char* title = "MeshView", WinGeom* wg = nullptr);
41  MeshView(char* title, WinGeom* wg = nullptr);
42  ~MeshView();
43 
44  void show(MeshSharedPtr mesh);
46  void set_b_elem_mrk(bool set);
47 
48  protected:
49 
50  Linearizer* lin;
51 
52  bool b_ids, b_markers, b_elem_mrk;
53 
54  struct ObjInfo
55  {
56  double x, y;
57  int id, type;
58  };
59 
60  ObjInfo* nodes;
61  ObjInfo* elems;
62  int nn, ne;
63 
64  float* get_marker_color(int marker);
65 
66  virtual void on_display();
67  virtual void on_key_down(unsigned char key, int x, int y);
68  virtual void scale_dispatch() {}
69  virtual const char* get_help_text() const;
70 
71  MeshSharedPtr mesh;
72  };
73 #else
74 #pragma optimize( "g", off )
75  class HERMES_API MeshView : public View
76  {
77  public:
78  MeshView(const char* title = "MeshView", WinGeom* wg = nullptr) {}
79  MeshView(char* title, WinGeom* wg = nullptr) {}
80 
81  void show(MeshSharedPtr mesh) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
82  void set_b_elem_mrk(bool set) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
83  };
84 #pragma optimize( "g", on )
85 #endif
86  }
87  }
88 }
89 #endif
::xsd::cxx::tree::id< char, ncname > id
C++ type corresponding to the ID XML Schema built-in type.
Definition: adapt.h:24
Represents a simple visualization window.
Definition: view.h:80
File containing LinearizerMultidimensional class.
::xsd::cxx::tree::type type
C++ type corresponding to the anyType XML Schema built-in type.
File containing View abstract class.