16 #ifndef dealii_tria_accessor_h 17 #define dealii_tria_accessor_h 20 #include <deal.II/base/config.h> 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> 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> 34 DEAL_II_NAMESPACE_OPEN
36 template <
int dim,
int spacedim>
38 template <
typename Accessor>
40 template <
typename Accessor>
42 template <
typename Accessor>
45 template <
int dim,
int spacedim>
51 namespace TriangulationImplementation
60 namespace TriaAccessorImplementation
69 template <
int structdim,
int dim>
124 template <
int structdim,
int dim,
int spacedim>
126 template <
int dim,
int spacedim>
128 template <
int spacedim>
146 "The operation you are attempting can only be performed for " 147 "(cell, face, or edge) iterators that point to valid " 148 "objects. These objects need not necessarily be active, " 149 "i.e., have no children, but they need to be part of a " 150 "triangulation. (The objects pointed to by an iterator " 151 "may -- after coarsening -- also be objects that used " 152 "to be part of a triangulation, but are now no longer " 153 "used. Their memory location may have been retained " 154 "for re-use upon the next mesh refinement, but is " 155 "currently unused.)");
166 "The operation you are attempting can only be performed for " 167 "(cell, face, or edge) iterators that point to 'active' " 168 "objects. 'Active' objects are those that do not have " 169 "children (in the case of cells), or that are part of " 170 "an active cell (in the case of faces or edges). However, " 171 "the object on which you are trying the current " 172 "operation is not 'active' in this sense.");
179 "The operation you are attempting can only be performed for " 180 "(cell, face, or edge) iterators that have children, " 181 "but the object on which you are trying the current " 182 "operation does not have any.");
190 "The operation you are attempting can only be performed for " 191 "(cell, face, or edge) iterators that have a parent object, " 192 "but the object on which you are trying the current " 193 "operation does not have one -- i.e., it is on the " 194 "coarsest level of the triangulation.");
200 <<
"You can only set the child index if the cell does not " 201 <<
"currently have children registered; or you can clear it. " 202 <<
"The given index was " << arg1
203 <<
" (-1 means: clear children).");
207 template <
typename AccessorType>
210 <<
"You tried to dereference an iterator for which this " 211 <<
"is not possible. More information on this iterator: " 212 <<
"index=" << arg1.index() <<
", state=" 222 "Iterators can only be compared if they point to the same " 223 "triangulation, or if neither of them are associated " 224 "with a triangulation.");
257 <<
"You can only set the child index of an even numbered child." 258 <<
"The number of the child given was " << arg1 <<
".");
288 template <
int structdim,
int dim,
int spacedim = dim>
297 static const unsigned int space_dimension = spacedim;
304 static const unsigned int dimension = dim;
311 static const unsigned int structure_dimension = structdim;
337 const int level = -1,
338 const int index = -1,
499 get_triangulation()
const;
509 typename ::internal::TriaAccessorImplementation::
524 template <
typename Accessor>
526 template <
typename Accessor>
528 template <
typename Accessor>
555 template <
int structdim,
int dim,
int spacedim = dim>
573 const int level = -1,
574 const int index = -1,
590 template <
typename OtherAccessor>
627 has_children()
const;
645 set_user_index(
const unsigned int p)
const;
657 vertex(
const unsigned int i)
const;
663 typename ::internal::TriangulationImplementation::
664 Iterators<dim, spacedim>::line_iterator
665 line(
const unsigned int i)
const;
671 typename ::internal::TriangulationImplementation::
672 Iterators<dim, spacedim>::quad_iterator
673 quad(
const unsigned int i)
const;
696 template <
int structdim,
int dim,
int spacedim>
710 const int level = -1,
711 const int index = -1,
726 template <
int structdim2,
int dim2,
int spacedim2>
733 template <
int structdim2,
int dim2,
int spacedim2>
769 vertex_iterator(
const unsigned int i)
const;
787 vertex_index(
const unsigned int i)
const;
827 vertex(
const unsigned int i)
const;
832 typename ::internal::TriangulationImplementation::
833 Iterators<dim, spacedim>::line_iterator
834 line(
const unsigned int i)
const;
843 line_index(
const unsigned int i)
const;
848 typename ::internal::TriangulationImplementation::
849 Iterators<dim, spacedim>::quad_iterator
850 quad(
const unsigned int i)
const;
859 quad_index(
const unsigned int i)
const;
883 face_orientation(
const unsigned int face)
const;
895 face_flip(
const unsigned int face)
const;
907 face_rotation(
const unsigned int face)
const;
920 line_orientation(
const unsigned int line)
const;
936 has_children()
const;
959 number_of_children()
const;
975 max_refinement_depth()
const;
981 child(
const unsigned int i)
const;
992 isotropic_child(
const unsigned int i)
const;
998 refinement_case()
const;
1006 child_index(
const unsigned int i)
const;
1014 isotropic_child_index(
const unsigned int i)
const;
1037 boundary_id()
const;
1112 at_boundary()
const;
1124 get_manifold()
const;
1147 manifold_id()
const;
1202 user_flag_set()
const;
1210 set_user_flag()
const;
1218 clear_user_flag()
const;
1226 recursively_set_user_flag()
const;
1234 recursively_clear_user_flag()
const;
1242 clear_user_data()
const;
1256 set_user_pointer(
void *p)
const;
1264 clear_user_pointer()
const;
1282 user_pointer()
const;
1306 recursively_set_user_pointer(
void *p)
const;
1315 recursively_clear_user_pointer()
const;
1327 set_user_index(
const unsigned int p)
const;
1335 clear_user_index()
const;
1369 recursively_set_user_index(
const unsigned int p)
const;
1380 recursively_clear_user_index()
const;
1428 std::pair<Point<spacedim>,
double>
1429 enclosing_ball()
const;
1440 bounding_box()
const;
1452 extent_in_direction(
const unsigned int axis)
const;
1458 minimum_vertex_distance()
const;
1499 real_to_unit_cell_affine_approximation(
const Point<spacedim> &point)
const;
1536 center(
const bool respect_manifold =
false,
1537 const bool interpolate_from_surrounding =
false)
const;
1623 set(const ::internal::TriangulationImplementation::TriaObject<structdim>
1634 set_line_orientation(
const unsigned int line,
const bool orientation)
const;
1647 set_face_orientation(
const unsigned int face,
const bool orientation)
const;
1656 set_face_flip(
const unsigned int face,
const bool flip)
const;
1665 set_face_rotation(
const unsigned int face,
const bool rotation)
const;
1671 set_used_flag()
const;
1677 clear_used_flag()
const;
1698 clear_refinement_case()
const;
1707 set_children(
const unsigned int i,
const int index)
const;
1714 clear_children()
const;
1720 friend struct ::internal::TriangulationImplementation::Implementation;
1721 friend struct ::internal::TriaAccessorImplementation::Implementation;
1745 template <
int dim,
int spacedim>
1754 static const unsigned int space_dimension = spacedim;
1761 static const unsigned int dimension = dim;
1768 static const unsigned int structure_dimension = 0;
1780 const unsigned int vertex_index);
1788 const int level = 0,
1789 const int index = 0,
1795 template <
int structdim2,
int dim2,
int spacedim2>
1801 template <
int structdim2,
int dim2,
int spacedim2>
1829 get_triangulation()
const;
1888 vertex_index(
const unsigned int i = 0)
const;
1896 vertex(
const unsigned int i = 0)
const;
1902 typename ::internal::TriangulationImplementation::
1903 Iterators<dim, spacedim>::line_iterator
static line(
const unsigned int);
1909 line_index(
const unsigned int i);
1914 static typename ::internal::TriangulationImplementation::
1915 Iterators<dim, spacedim>::quad_iterator
1916 quad(
const unsigned int i);
1922 quad_index(
const unsigned int i);
1950 extent_in_direction(
const unsigned int axis)
const;
1960 center(
const bool respect_manifold =
false,
1961 const bool interpolate_from_surrounding =
false)
const;
1988 face_orientation(
const unsigned int face);
1994 face_flip(
const unsigned int face);
2000 face_rotation(
const unsigned int face);
2006 line_orientation(
const unsigned int line);
2037 number_of_children();
2043 max_refinement_depth();
2049 child(
const unsigned int);
2055 isotropic_child(
const unsigned int);
2067 child_index(
const unsigned int i);
2073 isotropic_child_index(
const unsigned int i);
2117 template <
typename Accessor>
2119 template <
typename Accessor>
2121 template <
typename Accessor>
2144 template <
int spacedim>
2153 static const unsigned int space_dimension = spacedim;
2160 static const unsigned int dimension = 1;
2167 static const unsigned int structure_dimension = 0;
2207 const unsigned int vertex_index);
2222 template <
int structdim2,
int dim2,
int spacedim2>
2228 template <
int structdim2,
int dim2,
int spacedim2>
2265 get_triangulation()
const;
2336 vertex_index(
const unsigned int i = 0)
const;
2344 vertex(
const unsigned int i = 0)
const;
2357 typename ::internal::TriangulationImplementation::
2358 Iterators<1, spacedim>::line_iterator
static line(
const unsigned int);
2367 line_index(
const unsigned int i);
2372 static typename ::internal::TriangulationImplementation::
2373 Iterators<1, spacedim>::quad_iterator
2374 quad(
const unsigned int i);
2383 quad_index(
const unsigned int i);
2395 at_boundary()
const;
2412 boundary_id()
const;
2418 get_manifold()
const;
2427 manifold_id()
const;
2441 face_orientation(
const unsigned int face);
2447 face_flip(
const unsigned int face);
2453 face_rotation(
const unsigned int face);
2459 line_orientation(
const unsigned int line);
2490 number_of_children();
2496 max_refinement_depth();
2502 child(
const unsigned int);
2508 isotropic_child(
const unsigned int);
2520 child_index(
const unsigned int i);
2526 isotropic_child_index(
const unsigned int i);
2644 template <
int dim,
int spacedim = dim>
2669 const int level = -1,
2670 const int index = -1,
2690 template <
int structdim2,
int dim2,
int spacedim2>
2697 template <
int structdim2,
int dim2,
int spacedim2>
2728 child(
const unsigned int i)
const;
2734 face(
const unsigned int i)
const;
2746 face_index(
const unsigned int i)
const;
2796 neighbor_child_on_subface(
const unsigned int face_no,
2797 const unsigned int subface_no)
const;
2821 neighbor(
const unsigned int i)
const;
2828 neighbor_index(
const unsigned int i)
const;
2835 neighbor_level(
const unsigned int i)
const;
2849 neighbor_of_neighbor(
const unsigned int neighbor)
const;
2862 neighbor_is_coarser(
const unsigned int neighbor)
const;
2878 std::pair<unsigned int, unsigned int>
2879 neighbor_of_coarser_neighbor(
const unsigned int neighbor)
const;
2888 neighbor_face_no(
const unsigned int neighbor)
const;
2910 has_periodic_neighbor(
const unsigned int i)
const;
2929 periodic_neighbor(
const unsigned int i)
const;
2939 neighbor_or_periodic_neighbor(
const unsigned int i)
const;
2956 periodic_neighbor_child_on_subface(
const unsigned int face_no,
2957 const unsigned int subface_no)
const;
2969 std::pair<unsigned int, unsigned int>
2970 periodic_neighbor_of_coarser_periodic_neighbor(
const unsigned face_no)
const;
2978 periodic_neighbor_index(
const unsigned int i)
const;
2986 periodic_neighbor_level(
const unsigned int i)
const;
3003 periodic_neighbor_of_periodic_neighbor(
const unsigned int i)
const;
3011 periodic_neighbor_face_no(
const unsigned int i)
const;
3020 periodic_neighbor_is_coarser(
const unsigned int i)
const;
3039 at_boundary(
const unsigned int i)
const;
3050 at_boundary()
const;
3060 has_boundary_lines()
const;
3087 refine_flag_set()
const;
3114 clear_refine_flag()
const;
3124 flag_for_face_refinement(
3125 const unsigned int face_no,
3135 flag_for_line_refinement(
const unsigned int line_no)
const;
3146 subface_case(
const unsigned int face_no)
const;
3152 coarsen_flag_set()
const;
3159 set_coarsen_flag()
const;
3165 clear_coarsen_flag()
const;
3189 material_id()
const;
3241 subdomain_id()
const;
3266 level_subdomain_id()
const;
3273 set_level_subdomain_id(
3293 recursively_set_subdomain_id(
3313 direction_flag()
const;
3341 active_cell_index()
const;
3351 parent_index()
const;
3403 is_locally_owned()
const;
3410 is_locally_owned_on_level()
const;
3465 is_artificial()
const;
3492 set_neighbor(
const unsigned int i,
3546 neighbor_of_neighbor_internal(
const unsigned int neighbor)
const;
3553 template <
int dim_,
int spacedim_>
3565 set_active_cell_index(
const unsigned int active_cell_index);
3571 set_parent(
const unsigned int parent_index);
3580 set_direction_flag(
const bool new_direction_flag)
const;
3585 friend struct ::internal::TriangulationImplementation::Implementation;
3593 template <
int structdim,
int dim,
int spacedim>
3594 template <
typename OtherAccessor>
3596 const OtherAccessor &)
3599 ExcMessage(
"You are attempting an illegal conversion between " 3600 "iterator/accessor types. The constructor you call " 3601 "only exists to make certain template constructs " 3602 "easier to write as dimension independent code but " 3603 "the conversion is not valid in the current context."));
3608 template <
int structdim,
int dim,
int spacedim>
3609 template <
int structdim2,
int dim2,
int spacedim2>
3614 ExcMessage(
"You are attempting an illegal conversion between " 3615 "iterator/accessor types. The constructor you call " 3616 "only exists to make certain template constructs " 3617 "easier to write as dimension independent code but " 3618 "the conversion is not valid in the current context."));
3623 template <
int dim,
int spacedim>
3624 template <
int structdim2,
int dim2,
int spacedim2>
3629 ExcMessage(
"You are attempting an illegal conversion between " 3630 "iterator/accessor types. The constructor you call " 3631 "only exists to make certain template constructs " 3632 "easier to write as dimension independent code but " 3633 "the conversion is not valid in the current context."));
3638 template <
int structdim,
int dim,
int spacedim>
3639 template <
int structdim2,
int dim2,
int spacedim2>
3644 ExcMessage(
"You are attempting an illegal conversion between " 3645 "iterator/accessor types. The constructor you call " 3646 "only exists to make certain template constructs " 3647 "easier to write as dimension independent code but " 3648 "the conversion is not valid in the current context."));
3653 template <
int dim,
int spacedim>
3654 template <
int structdim2,
int dim2,
int spacedim2>
3659 ExcMessage(
"You are attempting an illegal conversion between " 3660 "iterator/accessor types. The constructor you call " 3661 "only exists to make certain template constructs " 3662 "easier to write as dimension independent code but " 3663 "the conversion is not valid in the current context."));
3695 DEAL_II_NAMESPACE_CLOSE
3698 #include "tria_accessor.templates.h"
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
unsigned int global_vertex_index
static ::ExceptionBase & ExcNeighborIsCoarser()
static ::ExceptionBase & ExcDereferenceInvalidObject(AccessorType arg1)
const Triangulation< 1, spacedim > * tria
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
#define DeclException1(Exception1, type1, outsequence)
const Triangulation< dim, spacedim > * tria
static ::ExceptionBase & ExcSetOnlyEvenChildren(int arg1)
#define Assert(cond, exc)
#define DeclExceptionMsg(Exception, defaulttext)
#define DeclException0(Exception0)
static ::ExceptionBase & ExcCellNotActive()
static ::ExceptionBase & ExcNoPeriodicNeighbor()
static ::ExceptionBase & ExcCantSetChildren(int arg1)
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 global_vertex_index
typename ::internal::TriaAccessorImplementation::PresentLevelType< structdim, dim >::type present_level
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcCantCompareIterators()