Reference documentation for deal.II version 9.3.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 - 2021 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:
79  (ReferenceCells::get_hypercube<dim>()
80  .template get_default_linear_mapping<dim, spacedim>()));
81 
85  ~Cache() override;
86 
97  void
99 
100 
105  const std::vector<
106  std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>> &
107  get_vertex_to_cell_map() const;
108 
113  const std::vector<std::vector<Tensor<1, spacedim>>> &
115 
120  const std::map<unsigned int, Point<spacedim>> &
121  get_used_vertices() const;
122 
127  const RTree<std::pair<Point<spacedim>, unsigned int>> &
128  get_used_vertices_rtree() const;
129 
136  const RTree<
137  std::pair<BoundingBox<spacedim>,
140 
151  const RTree<
152  std::pair<BoundingBox<spacedim>,
155 
156 
163  const std::vector<std::set<unsigned int>> &
165 
170  get_triangulation() const;
171 
175  const Mapping<dim, spacedim> &
176  get_mapping() const;
177 
178 
207  const RTree<std::pair<BoundingBox<spacedim>, unsigned int>> &
208  get_covering_rtree(const unsigned int level = 0) const;
209 
210  private:
215 
220 
225 
226 
231  mutable std::vector<
232  std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>>
234 
239  mutable std::vector<std::vector<Tensor<1, spacedim>>>
241 
250  mutable std::map<unsigned int,
253 
258  mutable std::map<unsigned int, Point<spacedim>> used_vertices;
259 
264 
269  mutable RTree<
270  std::pair<BoundingBox<spacedim>,
273 
278  mutable RTree<
279  std::pair<BoundingBox<spacedim>,
282 
283 
288  mutable std::vector<std::set<unsigned int>> vertex_to_neighbor_subdomain;
289 
293  boost::signals2::connection tria_signal;
294  };
295 
296 
297 
298  // Inline functions
299  template <int dim, int spacedim>
300  inline const Triangulation<dim, spacedim> &
302  {
303  return *tria;
304  }
305 
306 
307 
308  template <int dim, int spacedim>
309  inline const Mapping<dim, spacedim> &
311  {
312  return *mapping;
313  }
314 } // namespace GridTools
315 
316 
317 
319 
320 #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
std::vector< std::set< unsigned int > > vertex_to_neighbor_subdomain
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
const std::vector< std::set< unsigned int > > & get_vertex_to_neighbor_subdomain() const
Abstract base class for mapping classes.
Definition: mapping.h:303
SmartPointer< const Mapping< dim, spacedim >, Cache< dim, spacedim > > mapping
Cache(const Triangulation< dim, spacedim > &tria, const Mapping< dim, spacedim > &mapping=(ReferenceCells::get_hypercube< dim >() .template get_default_linear_mapping< dim, spacedim >()))
SmartPointer< const Triangulation< dim, spacedim >, Cache< dim, spacedim > > tria
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:395
unsigned int level
Definition: grid_out.cc:4590
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:394
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