`geo_element`

geometrical element of a mesh

# Description

This class defines a geometrical element. This element is obtained after the Piola geometrical transformation from a `reference_element`. The geo_element is mainly an array of indices for its nodes. These indices refer to the node table of the `geo` class. In addition, this class provides a list of indexes for edges (in 2D and 3D) and faces (in 3D). These indices refer to the edge and face lists, respectively, of the `geo` class.

# Implementation

This documentation has been generated from file fem/geo_element/geo_element.h

class geo_element {
public:
// typedefs:
enum {
_variant_offset = 0, // i.e. type, as triangle(t) or tetra(T), etc
_order_offset = 1, // i.e. k, when Pk curved element
_dis_ie_offset = 2, // internal numbering, depend upon partitionand nproc
_ios_dis_ie_offset = 3, // i/o numbering, independent of parition and nproc
_master_offset = 4, // (d-1)-side has one or two master d-element that contains it
_last_offset = 6 // here starts node indexes, face indexes, etc
};
// Implementation note: _master_offset reserve 2 size_type but is used only for sides,
// i.e. tri or quad in 3d mesh, edge in 2d mesh, or point in 1d
// => waste a lot of place
// it would be better with a polymorphic class
// and the geo class would define an array of smart_pointers on this class
// so, we could define edge with or without the 2 size_type for master elements
// then, hack_array will become obsolete (good thing)
// and reference_element could be also polymorphic, avoiding large swich (variant)
// in all internal loops. This change of implementation will be considered
// in the future.
typedef reference_element::size_type size_type;
typedef reference_element::variant_type variant_type;
typedef size_type* iterator;
typedef const size_type* const_iterator;
typedef size_type raw_type;
typedef geo_element generic_type;
typedef geo_element_auto<heap_allocator<size_type> > automatic_type;
typedef geo_element_indirect::orientation_type orientation_type; // for sign (+1,-1)
typedef geo_element_indirect::shift_type shift_type; // for 0..3 face shift
struct parameter_type {
variant_type variant;
size_type order;
parameter_type (variant_type v = reference_element::max_variant, size_type o = 0)
: variant(v), order(o) {}
};
// affectation:
geo_element& operator= (const geo_element& K)
{
reset (K.variant(), K.order()); // resize auto, nothing for hack
std::copy (K._data_begin(), K._data_begin() + _data_size(), _data_begin());
reset (K.variant(), K.order()); // reset order=1 for hack, resize nothing for auto
return *this;
}
virtual ~geo_element() {}
virtual void reset (variant_type variant, size_type order) = 0;
// implicit conversion:
operator reference_element () const { return reference_element(variant()); }
// accessors & modifiers:
variant_type variant() const { return variant_type( *(_data_begin() + _variant_offset)); }
size_type order() const { return *(_data_begin() + _order_offset); }
size_type dis_ie() const { return *(_data_begin() + _dis_ie_offset); }
size_type ios_dis_ie() const { return *(_data_begin() + _ios_dis_ie_offset); }
size_type master (bool i) const { return *(_data_begin() + _master_offset + i); }
size_type dimension() const { return reference_element::dimension (variant()); }
size_type size() const { return reference_element::n_vertex (variant()); }
char name() const { return reference_element::name (variant()); }
size_type n_node() const { return reference_element::n_node (variant(), order()); }
void set_dis_ie (size_type dis_ie) { *(_data_begin() + _dis_ie_offset) = dis_ie; }
void set_ios_dis_ie (size_type ios_dis_ie) { *(_data_begin() + _ios_dis_ie_offset) = ios_dis_ie; }
void set_master (bool i, size_type dis_ie) const {
const_iterator p = _data_begin() + _master_offset + i; // mutable member fct
*(const_cast<iterator>(p)) = dis_ie;
}
iterator begin() { return _data_begin() + _node_offset (variant(), order()); }
const_iterator begin() const { return _data_begin() + _node_offset (variant(), order()); }
iterator end() { return begin() + size(); }
const_iterator end() const { return begin() + size(); }
size_type& operator[] (size_type loc_inod) { return *(begin() + loc_inod); }
size_type operator[] (size_type loc_inod) const { return *(begin() + loc_inod); }
size_type& node (size_type loc_inod) { return operator[] (loc_inod); }
size_type node (size_type loc_inod) const { return operator[] (loc_inod); }
iterator begin(size_type node_subgeo_dim) { return begin() + first_inod (node_subgeo_dim); }
const_iterator begin(size_type node_subgeo_dim) const { return begin() + first_inod (node_subgeo_dim); }
iterator end (size_type node_subgeo_dim) { return begin() + last_inod (node_subgeo_dim); }
const_iterator end (size_type node_subgeo_dim) const { return begin() + last_inod (node_subgeo_dim); }
const geo_element_indirect& edge_indirect (size_type i) const {
const_iterator p = _data_begin() + _edge_offset (variant(), order()) + i;
return *(reinterpret_cast<const geo_element_indirect*>(p));
}
const geo_element_indirect& face_indirect (size_type i) const {
const_iterator p = _data_begin() + _face_offset (variant(), order()) + i;
return *(reinterpret_cast<const geo_element_indirect*>(p));
}
geo_element_indirect& edge_indirect (size_type i) {
iterator p = _data_begin() + _edge_offset (variant(), order()) + i;
return *(reinterpret_cast<geo_element_indirect*>(p));
}
geo_element_indirect& face_indirect (size_type i) {
iterator p = _data_begin() + _face_offset (variant(), order()) + i;
return *(reinterpret_cast<geo_element_indirect*>(p));
}
size_type edge (size_type i) const { return (dimension() <= 1) ? dis_ie() : edge_indirect(i).index(); }
size_type face (size_type i) const { return (dimension() <= 2) ? dis_ie() : face_indirect(i).index(); }
size_type n_subgeo (size_type subgeo_dim) const {
return reference_element::n_subgeo (variant(), subgeo_dim); }
size_type subgeo_dis_index (size_type subgeo_dim, size_type i) const {
return (subgeo_dim == 0) ? operator[](i) : (subgeo_dim == 1) ? edge(i) : (subgeo_dim == 2) ? face(i) : dis_ie(); }
size_type subgeo_n_node (size_type subgeo_dim, size_type loc_isid) const {
return reference_element::subgeo_n_node (variant(), order(), subgeo_dim, loc_isid); }
size_type subgeo_local_node (size_type subgeo_dim, size_type loc_isid, size_type loc_jsidnod) const {
return reference_element::subgeo_local_node (variant(), order(), subgeo_dim, loc_isid, loc_jsidnod); }
size_type subgeo_size (size_type subgeo_dim, size_type loc_isid) const {
return reference_element::subgeo_n_node (variant(), 1, subgeo_dim, loc_isid); }
size_type subgeo_local_vertex(size_type subgeo_dim, size_type i_subgeo, size_type i_subgeo_vertex) const {
return reference_element::subgeo_local_node (variant(), 1, subgeo_dim, i_subgeo, i_subgeo_vertex); }
size_type first_inod (size_type subgeo_dim) const {
return reference_element::first_inod (variant(), order(), subgeo_dim); }
size_type last_inod (size_type subgeo_dim) const {
return reference_element::last_inod (variant(), order(), subgeo_dim); }
size_type n_edge () const { return n_subgeo (1); }
size_type n_face () const { return n_subgeo (2); }
// orientation accessors:
// search S in all sides of K
orientation_type get_side_informations (
const geo_element& S,
size_type& loc_isid,
size_type& shift) const;
void get_side_informations (
const geo_element& S,
side_information_type& sid) const;
orientation_type get_side_orientation (const geo_element& S) const;
// compare two sides: S and *this
bool get_orientation_and_shift (const geo_element& S,
orientation_type& orient, shift_type& shift) const;
orientation_type get_edge_orientation (size_type dis_iv0, size_type dis_iv1) const;
void get_orientation_and_shift (
size_type dis_iv0, size_type dis_iv1, size_type dis_iv2,
orientation_type& orient,
shift_type& shift) const;
void get_orientation_and_shift (
size_type dis_iv0, size_type dis_iv1, size_type dis_iv2, size_type dis_iv3,
orientation_type& orient,
shift_type& shift) const;
// i/o;
void put (std::ostream& is) const;
void get (std::istream& os);
size_type
field::size_type size_type
Definition: branch.cc:425
edge
see the edge page for the full documentation
rheolef::geo_element_indirect::shift_type
short int shift_type
Definition: geo_element_indirect.h:39
rheolef::geo_element_indirect::orientation_type
short int orientation_type
Definition: geo_element_indirect.h:38
rheolef::geo_element::operator=
geo_element & operator=(const geo_element &K)
Definition: geo_element.h:145
rheolef::geo_element::_ios_dis_ie_offset
@ _ios_dis_ie_offset
Definition: geo_element.h:111
rheolef::geo_element::_variant_offset
@ _variant_offset
Definition: geo_element.h:108
rheolef::geo_element::_master_offset
@ _master_offset
Definition: geo_element.h:112
rheolef::geo_element::_last_offset
@ _last_offset
Definition: geo_element.h:113
rheolef::geo_element::_dis_ie_offset
@ _dis_ie_offset
Definition: geo_element.h:110
rheolef::geo_element::_order_offset
@ _order_offset
Definition: geo_element.h:109
rheolef::geo_element::automatic_type
geo_element_auto< heap_allocator< size_type > > automatic_type
Definition: geo_element.h:132
rheolef::geo_element::subgeo_n_node
size_type subgeo_n_node(size_type subgeo_dim, size_type loc_isid) const
Definition: geo_element.h:217
rheolef::geo_element::operator[]
size_type & operator[](size_type loc_inod)
Definition: geo_element.h:183
rheolef::geo_element::orientation_type
geo_element_indirect::orientation_type orientation_type
Definition: geo_element.h:134
rheolef::geo_element::get_orientation_and_shift
bool get_orientation_and_shift(const geo_element &S, orientation_type &orient, shift_type &shift) const
return orientation and shift between *this element and S
Definition: geo_element.cc:114
rheolef::geo_element::_data_begin
virtual iterator _data_begin()=0
rheolef::geo_element::edge
size_type edge(size_type i) const
Definition: geo_element.h:209
rheolef::geo_element::face
size_type face(size_type i) const
Definition: geo_element.h:210
rheolef::geo_element::n_node
size_type n_node() const
Definition: geo_element.h:170
rheolef::geo_element::subgeo_local_vertex
size_type subgeo_local_vertex(size_type subgeo_dim, size_type i_subgeo, size_type i_subgeo_vertex) const
Definition: geo_element.h:223
rheolef::geo_element::first_inod
size_type first_inod(size_type subgeo_dim) const
Definition: geo_element.h:225
rheolef::geo_element::size
size_type size() const
Definition: geo_element.h:168
rheolef::geo_element::size_type
reference_element::size_type size_type
Definition: geo_element.h:125
rheolef::geo_element::n_edge
size_type n_edge() const
Definition: geo_element.h:230
rheolef::geo_element::set_ios_dis_ie
void set_ios_dis_ie(size_type ios_dis_ie)
Definition: geo_element.h:173
rheolef::geo_element::index
size_t index() const
Definition: msh2geo.cc:237
rheolef::geo_element::put
void put(std::ostream &is) const
Definition: geo_element.cc:93
rheolef::geo_element::~geo_element
virtual ~geo_element()
Definition: geo_element.h:152
rheolef::geo_element::dimension
size_type dimension() const
Definition: geo_element.h:167
rheolef::geo_element::ios_dis_ie
size_type ios_dis_ie() const
Definition: geo_element.h:164
rheolef::geo_element::_face_offset
static size_type _face_offset(variant_type variant, size_type order)
Definition: geo_element.h:325
rheolef::geo_element::get
void get(std::istream &os)
Definition: geo_element.cc:42
rheolef::geo_element::const_iterator
const size_type * const_iterator
Definition: geo_element.h:128
rheolef::geo_element::subgeo_size
size_type subgeo_size(size_type subgeo_dim, size_type loc_isid) const
Definition: geo_element.h:221
rheolef::geo_element::get_side_orientation
orientation_type get_side_orientation(const geo_element &S) const
Definition: geo_element.cc:240
rheolef::geo_element::master
size_type master(bool i) const
Definition: geo_element.h:165
rheolef::geo_element::raw_type
size_type raw_type
Definition: geo_element.h:129
rheolef::geo_element::variant
variant_type variant() const
Definition: geo_element.h:161
rheolef::geo_element::node
size_type & node(size_type loc_inod)
Definition: geo_element.h:185
rheolef::geo_element::geo_element
geo_element()
Definition: field2gmsh_pos.cc:95
rheolef::geo_element::end
iterator end()
Definition: geo_element.h:181
rheolef::geo_element::get_edge_orientation
orientation_type get_edge_orientation(size_type dis_iv0, size_type dis_iv1) const
Definition: geo_element.cc:155
rheolef::geo_element::_node_offset
static size_type _node_offset(variant_type variant, size_type order)
Definition: geo_element.h:326
rheolef::geo_element::_data_size
size_type _data_size() const
Definition: geo_element.h:330
rheolef::geo_element::shift_type
geo_element_indirect::shift_type shift_type
Definition: geo_element.h:135
rheolef::geo_element::begin
iterator begin()
Definition: geo_element.h:179
rheolef::geo_element::get_side_informations
orientation_type get_side_informations(const geo_element &S, size_type &loc_isid, size_type &shift) const
Definition: geo_element.cc:185
rheolef::geo_element::n_subgeo
size_type n_subgeo(size_type subgeo_dim) const
Definition: geo_element.h:212
rheolef::geo_element::generic_type
geo_element generic_type
Definition: geo_element.h:131
rheolef::geo_element::iterator
size_type * iterator
Definition: geo_element.h:127
rheolef::geo_element::face_indirect
const geo_element_indirect & face_indirect(size_type i) const
Definition: geo_element.h:197
rheolef::geo_element::dis_ie
size_type dis_ie() const
Definition: geo_element.h:163
rheolef::geo_element::set_master
void set_master(bool i, size_type dis_ie) const
Definition: geo_element.h:174
rheolef::geo_element::n_face
size_type n_face() const
Definition: geo_element.h:231
rheolef::geo_element::edge_indirect
const geo_element_indirect & edge_indirect(size_type i) const
Definition: geo_element.h:193
rheolef::geo_element::reset
virtual void reset(variant_type variant, size_type order)=0
rheolef::geo_element::name
char name() const
Definition: geo_element.h:169
rheolef::geo_element::variant_type
reference_element::variant_type variant_type
Definition: geo_element.h:126
rheolef::geo_element::subgeo_local_node
size_type subgeo_local_node(size_type subgeo_dim, size_type loc_isid, size_type loc_jsidnod) const
Definition: geo_element.h:219
rheolef::geo_element::last_inod
size_type last_inod(size_type subgeo_dim) const
Definition: geo_element.h:227
rheolef::geo_element::order
size_type order() const
Definition: geo_element.h:162
rheolef::geo_element::subgeo_dis_index
size_type subgeo_dis_index(size_type subgeo_dim, size_type i) const
Definition: geo_element.h:214
rheolef::geo_element::set_dis_ie
void set_dis_ie(size_type dis_ie)
Definition: geo_element.h:172
rheolef::geo_element::_edge_offset
static size_type _edge_offset(variant_type variant, size_type order)
Definition: geo_element.h:324
rheolef::reference_element::n_vertex
size_type n_vertex() const
Definition: reference_element.h:103
rheolef::reference_element::subgeo_local_node
static size_type subgeo_local_node(variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid, size_type loc_jsidnod)
Definition: reference_element.cc:155
rheolef::reference_element::first_inod
static size_type first_inod(variant_type variant, size_type order, size_type subgeo_dim)
Definition: reference_element.h:156
rheolef::reference_element::max_variant
static const variant_type max_variant
Definition: reference_element.h:82
rheolef::reference_element::dimension
size_type dimension() const
Definition: reference_element.h:101
rheolef::reference_element::last_inod
static size_type last_inod(variant_type variant, size_type order, size_type subgeo_dim)
Definition: reference_element.h:158
rheolef::reference_element::variant_type
size_type variant_type
Definition: reference_element.h:72
rheolef::reference_element::subgeo_n_node
static size_type subgeo_n_node(variant_type variant, size_type order, size_type subgeo_dim, size_type loc_isid)
Definition: reference_element.cc:132
rheolef::reference_element::size_type
std::vector< int >::size_type size_type
Definition: reference_element.h:71
rheolef::reference_element::n_node
static size_type n_node(variant_type variant, size_type order)
Definition: reference_element.cc:201
rheolef::reference_element::n_subgeo
size_type n_subgeo(size_type subgeo_dim) const
Definition: reference_element.h:110
rheolef::reference_element::name
char name() const
Definition: reference_element.h:100
p
Definition: sphere.icc:25
rheolef::geo_element::parameter_type::parameter_type
parameter_type(variant_type v=reference_element::max_variant, size_type o=0)
Definition: geo_element.h:139
rheolef::geo_element::parameter_type::order
size_type order
Definition: geo_element.h:138
rheolef::geo_element::parameter_type::variant
variant_type variant
Definition: geo_element.h:137
};