/usr/include/rheolef/geo_element_v1.h is in librheolef-dev 6.7-6.
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 | #ifndef _RHEO_GEO_ELEMENT_V1_H
#define _RHEO_GEO_ELEMENT_V1_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
///
/// =========================================================================
/*Class:geo_element
NAME: @code{geo_element} - element of a mesh
@cindex geometrical element
@clindex reference element
@clindex geo_element
@clindex reference_element
@clindex geo
DESCRIPTION:
Defines geometrical elements and sides
as a set of vertice and edge indexes.
This element is obtained after a Piola transformation
from a reference element (@pxref{reference_element iclass}).
Indexes are related to arrays of edges and vertices.
These arrays are included in the description of the mesh.
Thus, this class is related of a given mesh instance
(@pxref{geo class}).
EXAMPLE:
This is the test of geo_element:
@example
geo_element K;
K.set_name('t') ;
cout << "n_vertices: " << K.size() << endl
<< "n_edges : " << K.n_edges() << endl
<< "dimension : " << K.dimension() << endl << endl;
for(geo_element::size_type i = 0; i < K.size(); i++)
K[i] = i*10 ;
for(geo_element::size_type i = 0; i < K.n_edges(); i++)
K.set_edge(i, i*10+5) ;
cout << "vertices: local -> global" << endl;
for (geo_element::size_type vloc = 0; vloc < K.size(); vloc++)
cout << vloc << "-> " << K[vloc] << endl;
cout << endl
<< "edges: local -> global" << endl;
for (geo_element::size_type eloc = 0; eloc < K.n_edges(); eloc++) @{
geo_element::size_type vloc1 = subgeo_local_vertex(1, eloc, 0);
geo_element::size_type vloc2 = subgeo_local_vertex(1, eloc, 1);
cout << eloc << "-> " << K.edge(eloc) << endl
<< "local_vertex_from_edge(" << eloc
<< ") -> (" << vloc1 << ", " << vloc2 << ")" << endl;
@}
@end example
SEE ALSO: "geo"(3)
AUTHOR: Pierre.Saramito@imag.fr
DATE: 18 jan 1998
METHODS: @geo_element
End:
*/
#include "rheolef/reference_element.h"
#include "rheolef/tiny_element.h"
namespace rheolef {
//<geo_element:
class geo_element : public reference_element {
public:
static const size_type not_set;
// allocators/deallocators:
geo_element(variant_type t = max_variant);
geo_element(const geo_element&);
void copy (const geo_element&);
geo_element& operator = (const geo_element&);
explicit geo_element (const class tiny_element&);
void copy (const class tiny_element&);
~geo_element();
// accessors:
size_type index() const;
size_type operator [] (size_type i) const;
size_type side(size_type i_side) const;
void build_side(size_type i_side, geo_element& S) const;
size_type edge (size_type i_edge) const;
size_type face (size_type i_face) const;
size_type subgeo(const geo_element& S) const;
size_type subgeo (size_type subgeo_dim, size_type i_subgeo) const;
size_type subgeo_vertex (size_type subgeo_dim, size_type i_subgeo,
size_type i_subgeo_vertex) const;
void build_subgeo(size_type subgeo_dim, size_type i_subgeo, geo_element& S) const;
size_type subgeo_local_index(const geo_element& S) const;
// modifiers:
void set_variant (variant_type t);
void set_variant (size_type sz, size_type dim);
void set_name (char name);
void set_index(size_type idx);
size_type& operator [] (size_type i);
void set_side (size_type i_side, size_type idx);
void set_edge (size_type i_edge, size_type idx);
void set_face (size_type i_face, size_type idx);
void set_subgeo (size_type subgeo_dim, size_type i_subgeo,
size_type idx);
void set_subgeo(const geo_element& S, size_type idx);
// inputs/outputs:
friend std::istream& operator >> (std::istream&, geo_element&);
friend std::ostream& operator << (std::ostream&, const geo_element&);
std::ostream& dump(std::ostream& s = std::cerr) const;
void check() const;
// data:
protected:
size_type *_heap;
// internal: memory management:
static const size_type max_subgeo_vertex = 8;
static const size_type _heap_size [reference_element::max_variant];
static const size_type _heap_offset [reference_element::max_variant][4];
void _heap_init();
void _heap_close();
size_type heap_offset(size_type subgeo_dim) const { return _heap_offset [_x][subgeo_dim]; }
size_type heap_size() const { return _heap_size [_x]; }
};
//>geo_element:
inline
geo_element::geo_element(variant_type t)
: reference_element(t), _heap(0)
{
_heap_init();
}
inline
geo_element::~geo_element()
{
_heap_close();
}
inline
void
geo_element::set_variant (variant_type t)
{
reference_element::set_variant(t);
_heap_init();
}
inline
void
geo_element::set_name (char name)
{
reference_element::set_name(name);
_heap_init();
}
inline
void
geo_element::set_variant (size_type n_vertex, size_type dim)
{
reference_element::set_variant(n_vertex,dim);
_heap_init();
}
inline
geo_element::size_type
geo_element::index() const
{
return *_heap;
}
inline
void
geo_element::set_index(size_type idx)
{
*_heap = idx;
}
inline
geo_element::size_type
geo_element::operator [] (size_type i) const
{
return *(_heap + heap_offset(0) + i);
}
inline
geo_element::size_type&
geo_element::operator [] (size_type i)
{
return *(_heap + heap_offset(0) + i);
}
inline
geo_element::size_type
geo_element::subgeo (size_type subgeo_dim, size_type i_subgeo) const
{
return *(_heap + heap_offset(subgeo_dim) + i_subgeo);
}
inline
void
geo_element::set_subgeo (size_type subgeo_dim, size_type i_subgeo,
size_type idx)
{
*(_heap + heap_offset(subgeo_dim) + i_subgeo) = idx;
}
inline
geo_element::size_type
geo_element::edge (size_type i_edge) const
{
return subgeo (1, i_edge);
}
inline
geo_element::size_type
geo_element::face (size_type i_edge) const
{
return subgeo (2, i_edge);
}
inline
geo_element::size_type
geo_element::side (size_type i_side) const
{
return subgeo (dimension()-1, i_side);
}
inline
void
geo_element::set_edge (size_type i_edge, size_type idx)
{
set_subgeo(1,i_edge,idx);
}
inline
void
geo_element::set_face (size_type i_face, size_type idx)
{
set_subgeo(1,i_face,idx);
}
inline
void
geo_element::set_side (size_type i_side, size_type idx)
{
set_subgeo(dimension()-1,i_side,idx);
}
inline
geo_element::size_type
geo_element::subgeo_vertex (size_type subgeo_dim, size_type i_subgeo,
size_type i_subgeo_vertex) const
{
size_type local_vertex = subgeo_local_vertex(subgeo_dim, i_subgeo, i_subgeo_vertex);
return operator[] (local_vertex);
}
inline
void
geo_element::build_side(size_type i_side, geo_element& S) const
{
build_subgeo(dimension()-1, i_side, S);
}
}// namespace rheolef
#endif // _RHEO_GEO_ELEMENT_V1_H
|