Reference documentation for deal.II version 9.1.0-pre
grid_tools_cache.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2017 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 
35 #include <boost/signals2.hpp>
36 
37 #include <cmath>
38 
39 DEAL_II_NAMESPACE_OPEN
40 
41 namespace GridTools
42 {
66  template <int dim, int spacedim = dim>
67  class Cache : public Subscriptor
68  {
69  public:
82 
86  ~Cache() override;
87 
98  void
100 
101 
106  const std::vector<
107  std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>> &
108  get_vertex_to_cell_map() const;
109 
114  const std::vector<std::vector<Tensor<1, spacedim>>> &
116 
121  const std::map<unsigned int, Point<spacedim>> &
122  get_used_vertices() const;
123 
128  get_triangulation() const;
129 
133  const Mapping<dim, spacedim> &
134  get_mapping() const;
135 
136 #ifdef DEAL_II_WITH_NANOFLANN
137 
141  const KDTree<spacedim> &
142  get_vertex_kdtree() const;
143 #endif
144 
145  private:
150 
155 
160 
161 
166  mutable std::vector<
167  std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>>
169 
174  mutable std::vector<std::vector<Tensor<1, spacedim>>>
176 
177 #ifdef DEAL_II_WITH_NANOFLANN
178 
182 #endif
183 
188  mutable std::map<unsigned int, Point<spacedim>> used_vertices;
189 
193  boost::signals2::connection tria_signal;
194  };
195 
196 
197 
198  // Inline functions
199  template <int dim, int spacedim>
200  inline const Triangulation<dim, spacedim> &
202  {
203  return *tria;
204  }
205 
206 
207 
208  template <int dim, int spacedim>
209  inline const Mapping<dim, spacedim> &
211  {
212  return *mapping;
213  }
214 } // namespace GridTools
215 
216 
217 
218 DEAL_II_NAMESPACE_CLOSE
219 
220 #endif
boost::signals2::connection tria_signal
KDTree< spacedim > vertex_kdtree
Cache(const Triangulation< dim, spacedim > &tria, const Mapping< dim, spacedim > &mapping=StaticMappingQ1< dim, spacedim >::mapping)
Definition: tria.h:81
const std::map< unsigned int, Point< spacedim > > & get_used_vertices() const
Abstract base class for mapping classes.
Definition: dof_tools.h:57
const std::vector< std::vector< Tensor< 1, spacedim > > > & get_vertex_to_cell_centers_directions() const
SmartPointer< const Mapping< dim, spacedim >, Cache< dim, spacedim > > mapping
SmartPointer< const Triangulation< dim, spacedim >, Cache< dim, spacedim > > tria
void mark_for_update(const CacheUpdateFlags &flags=update_all)
const KDTree< spacedim > & get_vertex_kdtree() const
CacheUpdateFlags update_flags
std::map< unsigned int, Point< spacedim > > used_vertices
const Mapping< dim, spacedim > & get_mapping() const
const Triangulation< dim, spacedim > & get_triangulation() const
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