Hermes2D  3.0
quad.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_QUAD_H
17 #define __H2D_QUAD_H
18 
19 #include "../global.h"
20 namespace Hermes
21 {
22  namespace Hermes2D
23  {
25  enum GIP2DIndices {
32  };
33 
34  static unsigned short H2D_GIP1D_X = 0;
35  static unsigned short H2D_GIP1D_W = 1;
36 
37  // Maximum integration order for global quadrature, for quadrilaterals.
38 #define g_max_quad 24
39  // Maximum integration order for global quadrature, for triangles.
40 #define g_max_tri 20
41 
42  // Maximum number of integration points.
43 #define H2D_MAX_INTEGRATION_POINTS_COUNT_TRI 79
44 #define H2D_MAX_INTEGRATION_POINTS_COUNT_QUAD 169
45 #define H2D_MAX_INTEGRATION_POINTS_COUNT 169
46 
49  class HERMES_API Quad1D
50  {
51  public:
52 
53  inline double2* get_points(int order) const { return tables[order]; }
54  inline unsigned char get_num_points(int order) const { return np[order]; };
55 
56  inline unsigned short get_max_order() const { return max_order; }
57  inline double get_ref_vertex(int n) const { return ref_vert[n]; }
58 
59  protected:
60 
61  double2** tables;
62  unsigned char* np;
63 
64  double ref_vert[H2D_NUM_MODES];
65  unsigned short max_order;
66 
68  virtual void dummy_fn() = 0;
69  };
70 
73 
74  class HERMES_API Quad2D
75  {
76  public:
77  inline unsigned char get_num_points(int order, ElementMode2D mode) const { assert(order < num_tables[mode]); return np[mode][order]; };
78  inline double3* get_points(int order, ElementMode2D mode) const { assert(order < num_tables[mode]); return tables[mode][order]; }
79  inline unsigned short get_edge_points(int edge, unsigned short order, ElementMode2D mode) { assert(order < num_tables[mode]); return max_order[mode] + 1 + (3 * (1 - mode) + 4 * mode)*order + edge; }
80 
81  inline unsigned short get_max_order(ElementMode2D mode) const { return max_order[mode]; }
82  inline unsigned short get_safe_max_order(ElementMode2D mode) const { return safe_max_order[mode]; }
83  inline unsigned short get_num_tables(ElementMode2D mode) const { return num_tables[mode]; }
84 
85  inline double2* get_ref_vertex(int n, ElementMode2D mode) { return &ref_vert[mode][n]; }
86 
87  virtual unsigned char get_id() = 0;
88  protected:
89  double3*** tables;
90  unsigned char** np;
91 
92  unsigned short num_tables[2];
93  unsigned short max_order[2], safe_max_order[2];
94  unsigned short max_edge_order;
95 
96  double2 ref_vert[2][H2D_MAX_NUMBER_VERTICES];
97  };
98  }
99 }
100 #endif
Definition: adapt.h:24
#define H2D_NUM_MODES
Internal.
Definition: global.h:35
Y-axis coordinate.
Definition: quad.h:29
GIP2DIndices
Indices of values in the value returned by Quad2D::get_points().
Definition: quad.h:25
#define H2D_MAX_NUMBER_VERTICES
A maximum number of vertices of an element.
Definition: global.h:32
X-axis coordinate.
Definition: quad.h:27