Reference documentation for deal.II version Git e3a3ec7800 2020-08-07 14:08:19 +0200
\(\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 
33 #include <deal.II/numerics/rtree.h>
34 
35 #include <boost/signals2.hpp>
36 
37 #include <cmath>
38 
40 
41 namespace GridTools
42 {
64  template <int dim, int spacedim = dim>
65  class Cache : public Subscriptor
66  {
67  public:
80 
84  ~Cache() override;
85 
96  void
98 
99 
104  const std::vector<
105  std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>> &
106  get_vertex_to_cell_map() const;
107 
112  const std::vector<std::vector<Tensor<1, spacedim>>> &
114 
119  const std::map<unsigned int, Point<spacedim>> &
120  get_used_vertices() const;
121 
126  const RTree<std::pair<Point<spacedim>, unsigned int>> &
127  get_used_vertices_rtree() const;
128 
135  const RTree<
136  std::pair<BoundingBox<spacedim>,
139 
150  const RTree<
151  std::pair<BoundingBox<spacedim>,
154 
159  get_triangulation() const;
160 
164  const Mapping<dim, spacedim> &
165  get_mapping() const;
166 
167 
196  const RTree<std::pair<BoundingBox<spacedim>, unsigned int>> &
197  get_covering_rtree(const unsigned int level = 0) const;
198 
199  private:
204 
209 
214 
215 
220  mutable std::vector<
221  std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>>
223 
228  mutable std::vector<std::vector<Tensor<1, spacedim>>>
230 
239  mutable std::map<unsigned int,
242 
247  mutable std::map<unsigned int, Point<spacedim>> used_vertices;
248 
253 
258  mutable RTree<
259  std::pair<BoundingBox<spacedim>,
262 
267  mutable RTree<
268  std::pair<BoundingBox<spacedim>,
271 
275  boost::signals2::connection tria_signal;
276  };
277 
278 
279 
280  // Inline functions
281  template <int dim, int spacedim>
282  inline const Triangulation<dim, spacedim> &
284  {
285  return *tria;
286  }
287 
288 
289 
290  template <int dim, int spacedim>
291  inline const Mapping<dim, spacedim> &
293  {
294  return *mapping;
295  }
296 } // namespace GridTools
297 
298 
299 
301 
302 #endif
const Triangulation< dim, spacedim > & get_triangulation() const
boost::signals2::connection tria_signal
const RTree< std::pair< BoundingBox< spacedim >, typename Triangulation< dim, spacedim >::active_cell_iterator > > & get_locally_owned_cell_bounding_boxes_rtree() const
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
RTree< std::pair< BoundingBox< spacedim >, typename Triangulation< dim, spacedim >::active_cell_iterator > > locally_owned_cell_bounding_boxes_rtree
boost::geometry::index::rtree< LeafType, IndexType, IndexableGetter > RTree
Definition: rtree.h:145
Abstract base class for mapping classes.
Definition: mapping.h:301
SmartPointer< const Mapping< dim, spacedim >, Cache< dim, spacedim > > mapping
SmartPointer< const Triangulation< dim, spacedim >, Cache< dim, spacedim > > tria
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:363
unsigned int level
Definition: grid_out.cc:4341
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 RTree< std::pair< BoundingBox< spacedim >, unsigned int > > & get_covering_rtree(const unsigned int level=0) const
CacheUpdateFlags update_flags
std::map< unsigned int, Point< spacedim > > used_vertices
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:362
RTree< std::pair< BoundingBox< spacedim >, typename Triangulation< dim, spacedim >::active_cell_iterator > > cell_bounding_boxes_rtree
std::map< unsigned int, 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