deal.II version GIT relicensing-1941-ga9013bea74 2024-10-08 06:50:00+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
246
251
252
257 mutable std::vector<
258 std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>>
260 mutable std::mutex vertex_to_cells_mutex;
261
266 mutable std::vector<std::vector<Tensor<1, spacedim>>>
269
278 mutable std::map<unsigned int,
281 mutable std::mutex covering_rtree_mutex;
282
287 mutable std::map<unsigned int, Point<spacedim>> used_vertices;
288 mutable std::mutex used_vertices_mutex;
289
294 mutable std::mutex used_vertices_rtree_mutex;
295
300 mutable RTree<
301 std::pair<BoundingBox<spacedim>,
305
310 mutable RTree<
311 std::pair<BoundingBox<spacedim>,
315
320 mutable std::vector<std::set<unsigned int>> vertex_to_neighbor_subdomain;
322
327 mutable std::map<unsigned int, std::set<::types::subdomain_id>>
330
334 boost::signals2::connection tria_change_signal;
335
339 boost::signals2::connection tria_create_signal;
340 };
341
342
343
344 // Inline functions
345 template <int dim, int spacedim>
346 inline const Triangulation<dim, spacedim> &
348 {
349 return *tria;
350 }
351
352
353
354 template <int dim, int spacedim>
355 inline const Mapping<dim, spacedim> &
357 {
358 Assert(mapping, ExcNotInitialized());
359 return *mapping;
360 }
361} // namespace GridTools
362
363
364
366
367#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:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
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