Hermes2D  2.0
mesh_view.h
1 // This file is part of Hermes2D.
2 //
3 // Copyright 2005-2008 Jakub Cerveny <jakub.cerveny@gmail.com>
4 // Copyright 2005-2008 Lenka Dubcova <dubcova@gmail.com>
5 // Copyright 2005-2008 Pavel Solin <solin@unr.edu>
6 //
7 // Hermes2D is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // Hermes2D is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
19 
20 // $Id: view.h 1086 2008-10-21 09:05:44Z jakub $
21 
22 #ifndef __H2D_MESH_VIEW_H
23 #define __H2D_MESH_VIEW_H
24 #include "view.h"
25 #include "../function/exact_solution.h"
26 
27 namespace Hermes
28 {
29  namespace Hermes2D
30  {
31  namespace Views
32  {
33  // you can define NOGLUT to turn off all OpenGL stuff in Hermes2D
34 #ifndef NOGLUT
35 
41  class HERMES_API MeshView : public View
42  {
43  public:
44 
45  MeshView(const char* title = "MeshView", WinGeom* wg = NULL);
46  MeshView(char* title, WinGeom* wg = NULL);
47  ~MeshView();
48 
49  void show (Mesh* mesh);
51  void set_b_elem_mrk(bool set);
52 
53  protected:
54 
55  Linearizer* lin;
56 
57  bool b_ids, b_markers, b_elem_mrk;
58 
59  struct ObjInfo
60  {
61  double x, y;
62  int id, type;
63  };
64 
65  ObjInfo* nodes;
66  ObjInfo* elems;
67  int nn, ne;
68 
69  float* get_marker_color(int marker);
70 
71  virtual void on_display();
72  virtual void on_key_down(unsigned char key, int x, int y);
73  virtual void scale_dispatch() {}
74  virtual const char* get_help_text() const;
75 
76  Mesh* mesh;
77  };
78 #else
79  class HERMES_API MeshView : public View
80  {
81  public:
82 
83  MeshView(const char* title = "MeshView", WinGeom* wg = NULL) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
84  MeshView(char* title, WinGeom* wg = NULL) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
85  void show(Mesh* mesh) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
86  };
87 #endif
88  }
89  }
90 }
91 #endif