Hermes2D  3.0
transformable.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_TRANSFORM_H
17 #define __H2D_TRANSFORM_H
18 
19 #include "../global.h"
20 #include "exceptions.h"
21 namespace Hermes
22 {
23  namespace Hermes2D
24  {
25  class Element;
26  template<typename Scalar> class Func;
27 
29  struct Trf
30  {
31  double2 m;
32  double2 t;
33  };
34 
36  extern HERMES_API Trf tri_trf[H2D_TRF_NUM];
38  extern HERMES_API Trf quad_trf[H2D_TRF_NUM];
39 
44  class HERMES_API Transformable : public Hermes::Mixins::Loggable
45  {
46  public:
48  inline Element* get_active_element() const { return this->element; }
49 
52  virtual void set_transform(uint64_t idx);
53 
55  uint64_t get_transform() const;
56 
57  virtual ~Transformable();
58 
63  virtual void push_transform(int son);
64 
68  virtual void pop_transform();
69 
71  static const unsigned int H2D_MAX_TRN_LEVEL = 15;
72 
73  protected:
74 
75  Transformable();
76 
81  virtual void set_active_element(Element* e);
82 
84  virtual void reset_transform();
85 
87  inline double get_transform_jacobian() const { return ctm->m[0] * ctm->m[1]; }
88 
90  inline Trf* get_ctm() const { return ctm; }
91 
93  virtual void force_transform(uint64_t sub_idx, Trf* ctm);
94 
96  inline unsigned int get_depth() const { return top; }
97 
98  static void push_transforms(std::set<Transformable *>& transformables, int son);
99  static void pop_transforms(std::set<Transformable *>& transformables);
100 
103 
107  uint64_t sub_idx;
108 
111  static const uint64_t H2D_MAX_IDX = (1ULL << 3 * H2D_MAX_TRN_LEVEL) - 1;
112 
114  Trf stack[21];
116  unsigned int top;
117 
118  template<typename T> friend class KellyTypeAdapt;
119  template<typename T> friend class Adapt;
120  template<typename T> friend class Func;
121  template<typename T> friend class Function;
122  template<typename T> friend class DiscontinuousFunc;
123  template<typename T> friend class DiscreteProblem;
124  template<typename T> friend class DiscreteProblemDGAssembler;
125  template<typename T> friend class DiscreteProblemThreadAssembler;
126  template<typename T> friend class NeighborSearch;
127  friend class CurvMap;
128  friend class Traverse;
129  };
130  }
131 }
132 #endif
Element * get_active_element() const
Definition: transformable.h:48
Definition: adapt.h:24
Trf * ctm
Current sub-element transformation matrix.
HERMES_API Trf quad_trf[H2D_TRF_NUM]
A table of quad sub-subdomain transforms. Only first ::H2D_TRF_QUAD_NUM transformations are valid...
double get_transform_jacobian() const
Definition: transformable.h:87
Stores one element of a mesh.
Definition: element.h:107
unsigned int get_depth() const
Definition: transformable.h:96
This class represents a function with jump discontinuity on an interface of two elements.
Definition: forms.h:335
double2 t
The 2x2 diagonal transformation matrix.
Definition: transformable.h:32
2D transformation.
Definition: transformable.h:29
Represents an arbitrary function defined on an element.
Definition: function.h:106
uint64_t sub_idx
Sub-element transformation index.
HERMES_API Trf tri_trf[H2D_TRF_NUM]
A table of triangle sub-subdomain transforms. Only first ::H2D_TRF_TRI_NUM transformations are valid...
Element * element
The active element.
This class is a one-thread (non-DG) assembly worker.
unsigned int top
Stack top.
This class characterizes a neighborhood of a given edge in terms of adjacent elements and provides me...