Hermes2D  2.0
vectorizer.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_VECTORIZER_H
17 #define __H2D_VECTORIZER_H
18 
19 #include "linearizer.h"
20 
21 namespace Hermes
22 {
23  namespace Hermes2D
24  {
25  namespace Views
26  {
32  class HERMES_API Vectorizer : public LinearizerBase
33  {
34  public:
35 
36  Vectorizer();
37  ~Vectorizer();
38 
39  void process_solution(MeshFunction<double>* xsln, MeshFunction<double>* ysln, int xitem = H2D_FN_VAL_0, int yitem = H2D_FN_VAL_0, double eps = HERMES_EPS_NORMAL);
40 
41  int get_num_vertices();
42  double4* get_vertices();
43 
44  int2* get_dashes();
45  int get_num_dashes();
46 
47  void calc_vertices_aabb(double* min_x, double* max_x, double* min_y, double* max_y) const;
48 
53  void set_curvature_epsilon(double curvature_epsilon);
54 
56  double get_curvature_epsilon();
57 
59  void free();
60 
61  protected:
64 
65  int xitem, component_x, value_type_x;
66  int yitem, component_y, value_type_y;
67 
68  double4* verts;
69  int2* dashes;
70 
73 
74  int get_vertex(int p1, int p2, double x, double y, double xvalue, double yvalue);
75  int create_vertex(double x, double y, double xvalue, double yvalue);
76  void process_dash(int iv1, int iv2);
77 
78  int add_vertex();
79 
80  void add_dash(int iv1, int iv2);
81 
82  void process_triangle(MeshFunction<double>** fns, int iv0, int iv1, int iv2, int level,
83  double* xval, double* yval, double* phx, double* phy, int* indices, bool curved);
84 
85  void process_quad(MeshFunction<double>** fns, int iv0, int iv1, int iv2, int iv3, int level,
86  double* xval, double* yval, double* phx, double* phy, int* indices, bool curved);
87 
88  void find_min_max();
89  };
90  }
91  }
92 }
93 #endif