Flow123d  JS_before_hm-989-g79825ac
intersection_aux.cc
Go to the documentation of this file.
1 /*
2  * Created on: 14.3.2016
3  * Author: pex
4  */
5 
6 #include "intersection_aux.hh"
8 #include "mesh/ref_element.hh"
9 
10 
11 template<unsigned int dimA, unsigned int dimB>
12 IntersectionAux<dimA,dimB>::IntersectionAux(unsigned int component_element_idx,
13  unsigned int bulk_element_idx)
14 : component_element_idx_(component_element_idx),
15  bulk_element_idx_(bulk_element_idx),
16  ips_in_face_(-1),
17  n_duplicities_(0)
18 {}
19 
20 template<unsigned int dimA, unsigned int dimB>
22 {}
23 
24 template<unsigned int dimA, unsigned int dimB>
26 {}
27 
28 
29 // 1D-3D
30 
31 template<>
33 {
34  double length = 0;
35 
36  if(i_points_.size() > 1)
37  for(unsigned int i=0; i < i_points_.size()-1; i++)
38  {
39  length += std::abs(i_points_[i].local_bcoords_A()[1] - i_points_[i+1].local_bcoords_A()[1]);
40  }
41  return length;
42 }
43 
44 
45 // 2D-3D
46 
47 template<>
49 {
50  double subtotal = 0.0;
51 
52  if(i_points_.size() > 2)
53  for(unsigned int j = 2; j < i_points_.size();j++){
54  //xprintf(Msg, "volani %d %d\n",j, i_points_.size());
55  subtotal += fabs(i_points_[0].local_bcoords_A()(1)*(i_points_[j-1].local_bcoords_A()(2) - i_points_[j].local_bcoords_A()(2)) +
56  i_points_[j-1].local_bcoords_A()(1)*(i_points_[j].local_bcoords_A()(2) - i_points_[0].local_bcoords_A()(2)) +
57  i_points_[j].local_bcoords_A()(1)*(i_points_[0].local_bcoords_A()(2) - i_points_[j-1].local_bcoords_A()(2)));
58  }
59  return fabs(subtotal/2);
60 }
61 
62 
63 template<unsigned int dimA, unsigned int dimB>
64 ostream& operator<<(ostream& os, const IntersectionAux<dimA,dimB>& intersection)
65 {
66  for(unsigned int i = 0; i < intersection.points().size(); i++)
67  os << intersection.points()[i];
68 
69  return os;
70 }
71 
72 
73 template class IntersectionAux<1,2>;
74 template class IntersectionAux<2,2>;
75 template class IntersectionAux<1,3>;
76 template class IntersectionAux<2,3>;
77 
78 template ostream& operator<< <1,2>(ostream &os, const IntersectionAux<1,2>& s);
79 template ostream& operator<< <2,2>(ostream &os, const IntersectionAux<2,2>& s);
80 template ostream& operator<< <1,3>(ostream &os, const IntersectionAux<1,3>& s);
81 template ostream& operator<< <2,3>(ostream &os, const IntersectionAux<2,3>& s);
std::vector< IntersectionPointAux< dimA, dimB > > i_points_
Vector of internal intersection points.
template ostream & operator<< < 2, 2 >(ostream &os, const IntersectionAux< 2, 2 > &s)
virtual ~IntersectionAux()
Destructor.
template ostream & operator<< < 1, 3 >(ostream &os, const IntersectionAux< 1, 3 > &s)
IntersectionAux()
Default constructor.
template ostream & operator<< < 2, 3 >(ostream &os, const IntersectionAux< 2, 3 > &s)
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc...
template ostream & operator<< < 1, 2 >(ostream &os, const IntersectionAux< 1, 2 > &s)
double compute_measure()
Internal class representing intersection point.
Internal class representing intersection object.