Hermes2D  3.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 #ifdef HERMES_FOR_AGROS
47 #define H2D_MAX_LOCAL_BASIS_SIZE_TRI 78
48 #define H2D_MAX_LOCAL_BASIS_SIZE_QUAD 137
49 #define H2D_MAX_LOCAL_BASIS_SIZE 137
50 #define H2D_NUM_SHAPESETS 2
51 #else
52 #define H2D_MAX_LOCAL_BASIS_SIZE_QUAD 308
53 #define H2D_MAX_LOCAL_BASIS_SIZE_TRI 164
54 #define H2D_MAX_LOCAL_BASIS_SIZE 308
55 #define H2D_NUM_SHAPESETS 5
56 #endif
57 
59 
60 
95  class HERMES_API Shapeset : public Hermes::Mixins::Loggable
96  {
97  public:
98  ~Shapeset();
99 
101  typedef double(*shape_fn_t)(double, double);
102 
106  unsigned short get_order(int index, ElementMode2D mode) const;
107 
108  virtual Shapeset* clone() = 0;
109 
111  unsigned char get_num_components() const;
112 
114  unsigned short get_max_order() const;
115  unsigned short get_min_order() const;
116 
118  virtual unsigned short get_max_index(ElementMode2D mode) const = 0;
119 
121  short get_vertex_index(int vertex, ElementMode2D mode) const;
122 
126  short get_edge_index(unsigned char edge, unsigned short ori, unsigned short order, ElementMode2D mode) const;
127 
130  virtual SpaceType get_space_type() const = 0;
131 
134  virtual unsigned char get_id() const = 0;
135 
138  double get_value(int n, int index, double x, double y, unsigned short component, ElementMode2D mode);
139 
140  double get_fn_value(int index, double x, double y, unsigned short component, ElementMode2D mode);
141  double get_dx_value(int index, double x, double y, unsigned short component, ElementMode2D mode);
142  double get_dy_value(int index, double x, double y, unsigned short component, ElementMode2D mode);
143 
145  double get_fn_value_0_tri(int index, double x, double y);
147  double get_dx_value_0_tri(int index, double x, double y);
149  double get_dy_value_0_tri(int index, double x, double y);
150 
152  double get_fn_value_0_quad(int index, double x, double y);
154  double get_dx_value_0_quad(int index, double x, double y);
156  double get_dy_value_0_quad(int index, double x, double y);
157 
158  double get_dxx_value(int index, double x, double y, unsigned short component, ElementMode2D mode);
159  double get_dyy_value(int index, double x, double y, unsigned short component, ElementMode2D mode);
160  double get_dxy_value(int index, double x, double y, unsigned short component, ElementMode2D mode);
161 
163  virtual unsigned short get_num_bubbles(unsigned short order, ElementMode2D mode) const;
164 
165  protected:
167  virtual short* get_bubble_indices(unsigned short order, ElementMode2D mode) const;
168 
171  int get_constrained_edge_index(unsigned char edge, unsigned short order, unsigned short ori, unsigned short part, ElementMode2D mode) const;
172 
174  double2* get_ref_vertex(int vertex, ElementMode2D mode);
175 
176  shape_fn_t*** shape_table[6];
177 
178  short** vertex_indices;
179  short*** edge_indices;
180  short*** bubble_indices;
181  unsigned short** bubble_count;
182  unsigned short** index_to_order;
183 
184  double2 ref_vert[H2D_MAX_SOLUTION_COMPONENTS][H2D_MAX_NUMBER_VERTICES];
185  unsigned char max_order, min_order;
186  unsigned char num_components;
187 
189  unsigned short ebias;
191 
192  double** comb_table;
193  unsigned short table_size;
213  double* calculate_constrained_edge_combination(unsigned short order, unsigned short part, unsigned short ori, ElementMode2D mode);
219 
224  double* get_constrained_edge_combination(unsigned short order, unsigned short part, unsigned short ori, unsigned short& nitems, ElementMode2D mode);
225 
227  void free_constrained_edge_combinations();
228 
231  double get_constrained_value(int n, int index, double x, double y, unsigned short component, ElementMode2D mode);
232 
233  template<typename Scalar> friend class DiscreteProblem;
234  template<typename Scalar> friend class DiscreteProblemIntegrationOrderCalculator;
235  template<typename Scalar> friend class Solution;
236  friend class CurvMap;
237  friend class CurvMapStatic;
238  friend class RefMap;
239  template<typename Scalar> friend class RefinementSelectors::H1ProjBasedSelector;
240  template<typename Scalar> friend class RefinementSelectors::L2ProjBasedSelector;
241  template<typename Scalar> friend class RefinementSelectors::HcurlProjBasedSelector;
242  template<typename Scalar> friend class RefinementSelectors::OptimumSelector;
243  friend class PrecalcShapeset;
244  template<typename Scalar> friend class Form;
245  template<typename Scalar> friend class MatrixForm;
246  template<typename Scalar> friend class VectorForm;
247  template<typename Scalar> friend class Space;
248  template<typename Scalar> friend class H1Space;
249  template<typename Scalar> friend class L2Space;
250  template<typename Scalar> friend class HcurlSpace;
251  template<typename Scalar> friend class HdivSpace;
252  template<typename Scalar> friend class L2MarkerWiseConstSpace;
253  };
254  }
255 }
256 #endif
Definition: adapt.h:24
Abstract, base class for vector form - i.e. a single integral in the linear form on the right hand si...
Definition: weakform.h:439
Index of df/dxdy.
Definition: shapeset.h:31
unsigned short ebias
2 for H1 shapesets, 0 for H(curl) shapesets. It is the order of the
Definition: shapeset.h:189
A projection-based selector for Hcurl space.
Definition: function.h:36
Caches precalculated shape function values.
Definition: precalc.h:32
A projection-based selector for H1 space.
Definition: function.h:35
Index of df/dx.
Definition: shapeset.h:27
Index of df/dy.
Definition: shapeset.h:28
Abstract, base class for any form - i.e. integral in the weak formulation of (a system of) PDE By de...
Definition: weakform.h:43
Index of a function value f.
Definition: shapeset.h:26
Abstract, base class for matrix form - i.e. a single integral in the bilinear form on the left hand s...
Definition: weakform.h:357
#define H2D_MAX_NUMBER_VERTICES
A maximum number of vertices of an element.
Definition: global.h:32
Should be exactly the same as is the count of enum ShapesetType.
Definition: shapeset.h:95
A selector that chooses an optimal candidates based on a score.
Definition: function.h:32
Represents a finite element space over a domain.
Definition: api2d.h:34
Represents the reference mapping.
Definition: refmap.h:40
Index of df/dxdx.
Definition: shapeset.h:29
A projection-based selector for L2 space.
Definition: function.h:34
Represents the solution of a PDE.
Definition: api2d.h:35
FunctionExpansionIndex
Index of a function expansion. Used to selected a value in Shapeset::get_value(). ...
Definition: shapeset.h:25
Index of df/dydy.
Definition: shapeset.h:30