Hermes2D  3.0
vector_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_VECTOR_VIEW_H
18 #define __H2D_VECTOR_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 
35  class HERMES_API VectorView : public View
36  {
37  public:
38 
39  VectorView(const char* title = "VectorView", WinGeom* wg = nullptr);
40  VectorView(char* title, WinGeom* wg = nullptr);
41  ~VectorView();
42 
43  void show(MeshFunctionSharedPtr<double> vsln);
44  void show(MeshFunctionSharedPtr<double> xsln, MeshFunctionSharedPtr<double> ysln, int xitem = H2D_FN_VAL_0, int yitem = H2D_FN_VAL_0, MeshFunctionSharedPtr<double> xdisp = nullptr, MeshFunctionSharedPtr<double> ydisp = nullptr, double dmult = 1.0);
45 
46  inline void set_grid_type(bool hexa) { this->hexa = hexa; refresh(); };
47  void set_mode(int mode);
48 
50  Vectorizer* get_vectorizer();
54  void set_vectorizer_criterion(LinearizerCriterion criterion);
55 
56  protected:
59 
60  double gx, gy, gs;
62  bool hexa;
64  int mode;
65  bool lines, pmode;
67  double length_coef;
69  void draw_edges_2d();
70 
71  void plot_arrow(double x, double y, double xval, double yval, double max, double min, double gs);
72 
73  virtual void on_display();
74  virtual void on_mouse_move(int x, int y);
75  virtual void on_key_down(unsigned char key, int x, int y);
76  virtual const char* get_help_text() const;
77  };
78 #else
79  class HERMES_API VectorView : public View
80  {
81  public:
82  VectorView(const char* title = "VectorView", WinGeom* wg = nullptr) {}
83  VectorView(char* title, WinGeom* wg = nullptr) {}
84 
85  void show(MeshFunctionSharedPtr<double> vsln) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
86  void show(MeshFunctionSharedPtr<double> xsln, MeshFunctionSharedPtr<double> ysln, int xitem = H2D_FN_VAL_0, int yitem = H2D_FN_VAL_0, MeshFunctionSharedPtr<double> xdisp = nullptr, MeshFunctionSharedPtr<double> ydisp = nullptr, double dmult = 1.0) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
87 
88  inline void set_grid_type(bool hexa) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
89  void set_mode(int mode) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
90 
92  Vectorizer* get_vectorizer() { throw Hermes::Exceptions::Exception("GLUT disabled."); return nullptr; }
96  void set_vectorizer_criterion(LinearizerCriterion criterion) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
97  };
98 #endif
99  }
100  }
101 }
102 #endif
Definition: adapt.h:24
Vectorizer * vec
Linearizer class responsible for obtaining linearized data.
Definition: vector_view.h:58
double length_coef
for extending or shortening arrows
Definition: vector_view.h:67
bool hexa
false - quad grid, true - hexa grid
Definition: vector_view.h:62
Represents a simple visualization window.
Definition: view.h:80
File containing LinearizerMultidimensional class.
File containing View abstract class.
int mode
0 - magnitude is on the background, 1 - arrows are colored, 2 - no arrows, just magnitude on the back...
Definition: vector_view.h:64
LinearizerMultidimensional< VectorLinearizerDataDimensions< LINEARIZER_DATA_TYPE > > Vectorizer
Linearizer for vector cases - historically called Vectorizer.
Definition: linearizer.h:203
Visualizes a vector PDE solution.
Definition: vector_view.h:35
Abstract class for criterion according to which the linearizer stops dividing elements at some point ...