Reference documentation for deal.II version GIT relicensing-1062-gc06da148b8 2024-07-15 19:20: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\}}\)
Loading...
Searching...
No Matches
grid_tools_cache.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2017 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_grid_grid_tools_cache_h
16#define dealii_grid_grid_tools_cache_h
17
18
19#include <deal.II/base/config.h>
20
22#include <deal.II/base/point.h>
24
25#include <deal.II/fe/mapping.h>
26
28#include <deal.II/grid/tria.h>
31
33
34#include <boost/signals2.hpp>
35
36#include <atomic>
37#include <cmath>
38
39
41
42namespace GridTools
43{
65 template <int dim, int spacedim = dim>
66 class Cache : public Subscriptor
67 {
68 public:
80
88
92 ~Cache() override;
93
104 void
106
107
112 const std::vector<
113 std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>> &
115
120 const std::vector<std::vector<Tensor<1, spacedim>>> &
122
127 const std::map<unsigned int, Point<spacedim>> &
128 get_used_vertices() const;
129
134 const RTree<std::pair<Point<spacedim>, unsigned int>> &
136
143 const RTree<
144 std::pair<BoundingBox<spacedim>,
147
158 const RTree<
159 std::pair<BoundingBox<spacedim>,
162
163
170 const std::vector<std::set<unsigned int>> &
172
177 const std::map<unsigned int, std::set<types::subdomain_id>> &
179
185
190 get_mapping() const;
191
192
221 const RTree<std::pair<BoundingBox<spacedim>, unsigned int>> &
222 get_covering_rtree(const unsigned int level = 0) const;
223
224 private:
239 mutable std::atomic<std::underlying_type_t<CacheUpdateFlags>> update_flags;
240
245
250
251
256 mutable std::vector<
257 std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>>
259 mutable std::mutex vertex_to_cells_mutex;
260
265 mutable std::vector<std::vector<Tensor<1, spacedim>>>
268
277 mutable std::map<unsigned int,
280 mutable std::mutex covering_rtree_mutex;
281
286 mutable std::map<unsigned int, Point<spacedim>> used_vertices;
287 mutable std::mutex used_vertices_mutex;
288
293 mutable std::mutex used_vertices_rtree_mutex;
294
299 mutable RTree<
300 std::pair<BoundingBox<spacedim>,
304
309 mutable RTree<
310 std::pair<BoundingBox<spacedim>,
314
319 mutable std::vector<std::set<unsigned int>> vertex_to_neighbor_subdomain;
321
326 mutable std::map<unsigned int, std::set<::types::subdomain_id>>
329
333 boost::signals2::connection tria_change_signal;
334
338 boost::signals2::connection tria_create_signal;
339 };
340
341
342
343 // Inline functions
344 template <int dim, int spacedim>
345 inline const Triangulation<dim, spacedim> &
347 {
348 return *tria;
349 }
350
351
352
353 template <int dim, int spacedim>
354 inline const Mapping<dim, spacedim> &
356 {
357 Assert(mapping, ExcNotInitialized());
358 return *mapping;
359 }
360} // namespace GridTools
361
362
363
365
366#endif
SmartPointer< const Triangulation< dim, spacedim >, Cache< dim, spacedim > > tria
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
std::mutex cell_bounding_boxes_rtree_mutex
std::mutex covering_rtree_mutex
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
boost::signals2::connection tria_change_signal
boost::signals2::connection tria_create_signal
RTree< std::pair< BoundingBox< spacedim >, typename Triangulation< dim, spacedim >::active_cell_iterator > > cell_bounding_boxes_rtree
std::mutex vertex_to_cells_mutex
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::mutex vertex_to_neighbor_subdomain_mutex
std::map< unsigned int, Point< spacedim > > used_vertices
const std::map< unsigned int, std::set< types::subdomain_id > > & get_vertices_with_ghost_neighbors() const
const RTree< std::pair< BoundingBox< spacedim >, typename Triangulation< dim, spacedim >::active_cell_iterator > > & get_locally_owned_cell_bounding_boxes_rtree() const
std::mutex vertex_to_cell_centers_mutex
const Mapping< dim, spacedim > & get_mapping() const
RTree< std::pair< Point< spacedim >, unsigned int > > used_vertices_rtree
const Triangulation< dim, spacedim > & get_triangulation() const
std::mutex used_vertices_rtree_mutex
std::atomic< std::underlying_type_t< CacheUpdateFlags > > update_flags
const RTree< std::pair< Point< spacedim >, unsigned int > > & get_used_vertices_rtree() const
std::map< unsigned int, std::set<::types::subdomain_id > > vertices_with_ghost_neighbors
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
std::mutex locally_owned_cell_bounding_boxes_rtree_mutex
const std::map< unsigned int, Point< spacedim > > & get_used_vertices() const
std::mutex vertices_with_ghost_neighbors_mutex
std::map< unsigned int, RTree< std::pair< BoundingBox< spacedim >, unsigned int > > > covering_rtree
void mark_for_update(const CacheUpdateFlags &flags=update_all)
std::mutex used_vertices_mutex
Abstract base class for mapping classes.
Definition mapping.h:318
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
unsigned int level
Definition grid_out.cc:4626
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotInitialized()
boost::geometry::index::rtree< LeafType, IndexType, IndexableGetter > RTree
Definition rtree.h:145