Flow123d  JS_before_hm-1727-ga1133b990
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  //DebugOut().fmt("volani {} {}\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);
ref_element.hh
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc.
IntersectionAux::IntersectionAux
IntersectionAux()
Default constructor.
Definition: intersection_aux.cc:21
IntersectionAux::i_points_
std::vector< IntersectionPointAux< dimA, dimB > > i_points_
Vector of internal intersection points.
Definition: intersection_aux.hh:39
operator<<< 1, 2 >
template ostream & operator<<< 1, 2 >(ostream &os, const IntersectionAux< 1, 2 > &s)
operator<<< 2, 3 >
template ostream & operator<<< 2, 3 >(ostream &os, const IntersectionAux< 2, 3 > &s)
IntersectionAux::points
std::vector< IntersectionPointAux< dimA, dimB > > & points()
Returns intersection points by a reference.
Definition: intersection_aux.hh:94
operator<<< 1, 3 >
template ostream & operator<<< 1, 3 >(ostream &os, const IntersectionAux< 1, 3 > &s)
IntersectionAux::~IntersectionAux
virtual ~IntersectionAux()
Destructor.
Definition: intersection_aux.cc:25
intersection_aux.hh
Internal class representing intersection object.
operator<<
ostream & operator<<(ostream &os, const IntersectionAux< dimA, dimB > &intersection)
Definition: intersection_aux.cc:64
IntersectionAux
Internal auxiliary class representing intersection object of simplex<dimA> and simplex<dimB>.
Definition: compute_intersection.hh:49
IntersectionAux::compute_measure
double compute_measure()
operator<<< 2, 2 >
template ostream & operator<<< 2, 2 >(ostream &os, const IntersectionAux< 2, 2 > &s)
intersection_point_aux.hh
Internal class representing intersection point.