Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
grid_tools_cache.h
Go to the documentation of this file.
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 
23 #include <deal.II/base/point.h>
25 
26 #include <deal.II/fe/mapping_q1.h>
27 
29 #include <deal.II/grid/tria.h>
32 
34 #include <deal.II/numerics/rtree.h>
35 
36 #include <boost/signals2.hpp>
37 
38 #include <cmath>
39 
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 
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 
283 
284 #endif
GridTools
Definition: grid_tools.h:125
tria_accessor.h
GridTools::Cache::covering_rtree
RTree< std::pair< BoundingBox< spacedim >, unsigned int > > covering_rtree
Definition: grid_tools_cache.h:225
GridTools::update_all
@ update_all
Definition: grid_tools_cache_update_flags.h:89
StaticMappingQ1
Definition: mapping_q1.h:88
GridTools::Cache::vertex_to_cells
std::vector< std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > > vertex_to_cells
Definition: grid_tools_cache.h:212
KDTree< spacedim >
Triangulation
Definition: tria.h:1109
tria.h
tria_iterator.h
mapping_q1.h
GridTools::Cache::get_covering_rtree
const RTree< std::pair< BoundingBox< spacedim >, unsigned int > > & get_covering_rtree() const
Definition: grid_tools_cache.cc:163
GridTools::Cache::vertex_kdtree
KDTree< spacedim > vertex_kdtree
Definition: grid_tools_cache.h:231
grid_tools_cache_update_flags.h
GridTools::CacheUpdateFlags
CacheUpdateFlags
Definition: grid_tools_cache_update_flags.h:35
rtree.h
GridTools::Cache::Cache
Cache(const Triangulation< dim, spacedim > &tria, const Mapping< dim, spacedim > &mapping=StaticMappingQ1< dim, spacedim >::mapping)
Definition: grid_tools_cache.cc:28
GridTools::Cache::mapping
SmartPointer< const Mapping< dim, spacedim >, Cache< dim, spacedim > > mapping
Definition: grid_tools_cache.h:203
GridTools::Cache::mark_for_update
void mark_for_update(const CacheUpdateFlags &flags=update_all)
Definition: grid_tools_cache.cc:51
Subscriptor
Definition: subscriptor.h:62
GridTools::Cache::used_vertices_rtree
RTree< std::pair< Point< spacedim >, unsigned int > > used_vertices_rtree
Definition: grid_tools_cache.h:243
GridTools::Cache::tria
SmartPointer< const Triangulation< dim, spacedim >, Cache< dim, spacedim > > tria
Definition: grid_tools_cache.h:198
GridTools::Cache::get_used_vertices
const std::map< unsigned int, Point< spacedim > > & get_used_vertices() const
Definition: grid_tools_cache.cc:90
RTree
boost::geometry::index::rtree< LeafType, IndexType > RTree
Definition: rtree.h:134
Mapping
Abstract base class for mapping classes.
Definition: mapping.h:302
GridTools::Cache::~Cache
~Cache() override
Definition: grid_tools_cache.cc:39
kdtree.h
subscriptor.h
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
GridTools::Cache::get_cell_bounding_boxes_rtree
const RTree< std::pair< BoundingBox< spacedim >, typename Triangulation< dim, spacedim >::active_cell_iterator > > & get_cell_bounding_boxes_rtree() const
Definition: grid_tools_cache.cc:126
GridTools::Cache
Definition: grid_tools.h:128
GridTools::Cache::get_vertex_kdtree
const KDTree< spacedim > & get_vertex_kdtree() const
Definition: grid_tools_cache.cc:148
exceptions.h
TriaActiveIterator
Definition: tria_iterator.h:759
SmartPointer
Definition: smartpointer.h:68
GridTools::Cache::get_vertex_to_cell_map
const std::vector< std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > > & get_vertex_to_cell_map() const
Definition: grid_tools_cache.cc:61
GridTools::Cache::vertex_to_cell_centers
std::vector< std::vector< Tensor< 1, spacedim > > > vertex_to_cell_centers
Definition: grid_tools_cache.h:219
GridTools::Cache::get_triangulation
const Triangulation< dim, spacedim > & get_triangulation() const
Definition: grid_tools_cache.h:265
GridTools::Cache::get_used_vertices_rtree
const RTree< std::pair< Point< spacedim >, unsigned int > > & get_used_vertices_rtree() const
Definition: grid_tools_cache.cc:104
GridTools::Cache::get_vertex_to_cell_centers_directions
const std::vector< std::vector< Tensor< 1, spacedim > > > & get_vertex_to_cell_centers_directions() const
Definition: grid_tools_cache.cc:75
config.h
GridTools::Cache::used_vertices
std::map< unsigned int, Point< spacedim > > used_vertices
Definition: grid_tools_cache.h:238
GridTools::Cache::get_mapping
const Mapping< dim, spacedim > & get_mapping() const
Definition: grid_tools_cache.h:274
GridTools::Cache::cell_bounding_boxes_rtree
RTree< std::pair< BoundingBox< spacedim >, typename Triangulation< dim, spacedim >::active_cell_iterator > > cell_bounding_boxes_rtree
Definition: grid_tools_cache.h:252
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
GridTools::Cache::tria_signal
boost::signals2::connection tria_signal
Definition: grid_tools_cache.h:257
point.h
GridTools::Cache::update_flags
CacheUpdateFlags update_flags
Definition: grid_tools_cache.h:193