Flow123d  jenkins-Flow123d-windows32-release-multijob-28
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  // cout << "sn dim: " << dim() << "side: " << lnum << "node: "<< i << endl;
37  int i_n = mesh()->side_nodes[dim()][el_idx_][i];
38  // cout << "el node: "<< i_n << "nn: " << element->n_nodes << endl;
39 
40  return element_->node[ i_n ];
41  }
42 
43  inline ElementFullIter Side::element() const {
44  ASSERT( valid(), "Wrong use of uninitialized accessor.\n");
45  return mesh()->element.full_iter( const_cast<Element *>(element_) );
46  }
47 
48  inline Mesh * Side::mesh() const {
49  return element_->mesh_;
50  }
51 
52  inline unsigned int Side::edge_idx() const {
53  return element_->edge_idx_[el_idx()];
54  }
55 
56  inline Edge * Side::edge() const {
57  if (edge_idx() == Mesh::undef_idx) return NULL;
58  else return &( mesh()->edges[ edge_idx() ] );
59  }
60 
61  inline Boundary * Side::cond() const {
62  if (cond_idx() == Mesh::undef_idx) return NULL;
63  else return &( mesh()->boundary_[ cond_idx() ] );
64  }
65 
66  inline unsigned int Side::cond_idx() const {
67  if (element_->boundary_idx_ == NULL) return Mesh::undef_idx;
68  else return element_->boundary_idx_[el_idx()];
69  }
70 
71 
72  inline unsigned int Side::el_idx() const {
73  return el_idx_;
74  }
75 
76 
77  inline bool Side::valid() const {
78  return element_!= NULL;
79  }
80 
81 
82  inline void Side::inc() {
83  el_idx_++;
84  }
85 
86 
87  inline void *Side::make_ptr() const {
88  return (void *)((long int) element_ << (2 + el_idx_) );
89  }
90 #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:52
Boundary * cond() const
Definition: side_impl.hh:61
static const unsigned int undef_idx
Definition: mesh.h:110
???
Definition: mesh.h:108
Node ** node
Definition: elements.h:90
int n_sides
Definition: edges.h:48
vector< vector< vector< unsigned int > > > side_nodes
Definition: mesh.h:248
Definition: edges.h:38
bool valid() const
Definition: side_impl.hh:77
vector< Boundary > boundary_
Definition: mesh.h:202
Edge * edge() const
Definition: side_impl.hh:56
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:120
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:87
Side()
Definition: sides.h:54
Mesh * mesh_
Definition: elements.h:132
unsigned int cond_idx() const
Definition: side_impl.hh:66
ElementFullIter element() const
Definition: side_impl.hh:43
std::vector< Edge > edges
Vector of MH edges, this should not be part of the geometrical mesh.
Definition: mesh.h:209
FullIter full_iter(Iter it)
Definition: sys_vector.hh:449
unsigned int el_idx_
Definition: sides.h:130
unsigned int el_idx() const
Definition: side_impl.hh:72
const Element * element_
Definition: sides.h:129
void inc()
Definition: side_impl.hh:82
const Node * node(unsigned int i) const
Definition: side_impl.hh:35
Mesh * mesh() const
Definition: side_impl.hh:48
ElementVector element
Vector of elements of the mesh.
Definition: mesh.h:198
unsigned int n_nodes() const
Definition: side_impl.hh:22