Reference documentation for deal.II version Git 54f37b890c 2020-02-28 19:52:28 +0100
\(\newcommand{\vcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\vcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
tria_accessor.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2019 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_tria_accessor_h
17 #define dealii_tria_accessor_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/bounding_box.h>
23 #include <deal.II/base/exceptions.h>
24 #include <deal.II/base/geometry_info.h>
25 #include <deal.II/base/point.h>
26 
27 #include <deal.II/grid/cell_id.h>
28 #include <deal.II/grid/tria_iterator_base.h>
29 #include <deal.II/grid/tria_iterator_selector.h>
30 
31 #include <utility>
32 
33 
34 DEAL_II_NAMESPACE_OPEN
35 
36 // Forward declarations
37 #ifndef DOXYGEN
38 template <int dim, int spacedim>
39 class Triangulation;
40 template <typename Accessor>
41 class TriaRawIterator;
42 template <typename Accessor>
43 class TriaIterator;
44 template <typename Accessor>
45 class TriaActiveIterator;
46 
47 template <int dim, int spacedim>
48 class Manifold;
49 #endif
50 
51 namespace internal
52 {
53  namespace TriangulationImplementation
54  {
55  template <int dim>
56  class TriaObject;
57  template <typename G>
58  class TriaObjects;
59  struct Implementation;
60  } // namespace TriangulationImplementation
61 
62  namespace TriaAccessorImplementation
63  {
64  struct Implementation;
65 
71  template <int structdim, int dim>
73  {
74  struct type
75  {
79  type() = default;
80 
84  type(const int level)
85  {
86  Assert(level == 0, ExcInternalError());
87  (void)level; // removes -Wunused-parameter warning in optimized mode
88  }
89 
93  operator int() const
94  {
95  return 0;
96  }
97 
98  void
99  operator++() const
100  {
101  Assert(false, ExcInternalError());
102  }
103 
104  void
105  operator--() const
106  {
107  Assert(false, ExcInternalError());
108  }
109  };
110  };
111 
112 
118  template <int dim>
119  struct PresentLevelType<dim, dim>
120  {
121  using type = int;
122  };
123 
124  } // namespace TriaAccessorImplementation
125 } // namespace internal
126 template <int structdim, int dim, int spacedim>
128 template <int dim, int spacedim>
129 class TriaAccessor<0, dim, spacedim>;
130 template <int spacedim>
131 class TriaAccessor<0, 1, spacedim>;
132 
133 // note: the file tria_accessor.templates.h is included at the end of
134 // this file. this includes a lot of templates. originally, this was
135 // only done in debug mode, but led to cyclic reduction problems and
136 // so is now on by default.
137 
138 
143 {
148  "The operation you are attempting can only be performed for "
149  "(cell, face, or edge) iterators that point to valid "
150  "objects. These objects need not necessarily be active, "
151  "i.e., have no children, but they need to be part of a "
152  "triangulation. (The objects pointed to by an iterator "
153  "may -- after coarsening -- also be objects that used "
154  "to be part of a triangulation, but are now no longer "
155  "used. Their memory location may have been retained "
156  "for re-use upon the next mesh refinement, but is "
157  "currently unused.)");
168  "The operation you are attempting can only be performed for "
169  "(cell, face, or edge) iterators that point to 'active' "
170  "objects. 'Active' objects are those that do not have "
171  "children (in the case of cells), or that are part of "
172  "an active cell (in the case of faces or edges). However, "
173  "the object on which you are trying the current "
174  "operation is not 'active' in this sense.");
181  "The operation you are attempting can only be performed for "
182  "(cell, face, or edge) iterators that have children, "
183  "but the object on which you are trying the current "
184  "operation does not have any.");
192  "The operation you are attempting can only be performed for "
193  "(cell, face, or edge) iterators that have a parent object, "
194  "but the object on which you are trying the current "
195  "operation does not have one -- i.e., it is on the "
196  "coarsest level of the triangulation.");
201  int,
202  << "You can only set the child index if the cell does not "
203  << "currently have children registered; or you can clear it. "
204  << "The given index was " << arg1
205  << " (-1 means: clear children).");
209  template <typename AccessorType>
211  AccessorType,
212  << "You tried to dereference an iterator for which this "
213  << "is not possible. More information on this iterator: "
214  << "index=" << arg1.index() << ", state="
215  << (arg1.state() == IteratorState::valid ?
216  "valid" :
217  (arg1.state() == IteratorState::past_the_end ?
218  "past_the_end" :
219  "invalid")));
224  "Iterators can only be compared if they point to the same "
225  "triangulation, or if neither of them are associated "
226  "with a triangulation.");
227  // TODO: Write documentation!
232  // TODO: Write documentation!
252  // TODO: Write documentation!
258  int,
259  << "You can only set the child index of an even numbered child."
260  << "The number of the child given was " << arg1 << ".");
261 } // namespace TriaAccessorExceptions
262 
263 
290 template <int structdim, int dim, int spacedim = dim>
292 {
293 public:
299  static const unsigned int space_dimension = spacedim;
300 
306  static const unsigned int dimension = dim;
307 
313  static const unsigned int structure_dimension = structdim;
314 
324  void
325  operator=(const TriaAccessorBase *) = delete;
326 
327 protected:
333  using AccessorData = void;
334 
338  TriaAccessorBase(const Triangulation<dim, spacedim> *parent = nullptr,
339  const int level = -1,
340  const int index = -1,
341  const AccessorData * = nullptr);
342 
347 
355  void
356  copy_from(const TriaAccessorBase &);
357 
362  operator=(const TriaAccessorBase &);
363 
374  bool
375  operator<(const TriaAccessorBase &other) const;
376 
377 protected:
381  bool
382  operator==(const TriaAccessorBase &) const;
383 
387  bool
388  operator!=(const TriaAccessorBase &) const;
389 
403  void
404  operator++();
405 
413  void
414  operator--();
424  objects() const;
425 
426 public:
432  using LocalData = void *;
433 
457  int
458  level() const;
459 
486  int
487  index() const;
488 
494  state() const;
495 
501  get_triangulation() const;
502 
506 protected:
511  typename ::internal::TriaAccessorImplementation::
512  PresentLevelType<structdim, dim>::type present_level;
513 
519 
524 
525 private:
526  template <typename Accessor>
527  friend class TriaRawIterator;
528  template <typename Accessor>
529  friend class TriaIterator;
530  template <typename Accessor>
531  friend class TriaActiveIterator;
532 };
533 
534 
535 
557 template <int structdim, int dim, int spacedim = dim>
558 class InvalidAccessor : public TriaAccessorBase<structdim, dim, spacedim>
559 {
560 public:
564  using AccessorData =
566 
574  InvalidAccessor(const Triangulation<dim, spacedim> *parent = nullptr,
575  const int level = -1,
576  const int index = -1,
577  const AccessorData * local_data = nullptr);
578 
587 
592  template <typename OtherAccessor>
593  InvalidAccessor(const OtherAccessor &);
594 
598  void
599  copy_from(const InvalidAccessor &);
600 
604  bool
605  operator==(const InvalidAccessor &) const;
606  bool
607  operator!=(const InvalidAccessor &) const;
608 
612  void
613  operator++() const;
614  void
615  operator--() const;
616 
621  bool
622  used() const;
623 
628  bool
629  has_children() const;
630 
635  manifold_id() const;
636 
640  unsigned int
641  user_index() const;
642 
646  void
647  set_user_index(const unsigned int p) const;
648 
652  void
653  set_manifold_id(const types::manifold_id) const;
654 
659  vertex(const unsigned int i) const;
660 
665  typename ::internal::TriangulationImplementation::
666  Iterators<dim, spacedim>::line_iterator
667  line(const unsigned int i) const;
668 
673  typename ::internal::TriangulationImplementation::
674  Iterators<dim, spacedim>::quad_iterator
675  quad(const unsigned int i) const;
676 };
677 
678 
679 
698 template <int structdim, int dim, int spacedim>
699 class TriaAccessor : public TriaAccessorBase<structdim, dim, spacedim>
700 {
701 public:
705  using AccessorData =
707 
711  TriaAccessor(const Triangulation<dim, spacedim> *parent = nullptr,
712  const int level = -1,
713  const int index = -1,
714  const AccessorData * local_data = nullptr);
715 
728  template <int structdim2, int dim2, int spacedim2>
730 
735  template <int structdim2, int dim2, int spacedim2>
737 
747  void
748  operator=(const TriaAccessor &) = delete;
749 
756  bool
757  used() const;
758 
771  vertex_iterator(const unsigned int i) const;
772 
788  unsigned int
789  vertex_index(const unsigned int i) const;
790 
829  vertex(const unsigned int i) const;
830 
834  typename ::internal::TriangulationImplementation::
835  Iterators<dim, spacedim>::line_iterator
836  line(const unsigned int i) const;
837 
844  unsigned int
845  line_index(const unsigned int i) const;
846 
850  typename ::internal::TriangulationImplementation::
851  Iterators<dim, spacedim>::quad_iterator
852  quad(const unsigned int i) const;
853 
860  unsigned int
861  quad_index(const unsigned int i) const;
884  bool
885  face_orientation(const unsigned int face) const;
886 
896  bool
897  face_flip(const unsigned int face) const;
898 
908  bool
909  face_rotation(const unsigned int face) const;
910 
921  bool
922  line_orientation(const unsigned int line) const;
937  bool
938  has_children() const;
939 
944  unsigned int
945  n_children() const;
946 
960  unsigned int
961  number_of_children() const;
962 
976  unsigned int
977  max_refinement_depth() const;
978 
983  child(const unsigned int i) const;
984 
989  unsigned int
990  child_iterator_to_index(
992 
1002  isotropic_child(const unsigned int i) const;
1003 
1008  refinement_case() const;
1009 
1015  int
1016  child_index(const unsigned int i) const;
1017 
1023  int
1024  isotropic_child_index(const unsigned int i) const;
1047  boundary_id() const;
1048 
1078  void
1079  set_boundary_id(const types::boundary_id) const;
1080 
1111  void
1112  set_all_boundary_ids(const types::boundary_id) const;
1113 
1121  bool
1122  at_boundary() const;
1123 
1133  const Manifold<dim, spacedim> &
1134  get_manifold() const;
1135 
1157  manifold_id() const;
1158 
1176  void
1177  set_manifold_id(const types::manifold_id) const;
1178 
1192  void
1193  set_all_manifold_ids(const types::manifold_id) const;
1194 
1211  bool
1212  user_flag_set() const;
1213 
1219  void
1220  set_user_flag() const;
1221 
1227  void
1228  clear_user_flag() const;
1229 
1235  void
1236  recursively_set_user_flag() const;
1237 
1243  void
1244  recursively_clear_user_flag() const;
1245 
1251  void
1252  clear_user_data() const;
1253 
1265  void
1266  set_user_pointer(void *p) const;
1267 
1273  void
1274  clear_user_pointer() const;
1275 
1291  void *
1292  user_pointer() const;
1293 
1315  void
1316  recursively_set_user_pointer(void *p) const;
1317 
1324  void
1325  recursively_clear_user_pointer() const;
1326 
1336  void
1337  set_user_index(const unsigned int p) const;
1338 
1344  void
1345  clear_user_index() const;
1346 
1358  unsigned int
1359  user_index() const;
1360 
1378  void
1379  recursively_set_user_index(const unsigned int p) const;
1380 
1389  void
1390  recursively_clear_user_index() const;
1409  double
1410  diameter() const;
1411 
1438  std::pair<Point<spacedim>, double>
1439  enclosing_ball() const;
1440 
1450  bounding_box() const;
1451 
1461  double
1462  extent_in_direction(const unsigned int axis) const;
1463 
1467  double
1468  minimum_vertex_distance() const;
1469 
1484  intermediate_point(const Point<structdim> &coordinates) const;
1485 
1509  real_to_unit_cell_affine_approximation(const Point<spacedim> &point) const;
1510 
1546  center(const bool respect_manifold = false,
1547  const bool interpolate_from_surrounding = false) const;
1548 
1567  barycenter() const;
1568 
1594  double
1595  measure() const;
1596 
1611  bool
1612  is_translation_of(
1614 
1620 private:
1625  void
1626  set_boundary_id_internal(const types::boundary_id id) const;
1627 
1632  void
1633  set(const ::internal::TriangulationImplementation::TriaObject<structdim>
1634  &o) const;
1635 
1643  void
1644  set_line_orientation(const unsigned int line, const bool orientation) const;
1645 
1656  void
1657  set_face_orientation(const unsigned int face, const bool orientation) const;
1658 
1665  void
1666  set_face_flip(const unsigned int face, const bool flip) const;
1667 
1674  void
1675  set_face_rotation(const unsigned int face, const bool rotation) const;
1676 
1680  void
1681  set_used_flag() const;
1682 
1686  void
1687  clear_used_flag() const;
1688 
1697  void
1698  set_refinement_case(const RefinementCase<structdim> &ref_case) const;
1699 
1707  void
1708  clear_refinement_case() const;
1709 
1716  void
1717  set_children(const unsigned int i, const int index) const;
1718 
1723  void
1724  clear_children() const;
1725 
1726 private:
1727  template <int, int>
1728  friend class Triangulation;
1729 
1730  friend struct ::internal::TriangulationImplementation::Implementation;
1731  friend struct ::internal::TriaAccessorImplementation::Implementation;
1732 };
1733 
1734 
1735 
1755 template <int dim, int spacedim>
1756 class TriaAccessor<0, dim, spacedim>
1757 {
1758 public:
1764  static const unsigned int space_dimension = spacedim;
1765 
1771  static const unsigned int dimension = dim;
1772 
1778  static const unsigned int structure_dimension = 0;
1779 
1783  using AccessorData = void;
1784 
1790  const unsigned int vertex_index);
1791 
1797  TriaAccessor(const Triangulation<dim, spacedim> *tria = nullptr,
1798  const int level = 0,
1799  const int index = 0,
1800  const AccessorData * = nullptr);
1801 
1805  template <int structdim2, int dim2, int spacedim2>
1807 
1811  template <int structdim2, int dim2, int spacedim2>
1813 
1818  state() const;
1819 
1824  static int
1825  level();
1826 
1831  int
1832  index() const;
1833 
1839  get_triangulation() const;
1840 
1850  void
1851  operator++();
1852 
1856  void
1857  operator--();
1861  bool
1862  operator==(const TriaAccessor &) const;
1863 
1867  bool
1868  operator!=(const TriaAccessor &) const;
1869 
1897  unsigned int
1898  vertex_index(const unsigned int i = 0) const;
1899 
1905  Point<spacedim> &
1906  vertex(const unsigned int i = 0) const;
1907 
1912  typename ::internal::TriangulationImplementation::
1913  Iterators<dim, spacedim>::line_iterator static line(const unsigned int);
1914 
1918  static unsigned int
1919  line_index(const unsigned int i);
1920 
1924  static typename ::internal::TriangulationImplementation::
1925  Iterators<dim, spacedim>::quad_iterator
1926  quad(const unsigned int i);
1927 
1931  static unsigned int
1932  quad_index(const unsigned int i);
1933 
1949  double
1950  diameter() const;
1951 
1959  double
1960  extent_in_direction(const unsigned int axis) const;
1961 
1970  center(const bool respect_manifold = false,
1971  const bool interpolate_from_surrounding = false) const;
1972 
1981  double
1982  measure() const;
1997  static bool
1998  face_orientation(const unsigned int face);
1999 
2003  static bool
2004  face_flip(const unsigned int face);
2005 
2009  static bool
2010  face_rotation(const unsigned int face);
2011 
2015  static bool
2016  line_orientation(const unsigned int line);
2017 
2032  static bool
2033  has_children();
2034 
2039  static unsigned int
2040  n_children();
2041 
2046  static unsigned int
2047  number_of_children();
2048 
2052  static unsigned int
2053  max_refinement_depth();
2054 
2058  static unsigned int
2059  child_iterator_to_index(const TriaIterator<TriaAccessor<0, dim, spacedim>> &);
2060 
2065  child(const unsigned int);
2066 
2071  isotropic_child(const unsigned int);
2072 
2076  static RefinementCase<0>
2077  refinement_case();
2078 
2082  static int
2083  child_index(const unsigned int i);
2084 
2088  static int
2089  isotropic_child_index(const unsigned int i);
2097  bool
2098  used() const;
2099 
2100 protected:
2108  void
2109  copy_from(const TriaAccessor &);
2110 
2119  bool
2120  operator<(const TriaAccessor &other) const;
2121 
2126 
2130  unsigned int global_vertex_index;
2131 
2132 private:
2133  template <typename Accessor>
2134  friend class TriaRawIterator;
2135  template <typename Accessor>
2136  friend class TriaIterator;
2137  template <typename Accessor>
2138  friend class TriaActiveIterator;
2139 };
2140 
2141 
2142 
2160 template <int spacedim>
2161 class TriaAccessor<0, 1, spacedim>
2162 {
2163 public:
2169  static const unsigned int space_dimension = spacedim;
2170 
2176  static const unsigned int dimension = 1;
2177 
2183  static const unsigned int structure_dimension = 0;
2184 
2188  using AccessorData = void;
2189 
2195  {
2207  right_vertex
2208  };
2209 
2222  const VertexKind vertex_kind,
2223  const unsigned int vertex_index);
2224 
2230  TriaAccessor(const Triangulation<1, spacedim> *tria = nullptr,
2231  const int = 0,
2232  const int = 0,
2233  const AccessorData * = nullptr);
2234 
2238  template <int structdim2, int dim2, int spacedim2>
2240 
2244  template <int structdim2, int dim2, int spacedim2>
2246 
2251  void
2252  copy_from(const TriaAccessor &);
2253 
2260  state();
2261 
2266  static int
2267  level();
2268 
2273  int
2274  index() const;
2275 
2281  get_triangulation() const;
2282 
2293  void
2294  operator++() const;
2295 
2300  void
2301  operator--() const;
2305  bool
2306  operator==(const TriaAccessor &) const;
2307 
2311  bool
2312  operator!=(const TriaAccessor &) const;
2313 
2322  bool
2323  operator<(const TriaAccessor &other) const;
2324 
2351  unsigned int
2352  vertex_index(const unsigned int i = 0) const;
2353 
2359  Point<spacedim> &
2360  vertex(const unsigned int i = 0) const;
2361 
2367  center() const;
2368 
2373  typename ::internal::TriangulationImplementation::
2374  Iterators<1, spacedim>::line_iterator static line(const unsigned int);
2375 
2382  static unsigned int
2383  line_index(const unsigned int i);
2384 
2388  static typename ::internal::TriangulationImplementation::
2389  Iterators<1, spacedim>::quad_iterator
2390  quad(const unsigned int i);
2391 
2398  static unsigned int
2399  quad_index(const unsigned int i);
2400 
2410  bool
2411  at_boundary() const;
2412 
2428  boundary_id() const;
2429 
2433  const Manifold<1, spacedim> &
2434  get_manifold() const;
2435 
2443  manifold_id() const;
2444 
2445 
2456  static bool
2457  face_orientation(const unsigned int face);
2458 
2462  static bool
2463  face_flip(const unsigned int face);
2464 
2468  static bool
2469  face_rotation(const unsigned int face);
2470 
2474  static bool
2475  line_orientation(const unsigned int line);
2476 
2491  static bool
2492  has_children();
2493 
2498  static unsigned int
2499  n_children();
2500 
2505  static unsigned int
2506  number_of_children();
2507 
2511  static unsigned int
2512  max_refinement_depth();
2513 
2517  static unsigned int
2518  child_iterator_to_index(const TriaIterator<TriaAccessor<0, 1, spacedim>> &);
2519 
2524  child(const unsigned int);
2525 
2530  isotropic_child(const unsigned int);
2531 
2535  static RefinementCase<0>
2536  refinement_case();
2537 
2541  static int
2542  child_index(const unsigned int i);
2543 
2547  static int
2548  isotropic_child_index(const unsigned int i);
2581  void
2582  set_boundary_id(const types::boundary_id);
2583 
2590  void
2591  set_manifold_id(const types::manifold_id);
2592 
2604  void
2605  set_all_boundary_ids(const types::boundary_id);
2606 
2618  void
2619  set_all_manifold_ids(const types::manifold_id);
2627  bool
2628  used() const;
2629 
2630 protected:
2635 
2641 
2645  unsigned int global_vertex_index;
2646 };
2647 
2648 
2649 
2666 template <int dim, int spacedim = dim>
2667 class CellAccessor : public TriaAccessor<dim, dim, spacedim>
2668 {
2669 public:
2674 
2679 
2690  CellAccessor(const Triangulation<dim, spacedim> *parent = nullptr,
2691  const int level = -1,
2692  const int index = -1,
2693  const AccessorData * local_data = nullptr);
2694 
2698  CellAccessor(const TriaAccessor<dim, dim, spacedim> &cell_accessor);
2699 
2712  template <int structdim2, int dim2, int spacedim2>
2714 
2719  template <int structdim2, int dim2, int spacedim2>
2721 
2731  void
2732  operator=(const CellAccessor<dim, spacedim> &) = delete;
2733 
2750  child(const unsigned int i) const;
2751 
2755  TriaIterator<TriaAccessor<dim - 1, dim, spacedim>>
2756  face(const unsigned int i) const;
2757 
2762  unsigned int
2763  face_iterator_to_index(
2765 
2769  std::array<TriaIterator<TriaAccessor<dim - 1, dim, spacedim>>,
2771  face_iterators() const;
2772 
2782  unsigned int
2783  face_index(const unsigned int i) const;
2784 
2833  neighbor_child_on_subface(const unsigned int face_no,
2834  const unsigned int subface_no) const;
2835 
2858  neighbor(const unsigned int i) const;
2859 
2864  int
2865  neighbor_index(const unsigned int i) const;
2866 
2871  int
2872  neighbor_level(const unsigned int i) const;
2873 
2885  unsigned int
2886  neighbor_of_neighbor(const unsigned int neighbor) const;
2887 
2898  bool
2899  neighbor_is_coarser(const unsigned int neighbor) const;
2900 
2915  std::pair<unsigned int, unsigned int>
2916  neighbor_of_coarser_neighbor(const unsigned int neighbor) const;
2917 
2924  unsigned int
2925  neighbor_face_no(const unsigned int neighbor) const;
2926 
2930  static bool
2931  is_level_cell();
2932 
2946  bool
2947  has_periodic_neighbor(const unsigned int i) const;
2948 
2966  periodic_neighbor(const unsigned int i) const;
2967 
2976  neighbor_or_periodic_neighbor(const unsigned int i) const;
2977 
2993  periodic_neighbor_child_on_subface(const unsigned int face_no,
2994  const unsigned int subface_no) const;
2995 
3006  std::pair<unsigned int, unsigned int>
3007  periodic_neighbor_of_coarser_periodic_neighbor(const unsigned face_no) const;
3008 
3014  int
3015  periodic_neighbor_index(const unsigned int i) const;
3016 
3022  int
3023  periodic_neighbor_level(const unsigned int i) const;
3024 
3039  unsigned int
3040  periodic_neighbor_of_periodic_neighbor(const unsigned int i) const;
3041 
3047  unsigned int
3048  periodic_neighbor_face_no(const unsigned int i) const;
3049 
3056  bool
3057  periodic_neighbor_is_coarser(const unsigned int i) const;
3058 
3075  bool
3076  at_boundary(const unsigned int i) const;
3077 
3086  bool
3087  at_boundary() const;
3088 
3096  bool
3097  has_boundary_lines() const;
3124  refine_flag_set() const;
3125 
3143  void
3144  set_refine_flag(const RefinementCase<dim> ref_case =
3146 
3150  void
3151  clear_refine_flag() const;
3152 
3160  bool
3161  flag_for_face_refinement(
3162  const unsigned int face_no,
3163  const RefinementCase<dim - 1> &face_refinement_case =
3165 
3171  bool
3172  flag_for_line_refinement(const unsigned int line_no) const;
3173 
3183  subface_case(const unsigned int face_no) const;
3184 
3188  bool
3189  coarsen_flag_set() const;
3190 
3195  void
3196  set_coarsen_flag() const;
3197 
3201  void
3202  clear_coarsen_flag() const;
3226  material_id() const;
3227 
3239  void
3240  set_material_id(const types::material_id new_material_id) const;
3241 
3250  void
3251  recursively_set_material_id(const types::material_id new_material_id) const;
3278  subdomain_id() const;
3279 
3295  void
3296  set_subdomain_id(const types::subdomain_id new_subdomain_id) const;
3297 
3307  level_subdomain_id() const;
3308 
3313  void
3314  set_level_subdomain_id(
3315  const types::subdomain_id new_level_subdomain_id) const;
3316 
3317 
3333  void
3334  recursively_set_subdomain_id(
3335  const types::subdomain_id new_subdomain_id) const;
3353  bool
3354  direction_flag() const;
3355 
3381  unsigned int
3382  active_cell_index() const;
3383 
3391  int
3392  parent_index() const;
3393 
3400  parent() const;
3401 
3426  DEAL_II_DEPRECATED
3427  bool
3428  active() const;
3429 
3438  bool
3439  is_active() const;
3440 
3460  bool
3461  is_locally_owned() const;
3462 
3467  bool
3468  is_locally_owned_on_level() const;
3469 
3493  bool
3494  is_ghost() const;
3495 
3522  bool
3523  is_artificial() const;
3524 
3538  bool
3539  point_inside(const Point<spacedim> &p) const;
3540 
3549  void
3550  set_neighbor(const unsigned int i,
3551  const TriaIterator<CellAccessor<dim, spacedim>> &pointer) const;
3552 
3566  CellId
3567  id() const;
3568 
3577  DeclException0(ExcRefineCellNotActive);
3581  DeclException0(ExcCellFlaggedForRefinement);
3585  DeclException0(ExcCellFlaggedForCoarsening);
3586 
3587 protected:
3603  unsigned int
3604  neighbor_of_neighbor_internal(const unsigned int neighbor) const;
3605 
3611  template <int dim_, int spacedim_>
3612  bool
3613  point_inside_codim(const Point<spacedim_> &p) const;
3614 
3615 
3616 
3617 private:
3622  void
3623  set_active_cell_index(const unsigned int active_cell_index);
3624 
3628  void
3629  set_parent(const unsigned int parent_index);
3630 
3637  void
3638  set_direction_flag(const bool new_direction_flag) const;
3639 
3640  template <int, int>
3641  friend class Triangulation;
3642 
3643  friend struct ::internal::TriangulationImplementation::Implementation;
3644 };
3645 
3646 
3647 
3648 /* ----- declaration of explicit specializations and general templates ----- */
3649 
3650 
3651 template <int structdim, int dim, int spacedim>
3652 template <typename OtherAccessor>
3654  const OtherAccessor &)
3655 {
3656  Assert(false,
3657  ExcMessage("You are attempting an illegal conversion between "
3658  "iterator/accessor types. The constructor you call "
3659  "only exists to make certain template constructs "
3660  "easier to write as dimension independent code but "
3661  "the conversion is not valid in the current context."));
3662 }
3663 
3664 
3665 
3666 template <int structdim, int dim, int spacedim>
3667 template <int structdim2, int dim2, int spacedim2>
3670 {
3671  Assert(false,
3672  ExcMessage("You are attempting an illegal conversion between "
3673  "iterator/accessor types. The constructor you call "
3674  "only exists to make certain template constructs "
3675  "easier to write as dimension independent code but "
3676  "the conversion is not valid in the current context."));
3677 }
3678 
3679 
3680 
3681 template <int dim, int spacedim>
3682 template <int structdim2, int dim2, int spacedim2>
3685 {
3686  Assert(false,
3687  ExcMessage("You are attempting an illegal conversion between "
3688  "iterator/accessor types. The constructor you call "
3689  "only exists to make certain template constructs "
3690  "easier to write as dimension independent code but "
3691  "the conversion is not valid in the current context."));
3692 }
3693 
3694 
3695 
3696 template <int structdim, int dim, int spacedim>
3697 template <int structdim2, int dim2, int spacedim2>
3700 {
3701  Assert(false,
3702  ExcMessage("You are attempting an illegal conversion between "
3703  "iterator/accessor types. The constructor you call "
3704  "only exists to make certain template constructs "
3705  "easier to write as dimension independent code but "
3706  "the conversion is not valid in the current context."));
3707 }
3708 
3709 
3710 
3711 template <int dim, int spacedim>
3712 template <int structdim2, int dim2, int spacedim2>
3715 {
3716  Assert(false,
3717  ExcMessage("You are attempting an illegal conversion between "
3718  "iterator/accessor types. The constructor you call "
3719  "only exists to make certain template constructs "
3720  "easier to write as dimension independent code but "
3721  "the conversion is not valid in the current context."));
3722 }
3723 
3724 
3725 #ifndef DOXYGEN
3726 
3727 template <>
3728 bool
3730 template <>
3731 bool
3733 template <>
3734 bool
3736 template <>
3737 bool
3739 template <>
3740 bool
3742 template <>
3743 bool
3745 // -------------------------------------------------------------------
3746 
3747 template <>
3748 void
3750 
3751 #endif // DOXYGEN
3752 
3753 DEAL_II_NAMESPACE_CLOSE
3754 
3755 // include more templates in debug and optimized mode
3756 #include "tria_accessor.templates.h"
3757 
3758 #endif
unsigned int manifold_id
Definition: types.h:137
static ::ExceptionBase & ExcCellHasNoChildren()
InvalidAccessor(const Triangulation< dim, spacedim > *parent=nullptr, const int level=-1, const int index=-1, const AccessorData *local_data=nullptr)
static ::ExceptionBase & ExcNeighborIsNotCoarser()
const Triangulation< dim, spacedim > * tria
static ::ExceptionBase & ExcNeighborIsCoarser()
static ::ExceptionBase & ExcDereferenceInvalidObject(AccessorType arg1)
const Triangulation< 1, spacedim > * tria
unsigned int material_id
Definition: types.h:148
void set_all_manifold_ids(const types::manifold_id) const
static ::ExceptionBase & ExcFacesHaveNoLevel()
static ::ExceptionBase & ExcCellNotUsed()
static ::ExceptionBase & ExcMessage(std::string arg1)
unsigned int subdomain_id
Definition: types.h:43
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:518
const Triangulation< dim, spacedim > * tria
static ::ExceptionBase & ExcSetOnlyEvenChildren(int arg1)
#define Assert(cond, exc)
Definition: exceptions.h:1411
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
#define DeclException0(Exception0)
Definition: exceptions.h:473
static ::ExceptionBase & ExcCellNotActive()
static ::ExceptionBase & ExcNoPeriodicNeighbor()
static ::ExceptionBase & ExcCantSetChildren(int arg1)
Definition: cell_id.h:68
CellAccessor(const Triangulation< dim, spacedim > *parent=nullptr, const int level=-1, const int index=-1, const AccessorData *local_data=nullptr)
static ::ExceptionBase & ExcCellHasNoParent()
bool point_inside(const Point< spacedim > &p) const
TriaAccessor(const Triangulation< dim, spacedim > *parent=nullptr, const int level=-1, const int index=-1, const AccessorData *local_data=nullptr)
Iterator reached end of container.
Iterator points to a valid object.
unsigned int boundary_id
Definition: types.h:125
typename ::internal::TriaAccessorImplementation::PresentLevelType< structdim, dim >::type present_level
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcCantCompareIterators()