Flow123d  DF_patch_fe_data_tables-1a16803
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(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);
#define ASSERT(expr)
Definition: asserts.hh:351
Internal auxiliary class representing intersection object of simplex<dimA> and simplex<dimB>.
IntersectionAux()
Default constructor.
std::vector< IntersectionPointAux< dimA, dimB > > i_points_
Vector of internal intersection points.
std::vector< IntersectionPointAux< dimA, dimB > > & points()
Returns intersection points by a reference.
double compute_measure()
virtual ~IntersectionAux()
Destructor.
template ostream & operator<<< 2, 3 >(ostream &os, const IntersectionAux< 2, 3 > &s)
ostream & operator<<(ostream &os, const IntersectionAux< dimA, dimB > &intersection)
template ostream & operator<<< 1, 3 >(ostream &os, const IntersectionAux< 1, 3 > &s)
template ostream & operator<<< 2, 2 >(ostream &os, const IntersectionAux< 2, 2 > &s)
template ostream & operator<<< 1, 2 >(ostream &os, const IntersectionAux< 1, 2 > &s)
Internal class representing intersection object.
Internal class representing intersection point.
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc.