Reference documentation for deal.II version GIT d7aca55de5 2022-08-10 12:50:02+00:00
\(\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 - 2022 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 #ifndef _MSC_VER
81  .template get_default_linear_mapping<dim, spacedim>()
82 #else
83  .ReferenceCell::get_default_linear_mapping<dim, spacedim>()
84 #endif
85  ));
86 
90  ~Cache() override;
91 
102  void
104 
105 
110  const std::vector<
111  std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>> &
112  get_vertex_to_cell_map() const;
113 
118  const std::vector<std::vector<Tensor<1, spacedim>>> &
120 
125  const std::map<unsigned int, Point<spacedim>> &
126  get_used_vertices() const;
127 
132  const RTree<std::pair<Point<spacedim>, unsigned int>> &
133  get_used_vertices_rtree() const;
134 
141  const RTree<
142  std::pair<BoundingBox<spacedim>,
145 
156  const RTree<
157  std::pair<BoundingBox<spacedim>,
160 
161 
168  const std::vector<std::set<unsigned int>> &
170 
176 
180  const Mapping<dim, spacedim> &
181  get_mapping() const;
182 
183 
212  const RTree<std::pair<BoundingBox<spacedim>, unsigned int>> &
213  get_covering_rtree(const unsigned int level = 0) const;
214 
215  private:
220 
225 
230 
231 
236  mutable std::vector<
237  std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>>
239 
244  mutable std::vector<std::vector<Tensor<1, spacedim>>>
246 
255  mutable std::map<unsigned int,
258 
263  mutable std::map<unsigned int, Point<spacedim>> used_vertices;
264 
269 
274  mutable RTree<
275  std::pair<BoundingBox<spacedim>,
278 
283  mutable RTree<
284  std::pair<BoundingBox<spacedim>,
287 
288 
293  mutable std::vector<std::set<unsigned int>> vertex_to_neighbor_subdomain;
294 
298  boost::signals2::connection tria_signal;
299  };
300 
301 
302 
303  // Inline functions
304  template <int dim, int spacedim>
305  inline const Triangulation<dim, spacedim> &
307  {
308  return *tria;
309  }
310 
311 
312 
313  template <int dim, int spacedim>
314  inline const Mapping<dim, spacedim> &
316  {
317  return *mapping;
318  }
319 } // namespace GridTools
320 
321 
322 
324 
325 #endif
SmartPointer< const Triangulation< dim, spacedim >, Cache< dim, spacedim > > tria
CacheUpdateFlags update_flags
const std::vector< std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > > & get_vertex_to_cell_map() const
std::vector< std::vector< Tensor< 1, spacedim > > > vertex_to_cell_centers
Cache(const Triangulation< dim, spacedim > &tria, const Mapping< dim, spacedim > &mapping=(ReferenceCells::get_hypercube< dim >() .template get_default_linear_mapping< dim, spacedim >()))
const RTree< std::pair< BoundingBox< spacedim >, unsigned int > > & get_covering_rtree(const unsigned int level=0) const
SmartPointer< const Mapping< dim, spacedim >, Cache< dim, spacedim > > mapping
std::vector< std::set< unsigned int > > vertex_to_neighbor_subdomain
const std::vector< std::vector< Tensor< 1, spacedim > > > & get_vertex_to_cell_centers_directions() const
RTree< std::pair< BoundingBox< spacedim >, typename Triangulation< dim, spacedim >::active_cell_iterator > > cell_bounding_boxes_rtree
RTree< std::pair< BoundingBox< spacedim >, typename Triangulation< dim, spacedim >::active_cell_iterator > > locally_owned_cell_bounding_boxes_rtree
const std::vector< std::set< unsigned int > > & get_vertex_to_neighbor_subdomain() const
std::map< unsigned int, Point< spacedim > > used_vertices
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
RTree< std::pair< Point< spacedim >, unsigned int > > used_vertices_rtree
const Triangulation< dim, spacedim > & get_triangulation() const
const RTree< std::pair< Point< spacedim >, unsigned int > > & get_used_vertices_rtree() const
const RTree< std::pair< BoundingBox< spacedim >, typename Triangulation< dim, spacedim >::active_cell_iterator > > & get_cell_bounding_boxes_rtree() const
std::vector< std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > > vertex_to_cells
const std::map< unsigned int, Point< spacedim > > & get_used_vertices() const
std::map< unsigned int, RTree< std::pair< BoundingBox< spacedim >, unsigned int > > > covering_rtree
void mark_for_update(const CacheUpdateFlags &flags=update_all)
boost::signals2::connection tria_signal
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
unsigned int level
Definition: grid_out.cc:4607
boost::geometry::index::rtree< LeafType, IndexType, IndexableGetter > RTree
Definition: rtree.h:146
const ::Triangulation< dim, spacedim > & tria