Flow123d  jenkins-Flow123d-windows-release-multijob-285
side_impl.hh
Go to the documentation of this file.
1 /*
2  * side_impl.hh
3  *
4  * Created on: Jun 17, 2012
5  * Author: jb
6  */
7 
8 #ifndef SIDE_IMPL_HH_
9 #define SIDE_IMPL_HH_
10 
11 #include "mesh/mesh.h"
12 #include "mesh/edges.h"
13 
14 
15 inline Side::Side(const Element * ele, unsigned int set_lnum)
16 : element_(ele), el_idx_(set_lnum)
17 {
18  ASSERT(mesh()->element.full_iter( const_cast<Element *>(element_) ), "Wrong initialization of the Side.\n");
19 }
20 
21 
22  inline unsigned int Side::n_nodes() const {
23  return dim()+1;
24  }
25 
26  inline unsigned int Side::dim() const {
27  return element_->dim()-1;
28  }
29 
30  // returns true for all sides either on boundary or connected to vb neigboring
31  inline bool Side::is_external() const {
32  return edge()->n_sides == 1;
33  }
34 
35  inline const Node * Side::node(unsigned int i) const {
36  int i_n = mesh()->side_nodes[dim()][el_idx_][i];
37 
38  return element_->node[ i_n ];
39  }
40 
41  inline ElementFullIter Side::element() const {
42  ASSERT( valid(), "Wrong use of uninitialized accessor.\n");
43  return mesh()->element.full_iter( const_cast<Element *>(element_) );
44  }
45 
46  inline Mesh * Side::mesh() const {
47  return element_->mesh_;
48  }
49 
50  inline unsigned int Side::edge_idx() const {
51  return element_->edge_idx_[el_idx()];
52  }
53 
54  inline Edge * Side::edge() const {
55  if (edge_idx() == Mesh::undef_idx) return NULL;
56  else return &( mesh()->edges[ edge_idx() ] );
57  }
58 
59  inline Boundary * Side::cond() const {
60  if (cond_idx() == Mesh::undef_idx) return NULL;
61  else return &( mesh()->boundary_[ cond_idx() ] );
62  }
63 
64  inline unsigned int Side::cond_idx() const {
65  if (element_->boundary_idx_ == NULL) return Mesh::undef_idx;
66  else return element_->boundary_idx_[el_idx()];
67  }
68 
69 
70  inline unsigned int Side::el_idx() const {
71  return el_idx_;
72  }
73 
74 
75  inline bool Side::valid() const {
76  return element_!= NULL;
77  }
78 
79 
80  inline void Side::inc() {
81  el_idx_++;
82  }
83 
84 
85  inline void *Side::make_ptr() const {
86  return (void *)((long int) element_ << (2 + el_idx_) );
87  }
88 #endif /* SIDE_IMPL_HH_ */
unsigned int * boundary_idx_
Definition: elements.h:94
Definition: nodes.hh:44
unsigned int edge_idx() const
Definition: side_impl.hh:50
Boundary * cond() const
Definition: side_impl.hh:59
static const unsigned int undef_idx
Definition: mesh.h:111
???
Definition: mesh.h:109
Node ** node
Definition: elements.h:90
int n_sides
Definition: edges.h:48
vector< vector< vector< unsigned int > > > side_nodes
Definition: mesh.h:254
Definition: edges.h:38
bool valid() const
Definition: side_impl.hh:75
vector< Boundary > boundary_
Definition: mesh.h:209
Edge * edge() const
Definition: side_impl.hh:54
bool is_external() const
Definition: side_impl.hh:31
unsigned int dim() const
unsigned int * edge_idx_
Definition: elements.h:93
#define ASSERT(...)
Definition: global_defs.h:121
unsigned int dim() const
Definition: side_impl.hh:26
void * make_ptr() const
This is necessary by current DofHandler, should change this.
Definition: side_impl.hh:85
Side()
Definition: sides.h:45
Mesh * mesh_
Definition: elements.h:132
unsigned int cond_idx() const
Definition: side_impl.hh:64
ElementFullIter element() const
Definition: side_impl.hh:41
std::vector< Edge > edges
Vector of MH edges, this should not be part of the geometrical mesh.
Definition: mesh.h:216
FullIter full_iter(Iter it)
Definition: sys_vector.hh:438
unsigned int el_idx_
Definition: sides.h:121
unsigned int el_idx() const
Definition: side_impl.hh:70
const Element * element_
Definition: sides.h:120
void inc()
Definition: side_impl.hh:80
const Node * node(unsigned int i) const
Definition: side_impl.hh:35
Mesh * mesh() const
Definition: side_impl.hh:46
ElementVector element
Vector of elements of the mesh.
Definition: mesh.h:205
unsigned int n_nodes() const
Definition: side_impl.hh:22