From: Wolfgang Bangerth Date: Sat, 25 Feb 2023 17:10:03 +0000 (-0700) Subject: Don't derive InvalidAccessor from TriaAccessorBase. X-Git-Tag: v9.5.0-rc1~523^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14828%2Fhead;p=dealii.git Don't derive InvalidAccessor from TriaAccessorBase. --- diff --git a/include/deal.II/grid/tria_accessor.h b/include/deal.II/grid/tria_accessor.h index e9d0cd6cc8..d6c44e618d 100644 --- a/include/deal.II/grid/tria_accessor.h +++ b/include/deal.II/grid/tria_accessor.h @@ -567,14 +567,36 @@ private: * @ingroup Accessors */ template -class InvalidAccessor : public TriaAccessorBase +class InvalidAccessor { public: /** - * Propagate alias from base class to this class. + * Dimension of the space the object represented by this accessor lives in. + * For example, if this accessor represents a quad that is part of a two- + * dimensional surface in four-dimensional space, then this value is four. */ - using AccessorData = - typename TriaAccessorBase::AccessorData; + static constexpr unsigned int space_dimension = spacedim; + + /** + * Dimensionality of the object that the thing represented by this accessor + * is part of. For example, if this accessor represents a line that is part + * of a hexahedron, then this value will be three. + */ + static constexpr unsigned int dimension = dim; + + /** + * Dimensionality of the current object represented by this accessor. For + * example, if it is line (irrespective of whether it is part of a quad or + * hex, and what dimension we are in), then this value equals 1. + */ + static const unsigned int structure_dimension = structdim; + + /** + * Declare the data type that this accessor class expects to get passed from + * the iterator classes. Since the pure triangulation iterators need no + * additional data, this data type is @p void. + */ + using AccessorData = void; /** * Constructor. This class is used for iterators that do not make @@ -626,6 +648,28 @@ public: void operator--() const; + /** + * Return the state of the iterator. For the different states an accessor + * can be in, refer to the TriaRawIterator documentation. + */ + static IteratorState::IteratorStates + state(); + + + /** + * Level of this object. Vertices have no level, so this function always + * returns zero. + */ + static int + level(); + + /** + * Index of this object. Returns the global index of the vertex this object + * points to. + */ + static int + index(); + /** * Dummy function representing whether the accessor points to a used or an * unused object. diff --git a/include/deal.II/grid/tria_accessor.templates.h b/include/deal.II/grid/tria_accessor.templates.h index 8cdf67858f..18920e2035 100644 --- a/include/deal.II/grid/tria_accessor.templates.h +++ b/include/deal.II/grid/tria_accessor.templates.h @@ -393,9 +393,7 @@ InvalidAccessor::InvalidAccessor( template InvalidAccessor::InvalidAccessor( - const InvalidAccessor &i) - : TriaAccessorBase( - static_cast &>(i)) + const InvalidAccessor &) { Assert(false, ExcMessage("You are attempting an invalid conversion between " @@ -565,7 +563,7 @@ inline typename dealii::internal::TriangulationImplementation:: { // nothing to do here. we could throw an exception but we can't get here // without first creating an object which would have already thrown - return dealii::internal::TriangulationImplementation:: + return typename dealii::internal::TriangulationImplementation:: Iterators::quad_iterator(); } diff --git a/source/grid/tria_accessor.cc b/source/grid/tria_accessor.cc index 5ffe8de7d4..ea92e51557 100644 --- a/source/grid/tria_accessor.cc +++ b/source/grid/tria_accessor.cc @@ -3512,6 +3512,32 @@ CellAccessor::neighbor_child_on_subface( +template +IteratorState::IteratorStates +InvalidAccessor::state() +{ + return IteratorState::invalid; +} + + + +template +int +InvalidAccessor::level() +{ + return -1; +} + + + +template +int +InvalidAccessor::index() +{ + return -1; +} + + // explicit instantiations #include "tria_accessor.inst" diff --git a/source/grid/tria_accessor.inst.in b/source/grid/tria_accessor.inst.in index b586d55ba2..865020c344 100644 --- a/source/grid/tria_accessor.inst.in +++ b/source/grid/tria_accessor.inst.in @@ -57,3 +57,11 @@ for (deal_II_space_dimension : DIMENSIONS) template class TriaAccessor<0, 1, deal_II_space_dimension>; template class TriaIterator>; } + +for (deal_II_struct_dimension : DIMENSIONS; deal_II_dimension : DIMENSIONS; + deal_II_space_dimension : DIMENSIONS) + { + template class InvalidAccessor; + } \ No newline at end of file