16 #ifndef dealii_tria_accessor_h 17 #define dealii_tria_accessor_h 20 #include <deal.II/base/bounding_box.h> 21 #include <deal.II/base/config.h> 22 #include <deal.II/base/exceptions.h> 23 #include <deal.II/base/geometry_info.h> 24 #include <deal.II/base/point.h> 25 #include <deal.II/grid/tria_iterator_base.h> 26 #include <deal.II/grid/tria_iterator_selector.h> 27 #include <deal.II/grid/cell_id.h> 32 DEAL_II_NAMESPACE_OPEN
39 template <
int dim,
int spacedim>
class Boundary;
40 template <
int dim,
int spacedim>
class Manifold;
45 namespace TriangulationImplementation
52 namespace TriaAccessorImplementation
73 type (
const int level)
87 void operator ++ ()
const 92 void operator -- ()
const 112 template <
int structdim,
int dim,
int spacedim>
class TriaAccessor;
113 template <
int dim,
int spacedim>
class TriaAccessor<0, dim, spacedim>;
114 template <
int spacedim>
class TriaAccessor<0, 1, spacedim>;
131 "The operation you are attempting can only be performed for " 132 "(cell, face, or edge) iterators that point to valid " 133 "objects. These objects need not necessarily be active, " 134 "i.e., have no children, but they need to be part of a " 135 "triangulation. (The objects pointed to by an iterator " 136 "may -- after coarsening -- also be objects that used " 137 "to be part of a triangulation, but are now no longer " 138 "used. Their memory location may have been retained " 139 "for re-use upon the next mesh refinement, but is " 140 "currently unused.)");
151 "The operation you are attempting can only be performed for " 152 "(cell, face, or edge) iterators that point to 'active' " 153 "objects. 'Active' objects are those that do not have " 154 "children (in the case of cells), or that are part of " 155 "an active cell (in the case of faces or edges). However, " 156 "the object on which you are trying the current " 157 "operation is not 'active' in this sense.");
164 "The operation you are attempting can only be performed for " 165 "(cell, face, or edge) iterators that have children, " 166 "but the object on which you are trying the current " 167 "operation does not have any.");
175 "The operation you are attempting can only be performed for " 176 "(cell, face, or edge) iterators that have a parent object, " 177 "but the object on which you are trying the current " 178 "operation does not have one -- i.e., it is on the " 179 "coarsest level of the triangulation.");
185 <<
"You can only set the child index if the cell does not " 186 <<
"currently have children registered; or you can clear it. " 187 <<
"The given index was " << arg1 <<
" (-1 means: clear children).");
191 template <
typename AccessorType>
194 <<
"You tried to dereference an iterator for which this " 195 <<
"is not possible. More information on this iterator: " 196 <<
"index=" << arg1.index()
200 "past_the_end" :
"invalid")));
205 "Iterators can only be compared if they point to the same " 206 "triangulation, or if neither of them are associated " 207 "with a triangulation.");
239 <<
"You can only set the child index of an even numbered child." 240 <<
"The number of the child given was " << arg1 <<
".");
270 template <
int structdim,
int dim,
int spacedim=dim>
307 const int level = -1,
308 const int index = -1,
474 typename ::internal::TriaAccessorImplementation::PresentLevelType<structdim,dim>::type
present_level;
517 template <
int structdim,
int dim,
int spacedim=dim>
534 const int level = -1,
535 const int index = -1,
551 template <
typename OtherAccessor>
569 void operator -- ()
const;
596 typename ::internal::TriangulationImplementation::Iterators<dim,spacedim>::line_iterator
597 line (
const unsigned int i)
const;
602 typename ::internal::TriangulationImplementation::Iterators<dim,spacedim>::quad_iterator
603 quad (
const unsigned int i)
const;
626 template <
int structdim,
int dim,
int spacedim>
641 const int level = -1,
642 const int index = -1,
657 template <
int structdim2,
int dim2,
int spacedim2>
664 template <
int structdim2,
int dim2,
int spacedim2>
758 typename ::internal::TriangulationImplementation::Iterators<dim,spacedim>::line_iterator
759 line (
const unsigned int i)
const;
767 unsigned int line_index (
const unsigned int i)
const;
772 typename ::internal::TriangulationImplementation::Iterators<dim,spacedim>::quad_iterator
773 quad (
const unsigned int i)
const;
781 unsigned int quad_index (
const unsigned int i)
const;
815 bool face_flip (
const unsigned int face)
const;
895 child (
const unsigned int i)
const;
1422 const bool interpolate_from_surrounding=
false)
const;
1502 void set (const ::internal::TriangulationImplementation::TriaObject<structdim> &o)
const;
1512 const bool orientation)
const;
1525 const bool orientation)
const;
1534 const bool flip)
const;
1543 const bool rotation)
const;
1592 friend struct ::internal::TriangulationImplementation::Implementation;
1593 friend struct ::internal::TriaAccessorImplementation::Implementation;
1619 template <
int dim,
int spacedim>
1662 const int level = 0,
1663 const int index = 0,
1669 template <
int structdim2,
int dim2,
int spacedim2>
1675 template <
int structdim2,
int dim2,
int spacedim2>
1687 static int level ();
1747 unsigned int vertex_index (
const unsigned int i = 0)
const;
1760 typename ::internal::TriangulationImplementation::Iterators<dim,spacedim>::line_iterator
1761 static line (
const unsigned int);
1766 static unsigned int line_index (
const unsigned int i);
1772 typename ::internal::TriangulationImplementation::Iterators<dim,spacedim>::quad_iterator
1773 quad (
const unsigned int i);
1778 static unsigned int quad_index (
const unsigned int i);
1814 const bool interpolate_from_surrounding=
false)
const;
1844 static bool face_flip (
const unsigned int face);
1894 child (
const unsigned int);
1952 template <
typename Accessor>
friend class TriaIterator;
1974 template <
int spacedim>
2036 const VertexKind vertex_kind,
2052 template <
int structdim2,
int dim2,
int spacedim2>
2058 template <
int structdim2,
int dim2,
int spacedim2>
2078 static int level ();
2139 unsigned int vertex_index (
const unsigned int i = 0)
const;
2158 typename ::internal::TriangulationImplementation::Iterators<1,spacedim>::line_iterator
2159 static line (
const unsigned int);
2167 static unsigned int line_index (
const unsigned int i);
2173 typename ::internal::TriangulationImplementation::Iterators<1,spacedim>::quad_iterator
2174 quad (
const unsigned int i);
2182 static unsigned int quad_index (
const unsigned int i);
2240 static bool face_flip (
const unsigned int face);
2290 child (
const unsigned int);
2433 template <
int dim,
int spacedim=dim>
2458 const int level = -1,
2459 const int index = -1,
2479 template <
int structdim2,
int dim2,
int spacedim2>
2486 template <
int structdim2,
int dim2,
int spacedim2>
2515 child (
const unsigned int i)
const;
2521 face (
const unsigned int i)
const;
2584 const unsigned int subface_no)
const;
2608 neighbor (
const unsigned int i)
const;
2661 std::pair<unsigned int, unsigned int>
2737 const unsigned int subface_no)
const;
2748 std::pair<unsigned int, unsigned int>
3295 template <
int dim_,
int spacedim_ >
3322 friend struct ::internal::TriangulationImplementation::Implementation;
3331 template <
int structdim,
int dim,
int spacedim>
3332 template <
typename OtherAccessor>
3337 ExcMessage (
"You are attempting an illegal conversion between " 3338 "iterator/accessor types. The constructor you call " 3339 "only exists to make certain template constructs " 3340 "easier to write as dimension independent code but " 3341 "the conversion is not valid in the current context."));
3346 template <
int structdim,
int dim,
int spacedim>
3347 template <
int structdim2,
int dim2,
int spacedim2>
3352 ExcMessage (
"You are attempting an illegal conversion between " 3353 "iterator/accessor types. The constructor you call " 3354 "only exists to make certain template constructs " 3355 "easier to write as dimension independent code but " 3356 "the conversion is not valid in the current context."));
3361 template <
int dim,
int spacedim>
3362 template <
int structdim2,
int dim2,
int spacedim2>
3367 ExcMessage (
"You are attempting an illegal conversion between " 3368 "iterator/accessor types. The constructor you call " 3369 "only exists to make certain template constructs " 3370 "easier to write as dimension independent code but " 3371 "the conversion is not valid in the current context."));
3376 template <
int structdim,
int dim,
int spacedim>
3377 template <
int structdim2,
int dim2,
int spacedim2>
3382 ExcMessage (
"You are attempting an illegal conversion between " 3383 "iterator/accessor types. The constructor you call " 3384 "only exists to make certain template constructs " 3385 "easier to write as dimension independent code but " 3386 "the conversion is not valid in the current context."));
3391 template <
int dim,
int spacedim>
3392 template <
int structdim2,
int dim2,
int spacedim2>
3397 ExcMessage (
"You are attempting an illegal conversion between " 3398 "iterator/accessor types. The constructor you call " 3399 "only exists to make certain template constructs " 3400 "easier to write as dimension independent code but " 3401 "the conversion is not valid in the current context."));
3419 DEAL_II_NAMESPACE_CLOSE
3422 # include "tria_accessor.templates.h" unsigned int periodic_neighbor_of_periodic_neighbor(const unsigned int i) const
void clear_used_flag() const
TriaAccessor< dim, dim, spacedim >::AccessorData AccessorData
std::pair< Point< spacedim >, double > enclosing_ball() const
static ::ExceptionBase & ExcCellHasNoChildren()
typename ::internal::TriangulationImplementation::Iterators< dim, spacedim >::quad_iterator quad(const unsigned int i) const
InvalidAccessor(const Triangulation< dim, spacedim > *parent=nullptr, const int level=-1, const int index=-1, const AccessorData *local_data=nullptr)
bool point_inside_codim(const Point< spacedim_ > &p) const
::internal::TriangulationImplementation::TriaObjects<::internal::TriangulationImplementation::TriaObject< structdim > > & objects() const
void set_face_rotation(const unsigned int face, const bool rotation) const
TriaIterator< CellAccessor< dim, spacedim > > neighbor_or_periodic_neighbor(const unsigned int i) const
static ::ExceptionBase & ExcNeighborIsNotCoarser()
unsigned int global_vertex_index
void set_active_cell_index(const unsigned int active_cell_index)
void recursively_clear_user_pointer() const
unsigned int active_cell_index() const
bool operator==(const InvalidAccessor &) const
static ::ExceptionBase & ExcNeighborIsCoarser()
static ::ExceptionBase & ExcRefineCellNotActive()
unsigned int neighbor_of_neighbor_internal(const unsigned int neighbor) const
void set_neighbor(const unsigned int i, const TriaIterator< CellAccessor< dim, spacedim > > &pointer) const
static ::ExceptionBase & ExcDereferenceInvalidObject(AccessorType arg1)
unsigned int user_index() const
static bool is_level_cell()
int isotropic_child_index(const unsigned int i) const
const Triangulation< dim, spacedim > * tria
void * user_pointer() const
types::material_id material_id() const
TriaAccessorBase< structdim, dim, spacedim >::AccessorData AccessorData
bool flag_for_line_refinement(const unsigned int line_no) const
void set_line_orientation(const unsigned int line, const bool orientation) const
TriaIterator< TriaAccessor< 0, dim, spacedim > > vertex_iterator(const unsigned int i) const
TriaIterator< TriaAccessor< dim-1, dim, spacedim > > face(const unsigned int i) const
void copy_from(const TriaAccessorBase &)
double extent_in_direction(const unsigned int axis) const
bool operator!=(const TriaAccessorBase &) const
unsigned int n_children() const
const Boundary< dim, spacedim > & get_boundary() const
void set_all_manifold_ids(const types::manifold_id) const
const Triangulation< 1, spacedim > * tria
void set_children(const unsigned int i, const int index) const
void clear_user_pointer() const
unsigned int line_index(const unsigned int i) const
static ::ExceptionBase & ExcFacesHaveNoLevel()
void operator=(const CellAccessor< dim, spacedim > &)=delete
unsigned int face_index(const unsigned int i) const
TriaIterator< CellAccessor< dim, spacedim > > neighbor_child_on_subface(const unsigned int face_no, const unsigned int subface_no) const
typename ::internal::TriangulationImplementation::Iterators< dim, spacedim >::line_iterator line(const unsigned int i) const
bool neighbor_is_coarser(const unsigned int neighbor) const
bool has_children() const
unsigned int vertex_index(const unsigned int i) const
types::manifold_id manifold_id() const
bool is_locally_owned() const
bool is_translation_of(const TriaIterator< TriaAccessor< structdim, dim, spacedim > > &o) const
bool face_rotation(const unsigned int face) const
static ::ExceptionBase & ExcCellNotUsed()
void copy_from(const InvalidAccessor &)
void clear_user_data() const
TriaIterator< CellAccessor< dim, spacedim > > parent() const
static const unsigned int space_dimension
void set_user_pointer(void *p) const
void set_boundary_id_internal(const types::boundary_id id) const
bool coarsen_flag_set() const
TriaIterator< CellAccessor< dim, spacedim > > neighbor(const unsigned int i) const
TriaAccessorBase< structdim, dim, spacedim >::AccessorData AccessorData
static ::ExceptionBase & ExcMessage(std::string arg1)
bool has_periodic_neighbor(const unsigned int i) const
void recursively_set_user_flag() const
bool operator==(const TriaAccessorBase &) const
void set_coarsen_flag() const
typename ::internal::TriangulationImplementation::Iterators< dim, spacedim >::line_iterator line(const unsigned int i) const
#define DeclException1(Exception1, type1, outsequence)
void clear_user_flag() const
types::manifold_id manifold_id() const
bool is_locally_owned_on_level() const
bool periodic_neighbor_is_coarser(const unsigned int i) const
static ::ExceptionBase & ExcCellFlaggedForCoarsening()
static ::ExceptionBase & ExcSetOnlyEvenChildren(int arg1)
#define Assert(cond, exc)
std::pair< unsigned int, unsigned int > periodic_neighbor_of_coarser_periodic_neighbor(const unsigned face_no) const
Point< spacedim > & vertex(const unsigned int i) const
BoundingBox< spacedim > bounding_box() const
bool line_orientation(const unsigned int line) const
void set_material_id(const types::material_id new_material_id) const
Point< spacedim > & vertex(const unsigned int i) const
const Triangulation< dim, spacedim > * tria
#define DeclExceptionMsg(Exception, defaulttext)
#define DeclException0(Exception0)
void set_face_orientation(const unsigned int face, const bool orientation) const
unsigned int quad_index(const unsigned int i) const
bool operator<(const TriaAccessorBase &other) const
typename ::internal::TriangulationImplementation::Iterators< dim, spacedim >::quad_iterator quad(const unsigned int i) const
RefinementCase< dim > refine_flag_set() const
static ::ExceptionBase & ExcCellNotActive()
void operator=(const TriaAccessorBase *)=delete
void operator=(const TriaAccessor &)=delete
IteratorState::IteratorStates state() const
void set_refine_flag(const RefinementCase< dim > ref_case=RefinementCase< dim >::isotropic_refinement) const
static ::ExceptionBase & ExcNoPeriodicNeighbor()
static ::ExceptionBase & ExcCantSetChildren(int arg1)
void clear_refine_flag() const
void recursively_set_material_id(const types::material_id new_material_id) const
typename ::internal::TriaAccessorImplementation::PresentLevelType< structdim, dim >::type present_level
unsigned int subdomain_id
void clear_children() const
void recursively_clear_user_index() const
TriaIterator< CellAccessor< dim, spacedim > > periodic_neighbor_child_on_subface(const unsigned int face_no, const unsigned int subface_no) const
void set_user_index(const unsigned int p) const
double minimum_vertex_distance() const
void clear_user_index() const
bool has_children() const
void recursively_clear_user_flag() const
CellAccessor(const Triangulation< dim, spacedim > *parent=nullptr, const int level=-1, const int index=-1, const AccessorData *local_data=nullptr)
Point< spacedim > center(const bool respect_manifold=false, const bool interpolate_from_surrounding=false) const
TriaAccessorBase(const Triangulation< dim, spacedim > *parent=nullptr, const int level=-1, const int index=-1, const AccessorData *=nullptr)
static ::ExceptionBase & ExcCellHasNoParent()
void set_all_boundary_ids(const types::boundary_id) const
Point< structdim > real_to_unit_cell_affine_approximation(const Point< spacedim > &point) const
bool is_artificial() const
types::boundary_id boundary_id() const
int periodic_neighbor_level(const unsigned int i) const
void recursively_set_user_pointer(void *p) const
std::pair< unsigned int, unsigned int > neighbor_of_coarser_neighbor(const unsigned int neighbor) const
bool flag_for_face_refinement(const unsigned int face_no, const RefinementCase< dim-1 > &face_refinement_case=RefinementCase< dim-1 >::isotropic_refinement) const
void set_manifold_id(const types::manifold_id) const
void recursively_set_subdomain_id(const types::subdomain_id new_subdomain_id) const
void set_boundary_id(const types::boundary_id) const
bool face_flip(const unsigned int face) const
::internal::SubfaceCase< dim > subface_case(const unsigned int face_no) const
int neighbor_level(const unsigned int i) const
bool point_inside(const Point< spacedim > &p) const
Point< spacedim > barycenter() const
void set_direction_flag(const bool new_direction_flag) const
static const unsigned int structure_dimension
unsigned int periodic_neighbor_face_no(const unsigned int i) const
int periodic_neighbor_index(const unsigned int i) const
TriaIterator< CellAccessor< dim, spacedim > > periodic_neighbor(const unsigned int i) const
unsigned int number_of_children() const
Triangulation< dim, spacedim > Container
void clear_refinement_case() const
int child_index(const unsigned int i) const
void set_parent(const unsigned int parent_index)
void clear_coarsen_flag() const
bool face_orientation(const unsigned int face) const
Point< spacedim > intermediate_point(const Point< structdim > &coordinates) const
TriaAccessor(const Triangulation< dim, spacedim > *parent=nullptr, const int level=-1, const int index=-1, const AccessorData *local_data=nullptr)
bool direction_flag() const
int neighbor_index(const unsigned int i) const
const Triangulation< dim, spacedim > & get_triangulation() const
Iterator reached end of container.
Iterator points to a valid object.
void set_level_subdomain_id(const types::subdomain_id new_level_subdomain_id) const
void recursively_set_user_index(const unsigned int p) const
TriaIterator< TriaAccessor< structdim, dim, spacedim > > isotropic_child(const unsigned int i) const
void set_subdomain_id(const types::subdomain_id new_subdomain_id) const
types::subdomain_id level_subdomain_id() const
void set_user_flag() const
bool user_flag_set() const
void set_face_flip(const unsigned int face, const bool flip) const
unsigned int neighbor_face_no(const unsigned int neighbor) const
types::subdomain_id subdomain_id() const
static ::ExceptionBase & ExcCellFlaggedForRefinement()
static const unsigned int dimension
unsigned int global_vertex_index
const Manifold< dim, spacedim > & get_manifold() const
void set_refinement_case(const RefinementCase< structdim > &ref_case) const
RefinementCase< structdim > refinement_case() const
unsigned int max_refinement_depth() const
unsigned int neighbor_of_neighbor(const unsigned int neighbor) const
void set_used_flag() const
TriaIterator< CellAccessor< dim, spacedim > > child(const unsigned int i) const
bool has_boundary_lines() const
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcCantCompareIterators()
TriaIterator< TriaAccessor< structdim, dim, spacedim > > child(const unsigned int i) const