Hermes2D  2.0
shapeset.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_SHAPESET_H
17 #define __H2D_SHAPESET_H
18 
19 #include "../global.h"
20 namespace Hermes
21 {
22  namespace Hermes2D
23  {
27  H2D_FEI_DX = 1,
28  H2D_FEI_DY = 2,
32  };
33 
34  namespace RefinementSelectors
35  {
36  template<typename Scalar> class Selector;
37  template<typename Scalar> class POnlySelector;
38  template<typename Scalar> class HOnlySelector;
39  template<typename Scalar> class OptimumSelector;
40  template<typename Scalar> class ProjBasedSelector;
41  template<typename Scalar> class H1ProjBasedSelector;
42  template<typename Scalar> class L2ProjBasedSelector;
43  template<typename Scalar> class HcurlProjBasedSelector;
44  };
45 
46  enum SpaceType {
47  HERMES_H1_SPACE = 0,
48  HERMES_HCURL_SPACE = 1,
49  HERMES_HDIV_SPACE = 2,
50  HERMES_L2_SPACE = 3,
51  HERMES_INVALID_SPACE = -9999
52  };
53 
86  class HERMES_API Shapeset : public Hermes::Mixins::Loggable
87  {
88  public:
89  ~Shapeset();
90 
92  typedef double (*shape_fn_t)(double, double);
93 
97  int get_order(int index, ElementMode2D mode) const;
98 
99  virtual Shapeset* clone() = 0;
100 
102  int get_num_components() const;
103 
105  int get_max_order() const;
106 
108  virtual int get_max_index(ElementMode2D mode) = 0;
109 
111  int get_vertex_index(int vertex, ElementMode2D mode) const;
112 
116  int get_edge_index(int edge, int ori, int order, ElementMode2D mode) const;
117 
119  virtual SpaceType get_space_type() const = 0;
120 
121  protected:
123  int* get_bubble_indices(int order, ElementMode2D mode) const;
124 
126  int get_num_bubbles(int order, ElementMode2D mode) const;
127 
130  int get_constrained_edge_index(int edge, int order, int ori, int part, ElementMode2D mode) const;
131 
134  double get_value(int n, int index, double x, double y, int component, ElementMode2D mode);
135 
136  double get_fn_value (int index, double x, double y, int component, ElementMode2D mode);
137  double get_dx_value (int index, double x, double y, int component, ElementMode2D mode);
138  double get_dy_value (int index, double x, double y, int component, ElementMode2D mode);
139  double get_dxx_value(int index, double x, double y, int component, ElementMode2D mode);
140  double get_dyy_value(int index, double x, double y, int component, ElementMode2D mode);
141  double get_dxy_value(int index, double x, double y, int component, ElementMode2D mode);
142 
144  double2* get_ref_vertex(int vertex, ElementMode2D mode);
145 
147  virtual int get_id() const = 0;
148 
149  shape_fn_t*** shape_table[6];
150 
151  int** vertex_indices;
152  int*** edge_indices;
153  int*** bubble_indices;
154  int** bubble_count;
155  int** index_to_order;
156 
157  double2 ref_vert[H2D_MAX_SOLUTION_COMPONENTS][H2D_MAX_NUMBER_VERTICES];
158  int max_order;
159  int num_components;
160 
161  int ebias;
162 
163 
164  double** comb_table;
165  int table_size;
185 
186 
187 
188 
189 
190  double* calculate_constrained_edge_combination(int order, int part, int ori, ElementMode2D mode);
191 
196  double* get_constrained_edge_combination(int order, int part, int ori, int& nitems, ElementMode2D mode);
197 
199  void free_constrained_edge_combinations();
200 
203  double get_constrained_value(int n, int index, double x, double y, int component, ElementMode2D mode);
204 
205  template<typename Scalar> friend class DiscreteProblem;
206  template<typename Scalar> friend class Solution;
207  friend class CurvMap; friend class RefMap;
208  template<typename Scalar> friend class RefinementSelectors::H1ProjBasedSelector;
209  template<typename Scalar> friend class RefinementSelectors::L2ProjBasedSelector;
210  template<typename Scalar> friend class RefinementSelectors::HcurlProjBasedSelector;
211  template<typename Scalar> friend class RefinementSelectors::OptimumSelector;
212  friend class PrecalcShapeset;
213  friend void check_leg_tri(Shapeset* shapeset);
214  friend void check_gradleg_tri(Shapeset* shapeset);
215  template<typename Scalar> friend class Form;
216  template<typename Scalar> friend class MatrixForm;
217  template<typename Scalar> friend class VectorForm;
218  template<typename Scalar> friend class Space;
219  template<typename Scalar> friend class H1Space;
220  template<typename Scalar> friend class L2Space;
221  template<typename Scalar> friend class HcurlSpace;
222  template<typename Scalar> friend class HdivSpace;
223  };
224  }
225 }
226 #endif