From 0f102db70a16fb6688be9a855d03182aa4d99f54 Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Mon, 16 Nov 2015 18:30:10 -0600 Subject: [PATCH] Improve documentation. --- include/deal.II/grid/tria.h | 9 ++++++--- include/deal.II/grid/tria_accessor.h | 6 ++++++ include/deal.II/grid/tria_accessor.templates.h | 6 +++++- source/grid/tria.cc | 3 +++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index 6609920cbd..1e1e54f780 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -2559,19 +2559,22 @@ public: */ /** - * Iterator to the first used vertex. + * Iterator to the first used vertex. This function can only be used if dim is + * not one. */ vertex_iterator begin_vertex() const; /** * Iterator to the first active vertex. Because all vertices are active, - * begin_vertex() and begin_active_vertex() return the same vertex. + * begin_vertex() and begin_active_vertex() return the same vertex. This + * function can only be used if dim is not one. */ active_vertex_iterator begin_active_vertex() const; /** * Iterator past the end; this iterator serves for comparisons of iterators - * with past-the-end or before-the-beginning states. + * with past-the-end or before-the-beginning states. This function can only be + * used if dim is not one. */ vertex_iterator end_vertex() const; diff --git a/include/deal.II/grid/tria_accessor.h b/include/deal.II/grid/tria_accessor.h index aa5e0170f8..025217ee31 100644 --- a/include/deal.II/grid/tria_accessor.h +++ b/include/deal.II/grid/tria_accessor.h @@ -1815,6 +1815,12 @@ protected: * The global vertex index of the vertex this object corresponds to. */ unsigned int global_vertex_index; + +private: + + template friend class TriaRawIterator; + template friend class TriaIterator; + template friend class TriaActiveIterator; }; diff --git a/include/deal.II/grid/tria_accessor.templates.h b/include/deal.II/grid/tria_accessor.templates.h index 03a760adfa..4e68cf6f98 100644 --- a/include/deal.II/grid/tria_accessor.templates.h +++ b/include/deal.II/grid/tria_accessor.templates.h @@ -2241,7 +2241,11 @@ void TriaAccessor<0, dim, spacedim>::operator -- () { if (global_vertex_index!=numbers::invalid_unsigned_int) - --global_vertex_index; + { + --global_vertex_index; + if (global_vertex_index==static_cast(-1)) + global_vertex_index = numbers::invalid_unsigned_int; + } } diff --git a/source/grid/tria.cc b/source/grid/tria.cc index d37c7e20a3..8ace37f5b3 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -10614,6 +10614,8 @@ Triangulation::begin_vertex() const { if (dim==1) { + // This does not work if dim==1 because TriaAccessor<0,1,spacedim> does not + // implement operator++ Assert(false, ExcNotImplemented()); return raw_vertex_iterator(); } @@ -10624,6 +10626,7 @@ Triangulation::begin_vertex() const 0); if (i.state() != IteratorState::valid) return i; + // This loop will end because every triangulation has used vertices. while (i->used() == false) if ((++i).state() != IteratorState::valid) return i; -- 2.39.5