Flow123d  release_2.2.0-914-gf1a3a4f
intersection_aux.hh
Go to the documentation of this file.
1 /*!
2  *
3 * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file intersection_aux.hh
15  * @brief Internal class representing intersection object.
16  * @author Pavel Exner
17  *
18  */
19 
20 #ifndef INTERSECTIONAUX_H_
21 #define INTERSECTIONAUX_H_
22 
23 #include "system/system.hh"
24 
25 
26 //forward declare
27 template<unsigned int, unsigned int> class IntersectionPointAux;
28 template<typename U, typename V> class ComputeIntersection;
29 
30 /** @brief Internal auxiliary class representing intersection object of simplex<dimA> and simplex<dimB>.
31  *
32  * It contains topology information and auxiliary intersection points.
33  * Used in ComputeIntersection classes.
34  */
35 template<unsigned int dimA, unsigned int dimB>
36 class IntersectionAux{
37 
38  /// Vector of internal intersection points.
40 
41  /// Index of intersecting element in the component.
42  unsigned int component_element_idx_;
43  /// Index of intersecting element in the bulk.
44  unsigned int bulk_element_idx_;
45  /// Flag for pathologic case.
47 
48 public:
49 
50  /// Default constructor.
52  /// Constructor taking in element indices.
53  IntersectionAux(unsigned int component_element_idx,
54  unsigned int bulk_element_idx);
55  /// Destructor.
56  virtual ~IntersectionAux();
57 
58  /// Returns intersection points by a reference.
60 
61  /// Returns intersection points by a constant reference.
63 
64  /// Returns intersection point of given @p index.
65  const IntersectionPointAux<dimA,dimB> &operator[](unsigned int index) const;
66 
67  unsigned int size() const; ///< Returns number of intersection points.
68  unsigned int component_ele_idx() const; ///< Returns index of component element.
69  unsigned int bulk_ele_idx() const; ///< Returns index of bulk element.
70  unsigned int is_pathologic() const; ///< Returns index of bulk element.
71 
72  /// Computes the relative measure of intersection object.
73  /// TODO: unifiy implementation with IntersectionLocalb
74  double compute_measure();
75 
76  /// Friend output operator.
77  template<unsigned int dimAA, unsigned int dimBB>
78  friend std::ostream& operator<<(std::ostream& os, const IntersectionAux<dimAA,dimBB>& intersection);
79 
80  template<typename U, typename V>
81  friend class ComputeIntersection;
82 };
83 
84 /********************************************* IMPLEMENTATION ***********************************************/
85 
86 template<unsigned int dimA, unsigned int dimB>
88 { return i_points_; }
89 
90 template<unsigned int dimA, unsigned int dimB>
92 { return i_points_; }
93 
94 template<unsigned int dimA, unsigned int dimB>
96 { ASSERT_DBG(index < i_points_.size());
97  return i_points_[index]; }
98 
99 
100 template<unsigned int dimA, unsigned int dimB>
101 inline unsigned int IntersectionAux<dimA,dimB>::size() const
102 { return i_points_.size(); }
103 
104 template<unsigned int dimA, unsigned int dimB>
106 { return component_element_idx_; }
107 
108 template<unsigned int dimA, unsigned int dimB>
109 inline unsigned int IntersectionAux<dimA,dimB>::bulk_ele_idx() const
110 { return bulk_element_idx_; }
111 
112 template<unsigned int dimA, unsigned int dimB>
113 inline unsigned int IntersectionAux<dimA,dimB>::is_pathologic() const
114 { return pathologic_; }
115 
116 
117 #endif /* INTERSECTIONAUX_H_ */
std::vector< IntersectionPointAux< dimA, dimB > > i_points_
Vector of internal intersection points.
unsigned int component_ele_idx() const
Returns index of component element.
unsigned int component_element_idx_
Index of intersecting element in the component.
virtual ~IntersectionAux()
Destructor.
bool pathologic_
Flag for pathologic case.
const IntersectionPointAux< dimA, dimB > & operator[](unsigned int index) const
Returns intersection point of given index.
unsigned int size() const
Returns number of intersection points.
unsigned int is_pathologic() const
Returns index of bulk element.
unsigned int bulk_ele_idx() const
Returns index of bulk element.
std::vector< IntersectionPointAux< dimA, dimB > > & points()
Returns intersection points by a reference.
IntersectionAux()
Default constructor.
unsigned int bulk_element_idx_
Index of intersecting element in the bulk.
#define ASSERT_DBG(expr)
Definition: asserts.hh:349
Internal auxiliary class represents an intersection point of simplex<N> and simplex<M>.
Internal auxiliary class representing intersection object of simplex<dimA> and simplex<dimB>.
double compute_measure()