AnisotropicEikonal.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2014 SINTEF ICT, Applied Mathematics.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_ANISOTROPICEIKONAL_HEADER_INCLUDED
21 #define OPM_ANISOTROPICEIKONAL_HEADER_INCLUDED
22 
24 #include <vector>
25 #include <set>
26 #include <map>
27 
28 #include <opm/common/utility/platform_dependent/disable_warnings.h>
29 
30 #include <boost/version.hpp>
31 
32 #define BOOST_HEAP_AVAILABLE ((BOOST_VERSION / 100 % 1000) >= 49)
33 
34 #if BOOST_HEAP_AVAILABLE
35 #include <boost/heap/fibonacci_heap.hpp>
36 #endif
37 
38 #include <opm/common/utility/platform_dependent/reenable_warnings.h>
39 
40 
41 struct UnstructuredGrid;
42 
43 namespace Opm
44 {
51  {
52  public:
56 
61  void solve(const double* metric,
62  const std::vector<int>& startcells,
63  std::vector<double>& solution);
64  private:
65 #if BOOST_HEAP_AVAILABLE
66  // Grid and topology.
67  const UnstructuredGrid& grid_;
68  SparseTable<int> cell_neighbours_;
69 
70  // Keep track of accepted cells.
71  std::vector<char> is_accepted_;
72  std::set<int> accepted_front_;
73 
74  // Quantities relating to anisotropy.
75  std::vector<double> grid_radius_;
76  std::vector<double> aniso_ratio_;
77  const double safety_factor_;
78 
79  // Keep track of considered cells.
80  typedef std::pair<double, int> ValueAndCell;
81  typedef boost::heap::compare<std::greater<ValueAndCell>> Comparator;
82  typedef boost::heap::fibonacci_heap<ValueAndCell, Comparator> Heap;
83  Heap considered_;
84  typedef Heap::handle_type HeapHandle;
85  std::map<int, HeapHandle> considered_handles_;
86  std::vector<char> is_considered_;
87 
88  bool isClose(const int c1, const int c2) const;
89  double computeValue(const int cell, const double* metric, const double* solution) const;
90  double computeValueUpdate(const int cell, const double* metric, const double* solution, const int new_cell) const;
91  double computeFromLine(const int cell, const int from, const double* metric, const double* solution) const;
92  double computeFromTri(const int cell, const int n0, const int n1, const double* metric, const double* solution) const;
93 
94  const ValueAndCell& topConsidered() const;
95  void pushConsidered(const ValueAndCell& vc);
96  void popConsidered();
97 
98  void computeGridRadius();
99  void computeAnisoRatio(const double* metric);
100 #endif // BOOST_HEAP_AVAILABLE
101  };
102 
103 } // namespace Opm
104 
105 
106 #endif // OPM_ANISOTROPICEIKONAL_HEADER_INCLUDED
Definition: grid.h:98
Definition: AnisotropicEikonal.hpp:43
void solve(const double *metric, const std::vector< int > &startcells, std::vector< double > &solution)
Definition: AnisotropicEikonal.hpp:50
double from(const double q, const double unit)
Definition: Units.hpp:191
const UnstructuredGrid & grid
Definition: ColumnExtract.hpp:31
AnisotropicEikonal2d(const UnstructuredGrid &grid)