Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
grid_tools_cache.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2017 - 2019 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_grid_grid_tools_cache_h
17 #define dealii_grid_grid_tools_cache_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/exceptions.h>
23 #include <deal.II/base/point.h>
24 #include <deal.II/base/subscriptor.h>
25 
26 #include <deal.II/fe/mapping_q1.h>
27 
28 #include <deal.II/grid/grid_tools_cache_update_flags.h>
29 #include <deal.II/grid/tria.h>
30 #include <deal.II/grid/tria_accessor.h>
31 #include <deal.II/grid/tria_iterator.h>
32 
33 #include <deal.II/numerics/kdtree.h>
34 #include <deal.II/numerics/rtree.h>
35 
36 #include <boost/signals2.hpp>
37 
38 #include <cmath>
39 
40 DEAL_II_NAMESPACE_OPEN
41 
42 namespace GridTools
43 {
67  template <int dim, int spacedim = dim>
68  class Cache : public Subscriptor
69  {
70  public:
83 
87  ~Cache() override;
88 
99  void
101 
102 
107  const std::vector<
108  std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>> &
109  get_vertex_to_cell_map() const;
110 
115  const std::vector<std::vector<Tensor<1, spacedim>>> &
117 
122  const std::map<unsigned int, Point<spacedim>> &
123  get_used_vertices() const;
124 
129  const RTree<std::pair<Point<spacedim>, unsigned int>> &
130  get_used_vertices_rtree() const;
131 
136  const RTree<
137  std::pair<BoundingBox<spacedim>,
140 
145  get_triangulation() const;
146 
150  const Mapping<dim, spacedim> &
151  get_mapping() const;
152 
153 
177  const RTree<std::pair<BoundingBox<spacedim>, unsigned int>> &
178  get_covering_rtree() const;
179 
180 #ifdef DEAL_II_WITH_NANOFLANN
181 
185  const KDTree<spacedim> &
186  get_vertex_kdtree() const;
187 #endif
188 
189  private:
194 
199 
204 
205 
210  mutable std::vector<
211  std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>>
213 
218  mutable std::vector<std::vector<Tensor<1, spacedim>>>
220 
224  mutable RTree<std::pair<BoundingBox<spacedim>, unsigned int>>
226 
227 #ifdef DEAL_II_WITH_NANOFLANN
228 
232 #endif
233 
238  mutable std::map<unsigned int, Point<spacedim>> used_vertices;
239 
243  mutable RTree<std::pair<Point<spacedim>, unsigned int>> used_vertices_rtree;
244 
249  mutable RTree<
250  std::pair<BoundingBox<spacedim>,
253 
257  boost::signals2::connection tria_signal;
258  };
259 
260 
261 
262  // Inline functions
263  template <int dim, int spacedim>
264  inline const Triangulation<dim, spacedim> &
266  {
267  return *tria;
268  }
269 
270 
271 
272  template <int dim, int spacedim>
273  inline const Mapping<dim, spacedim> &
275  {
276  return *mapping;
277  }
278 } // namespace GridTools
279 
280 
281 
282 DEAL_II_NAMESPACE_CLOSE
283 
284 #endif
const Triangulation< dim, spacedim > & get_triangulation() const
boost::signals2::connection tria_signal
KDTree< spacedim > vertex_kdtree
const Mapping< dim, spacedim > & get_mapping() const
Cache(const Triangulation< dim, spacedim > &tria, const Mapping< dim, spacedim > &mapping=StaticMappingQ1< dim, spacedim >::mapping)
RTree< std::pair< Point< spacedim >, unsigned int > > used_vertices_rtree
const RTree< std::pair< BoundingBox< spacedim >, typename Triangulation< dim, spacedim >::active_cell_iterator > > & get_cell_bounding_boxes_rtree() const
const RTree< std::pair< BoundingBox< spacedim >, unsigned int > > & get_covering_rtree() const
Definition: tria.h:81
Abstract base class for mapping classes.
Definition: dof_tools.h:57
SmartPointer< const Mapping< dim, spacedim >, Cache< dim, spacedim > > mapping
SmartPointer< const Triangulation< dim, spacedim >, Cache< dim, spacedim > > tria
const RTree< std::pair< Point< spacedim >, unsigned int > > & get_used_vertices_rtree() const
void mark_for_update(const CacheUpdateFlags &flags=update_all)
const std::vector< std::vector< Tensor< 1, spacedim > > > & get_vertex_to_cell_centers_directions() const
const std::map< unsigned int, Point< spacedim > > & get_used_vertices() const
const KDTree< spacedim > & get_vertex_kdtree() const
CacheUpdateFlags update_flags
std::map< unsigned int, Point< spacedim > > used_vertices
RTree< std::pair< BoundingBox< spacedim >, typename Triangulation< dim, spacedim >::active_cell_iterator > > cell_bounding_boxes_rtree
RTree< std::pair< BoundingBox< spacedim >, unsigned int > > covering_rtree
std::vector< std::vector< Tensor< 1, spacedim > > > vertex_to_cell_centers
std::vector< std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > > vertex_to_cells
const std::vector< std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > > & get_vertex_to_cell_map() const