Hermes2D  2.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 {
29  };
30 
31  static int H2D_GIP1D_X = 0;
32  static int H2D_GIP1D_W = 1;
33 
34  const int g_max_quad = 24;
35  const int g_max_tri = 20;
36 
39  class HERMES_API Quad1D
40  {
41  public:
42 
43  inline double2* get_points(int order) const { return tables[order]; }
44  inline int get_num_points(int order) const { return np[order]; };
45 
46  inline int get_max_order() const { return max_order; }
47  inline double get_ref_vertex(int n) const { return ref_vert[n]; }
48 
49  protected:
50 
51  double2** tables;
52  int* np;
53 
54  double ref_vert[H2D_NUM_MODES];
55  int max_order;
56 
57  virtual void dummy_fn() = 0; // to prevent this class from being instantiated
58  };
59 
62  class HERMES_API Quad2D
63  {
64  public:
65  inline int get_num_points(int order, ElementMode2D mode) const { assert(order < num_tables[mode]); return np[mode][order]; };
66  inline double3* get_points(int order, ElementMode2D mode) const { assert(order < num_tables[mode]); return tables[mode][order]; }
67  inline int get_edge_points(int edge, int order, ElementMode2D mode) {assert(order < num_tables[mode]); return max_order[mode]+1 + (3*(1-mode) + 4*mode)*order + edge;}
68 
69  inline int get_max_order(ElementMode2D mode) const { return max_order[mode]; }
70  inline int get_safe_max_order(ElementMode2D mode) const { return safe_max_order[mode]; }
71  inline int get_num_tables(ElementMode2D mode) const { return num_tables[mode]; }
72 
73  inline double2* get_ref_vertex(int n, ElementMode2D mode) { return &ref_vert[mode][n]; }
74 
75  protected:
76  double3*** tables;
77  int** np;
78 
79  int num_tables[2];
80  int max_order[2], safe_max_order[2];
81  int max_edge_order;
82 
83  double2 ref_vert[2][H2D_MAX_NUMBER_VERTICES];
84  };
85  }
86 }
87 #endif