rheolef  7.0
reference_element.h
Go to the documentation of this file.
1 #ifndef _RHEOLEF_REFERENCE_ELEMENT_H
2 #define _RHEOLEF_REFERENCE_ELEMENT_H
3 #include "rheolef/point.h"
4 #include <array>
5 
6 namespace rheolef {
7 
39 public:
40 
41 
43 
44 
45  typedef size_type variant_type;
46  static const variant_type
47  p = 0,
48  e = 1,
49  t = 2,
50  q = 3,
51  T = 4,
52  P = 5,
53  H = 6,
55 
56 // allocators/deallocators:
57 
58  reference_element (variant_type x = max_variant)
59  : _x(x) { assert_macro (x >= 0 && x <= max_variant, "invalid type " << x); }
60 
61 
62  void set_variant (variant_type x) { _x = x; }
63  void set_variant (size_type n_vertex, size_type dim) { _x = variant (n_vertex, dim); }
64  void set_name (char name);
65 
66 
67  variant_type variant() const { return _x; }
68  char name() const { return _name[_x % max_variant]; }
69  size_type dimension() const { return _dimension[_x]; }
70  size_type size() const { return _n_vertex[_x]; }
71  size_type n_subgeo(size_type subgeo_dim) const { return n_subgeo (variant(), subgeo_dim); }
72  size_type n_edge() const { return n_subgeo(1); }
73  size_type n_face() const { return n_subgeo(2); }
74  size_type subgeo_size (size_type subgeo_dim, size_type loc_isid) const {
75  return subgeo_n_node (_x, 1, subgeo_dim, loc_isid); }
76  size_type subgeo_local_vertex(size_type subgeo_dim, size_type loc_isid, size_type loc_jsidvert) const {
77  return subgeo_local_node (_x, 1, subgeo_dim, loc_isid, loc_jsidvert); }
78 
79  // TODO: use template<class T> instead of Float
80  const point_basic<Float>& vertex (size_type iloc) const;
81  friend Float measure (reference_element hat_K);
82  Float side_measure (size_type loc_isid) const;
83  void side_normal (size_type loc_isid, point_basic<Float>& hat_n) const;
84 
85 
86  static variant_type variant (char name);
87  static variant_type variant (size_type n_vertex, size_type dim);
88  static char name (variant_type variant) { return _name [variant]; }
89  static size_type dimension (variant_type variant) { return _dimension[variant]; }
90  static size_type n_vertex (variant_type variant) { return _n_vertex [variant]; }
91  static size_type n_node (variant_type variant, size_type order);
92 
93  static size_type n_sub_edge (variant_type variant);
94  static size_type n_sub_face (variant_type variant);
95  static size_type n_subgeo (variant_type variant, size_type subgeo_dim);
96  static size_type subgeo_n_node (variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid);
97  static size_type subgeo_local_node (variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid, size_type loc_jsidnod);
98 
99  static variant_type first_variant_by_dimension (size_type dim) {
100  return _first_variant_by_dimension[dim]; }
101  static variant_type last_variant_by_dimension (size_type dim) {
102  return _first_variant_by_dimension[dim+1]; }
103 
104  static size_type first_inod_by_variant (variant_type variant, size_type order, variant_type subgeo_variant);
105  static size_type last_inod_by_variant (variant_type variant, size_type order, variant_type subgeo_variant)
106  { return first_inod_by_variant (variant, order, subgeo_variant+1); }
107  static size_type first_inod (variant_type variant, size_type order, size_type subgeo_dim)
108  { return first_inod_by_variant (variant, order, first_variant_by_dimension(subgeo_dim)); }
109  static size_type last_inod (variant_type variant, size_type order, size_type subgeo_dim)
110  { return first_inod_by_variant (variant, order, last_variant_by_dimension(subgeo_dim)); }
111  static void init_local_nnode_by_variant (size_type order, std::array<size_type,reference_element::max_variant>& loc_nnod_by_variant);
112 
113 protected:
114 
115  static const char _name [max_variant];
116  static const size_type _dimension [max_variant];
117  static const size_type _n_vertex [max_variant];
118  static const variant_type _first_variant_by_dimension[5];
119 
120 
121  variant_type _x;
122 };
123 @endcode
124 
126 public:
127 
128 
130 
131 
132  static size_type n_subgeo (size_type side_dim);
133  static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
134  static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
135  static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
136  static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
137  static const point_basic<Float>& vertex (size_type iloc);
138  static Float side_measure (size_type loc_isid);
139  static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
140 };
141 
143 public:
144 
145 
147 
148 
149  static size_type n_subgeo (size_type side_dim);
150  static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
151  static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
152  static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
153  static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
154  static const point_basic<Float>& vertex (size_type iloc);
155  static Float side_measure (size_type loc_isid);
156  static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
157 };
158 
160 public:
161 
162 
164 
165 
166  static size_type n_subgeo (size_type side_dim);
167  static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
168  static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
169  static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
170  static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
171  static const point_basic<Float>& vertex (size_type iloc);
172  static Float side_measure (size_type loc_isid);
173  static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
174 };
175 
177 public:
178 
179 
181 
182 
183  static size_type n_subgeo (size_type side_dim);
184  static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
185  static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
186  static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
187  static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
188  static const point_basic<Float>& vertex (size_type iloc);
189  static Float side_measure (size_type loc_isid);
190  static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
191 };
192 
194 public:
195 
196 
198 
199 
200  static size_type n_subgeo (size_type side_dim);
201  static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
202  static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
203  static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
204  static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
205  static size_type face2edge (size_type loc_iface, size_type loc_iface_jedg);
206  static int face2edge_orient (size_type loc_iface, size_type loc_iface_jedg);
207  static const point_basic<Float>& vertex (size_type iloc);
208  static Float side_measure (size_type loc_isid);
209  static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
210 };
211 
213 public:
214 
215 
217 
218 
219  static size_type n_subgeo (size_type side_dim);
220  static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
221  static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
222  static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
223  static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
224  static size_type face2edge (size_type loc_iface, size_type loc_iface_jedg);
225  static int face2edge_orient (size_type loc_iface, size_type loc_iface_jedg);
226  static const point_basic<Float>& vertex (size_type iloc);
227  static Float side_measure (size_type loc_isid);
228  static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
229 };
230 
232 public:
233 
234 
236 
237 
238  static size_type n_subgeo (size_type side_dim);
239  static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
240  static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
241  static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
242  static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
243  static size_type face2edge (size_type loc_iface, size_type loc_iface_jedg);
244  static int face2edge_orient (size_type loc_iface, size_type loc_iface_jedg);
245  static const point_basic<Float>& vertex (size_type iloc);
246  static Float side_measure (size_type loc_isid);
247  static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
248 };
249 
250 } // namespace rheolef
251 #endif // _RHEOLEF_REFERENCE_ELEMENT_H
static size_type first_inod_by_variant(variant_type variant, size_type order, variant_type subgeo_variant)
static const variant_type t
size_type subgeo_size(size_type subgeo_dim, size_type loc_isid) const
static const variant_type max_variant
static const variant_type q
static size_type n_vertex(variant_type variant)
point_basic< size_t >::size_type size_type
friend Float measure(reference_element hat_K)
static size_type n_sub_edge(variant_type variant)
size_t size_type
Definition: point.h:26
reference_element - reference element
static const variant_type P
point - vertex of a mesh
Definition: point.h:22
static variant_type last_variant_by_dimension(size_type dim)
const point_basic< Float > & vertex(size_type iloc) const
static size_type last_inod(variant_type variant, size_type order, size_type subgeo_dim)
static const variant_type p
variant_type variant() const
std::vector< int >::size_type size_type
irheostream, orheostream - large data streams
Definition: compiler.h:7
static const variant_type T
static void init_local_nnode_by_variant(size_type order, std::array< size_type, reference_element::max_variant > &loc_nnod_by_variant)
#define assert_macro(ok_condition, message)
Definition: compiler.h:121
static size_type n_sub_face(variant_type variant)
static const variant_type _first_variant_by_dimension[5]
static const variant_type e
point_basic< size_t >::size_type size_type
double Float
Definition: compiler.h:160
void side_normal(size_type loc_isid, point_basic< Float > &hat_n) const
static char name(variant_type variant)
size_type n_subgeo(size_type subgeo_dim) const
void set_variant(size_type n_vertex, size_type dim)
Float side_measure(size_type loc_isid) const
static const variant_type H
point_basic< size_t >::size_type size_type
static size_type subgeo_local_node(variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid, size_type loc_jsidnod)
size_type subgeo_local_vertex(size_type subgeo_dim, size_type loc_isid, size_type loc_jsidvert) const
static size_type dimension(variant_type variant)
static size_type subgeo_n_node(variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid)
static const size_type _n_vertex[max_variant]
static variant_type first_variant_by_dimension(size_type dim)
void set_variant(variant_type x)
static const char _name[max_variant]
static size_type last_inod_by_variant(variant_type variant, size_type order, variant_type subgeo_variant)
point_basic< size_t >::size_type size_type
reference_element(variant_type x=max_variant)
point_basic< size_t >::size_type size_type
static size_type first_inod(variant_type variant, size_type order, size_type subgeo_dim)
static size_type n_node(variant_type variant, size_type order)
point_basic< size_t >::size_type size_type
point_basic< size_t >::size_type size_type
static const size_type _dimension[max_variant]