Hermes2D  2.0
linearizer.h
1 // This file is part of Hermes2D.
2 //
3 // Hermes2D is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // Hermes2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef __H2D_LINEARIZER_H
17 #define __H2D_LINEARIZER_H
18 
19 #include "../global.h"
20 #include "../function/solution.h"
21 #include "linearizer_base.h"
22 
23 namespace Hermes
24 {
25  namespace Hermes2D
26  {
27  namespace Views
28  {
37  class HERMES_API Linearizer : public LinearizerBase
38  {
39  public:
40 
41  Linearizer(bool auto_max = true);
42  ~Linearizer();
43 
44  void process_solution(MeshFunction<double>* sln, int item = H2D_FN_VAL_0, double eps = HERMES_EPS_NORMAL);
45 
47  void save_solution_vtk(MeshFunction<double>* sln, const char* filename, const char* quantity_name,
48  bool mode_3D = true, int item = H2D_FN_VAL_0,
49  double eps = HERMES_EPS_NORMAL);
50 
51  void set_displacement(MeshFunction<double>* xdisp, MeshFunction<double>* ydisp, double dmult = 1.0);
52 
53  void calc_vertices_aabb(double* min_x, double* max_x,
54  double* min_y, double* max_y) const;
55 
56  int get_num_vertices();
57  double3* get_vertices();
58 
59  int3* get_contour_triangles();
60  int get_num_contour_triangles();
61 
66  void set_curvature_epsilon(double curvature_epsilon);
67 
69  double get_curvature_epsilon();
70 
72  void free();
73 
74  protected:
77 
79  bool user_xdisp, user_ydisp;
82  double dmult;
83 
84  int3* tris_contours;
85  int triangle_contours_count;
86  double3* verts;
87 
89  int item, component, value_type;
90 
91  int add_vertex();
92  int get_vertex(int p1, int p2, double x, double y, double value);
93 
94  void process_triangle(MeshFunction<double>** fns, int iv0, int iv1, int iv2, int level,
95  double* val, double* phx, double* phy, int* indices, bool curved);
96 
97  void process_quad(MeshFunction<double>** fns, int iv0, int iv1, int iv2, int iv3, int level,
98  double* val, double* phx, double* phy, int* indices, bool curved);
99 
100  void find_min_max();
101  };
102  }
103  }
104 }
105 #endif