Flow123d  JS_before_hm-1829-g302b31a68
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  ASSERT_DBG(false);
24 }
25 
26 template<unsigned int dimA, unsigned int dimB>
28 {}
29 
30 
31 // 1D-3D
32 
33 template<>
35 {
36  double length = 0;
37 
38  if(i_points_.size() > 1)
39  for(unsigned int i=0; i < i_points_.size()-1; i++)
40  {
41  length += std::abs(i_points_[i].local_bcoords_A()[1] - i_points_[i+1].local_bcoords_A()[1]);
42  }
43  return length;
44 }
45 
46 
47 // 2D-3D
48 
49 template<>
51 {
52  double subtotal = 0.0;
53 
54  if(i_points_.size() > 2)
55  for(unsigned int j = 2; j < i_points_.size();j++){
56  //DebugOut().fmt("volani {} {}\n", j, i_points_.size());
57  subtotal += fabs(i_points_[0].local_bcoords_A()(1)*(i_points_[j-1].local_bcoords_A()(2) - i_points_[j].local_bcoords_A()(2)) +
58  i_points_[j-1].local_bcoords_A()(1)*(i_points_[j].local_bcoords_A()(2) - i_points_[0].local_bcoords_A()(2)) +
59  i_points_[j].local_bcoords_A()(1)*(i_points_[0].local_bcoords_A()(2) - i_points_[j-1].local_bcoords_A()(2)));
60  }
61  return fabs(subtotal/2);
62 }
63 
64 
65 template<unsigned int dimA, unsigned int dimB>
66 ostream& operator<<(ostream& os, const IntersectionAux<dimA,dimB>& intersection)
67 {
68  for(unsigned int i = 0; i < intersection.points().size(); i++)
69  os << intersection.points()[i];
70 
71  return os;
72 }
73 
74 
75 template class IntersectionAux<1,2>;
76 template class IntersectionAux<2,2>;
77 template class IntersectionAux<1,3>;
78 template class IntersectionAux<2,3>;
79 
80 template ostream& operator<< <1,2>(ostream &os, const IntersectionAux<1,2>& s);
81 template ostream& operator<< <2,2>(ostream &os, const IntersectionAux<2,2>& s);
82 template ostream& operator<< <1,3>(ostream &os, const IntersectionAux<1,3>& s);
83 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
ASSERT_DBG
#define ASSERT_DBG(expr)
Definition: include_fadbad.hh:28
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:100
operator<<< 1, 3 >
template ostream & operator<<< 1, 3 >(ostream &os, const IntersectionAux< 1, 3 > &s)
IntersectionAux::~IntersectionAux
virtual ~IntersectionAux()
Destructor.
Definition: intersection_aux.cc:27
intersection_aux.hh
Internal class representing intersection object.
operator<<
ostream & operator<<(ostream &os, const IntersectionAux< dimA, dimB > &intersection)
Definition: intersection_aux.cc:66
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.