3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
boundingboxtreeintersection.hh
Go to the documentation of this file.
1/*****************************************************************************
2 * See the file COPYING for full copying permissions. *
3 * *
4 * This program is free software: you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation, either version 3 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16 *****************************************************************************/
22#ifndef DUMUX_BOUNDING_BOX_TREE_INTERSECTION_HH
23#define DUMUX_BOUNDING_BOX_TREE_INTERSECTION_HH
24
25#warning "This header is deprecated and will be removed after 3.2. Use more general class IntersectionInfo from header intersectingentities.hh"
26#include <dune/common/fvector.hh>
27#include <dune/common/promotiontraits.hh>
28
29namespace Dumux {
30
40template<class EntitySet0, class EntitySet1>
41class [[deprecated("Will be removed after 3.2. Use more general class IntersectionInfo from header intersectingentities.hh")]] BoundingBoxTreeIntersection
42{
43 enum { dimworld = EntitySet0::dimensionworld };
44 using ctype = typename Dune::PromotionTraits<typename EntitySet0::ctype, typename EntitySet1::ctype>::PromotedType;
45 using GlobalPosition = Dune::FieldVector<ctype, dimworld>;
46
47public:
48 template<class Corners>
49 explicit BoundingBoxTreeIntersection(std::size_t a,
50 std::size_t b,
51 Corners&& c)
52 : a_(a)
53 , b_(b)
54 , corners_(c.begin(), c.end())
55 {
56 static_assert(int(EntitySet0::dimensionworld) == int(EntitySet1::dimensionworld),
57 "Can only store intersections of entity sets with the same world dimension");
58 }
59
61 std::size_t first() const
62 { return a_; }
63
65 std::size_t second() const
66 { return b_; }
67
69 std::vector<GlobalPosition> corners() const
70 { return corners_; }
71
76 bool cornersMatch(const std::vector<GlobalPosition>& otherCorners) const
77 {
78 if (otherCorners.size() != corners_.size())
79 return false;
80
81 const auto eps = 1.5e-7*(corners_[1] - corners_[0]).two_norm();
82 for (int i = 0; i < corners_.size(); ++i)
83 if ((corners_[i] - otherCorners[i]).two_norm() > eps)
84 return false;
85
86 return true;
87 }
88
89private:
90 std::size_t a_, b_;
91 std::vector<GlobalPosition> corners_;
92};
93
94} // end namespace Dumux
95
96#endif
Definition: adapt.hh:29
An intersection object resulting from the intersection of two bounding box tree primitives.
Definition: boundingboxtreeintersection.hh:42
std::vector< GlobalPosition > corners() const
Get the corners of the intersection geometry.
Definition: boundingboxtreeintersection.hh:69
std::size_t first() const
Get the index of the intersecting entity belonging to this grid.
Definition: boundingboxtreeintersection.hh:61
std::size_t second() const
Get the index of the intersecting entity belonging to the other grid.
Definition: boundingboxtreeintersection.hh:65
bool cornersMatch(const std::vector< GlobalPosition > &otherCorners) const
Check if the corners of this intersection match with the given corners.
Definition: boundingboxtreeintersection.hh:76
BoundingBoxTreeIntersection(std::size_t a, std::size_t b, Corners &&c)
Definition: boundingboxtreeintersection.hh:49
An intersection object resulting from the intersection of two primitives in an entity set.
Definition: intersectingentities.hh:46