/usr/include/rheolef/reference_element.h is in librheolef-dev 6.5-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | #ifndef _RHEOLEF_REFERENCE_ELEMENT_H
#define _RHEOLEF_REFERENCE_ELEMENT_H
///
/// This file is part of Rheolef.
///
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
///
/// Rheolef is free software; you can redistribute it and/or modify
/// it under the terms of the GNU General Public License as published by
/// the Free Software Foundation; either version 2 of the License, or
/// (at your option) any later version.
///
/// Rheolef is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU General Public License for more details.
///
/// You should have received a copy of the GNU General Public License
/// along with Rheolef; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
///
/// =========================================================================
//
// groups misc helper functions:
// local renumbering, etc
//
#include "rheolef/point.h"
#include <boost/array.hpp>
namespace rheolef {
/*Class:reference_element
NAME: @code{reference_element} - reference element
@cindex reference element
@clindex reference_element
SYNOPSYS:
@noindent
The @code{reference_element} class defines all supported types of
geometrical elements in one, two and three dimensions. The set of
supported elements are designate by a letter
@table @samp
@item p
point (dimension 0)
@item e
edge (dimension 1)
@item t
triangle(dimension 2)
@item q
quadrangle(dimension 2)
@item T
tetrahedron(dimension 3)
@item P
prism(dimension 3)
@item H
hexaedron(dimension 3)
@end table
AUTHORS:
LMC-IMAG, 38041 Grenoble cedex 9, France
| Pierre.Saramito@imag.fr
DATE: 30 november 2003
End:
*/
//<reference_element:
class reference_element {
public:
// typedefs:
typedef std::vector<int>::size_type size_type;
// defines variant_type { p, t, q ..., H, ...};
// in an automatically generated file :
typedef size_type variant_type;
static const variant_type
p = 0,
e = 1,
t = 2,
q = 3,
T = 4,
P = 5,
H = 6,
max_variant = 7;
// allocators/deallocators:
reference_element (variant_type x = max_variant)
: _x(x) { assert_macro (x >= 0 && x <= max_variant, "invalid type " << x); }
// initializers:
void set_variant (variant_type x) { _x = x; }
void set_variant (size_type n_vertex, size_type dim) { _x = variant (n_vertex, dim); }
void set_name (char name);
// accessors:
variant_type variant() const { return _x; }
char name() const { return _name[_x]; }
size_type dimension() const { return _dimension[_x]; }
size_type size() const { return _n_vertex[_x]; }
size_type n_subgeo(size_type subgeo_dim) const { return n_subgeo (variant(), subgeo_dim); }
size_type n_edge() const { return n_subgeo(1); }
size_type n_face() const { return n_subgeo(2); }
size_type subgeo_size (size_type subgeo_dim, size_type loc_isid) const {
return subgeo_n_node (_x, 1, subgeo_dim, loc_isid); }
size_type subgeo_local_vertex(size_type subgeo_dim, size_type loc_isid, size_type loc_jsidvert) const {
return subgeo_local_node (_x, 1, subgeo_dim, loc_isid, loc_jsidvert); }
// TODO: use template<class T> instead of Float
const point_basic<Float>& vertex (size_type iloc) const;
friend Float measure (reference_element hat_K);
Float side_measure (size_type loc_isid) const;
void side_normal (size_type loc_isid, point_basic<Float>& hat_n) const;
// helpers:
static variant_type variant (char name);
static variant_type variant (size_type n_vertex, size_type dim);
static char name (variant_type variant) { return _name [variant]; }
static size_type dimension (variant_type variant) { return _dimension[variant]; }
static size_type n_vertex (variant_type variant) { return _n_vertex [variant]; }
static size_type n_node (variant_type variant, size_type order);
static size_type n_sub_edge (variant_type variant);
static size_type n_sub_face (variant_type variant);
static size_type n_subgeo (variant_type variant, size_type subgeo_dim);
static size_type subgeo_n_node (variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid);
static size_type subgeo_local_node (variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid, size_type loc_jsidnod);
static variant_type first_variant_by_dimension (size_type dim) {
return _first_variant_by_dimension[dim]; }
static variant_type last_variant_by_dimension (size_type dim) {
return _first_variant_by_dimension[dim+1]; }
static size_type first_inod_by_variant (variant_type variant, size_type order, variant_type subgeo_variant);
static size_type last_inod_by_variant (variant_type variant, size_type order, variant_type subgeo_variant)
{ return first_inod_by_variant (variant, order, subgeo_variant+1); }
static size_type first_inod (variant_type variant, size_type order, size_type subgeo_dim)
{ return first_inod_by_variant (variant, order, first_variant_by_dimension(subgeo_dim)); }
static size_type last_inod (variant_type variant, size_type order, size_type subgeo_dim)
{ return first_inod_by_variant (variant, order, last_variant_by_dimension(subgeo_dim)); }
static void init_local_nnode_by_variant (size_type order, boost::array<size_type,reference_element::max_variant>& loc_nnod_by_variant);
protected:
// constants:
static const char _name [max_variant];
static const size_type _dimension [max_variant];
static const size_type _n_vertex [max_variant];
static const variant_type _first_variant_by_dimension[5];
// data:
variant_type _x;
};
//>reference_element:
class reference_element_p {
public:
// typedefs:
typedef point_basic<size_t>::size_type size_type;
// static functions:
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);
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);
static const point_basic<Float>& vertex (size_type iloc);
static Float side_measure (size_type loc_isid);
static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
};
class reference_element_e {
public:
// typedefs:
typedef point_basic<size_t>::size_type size_type;
// static functions:
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);
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);
static const point_basic<Float>& vertex (size_type iloc);
static Float side_measure (size_type loc_isid);
static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
};
class reference_element_t {
public:
// typedefs:
typedef point_basic<size_t>::size_type size_type;
// static functions:
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);
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);
static const point_basic<Float>& vertex (size_type iloc);
static Float side_measure (size_type loc_isid);
static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
};
class reference_element_q {
public:
// typedefs:
typedef point_basic<size_t>::size_type size_type;
// static functions:
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);
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);
static const point_basic<Float>& vertex (size_type iloc);
static Float side_measure (size_type loc_isid);
static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
};
class reference_element_T {
public:
// typedefs:
typedef point_basic<size_t>::size_type size_type;
// static functions:
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);
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);
static size_type face2edge (size_type loc_iface, size_type loc_iface_jedg);
static int face2edge_orient (size_type loc_iface, size_type loc_iface_jedg);
static const point_basic<Float>& vertex (size_type iloc);
static Float side_measure (size_type loc_isid);
static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
};
class reference_element_P {
public:
// typedefs:
typedef point_basic<size_t>::size_type size_type;
// static functions:
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);
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);
static size_type face2edge (size_type loc_iface, size_type loc_iface_jedg);
static int face2edge_orient (size_type loc_iface, size_type loc_iface_jedg);
static const point_basic<Float>& vertex (size_type iloc);
static Float side_measure (size_type loc_isid);
static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
};
class reference_element_H {
public:
// typedefs:
typedef point_basic<size_t>::size_type size_type;
// static functions:
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);
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);
static size_type face2edge (size_type loc_iface, size_type loc_iface_jedg);
static int face2edge_orient (size_type loc_iface, size_type loc_iface_jedg);
static const point_basic<Float>& vertex (size_type iloc);
static Float side_measure (size_type loc_isid);
static void side_normal (size_type loc_isid, point_basic<Float>& hat_n);
};
} // namespace rheolef
#endif // _RHEOLEF_REFERENCE_ELEMENT_H
|