Hermes2D  3.0
precalc.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_PRECALC_H
17 #define __H2D_PRECALC_H
18 
19 #include "../function/function.h"
20 #include "../shapeset/shapeset.h"
21 
22 namespace Hermes
23 {
24  namespace Hermes2D
25  {
26  enum SpaceType;
32  class HERMES_API PrecalcShapeset : public Function < double >
33  {
34  public:
36  SpaceType get_space_type() const;
37 
40  PrecalcShapeset(Shapeset* shapeset);
41 
43  virtual ~PrecalcShapeset();
44 
49  virtual void set_active_shape(int index);
50 
51  protected:
52  virtual void set_quad_2d(Quad2D* quad_2d);
53 
55  virtual void free();
56 
58  int get_active_shape() const;
59 
61  Shapeset* get_shapeset() const;
62 
64  virtual unsigned short get_edge_fn_order(int edge);
65 
66  Shapeset* shapeset;
67 
68  int index;
69 
70  unsigned short max_index[H2D_NUM_MODES];
71 
73  double2 ref_points[H2D_MAX_INTEGRATION_POINTS_COUNT];
74 
75  virtual void precalculate(unsigned short order, unsigned short mask);
76 
77  void update_max_index();
78 
79  friend class RefMap;
80  template<typename T> friend class KellyTypeAdapt;
81  template<typename T> friend class Adapt;
82  template<typename T> friend class Func;
83  template<typename T> friend class Solution;
84  template<typename T> friend class DiscontinuousFunc;
85  template<typename T> friend class DiscreteProblem;
86  template<typename T> friend class DiscreteProblemDGAssembler;
87  template<typename T> friend class DiscreteProblemThreadAssembler;
88  template<typename T> friend class NeighborSearch;
89  friend class CurvMap;
90  };
91 
94  {
95  public:
98  unsigned char shapeset_id;
99  unsigned short max_index[2];
100  unsigned short ref_count;
101 
102  private:
103  double*** PrecalculatedValues[H2D_NUM_MODES][H2D_NUM_FUNCTION_VALUES];
104  bool** PrecalculatedInfo[H2D_NUM_MODES];
105  friend class PrecalcShapesetAssembling;
106  };
107 
109  class HERMES_API PrecalcShapesetAssembling : public PrecalcShapeset
110  {
111  public:
115 
118 
120  virtual ~PrecalcShapesetAssembling();
121 
125  const double* get_fn_values(int component = 0) const;
126 
130  const double* get_dx_values(int component = 0) const;
131 
135  const double* get_dy_values(int component = 0) const;
136 
137 #ifdef H2D_USE_SECOND_DERIVATIVES
138  const double* get_dxx_values(int component = 0) const;
142 
146  const double* get_dyy_values(int component = 0) const;
147 
151  const double* get_dxy_values(int component = 0) const;
152 #endif
153 
154  const double* get_values(int component, unsigned short item) const;
155 
156  private:
157  virtual void precalculate(unsigned short order, unsigned short mask);
158 
160 
161  bool attempt_to_reuse(unsigned short order) const;
162  bool reuse_possible() const;
163  };
164 
168  {
169  public:
172  };
173  }
174 }
175 #endif
PrecalcShapeset variant for fast assembling.
Definition: precalc.h:109
Definition: adapt.h:24
Caches precalculated shape function values.
Definition: precalc.h:32
This class represents a function with jump discontinuity on an interface of two elements.
Definition: forms.h:335
#define H2D_NUM_MODES
Internal.
Definition: global.h:35
Represents an arbitrary function defined on an element.
Definition: function.h:106
Should be exactly the same as is the count of enum ShapesetType.
Definition: shapeset.h:95
PrecalcShapesetAssembling common storage.
Definition: precalc.h:93
This class is a one-thread (non-DG) assembly worker.
Represents the reference mapping.
Definition: refmap.h:40
This class characterizes a neighborhood of a given edge in terms of adjacent elements and provides me...
Represents the solution of a PDE.
Definition: api2d.h:35