Hermes2D  3.0
base_view.h
1 // Hermes2D is free software: you can redistribute it and/or modify
2 // it under the terms of the GNU General Public License as published by
3 // the Free Software Foundation, either version 2 of the License, or
4 // (at your option) any later version.
5 //
6 // Hermes2D is distributed in the hope that it will be useful,
7 // but WITHOUT ANY WARRANTY; without even the implied warranty of
8 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 // GNU General Public License for more details.
10 //
11 // You should have received a copy of the GNU General Public License
12 // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
13 
14 // $Id: view.h 1086 2008-10-21 09:05:44Z jakub $
15 
16 #ifndef __H2D_BASE_VIEW_H
17 #define __H2D_BASE_VIEW_H
18 
19 #include "../global.h"
20 #include "../space/space.h"
21 #include "../shapeset/precalc.h"
22 #include "scalar_view.h"
23 
24 namespace Hermes
25 {
26  namespace Hermes2D
27  {
28  namespace Views
29  {
30  // you can define NOGLUT to turn off all OpenGL stuff in Hermes2D
31 #ifndef NOGLUT
32 
38  template<typename Scalar>
39  class HERMES_API BaseView : public ScalarView
40  {
41  public:
42 
43  BaseView(const char* title = "BaseView", WinGeom* wg = nullptr);
44  BaseView(char* title, WinGeom* wg = nullptr);
45 
46  void show(SpaceSharedPtr<Scalar> space, int item = H2D_FN_VAL_0);
47 
48  ~BaseView() { free(); }
49 
50  protected:
51 
52  SpaceSharedPtr<Scalar> space;
53  MeshFunctionSharedPtr<Scalar> sln;
54  MeshFunctionSharedPtr<double> complex_filter;
55 
56  double eps;
57  int ndof, item;
58  int base_index;
59 
60  std::string basic_title;
61 
62  void free();
63  void update_solution();
64  void update_title();
65 
66  virtual void on_special_key(int key, int x, int y);
67  virtual const char* get_help_text() const;
68  };
69 #else
70  template<typename Scalar>
71  class HERMES_API BaseView : public ScalarView
72  {
73  public:
74  BaseView(const char* title = "BaseView", WinGeom* wg = nullptr) : ScalarView(title, wg) {}
75  BaseView(char* title, WinGeom* wg = nullptr) : ScalarView(title, wg) {}
76 
77  void show(SpaceSharedPtr<Scalar> space, int item = H2D_FN_VAL_0) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
78  };
79 
80 #endif
81  }
82  }
83 }
84 #endif
Definition: adapt.h:24
File containing ScalarView class.
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.