Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
reference_element.h
Go to the documentation of this file.
1#ifndef _RHEOLEF_REFERENCE_ELEMENT_H
2#define _RHEOLEF_REFERENCE_ELEMENT_H
3//
4// This file is part of Rheolef.
5//
6// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
7//
8// Rheolef is free software; you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation; either version 2 of the License, or
11// (at your option) any later version.
12//
13// Rheolef is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with Rheolef; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21//
22// =========================================================================
23// AUTHOR: Pierre.Saramito@imag.fr
24// DATE: 30 november 2003
25
26namespace rheolef {
58} // namespace rheolef
59
60#include "rheolef/point.h"
61#include <array>
62
63namespace rheolef {
64
65// [verbatim_reference_element]
67public:
68
69// typedefs:
70
71 typedef std::vector<int>::size_type size_type;
73
74 static const variant_type
75 p = 0,
76 e = 1,
77 t = 2,
78 q = 3,
79 T = 4,
80 P = 5,
81 H = 6,
83
85
86// allocators/deallocators:
87
89 : _x(x) { assert_macro (x >= 0 && x <= max_variant, "invalid type " << x); }
90
91// initializers:
92
93 void set_variant (variant_type x) { _x = x; }
95 void set_name (char name);
96
97// accessors:
98
99 variant_type variant() const { return _x; }
100 char name() const { return _name[_x % max_variant]; }
101 size_type dimension() const { return _dimension[_x]; }
102 size_type size() const { return _n_vertex[_x]; }
103 size_type n_vertex() const { return _n_vertex[_x]; }
104 size_type n_side() const { return dimension() > 0 ? n_subgeo (variant(), dimension()-1) : 0; }
105 size_type n_edge() const { return n_subgeo(1); }
106 size_type n_face() const { return n_subgeo(2); }
107 size_type n_subgeo_by_variant (size_type subgeo_variant) const {
108 return n_subgeo_by_variant(variant(), subgeo_variant); }
109
110 size_type n_subgeo(size_type subgeo_dim) const { return n_subgeo (variant(), subgeo_dim); }
111 reference_element subgeo (size_type subgeo_dim, size_type loc_isid) const {
113 if (dimension() == subgeo_dim) return *this;
114 reference_element hat_S;
115 size_type subgeo_n_vertex = subgeo_size (subgeo_dim, loc_isid);
116 hat_S.set_variant (subgeo_n_vertex, subgeo_dim);
117 return hat_S;
118 }
119 reference_element side (size_type loc_isid) const { return subgeo (dimension()-1, loc_isid); }
120 size_type subgeo_size (size_type subgeo_dim, size_type loc_isid) const {
121 return subgeo_n_node (_x, 1, subgeo_dim, loc_isid); }
122 size_type subgeo_local_vertex(size_type subgeo_dim, size_type loc_isid, size_type loc_jsidvert) const {
123 return subgeo_local_node (_x, 1, subgeo_dim, loc_isid, loc_jsidvert); }
125 return (variant() == P && subgeo_variant == q) ? i-2 : i; }
126
127 // TODO: use template<class T> instead of Float
128 const point_basic<Float>& vertex (size_type iloc) const;
129 friend Float measure (reference_element hat_K);
130 Float side_measure (size_type loc_isid) const;
131 void side_normal (size_type loc_isid, point_basic<Float>& hat_n) const;
132
133// helpers:
134
135 static variant_type variant (char name);
137 static char name (variant_type variant) { return _name [variant]; }
141
144 static size_type n_subgeo (variant_type variant, size_type subgeo_dim);
145 static size_type subgeo_n_node (variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid);
146 static size_type subgeo_local_node (variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid, size_type loc_jsidnod);
147
152
155 { return first_inod_by_variant (variant, order, subgeo_variant+1); }
157 { return first_inod_by_variant (variant, order, first_variant_by_dimension(subgeo_dim)); }
159 { return first_inod_by_variant (variant, order, last_variant_by_dimension(subgeo_dim)); }
160 static void init_local_nnode_by_variant (size_type order, std::array<size_type,reference_element::max_variant>& loc_nnod_by_variant);
161
163 { return _n_subgeo_by_variant [variant] [subgeo_variant]; }
164// [verbatim_reference_element]
165
166protected:
167// constants:
168
169 static const char _name [max_variant];
174
175// data:
176
178// [verbatim_reference_element_cont]
179};
180// [verbatim_reference_element_cont]
181
183public:
184
185// typedefs:
186
188
189// static functions:
190
191 static size_type n_subgeo (size_type side_dim);
192 static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
193 static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
194 static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
195 static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
196 static const point_basic<Float>& vertex (size_type iloc);
197 static Float side_measure (size_type loc_isid);
198 static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
199};
200
202public:
203
204// typedefs:
205
207
208// static functions:
209
210 static size_type n_subgeo (size_type side_dim);
211 static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
212 static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
213 static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
214 static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
215 static const point_basic<Float>& vertex (size_type iloc);
216 static Float side_measure (size_type loc_isid);
217 static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
218};
219
221public:
222
223// typedefs:
224
226
227// static functions:
228
229 static size_type n_subgeo (size_type side_dim);
230 static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
231 static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
232 static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
233 static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
234 static const point_basic<Float>& vertex (size_type iloc);
235 static Float side_measure (size_type loc_isid);
236 static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
237};
238
240public:
241
242// typedefs:
243
245
246// static functions:
247
248 static size_type n_subgeo (size_type side_dim);
249 static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
250 static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
251 static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
252 static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
253 static const point_basic<Float>& vertex (size_type iloc);
254 static Float side_measure (size_type loc_isid);
255 static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
256};
257
259public:
260
261// typedefs:
262
264
265// static functions:
266
267 static size_type n_subgeo (size_type side_dim);
268 static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
269 static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
270 static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
271 static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
272 static size_type face2edge (size_type loc_iface, size_type loc_iface_jedg);
273 static int face2edge_orient (size_type loc_iface, size_type loc_iface_jedg);
274 static const point_basic<Float>& vertex (size_type iloc);
275 static Float side_measure (size_type loc_isid);
276 static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
277};
278
280public:
281
282// typedefs:
283
285
286// static functions:
287
288 static size_type n_subgeo (size_type side_dim);
289 static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
290 static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
291 static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
292 static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
293 static size_type face2edge (size_type loc_iface, size_type loc_iface_jedg);
294 static int face2edge_orient (size_type loc_iface, size_type loc_iface_jedg);
295 static const point_basic<Float>& vertex (size_type iloc);
296 static Float side_measure (size_type loc_isid);
297 static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
298};
299
301public:
302
303// typedefs:
304
306
307// static functions:
308
309 static size_type n_subgeo (size_type side_dim);
310 static size_type subgeo_n_node (size_type order, size_type side_dim, size_type loc_isid);
311 static size_type subgeo_local_node (size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod);
312 static size_type ilat2loc_inod (size_type order, const point_basic<size_type>& ilat);
313 static size_type first_inod_by_variant (size_type order, size_type subgeo_variant);
314 static size_type face2edge (size_type loc_iface, size_type loc_iface_jedg);
315 static int face2edge_orient (size_type loc_iface, size_type loc_iface_jedg);
316 static const point_basic<Float>& vertex (size_type iloc);
317 static Float side_measure (size_type loc_isid);
318 static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
319};
320
321} // namespace rheolef
322#endif // _RHEOLEF_REFERENCE_ELEMENT_H
field::size_type size_type
Definition branch.cc:430
see the Float page for the full documentation
static size_type subgeo_n_node(size_type order, size_type side_dim, size_type loc_isid)
point_basic< size_t >::size_type size_type
static size_type n_subgeo(size_type side_dim)
static size_type face2edge(size_type loc_iface, size_type loc_iface_jedg)
static size_type subgeo_local_node(size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod)
static Float side_measure(size_type loc_isid)
static size_type ilat2loc_inod(size_type order, const point_basic< size_type > &ilat)
static void side_normal(size_type loc_isid, point_basic< Float > &hat_n)
static size_type first_inod_by_variant(size_type order, size_type subgeo_variant)
static int face2edge_orient(size_type loc_iface, size_type loc_iface_jedg)
static size_type subgeo_local_node(size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod)
point_basic< size_t >::size_type size_type
static size_type n_subgeo(size_type side_dim)
static size_type first_inod_by_variant(size_type order, size_type subgeo_variant)
static size_type face2edge(size_type loc_iface, size_type loc_iface_jedg)
static Float side_measure(size_type loc_isid)
static size_type ilat2loc_inod(size_type order, const point_basic< size_type > &ilat)
static void side_normal(size_type loc_isid, point_basic< Float > &hat_n)
static size_type subgeo_n_node(size_type order, size_type side_dim, size_type loc_isid)
static int face2edge_orient(size_type loc_iface, size_type loc_iface_jedg)
static size_type subgeo_local_node(size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod)
static size_type face2edge(size_type loc_iface, size_type loc_iface_jedg)
static size_type n_subgeo(size_type side_dim)
static size_type ilat2loc_inod(size_type order, const point_basic< size_type > &ilat)
point_basic< size_t >::size_type size_type
static size_type subgeo_n_node(size_type order, size_type side_dim, size_type loc_isid)
static size_type first_inod_by_variant(size_type order, size_type subgeo_variant)
static int face2edge_orient(size_type loc_iface, size_type loc_iface_jedg)
static Float side_measure(size_type loc_isid)
static void side_normal(size_type loc_isid, point_basic< Float > &hat_n)
static size_type n_subgeo(size_type side_dim)
static size_type subgeo_n_node(size_type order, size_type side_dim, size_type loc_isid)
static size_type subgeo_local_node(size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod)
point_basic< size_t >::size_type size_type
static size_type first_inod_by_variant(size_type order, size_type subgeo_variant)
static size_type ilat2loc_inod(size_type order, const point_basic< size_type > &ilat)
static Float side_measure(size_type loc_isid)
static void side_normal(size_type loc_isid, point_basic< Float > &hat_n)
static size_type n_subgeo(size_type side_dim)
static size_type ilat2loc_inod(size_type order, const point_basic< size_type > &ilat)
static size_type first_inod_by_variant(size_type order, size_type subgeo_variant)
point_basic< size_t >::size_type size_type
static size_type subgeo_local_node(size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod)
static Float side_measure(size_type loc_isid)
static void side_normal(size_type loc_isid, point_basic< Float > &hat_n)
static size_type subgeo_n_node(size_type order, size_type side_dim, size_type loc_isid)
static size_type subgeo_n_node(size_type order, size_type side_dim, size_type loc_isid)
static size_type n_subgeo(size_type side_dim)
static size_type first_inod_by_variant(size_type order, size_type subgeo_variant)
static size_type subgeo_local_node(size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod)
point_basic< size_t >::size_type size_type
static size_type ilat2loc_inod(size_type order, const point_basic< size_type > &ilat)
static Float side_measure(size_type loc_isid)
static void side_normal(size_type loc_isid, point_basic< Float > &hat_n)
static size_type subgeo_n_node(size_type order, size_type side_dim, size_type loc_isid)
static size_type first_inod_by_variant(size_type order, size_type subgeo_variant)
static size_type n_subgeo(size_type side_dim)
point_basic< size_t >::size_type size_type
static size_type subgeo_local_node(size_type order, size_type side_dim, size_type loc_isid, size_type loc_jsidnod)
static size_type ilat2loc_inod(size_type order, const point_basic< size_type > &ilat)
static Float side_measure(size_type loc_isid)
static void side_normal(size_type loc_isid, point_basic< Float > &hat_n)
see the reference_element page for the full documentation
static const size_type max_side_by_variant
void side_normal(size_type loc_isid, point_basic< Float > &hat_n) const
static const size_type _n_subgeo_by_variant[max_variant][max_variant]
static const variant_type H
static const variant_type _first_variant_by_dimension[5]
static size_type last_inod_by_variant(variant_type variant, size_type order, variant_type subgeo_variant)
static size_type dimension(variant_type variant)
static const variant_type q
static const variant_type e
static char name(variant_type variant)
reference_element subgeo(size_type subgeo_dim, size_type loc_isid) const
reference_element side(size_type loc_isid) const
void set_variant(variant_type x)
static size_type n_subgeo_by_variant(size_type variant, size_type subgeo_variant)
static size_type subgeo_local_node(variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid, size_type loc_jsidnod)
reference_element(variant_type x=max_variant)
static size_type first_inod(variant_type variant, size_type order, size_type subgeo_dim)
static const variant_type max_variant
static size_type n_sub_edge(variant_type variant)
static void init_local_nnode_by_variant(size_type order, std::array< size_type, reference_element::max_variant > &loc_nnod_by_variant)
static variant_type last_variant_by_dimension(size_type dim)
size_type local_subgeo_index2index_by_variant(size_type subgeo_variant, size_type i) const
friend Float measure(reference_element hat_K)
static const char _name[max_variant]
void set_variant(size_type n_vertex, size_type dim)
size_type subgeo_size(size_type subgeo_dim, size_type loc_isid) const
static size_type n_vertex(variant_type variant)
static variant_type first_variant_by_dimension(size_type dim)
static const variant_type p
Float side_measure(size_type loc_isid) const
static size_type n_sub_face(variant_type variant)
static const size_type _n_vertex[max_variant]
size_type n_subgeo_by_variant(size_type subgeo_variant) const
variant_type variant() const
size_type subgeo_local_vertex(size_type subgeo_dim, size_type loc_isid, size_type loc_jsidvert) const
static size_type last_inod(variant_type variant, size_type order, size_type subgeo_dim)
static size_type first_inod_by_variant(variant_type variant, size_type order, variant_type subgeo_variant)
static size_type subgeo_n_node(variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid)
std::vector< int >::size_type size_type
static const size_type _dimension[max_variant]
static size_type n_node(variant_type variant, size_type order)
size_type n_subgeo(size_type subgeo_dim) const
static const variant_type P
static const variant_type t
#define assert_macro(ok_condition, message)
Definition dis_macros.h:113
const point vertex[n_vertex]
Definition edge.icc:67
Expr1::float_type T
Definition field_expr.h:230
This file is part of Rheolef.
Definition sphere.icc:25