deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+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: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2017 - 2025 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_grid_grid_tools_cache_h
14#define dealii_grid_grid_tools_cache_h
15
16
17#include <deal.II/base/config.h>
18
21#include <deal.II/base/point.h>
22
23#include <deal.II/fe/mapping.h>
24
26#include <deal.II/grid/tria.h>
29
31
32#include <boost/signals2.hpp>
33
34#include <atomic>
35#include <cmath>
36#include <set>
37
38
40
41namespace GridTools
42{
64 template <int dim, int spacedim = dim>
66 {
67 public:
79
87
91 ~Cache() override;
92
103 void
105
106
111 const std::vector<
112 std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>> &
114
119 const std::vector<std::vector<Tensor<1, spacedim>>> &
121
126 const std::map<unsigned int, Point<spacedim>> &
127 get_used_vertices() const;
128
133 const RTree<std::pair<Point<spacedim>, unsigned int>> &
135
142 const RTree<
143 std::pair<BoundingBox<spacedim>,
146
157 const RTree<
158 std::pair<BoundingBox<spacedim>,
161
162
169 const std::vector<std::set<unsigned int>> &
171
176 const std::map<unsigned int, std::set<types::subdomain_id>> &
178
184
189 get_mapping() const;
190
191
220 const RTree<std::pair<BoundingBox<spacedim>, unsigned int>> &
221 get_covering_rtree(const unsigned int level = 0) const;
222
223 private:
238 mutable std::atomic<std::underlying_type_t<CacheUpdateFlags>> update_flags;
239
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
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
ObserverPointer< 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
ObserverPointer< const Triangulation< dim, spacedim >, Cache< dim, spacedim > > tria
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:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
unsigned int level
Definition grid_out.cc:4642
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotInitialized()
boost::geometry::index::rtree< LeafType, IndexType, IndexableGetter > RTree
Definition rtree.h:159